diff options
author | Matthew Wilcox <matthew@wil.cx> | 2007-07-30 11:14:52 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.localdomain> | 2007-10-12 14:39:01 -0400 |
commit | b09e05a73e8308397371edc15b7d45082971fa95 (patch) | |
tree | 3f727e4ebf6bcab57aa1a9e056eb5813bf97ec50 /drivers/scsi | |
parent | 78e77d8b50633241d34cd9e64626d39d0a8cd2c0 (diff) |
[SCSI] advansys: Convert to EISA driver model
- Switch EISA probing to the driver model
- Remove some now-unused macros and functions
- Update the FIXME now that we use the correct driver model probing API
Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/advansys.c | 175 |
1 files changed, 94 insertions, 81 deletions
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index 3ba70323345d..e096f19e4dd9 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c | |||
@@ -769,6 +769,7 @@ | |||
769 | #include <linux/proc_fs.h> | 769 | #include <linux/proc_fs.h> |
770 | #include <linux/init.h> | 770 | #include <linux/init.h> |
771 | #include <linux/blkdev.h> | 771 | #include <linux/blkdev.h> |
772 | #include <linux/eisa.h> | ||
772 | #include <linux/pci.h> | 773 | #include <linux/pci.h> |
773 | #include <linux/spinlock.h> | 774 | #include <linux/spinlock.h> |
774 | #include <linux/dma-mapping.h> | 775 | #include <linux/dma-mapping.h> |
@@ -783,13 +784,9 @@ | |||
783 | #include <scsi/scsi.h> | 784 | #include <scsi/scsi.h> |
784 | #include <scsi/scsi_host.h> | 785 | #include <scsi/scsi_host.h> |
785 | 786 | ||
786 | /* FIXME: (by jejb@steeleye.com) This warning is present for two | 787 | /* FIXME: (by jejb@steeleye.com) |
787 | * reasons: | ||
788 | * | 788 | * |
789 | * 1) This driver badly needs converting to the correct driver model | 789 | * Although all of the necessary command mapping places have the |
790 | * probing API | ||
791 | * | ||
792 | * 2) Although all of the necessary command mapping places have the | ||
793 | * appropriate dma_map.. APIs, the driver still processes its internal | 790 | * appropriate dma_map.. APIs, the driver still processes its internal |
794 | * queue using bus_to_virt() and virt_to_bus() which are illegal under | 791 | * queue using bus_to_virt() and virt_to_bus() which are illegal under |
795 | * the API. The entire queue processing structure will need to be | 792 | * the API. The entire queue processing structure will need to be |
@@ -1787,16 +1784,10 @@ typedef struct asceep_config { | |||
1787 | #define ASC_1000_ID0W 0x04C1 | 1784 | #define ASC_1000_ID0W 0x04C1 |
1788 | #define ASC_1000_ID0W_FIX 0x00C1 | 1785 | #define ASC_1000_ID0W_FIX 0x00C1 |
1789 | #define ASC_1000_ID1B 0x25 | 1786 | #define ASC_1000_ID1B 0x25 |
1790 | #define ASC_EISA_BIG_IOP_GAP (0x1C30-0x0C50) | ||
1791 | #define ASC_EISA_SMALL_IOP_GAP (0x0020) | ||
1792 | #define ASC_EISA_MIN_IOP_ADDR (0x0C30) | ||
1793 | #define ASC_EISA_MAX_IOP_ADDR (0xFC50) | ||
1794 | #define ASC_EISA_REV_IOP_MASK (0x0C83) | 1787 | #define ASC_EISA_REV_IOP_MASK (0x0C83) |
1795 | #define ASC_EISA_PID_IOP_MASK (0x0C80) | 1788 | #define ASC_EISA_PID_IOP_MASK (0x0C80) |
1796 | #define ASC_EISA_CFG_IOP_MASK (0x0C86) | 1789 | #define ASC_EISA_CFG_IOP_MASK (0x0C86) |
1797 | #define ASC_GET_EISA_SLOT(iop) (PortAddr)((iop) & 0xF000) | 1790 | #define ASC_GET_EISA_SLOT(iop) (PortAddr)((iop) & 0xF000) |
1798 | #define ASC_EISA_ID_740 0x01745004UL | ||
1799 | #define ASC_EISA_ID_750 0x01755004UL | ||
1800 | #define INS_HALTINT (ushort)0x6281 | 1791 | #define INS_HALTINT (ushort)0x6281 |
1801 | #define INS_HALT (ushort)0x6280 | 1792 | #define INS_HALT (ushort)0x6280 |
1802 | #define INS_SINT (ushort)0x6200 | 1793 | #define INS_SINT (ushort)0x6200 |
@@ -1943,8 +1934,6 @@ static int AscIsrQDone(ASC_DVC_VAR *); | |||
1943 | static int AscCompareString(uchar *, uchar *, int); | 1934 | static int AscCompareString(uchar *, uchar *, int); |
1944 | #ifdef CONFIG_ISA | 1935 | #ifdef CONFIG_ISA |
1945 | static ushort AscGetEisaChipCfg(PortAddr); | 1936 | static ushort AscGetEisaChipCfg(PortAddr); |
1946 | static ASC_DCNT AscGetEisaProductID(PortAddr); | ||
1947 | static PortAddr AscSearchIOPortAddrEISA(PortAddr); | ||
1948 | static PortAddr AscSearchIOPortAddr11(PortAddr); | 1937 | static PortAddr AscSearchIOPortAddr11(PortAddr); |
1949 | static PortAddr AscSearchIOPortAddr(PortAddr, ushort); | 1938 | static PortAddr AscSearchIOPortAddr(PortAddr, ushort); |
1950 | static void AscSetISAPNPWaitForKey(void); | 1939 | static void AscSetISAPNPWaitForKey(void); |
@@ -3418,7 +3407,7 @@ typedef struct { | |||
3418 | 3407 | ||
3419 | #define ASC_NUM_BOARD_SUPPORTED 16 | 3408 | #define ASC_NUM_BOARD_SUPPORTED 16 |
3420 | #define ASC_NUM_IOPORT_PROBE 4 | 3409 | #define ASC_NUM_IOPORT_PROBE 4 |
3421 | #define ASC_NUM_BUS 3 | 3410 | #define ASC_NUM_BUS 2 |
3422 | 3411 | ||
3423 | /* Reference Scsi_Host hostdata */ | 3412 | /* Reference Scsi_Host hostdata */ |
3424 | #define ASC_BOARDP(host) ((asc_board_t *) &((host)->hostdata)) | 3413 | #define ASC_BOARDP(host) ((asc_board_t *) &((host)->hostdata)) |
@@ -3864,7 +3853,6 @@ static ASC_SG_HEAD asc_sg_head = { 0 }; | |||
3864 | static ushort asc_bus[ASC_NUM_BUS] __initdata = { | 3853 | static ushort asc_bus[ASC_NUM_BUS] __initdata = { |
3865 | ASC_IS_ISA, | 3854 | ASC_IS_ISA, |
3866 | ASC_IS_VL, | 3855 | ASC_IS_VL, |
3867 | ASC_IS_EISA, | ||
3868 | }; | 3856 | }; |
3869 | 3857 | ||
3870 | static int asc_iopflag = ASC_FALSE; | 3858 | static int asc_iopflag = ASC_FALSE; |
@@ -3874,7 +3862,6 @@ static int asc_ioport[ASC_NUM_IOPORT_PROBE] = { 0, 0, 0, 0 }; | |||
3874 | static char *asc_bus_name[ASC_NUM_BUS] = { | 3862 | static char *asc_bus_name[ASC_NUM_BUS] = { |
3875 | "ASC_IS_ISA", | 3863 | "ASC_IS_ISA", |
3876 | "ASC_IS_VL", | 3864 | "ASC_IS_VL", |
3877 | "ASC_IS_EISA", | ||
3878 | }; | 3865 | }; |
3879 | 3866 | ||
3880 | static int asc_dbglvl = 3; | 3867 | static int asc_dbglvl = 3; |
@@ -8241,12 +8228,6 @@ static PortAddr __init AscSearchIOPortAddr(PortAddr iop_beg, ushort bus_type) | |||
8241 | } | 8228 | } |
8242 | return (0); | 8229 | return (0); |
8243 | } | 8230 | } |
8244 | if (bus_type & ASC_IS_EISA) { | ||
8245 | if ((iop_beg = AscSearchIOPortAddrEISA(iop_beg)) != 0) { | ||
8246 | return (iop_beg); | ||
8247 | } | ||
8248 | return (0); | ||
8249 | } | ||
8250 | return (0); | 8231 | return (0); |
8251 | } | 8232 | } |
8252 | 8233 | ||
@@ -10256,57 +10237,6 @@ static void DvcDelayNanoSecond(ASC_DVC_VAR *asc_dvc, ASC_DCNT nano_sec) | |||
10256 | udelay((nano_sec + 999) / 1000); | 10237 | udelay((nano_sec + 999) / 1000); |
10257 | } | 10238 | } |
10258 | 10239 | ||
10259 | #ifdef CONFIG_ISA | ||
10260 | static ASC_DCNT __init AscGetEisaProductID(PortAddr iop_base) | ||
10261 | { | ||
10262 | PortAddr eisa_iop; | ||
10263 | ushort product_id_high, product_id_low; | ||
10264 | ASC_DCNT product_id; | ||
10265 | |||
10266 | eisa_iop = ASC_GET_EISA_SLOT(iop_base) | ASC_EISA_PID_IOP_MASK; | ||
10267 | product_id_low = inpw(eisa_iop); | ||
10268 | product_id_high = inpw(eisa_iop + 2); | ||
10269 | product_id = ((ASC_DCNT) product_id_high << 16) | | ||
10270 | (ASC_DCNT) product_id_low; | ||
10271 | return (product_id); | ||
10272 | } | ||
10273 | |||
10274 | static PortAddr __init AscSearchIOPortAddrEISA(PortAddr iop_base) | ||
10275 | { | ||
10276 | ASC_DCNT eisa_product_id; | ||
10277 | |||
10278 | if (iop_base == 0) { | ||
10279 | iop_base = ASC_EISA_MIN_IOP_ADDR; | ||
10280 | } else { | ||
10281 | if (iop_base == ASC_EISA_MAX_IOP_ADDR) | ||
10282 | return (0); | ||
10283 | if ((iop_base & 0x0050) == 0x0050) { | ||
10284 | iop_base += ASC_EISA_BIG_IOP_GAP; | ||
10285 | } else { | ||
10286 | iop_base += ASC_EISA_SMALL_IOP_GAP; | ||
10287 | } | ||
10288 | } | ||
10289 | while (iop_base <= ASC_EISA_MAX_IOP_ADDR) { | ||
10290 | eisa_product_id = AscGetEisaProductID(iop_base); | ||
10291 | if ((eisa_product_id == ASC_EISA_ID_740) || | ||
10292 | (eisa_product_id == ASC_EISA_ID_750)) { | ||
10293 | if (AscFindSignature(iop_base)) { | ||
10294 | inpw(iop_base + 4); | ||
10295 | return (iop_base); | ||
10296 | } | ||
10297 | } | ||
10298 | if (iop_base == ASC_EISA_MAX_IOP_ADDR) | ||
10299 | return (0); | ||
10300 | if ((iop_base & 0x0050) == 0x0050) { | ||
10301 | iop_base += ASC_EISA_BIG_IOP_GAP; | ||
10302 | } else { | ||
10303 | iop_base += ASC_EISA_SMALL_IOP_GAP; | ||
10304 | } | ||
10305 | } | ||
10306 | return (0); | ||
10307 | } | ||
10308 | #endif /* CONFIG_ISA */ | ||
10309 | |||
10310 | static int AscStartChip(PortAddr iop_base) | 10240 | static int AscStartChip(PortAddr iop_base) |
10311 | { | 10241 | { |
10312 | AscSetChipControl(iop_base, 0); | 10242 | AscSetChipControl(iop_base, 0); |
@@ -18607,12 +18537,6 @@ static int __init advansys_detect(void) | |||
18607 | #endif /* CONFIG_ISA */ | 18537 | #endif /* CONFIG_ISA */ |
18608 | break; | 18538 | break; |
18609 | 18539 | ||
18610 | case ASC_IS_EISA: | ||
18611 | #ifdef CONFIG_ISA | ||
18612 | iop = AscSearchIOPortAddr(iop, asc_bus[bus]); | ||
18613 | #endif /* CONFIG_ISA */ | ||
18614 | break; | ||
18615 | |||
18616 | default: | 18540 | default: |
18617 | ASC_PRINT1 | 18541 | ASC_PRINT1 |
18618 | ("advansys_detect: unknown bus type: %d\n", | 18542 | ("advansys_detect: unknown bus type: %d\n", |
@@ -18667,6 +18591,87 @@ static int advansys_release(struct Scsi_Host *shost) | |||
18667 | return 0; | 18591 | return 0; |
18668 | } | 18592 | } |
18669 | 18593 | ||
18594 | static struct eisa_device_id advansys_eisa_table[] __devinitdata = { | ||
18595 | { "ABP7401" }, | ||
18596 | { "ABP7501" }, | ||
18597 | { "" } | ||
18598 | }; | ||
18599 | |||
18600 | MODULE_DEVICE_TABLE(eisa, advansys_eisa_table); | ||
18601 | |||
18602 | /* | ||
18603 | * EISA is a little more tricky than PCI; each EISA device may have two | ||
18604 | * channels, and this driver is written to make each channel its own Scsi_Host | ||
18605 | */ | ||
18606 | struct eisa_scsi_data { | ||
18607 | struct Scsi_Host *host[2]; | ||
18608 | }; | ||
18609 | |||
18610 | static int __devinit advansys_eisa_probe(struct device *dev) | ||
18611 | { | ||
18612 | int i, ioport; | ||
18613 | int err; | ||
18614 | struct eisa_device *edev = to_eisa_device(dev); | ||
18615 | struct eisa_scsi_data *data; | ||
18616 | |||
18617 | err = -ENOMEM; | ||
18618 | data = kzalloc(sizeof(*data), GFP_KERNEL); | ||
18619 | if (!data) | ||
18620 | goto fail; | ||
18621 | ioport = edev->base_addr + 0xc30; | ||
18622 | |||
18623 | err = -ENODEV; | ||
18624 | for (i = 0; i < 2; i++, ioport += 0x20) { | ||
18625 | if (!AscFindSignature(ioport)) | ||
18626 | continue; | ||
18627 | /* | ||
18628 | * I don't know why we need to do this for EISA chips, but | ||
18629 | * not for any others. It looks to be equivalent to | ||
18630 | * AscGetChipCfgMsw, but I may have overlooked something, | ||
18631 | * so I'm not converting it until I get an EISA board to | ||
18632 | * test with. | ||
18633 | */ | ||
18634 | inw(ioport + 4); | ||
18635 | data->host[i] = advansys_board_found(ioport, dev, ASC_IS_EISA); | ||
18636 | if (data->host[i]) | ||
18637 | err = 0; | ||
18638 | } | ||
18639 | |||
18640 | if (err) { | ||
18641 | kfree(data); | ||
18642 | } else { | ||
18643 | dev_set_drvdata(dev, data); | ||
18644 | } | ||
18645 | |||
18646 | fail: | ||
18647 | return err; | ||
18648 | } | ||
18649 | |||
18650 | static __devexit int advansys_eisa_remove(struct device *dev) | ||
18651 | { | ||
18652 | int i; | ||
18653 | struct eisa_scsi_data *data = dev_get_drvdata(dev); | ||
18654 | |||
18655 | for (i = 0; i < 2; i++) { | ||
18656 | struct Scsi_Host *shost = data->host[i]; | ||
18657 | if (!shost) | ||
18658 | continue; | ||
18659 | advansys_release(shost); | ||
18660 | } | ||
18661 | |||
18662 | kfree(data); | ||
18663 | return 0; | ||
18664 | } | ||
18665 | |||
18666 | static struct eisa_driver advansys_eisa_driver = { | ||
18667 | .id_table = advansys_eisa_table, | ||
18668 | .driver = { | ||
18669 | .name = "advansys", | ||
18670 | .probe = advansys_eisa_probe, | ||
18671 | .remove = __devexit_p(advansys_eisa_remove), | ||
18672 | } | ||
18673 | }; | ||
18674 | |||
18670 | /* PCI Devices supported by this driver */ | 18675 | /* PCI Devices supported by this driver */ |
18671 | static struct pci_device_id advansys_pci_tbl[] __devinitdata = { | 18676 | static struct pci_device_id advansys_pci_tbl[] __devinitdata = { |
18672 | {PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_ASP_1200A, | 18677 | {PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_ASP_1200A, |
@@ -18732,12 +18737,19 @@ static int __init advansys_init(void) | |||
18732 | { | 18737 | { |
18733 | int i, error; | 18738 | int i, error; |
18734 | advansys_detect(); | 18739 | advansys_detect(); |
18735 | error = pci_register_driver(&advansys_pci_driver); | 18740 | |
18741 | error = eisa_driver_register(&advansys_eisa_driver); | ||
18736 | if (error) | 18742 | if (error) |
18737 | goto fail; | 18743 | goto fail; |
18738 | 18744 | ||
18745 | error = pci_register_driver(&advansys_pci_driver); | ||
18746 | if (error) | ||
18747 | goto unregister_eisa; | ||
18748 | |||
18739 | return 0; | 18749 | return 0; |
18740 | 18750 | ||
18751 | unregister_eisa: | ||
18752 | eisa_driver_unregister(&advansys_eisa_driver); | ||
18741 | fail: | 18753 | fail: |
18742 | for (i = 0; i < asc_legacy_count; i++) | 18754 | for (i = 0; i < asc_legacy_count; i++) |
18743 | advansys_release(asc_host[i]); | 18755 | advansys_release(asc_host[i]); |
@@ -18750,6 +18762,7 @@ static void __exit advansys_exit(void) | |||
18750 | int i; | 18762 | int i; |
18751 | 18763 | ||
18752 | pci_unregister_driver(&advansys_pci_driver); | 18764 | pci_unregister_driver(&advansys_pci_driver); |
18765 | eisa_driver_unregister(&advansys_eisa_driver); | ||
18753 | 18766 | ||
18754 | for (i = 0; i < asc_legacy_count; i++) | 18767 | for (i = 0; i < asc_legacy_count; i++) |
18755 | advansys_release(asc_host[i]); | 18768 | advansys_release(asc_host[i]); |