diff options
-rw-r--r-- | drivers/scsi/pcmcia/nsp_cs.c | 159 | ||||
-rw-r--r-- | drivers/scsi/pcmcia/nsp_cs.h | 8 |
2 files changed, 5 insertions, 162 deletions
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index 445cfbbca9b3..a45d89b14147 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c | |||
@@ -25,8 +25,6 @@ | |||
25 | 25 | ||
26 | ***********************************************************************/ | 26 | ***********************************************************************/ |
27 | 27 | ||
28 | /* $Id: nsp_cs.c,v 1.23 2003/08/18 11:09:19 elca Exp $ */ | ||
29 | |||
30 | #include <linux/version.h> | 28 | #include <linux/version.h> |
31 | #include <linux/module.h> | 29 | #include <linux/module.h> |
32 | #include <linux/kernel.h> | 30 | #include <linux/kernel.h> |
@@ -59,7 +57,7 @@ | |||
59 | #include "nsp_cs.h" | 57 | #include "nsp_cs.h" |
60 | 58 | ||
61 | MODULE_AUTHOR("YOKOTA Hiroshi <yokota@netlab.is.tsukuba.ac.jp>"); | 59 | MODULE_AUTHOR("YOKOTA Hiroshi <yokota@netlab.is.tsukuba.ac.jp>"); |
62 | MODULE_DESCRIPTION("WorkBit NinjaSCSI-3 / NinjaSCSI-32Bi(16bit) PCMCIA SCSI host adapter module $Revision: 1.23 $"); | 60 | MODULE_DESCRIPTION("WorkBit NinjaSCSI-3 / NinjaSCSI-32Bi(16bit) PCMCIA SCSI host adapter module"); |
63 | MODULE_SUPPORTED_DEVICE("sd,sr,sg,st"); | 61 | MODULE_SUPPORTED_DEVICE("sd,sr,sg,st"); |
64 | #ifdef MODULE_LICENSE | 62 | #ifdef MODULE_LICENSE |
65 | MODULE_LICENSE("GPL"); | 63 | MODULE_LICENSE("GPL"); |
@@ -83,10 +81,6 @@ static struct scsi_host_template nsp_driver_template = { | |||
83 | .proc_name = "nsp_cs", | 81 | .proc_name = "nsp_cs", |
84 | .proc_info = nsp_proc_info, | 82 | .proc_info = nsp_proc_info, |
85 | .name = "WorkBit NinjaSCSI-3/32Bi(16bit)", | 83 | .name = "WorkBit NinjaSCSI-3/32Bi(16bit)", |
86 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) | ||
87 | .detect = nsp_detect_old, | ||
88 | .release = nsp_release_old, | ||
89 | #endif | ||
90 | .info = nsp_info, | 84 | .info = nsp_info, |
91 | .queuecommand = nsp_queuecommand, | 85 | .queuecommand = nsp_queuecommand, |
92 | /* .eh_abort_handler = nsp_eh_abort,*/ | 86 | /* .eh_abort_handler = nsp_eh_abort,*/ |
@@ -97,9 +91,6 @@ static struct scsi_host_template nsp_driver_template = { | |||
97 | .sg_tablesize = SG_ALL, | 91 | .sg_tablesize = SG_ALL, |
98 | .cmd_per_lun = 1, | 92 | .cmd_per_lun = 1, |
99 | .use_clustering = DISABLE_CLUSTERING, | 93 | .use_clustering = DISABLE_CLUSTERING, |
100 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,2)) | ||
101 | .use_new_eh_code = 1, | ||
102 | #endif | ||
103 | }; | 94 | }; |
104 | 95 | ||
105 | static nsp_hw_data nsp_data_base; /* attach <-> detect glue */ | 96 | static nsp_hw_data nsp_data_base; /* attach <-> detect glue */ |
@@ -1313,11 +1304,7 @@ static struct Scsi_Host *nsp_detect(struct scsi_host_template *sht) | |||
1313 | nsp_hw_data *data_b = &nsp_data_base, *data; | 1304 | nsp_hw_data *data_b = &nsp_data_base, *data; |
1314 | 1305 | ||
1315 | nsp_dbg(NSP_DEBUG_INIT, "this_id=%d", sht->this_id); | 1306 | nsp_dbg(NSP_DEBUG_INIT, "this_id=%d", sht->this_id); |
1316 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,73)) | ||
1317 | host = scsi_host_alloc(&nsp_driver_template, sizeof(nsp_hw_data)); | 1307 | host = scsi_host_alloc(&nsp_driver_template, sizeof(nsp_hw_data)); |
1318 | #else | ||
1319 | host = scsi_register(sht, sizeof(nsp_hw_data)); | ||
1320 | #endif | ||
1321 | if (host == NULL) { | 1308 | if (host == NULL) { |
1322 | nsp_dbg(NSP_DEBUG_INIT, "host failed"); | 1309 | nsp_dbg(NSP_DEBUG_INIT, "host failed"); |
1323 | return NULL; | 1310 | return NULL; |
@@ -1354,37 +1341,6 @@ static struct Scsi_Host *nsp_detect(struct scsi_host_template *sht) | |||
1354 | return host; /* detect done. */ | 1341 | return host; /* detect done. */ |
1355 | } | 1342 | } |
1356 | 1343 | ||
1357 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) | ||
1358 | static int nsp_detect_old(struct scsi_host_template *sht) | ||
1359 | { | ||
1360 | if (nsp_detect(sht) == NULL) { | ||
1361 | return 0; | ||
1362 | } else { | ||
1363 | //MOD_INC_USE_COUNT; | ||
1364 | return 1; | ||
1365 | } | ||
1366 | } | ||
1367 | |||
1368 | |||
1369 | static int nsp_release_old(struct Scsi_Host *shpnt) | ||
1370 | { | ||
1371 | //nsp_hw_data *data = (nsp_hw_data *)shpnt->hostdata; | ||
1372 | |||
1373 | /* PCMCIA Card Service dose same things below. */ | ||
1374 | /* So we do nothing. */ | ||
1375 | //if (shpnt->irq) { | ||
1376 | // free_irq(shpnt->irq, data->ScsiInfo); | ||
1377 | //} | ||
1378 | //if (shpnt->io_port) { | ||
1379 | // release_region(shpnt->io_port, shpnt->n_io_port); | ||
1380 | //} | ||
1381 | |||
1382 | //MOD_DEC_USE_COUNT; | ||
1383 | |||
1384 | return 0; | ||
1385 | } | ||
1386 | #endif | ||
1387 | |||
1388 | /*----------------------------------------------------------------*/ | 1344 | /*----------------------------------------------------------------*/ |
1389 | /* return info string */ | 1345 | /* return info string */ |
1390 | /*----------------------------------------------------------------*/ | 1346 | /*----------------------------------------------------------------*/ |
@@ -1403,19 +1359,9 @@ static const char *nsp_info(struct Scsi_Host *shpnt) | |||
1403 | nsp_dbg(NSP_DEBUG_PROC, "buffer=0x%p pos=0x%p length=%d %d\n", buffer, pos, length, length - (pos - buffer));\ | 1359 | nsp_dbg(NSP_DEBUG_PROC, "buffer=0x%p pos=0x%p length=%d %d\n", buffer, pos, length, length - (pos - buffer));\ |
1404 | } \ | 1360 | } \ |
1405 | } while(0) | 1361 | } while(0) |
1406 | static int | 1362 | |
1407 | nsp_proc_info( | 1363 | static int nsp_proc_info(struct Scsi_Host *host, char *buffer, char **start, |
1408 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,73)) | 1364 | off_t offset, int length, int inout) |
1409 | struct Scsi_Host *host, | ||
1410 | #endif | ||
1411 | char *buffer, | ||
1412 | char **start, | ||
1413 | off_t offset, | ||
1414 | int length, | ||
1415 | #if !(LINUX_VERSION_CODE > KERNEL_VERSION(2,5,73)) | ||
1416 | int hostno, | ||
1417 | #endif | ||
1418 | int inout) | ||
1419 | { | 1365 | { |
1420 | int id; | 1366 | int id; |
1421 | char *pos = buffer; | 1367 | char *pos = buffer; |
@@ -1423,24 +1369,13 @@ nsp_proc_info( | |||
1423 | int speed; | 1369 | int speed; |
1424 | unsigned long flags; | 1370 | unsigned long flags; |
1425 | nsp_hw_data *data; | 1371 | nsp_hw_data *data; |
1426 | #if !(LINUX_VERSION_CODE > KERNEL_VERSION(2,5,73)) | ||
1427 | struct Scsi_Host *host; | ||
1428 | #else | ||
1429 | int hostno; | 1372 | int hostno; |
1430 | #endif | 1373 | |
1431 | if (inout) { | 1374 | if (inout) { |
1432 | return -EINVAL; | 1375 | return -EINVAL; |
1433 | } | 1376 | } |
1434 | 1377 | ||
1435 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,73)) | ||
1436 | hostno = host->host_no; | 1378 | hostno = host->host_no; |
1437 | #else | ||
1438 | /* search this HBA host */ | ||
1439 | host = scsi_host_hn_get(hostno); | ||
1440 | if (host == NULL) { | ||
1441 | return -ESRCH; | ||
1442 | } | ||
1443 | #endif | ||
1444 | data = (nsp_hw_data *)host->hostdata; | 1379 | data = (nsp_hw_data *)host->hostdata; |
1445 | 1380 | ||
1446 | 1381 | ||
@@ -1675,10 +1610,6 @@ static int nsp_cs_config(struct pcmcia_device *link) | |||
1675 | cistpl_cftable_entry_t dflt = { 0 }; | 1610 | cistpl_cftable_entry_t dflt = { 0 }; |
1676 | struct Scsi_Host *host; | 1611 | struct Scsi_Host *host; |
1677 | nsp_hw_data *data = &nsp_data_base; | 1612 | nsp_hw_data *data = &nsp_data_base; |
1678 | #if !(LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,74)) | ||
1679 | struct scsi_device *dev; | ||
1680 | dev_node_t **tail, *node; | ||
1681 | #endif | ||
1682 | 1613 | ||
1683 | nsp_dbg(NSP_DEBUG_INIT, "in"); | 1614 | nsp_dbg(NSP_DEBUG_INIT, "in"); |
1684 | 1615 | ||
@@ -1811,17 +1742,7 @@ static int nsp_cs_config(struct pcmcia_device *link) | |||
1811 | goto cs_failed; | 1742 | goto cs_failed; |
1812 | } | 1743 | } |
1813 | 1744 | ||
1814 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,2)) | ||
1815 | host = nsp_detect(&nsp_driver_template); | 1745 | host = nsp_detect(&nsp_driver_template); |
1816 | #else | ||
1817 | scsi_register_host(&nsp_driver_template); | ||
1818 | for (host = scsi_host_get_next(NULL); host != NULL; | ||
1819 | host = scsi_host_get_next(host)) { | ||
1820 | if (host->hostt == &nsp_driver_template) { | ||
1821 | break; | ||
1822 | } | ||
1823 | } | ||
1824 | #endif | ||
1825 | 1746 | ||
1826 | if (host == NULL) { | 1747 | if (host == NULL) { |
1827 | nsp_dbg(NSP_DEBUG_INIT, "detect failed"); | 1748 | nsp_dbg(NSP_DEBUG_INIT, "detect failed"); |
@@ -1829,7 +1750,6 @@ static int nsp_cs_config(struct pcmcia_device *link) | |||
1829 | } | 1750 | } |
1830 | 1751 | ||
1831 | 1752 | ||
1832 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,74)) | ||
1833 | ret = scsi_add_host (host, NULL); | 1753 | ret = scsi_add_host (host, NULL); |
1834 | if (ret) | 1754 | if (ret) |
1835 | goto cs_failed; | 1755 | goto cs_failed; |
@@ -1840,52 +1760,6 @@ static int nsp_cs_config(struct pcmcia_device *link) | |||
1840 | link->dev_node = &info->node; | 1760 | link->dev_node = &info->node; |
1841 | info->host = host; | 1761 | info->host = host; |
1842 | 1762 | ||
1843 | #else | ||
1844 | nsp_dbg(NSP_DEBUG_INIT, "GET_SCSI_INFO"); | ||
1845 | tail = &link->dev_node; | ||
1846 | info->ndev = 0; | ||
1847 | |||
1848 | nsp_dbg(NSP_DEBUG_INIT, "host=0x%p", host); | ||
1849 | |||
1850 | for (dev = host->host_queue; dev != NULL; dev = dev->next) { | ||
1851 | unsigned long id; | ||
1852 | id = (dev->id & 0x0f) + ((dev->lun & 0x0f) << 4) + | ||
1853 | ((dev->channel & 0x0f) << 8) + | ||
1854 | ((dev->host->host_no & 0x0f) << 12); | ||
1855 | node = &info->node[info->ndev]; | ||
1856 | node->minor = 0; | ||
1857 | switch (dev->type) { | ||
1858 | case TYPE_TAPE: | ||
1859 | node->major = SCSI_TAPE_MAJOR; | ||
1860 | snprintf(node->dev_name, sizeof(node->dev_name), "st#%04lx", id); | ||
1861 | break; | ||
1862 | case TYPE_DISK: | ||
1863 | case TYPE_MOD: | ||
1864 | node->major = SCSI_DISK0_MAJOR; | ||
1865 | snprintf(node->dev_name, sizeof(node->dev_name), "sd#%04lx", id); | ||
1866 | break; | ||
1867 | case TYPE_ROM: | ||
1868 | case TYPE_WORM: | ||
1869 | node->major = SCSI_CDROM_MAJOR; | ||
1870 | snprintf(node->dev_name, sizeof(node->dev_name), "sr#%04lx", id); | ||
1871 | break; | ||
1872 | default: | ||
1873 | node->major = SCSI_GENERIC_MAJOR; | ||
1874 | snprintf(node->dev_name, sizeof(node->dev_name), "sg#%04lx", id); | ||
1875 | break; | ||
1876 | } | ||
1877 | *tail = node; tail = &node->next; | ||
1878 | info->ndev++; | ||
1879 | info->host = dev->host; | ||
1880 | } | ||
1881 | |||
1882 | *tail = NULL; | ||
1883 | if (info->ndev == 0) { | ||
1884 | nsp_msg(KERN_INFO, "no SCSI devices found"); | ||
1885 | } | ||
1886 | nsp_dbg(NSP_DEBUG_INIT, "host=0x%p", host); | ||
1887 | #endif | ||
1888 | |||
1889 | /* Finally, report what we've done */ | 1763 | /* Finally, report what we've done */ |
1890 | printk(KERN_INFO "nsp_cs: index 0x%02x: ", | 1764 | printk(KERN_INFO "nsp_cs: index 0x%02x: ", |
1891 | link->conf.ConfigIndex); | 1765 | link->conf.ConfigIndex); |
@@ -1938,13 +1812,9 @@ static void nsp_cs_release(struct pcmcia_device *link) | |||
1938 | nsp_dbg(NSP_DEBUG_INIT, "link=0x%p", link); | 1812 | nsp_dbg(NSP_DEBUG_INIT, "link=0x%p", link); |
1939 | 1813 | ||
1940 | /* Unlink the device chain */ | 1814 | /* Unlink the device chain */ |
1941 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,2)) | ||
1942 | if (info->host != NULL) { | 1815 | if (info->host != NULL) { |
1943 | scsi_remove_host(info->host); | 1816 | scsi_remove_host(info->host); |
1944 | } | 1817 | } |
1945 | #else | ||
1946 | scsi_unregister_host(&nsp_driver_template); | ||
1947 | #endif | ||
1948 | link->dev_node = NULL; | 1818 | link->dev_node = NULL; |
1949 | 1819 | ||
1950 | if (link->win) { | 1820 | if (link->win) { |
@@ -1954,11 +1824,9 @@ static void nsp_cs_release(struct pcmcia_device *link) | |||
1954 | } | 1824 | } |
1955 | pcmcia_disable_device(link); | 1825 | pcmcia_disable_device(link); |
1956 | 1826 | ||
1957 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,2)) | ||
1958 | if (info->host != NULL) { | 1827 | if (info->host != NULL) { |
1959 | scsi_host_put(info->host); | 1828 | scsi_host_put(info->host); |
1960 | } | 1829 | } |
1961 | #endif | ||
1962 | } /* nsp_cs_release */ | 1830 | } /* nsp_cs_release */ |
1963 | 1831 | ||
1964 | static int nsp_cs_suspend(struct pcmcia_device *link) | 1832 | static int nsp_cs_suspend(struct pcmcia_device *link) |
@@ -2005,7 +1873,6 @@ static int nsp_cs_resume(struct pcmcia_device *link) | |||
2005 | /*======================================================================* | 1873 | /*======================================================================* |
2006 | * module entry point | 1874 | * module entry point |
2007 | *====================================================================*/ | 1875 | *====================================================================*/ |
2008 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,68)) | ||
2009 | static struct pcmcia_device_id nsp_cs_ids[] = { | 1876 | static struct pcmcia_device_id nsp_cs_ids[] = { |
2010 | PCMCIA_DEVICE_PROD_ID123("IO DATA", "CBSC16 ", "1", 0x547e66dc, 0x0d63a3fd, 0x51de003a), | 1877 | PCMCIA_DEVICE_PROD_ID123("IO DATA", "CBSC16 ", "1", 0x547e66dc, 0x0d63a3fd, 0x51de003a), |
2011 | PCMCIA_DEVICE_PROD_ID123("KME ", "SCSI-CARD-001", "1", 0x534c02bc, 0x52008408, 0x51de003a), | 1878 | PCMCIA_DEVICE_PROD_ID123("KME ", "SCSI-CARD-001", "1", 0x534c02bc, 0x52008408, 0x51de003a), |
@@ -2029,28 +1896,12 @@ static struct pcmcia_driver nsp_driver = { | |||
2029 | .suspend = nsp_cs_suspend, | 1896 | .suspend = nsp_cs_suspend, |
2030 | .resume = nsp_cs_resume, | 1897 | .resume = nsp_cs_resume, |
2031 | }; | 1898 | }; |
2032 | #endif | ||
2033 | 1899 | ||
2034 | static int __init nsp_cs_init(void) | 1900 | static int __init nsp_cs_init(void) |
2035 | { | 1901 | { |
2036 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,68)) | ||
2037 | nsp_msg(KERN_INFO, "loading..."); | 1902 | nsp_msg(KERN_INFO, "loading..."); |
2038 | 1903 | ||
2039 | return pcmcia_register_driver(&nsp_driver); | 1904 | return pcmcia_register_driver(&nsp_driver); |
2040 | #else | ||
2041 | servinfo_t serv; | ||
2042 | |||
2043 | nsp_msg(KERN_INFO, "loading..."); | ||
2044 | pcmcia_get_card_services_info(&serv); | ||
2045 | if (serv.Revision != CS_RELEASE_CODE) { | ||
2046 | nsp_msg(KERN_DEBUG, "Card Services release does not match!"); | ||
2047 | return -EINVAL; | ||
2048 | } | ||
2049 | register_pcmcia_driver(&dev_info, &nsp_cs_attach, &nsp_cs_detach); | ||
2050 | |||
2051 | nsp_dbg(NSP_DEBUG_INIT, "out"); | ||
2052 | return 0; | ||
2053 | #endif | ||
2054 | } | 1905 | } |
2055 | 1906 | ||
2056 | static void __exit nsp_cs_exit(void) | 1907 | static void __exit nsp_cs_exit(void) |
diff --git a/drivers/scsi/pcmcia/nsp_cs.h b/drivers/scsi/pcmcia/nsp_cs.h index 9102cbdf1359..b7f0fa246413 100644 --- a/drivers/scsi/pcmcia/nsp_cs.h +++ b/drivers/scsi/pcmcia/nsp_cs.h | |||
@@ -10,8 +10,6 @@ | |||
10 | 10 | ||
11 | =========================================================*/ | 11 | =========================================================*/ |
12 | 12 | ||
13 | /* $Id: nsp_cs.h,v 1.19 2003/08/18 11:09:19 elca Exp $ */ | ||
14 | |||
15 | #ifndef __nsp_cs__ | 13 | #ifndef __nsp_cs__ |
16 | #define __nsp_cs__ | 14 | #define __nsp_cs__ |
17 | 15 | ||
@@ -227,13 +225,7 @@ | |||
227 | typedef struct scsi_info_t { | 225 | typedef struct scsi_info_t { |
228 | struct pcmcia_device *p_dev; | 226 | struct pcmcia_device *p_dev; |
229 | struct Scsi_Host *host; | 227 | struct Scsi_Host *host; |
230 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,74)) | ||
231 | dev_node_t node; | 228 | dev_node_t node; |
232 | #else | ||
233 | int ndev; | ||
234 | dev_node_t node[8]; | ||
235 | struct bus_operations *bus; | ||
236 | #endif | ||
237 | int stop; | 229 | int stop; |
238 | } scsi_info_t; | 230 | } scsi_info_t; |
239 | 231 | ||