diff options
Diffstat (limited to 'drivers/scsi/aic7xxx/aic7xxx_osm.c')
-rw-r--r-- | drivers/scsi/aic7xxx/aic7xxx_osm.c | 152 |
1 files changed, 4 insertions, 148 deletions
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c index f94a67be0be4..116d0f51ca2c 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c | |||
@@ -136,10 +136,6 @@ static struct scsi_transport_template *ahc_linux_transport_template = NULL; | |||
136 | #include <linux/blkdev.h> /* For block_size() */ | 136 | #include <linux/blkdev.h> /* For block_size() */ |
137 | #include <linux/delay.h> /* For ssleep/msleep */ | 137 | #include <linux/delay.h> /* For ssleep/msleep */ |
138 | 138 | ||
139 | /* | ||
140 | * Lock protecting manipulation of the ahc softc list. | ||
141 | */ | ||
142 | spinlock_t ahc_list_spinlock; | ||
143 | 139 | ||
144 | /* | 140 | /* |
145 | * Set this to the delay in seconds after SCSI bus reset. | 141 | * Set this to the delay in seconds after SCSI bus reset. |
@@ -292,25 +288,6 @@ ahc_print_path(struct ahc_softc *ahc, struct scb *scb) | |||
292 | static uint32_t aic7xxx_no_reset; | 288 | static uint32_t aic7xxx_no_reset; |
293 | 289 | ||
294 | /* | 290 | /* |
295 | * Certain PCI motherboards will scan PCI devices from highest to lowest, | ||
296 | * others scan from lowest to highest, and they tend to do all kinds of | ||
297 | * strange things when they come into contact with PCI bridge chips. The | ||
298 | * net result of all this is that the PCI card that is actually used to boot | ||
299 | * the machine is very hard to detect. Most motherboards go from lowest | ||
300 | * PCI slot number to highest, and the first SCSI controller found is the | ||
301 | * one you boot from. The only exceptions to this are when a controller | ||
302 | * has its BIOS disabled. So, we by default sort all of our SCSI controllers | ||
303 | * from lowest PCI slot number to highest PCI slot number. We also force | ||
304 | * all controllers with their BIOS disabled to the end of the list. This | ||
305 | * works on *almost* all computers. Where it doesn't work, we have this | ||
306 | * option. Setting this option to non-0 will reverse the order of the sort | ||
307 | * to highest first, then lowest, but will still leave cards with their BIOS | ||
308 | * disabled at the very end. That should fix everyone up unless there are | ||
309 | * really strange cirumstances. | ||
310 | */ | ||
311 | static uint32_t aic7xxx_reverse_scan; | ||
312 | |||
313 | /* | ||
314 | * Should we force EXTENDED translation on a controller. | 291 | * Should we force EXTENDED translation on a controller. |
315 | * 0 == Use whatever is in the SEEPROM or default to off | 292 | * 0 == Use whatever is in the SEEPROM or default to off |
316 | * 1 == Use whatever is in the SEEPROM or default to on | 293 | * 1 == Use whatever is in the SEEPROM or default to on |
@@ -416,7 +393,9 @@ static int ahc_linux_run_command(struct ahc_softc*, | |||
416 | static void ahc_linux_setup_tag_info_global(char *p); | 393 | static void ahc_linux_setup_tag_info_global(char *p); |
417 | static aic_option_callback_t ahc_linux_setup_tag_info; | 394 | static aic_option_callback_t ahc_linux_setup_tag_info; |
418 | static int aic7xxx_setup(char *s); | 395 | static int aic7xxx_setup(char *s); |
419 | static int ahc_linux_next_unit(void); | 396 | |
397 | static int ahc_linux_unit; | ||
398 | |||
420 | 399 | ||
421 | /********************************* Inlines ************************************/ | 400 | /********************************* Inlines ************************************/ |
422 | static __inline void ahc_linux_unmap_scb(struct ahc_softc*, struct scb*); | 401 | static __inline void ahc_linux_unmap_scb(struct ahc_softc*, struct scb*); |
@@ -911,99 +890,6 @@ ahc_dmamap_unload(struct ahc_softc *ahc, bus_dma_tag_t dmat, bus_dmamap_t map) | |||
911 | return (0); | 890 | return (0); |
912 | } | 891 | } |
913 | 892 | ||
914 | /********************* Platform Dependent Functions ***************************/ | ||
915 | /* | ||
916 | * Compare "left hand" softc with "right hand" softc, returning: | ||
917 | * < 0 - lahc has a lower priority than rahc | ||
918 | * 0 - Softcs are equal | ||
919 | * > 0 - lahc has a higher priority than rahc | ||
920 | */ | ||
921 | int | ||
922 | ahc_softc_comp(struct ahc_softc *lahc, struct ahc_softc *rahc) | ||
923 | { | ||
924 | int value; | ||
925 | int rvalue; | ||
926 | int lvalue; | ||
927 | |||
928 | /* | ||
929 | * Under Linux, cards are ordered as follows: | ||
930 | * 1) VLB/EISA BIOS enabled devices sorted by BIOS address. | ||
931 | * 2) PCI devices with BIOS enabled sorted by bus/slot/func. | ||
932 | * 3) All remaining VLB/EISA devices sorted by ioport. | ||
933 | * 4) All remaining PCI devices sorted by bus/slot/func. | ||
934 | */ | ||
935 | value = (lahc->flags & AHC_BIOS_ENABLED) | ||
936 | - (rahc->flags & AHC_BIOS_ENABLED); | ||
937 | if (value != 0) | ||
938 | /* Controllers with BIOS enabled have a *higher* priority */ | ||
939 | return (value); | ||
940 | |||
941 | /* | ||
942 | * Same BIOS setting, now sort based on bus type. | ||
943 | * EISA and VL controllers sort together. EISA/VL | ||
944 | * have higher priority than PCI. | ||
945 | */ | ||
946 | rvalue = (rahc->chip & AHC_BUS_MASK); | ||
947 | if (rvalue == AHC_VL) | ||
948 | rvalue = AHC_EISA; | ||
949 | lvalue = (lahc->chip & AHC_BUS_MASK); | ||
950 | if (lvalue == AHC_VL) | ||
951 | lvalue = AHC_EISA; | ||
952 | value = rvalue - lvalue; | ||
953 | if (value != 0) | ||
954 | return (value); | ||
955 | |||
956 | /* Still equal. Sort by BIOS address, ioport, or bus/slot/func. */ | ||
957 | switch (rvalue) { | ||
958 | #ifdef CONFIG_PCI | ||
959 | case AHC_PCI: | ||
960 | { | ||
961 | char primary_channel; | ||
962 | |||
963 | if (aic7xxx_reverse_scan != 0) | ||
964 | value = ahc_get_pci_bus(lahc->dev_softc) | ||
965 | - ahc_get_pci_bus(rahc->dev_softc); | ||
966 | else | ||
967 | value = ahc_get_pci_bus(rahc->dev_softc) | ||
968 | - ahc_get_pci_bus(lahc->dev_softc); | ||
969 | if (value != 0) | ||
970 | break; | ||
971 | if (aic7xxx_reverse_scan != 0) | ||
972 | value = ahc_get_pci_slot(lahc->dev_softc) | ||
973 | - ahc_get_pci_slot(rahc->dev_softc); | ||
974 | else | ||
975 | value = ahc_get_pci_slot(rahc->dev_softc) | ||
976 | - ahc_get_pci_slot(lahc->dev_softc); | ||
977 | if (value != 0) | ||
978 | break; | ||
979 | /* | ||
980 | * On multi-function devices, the user can choose | ||
981 | * to have function 1 probed before function 0. | ||
982 | * Give whichever channel is the primary channel | ||
983 | * the highest priority. | ||
984 | */ | ||
985 | primary_channel = (lahc->flags & AHC_PRIMARY_CHANNEL) + 'A'; | ||
986 | value = -1; | ||
987 | if (lahc->channel == primary_channel) | ||
988 | value = 1; | ||
989 | break; | ||
990 | } | ||
991 | #endif | ||
992 | case AHC_EISA: | ||
993 | if ((rahc->flags & AHC_BIOS_ENABLED) != 0) { | ||
994 | value = rahc->platform_data->bios_address | ||
995 | - lahc->platform_data->bios_address; | ||
996 | } else { | ||
997 | value = rahc->bsh.ioport | ||
998 | - lahc->bsh.ioport; | ||
999 | } | ||
1000 | break; | ||
1001 | default: | ||
1002 | panic("ahc_softc_sort: invalid bus type"); | ||
1003 | } | ||
1004 | return (value); | ||
1005 | } | ||
1006 | |||
1007 | static void | 893 | static void |
1008 | ahc_linux_setup_tag_info_global(char *p) | 894 | ahc_linux_setup_tag_info_global(char *p) |
1009 | { | 895 | { |
@@ -1055,7 +941,6 @@ aic7xxx_setup(char *s) | |||
1055 | #ifdef AHC_DEBUG | 941 | #ifdef AHC_DEBUG |
1056 | { "debug", &ahc_debug }, | 942 | { "debug", &ahc_debug }, |
1057 | #endif | 943 | #endif |
1058 | { "reverse_scan", &aic7xxx_reverse_scan }, | ||
1059 | { "periodic_otag", &aic7xxx_periodic_otag }, | 944 | { "periodic_otag", &aic7xxx_periodic_otag }, |
1060 | { "pci_parity", &aic7xxx_pci_parity }, | 945 | { "pci_parity", &aic7xxx_pci_parity }, |
1061 | { "seltime", &aic7xxx_seltime }, | 946 | { "seltime", &aic7xxx_seltime }, |
@@ -1130,7 +1015,7 @@ ahc_linux_register_host(struct ahc_softc *ahc, struct scsi_host_template *templa | |||
1130 | host->max_lun = AHC_NUM_LUNS; | 1015 | host->max_lun = AHC_NUM_LUNS; |
1131 | host->max_channel = (ahc->features & AHC_TWIN) ? 1 : 0; | 1016 | host->max_channel = (ahc->features & AHC_TWIN) ? 1 : 0; |
1132 | host->sg_tablesize = AHC_NSEG; | 1017 | host->sg_tablesize = AHC_NSEG; |
1133 | ahc_set_unit(ahc, ahc_linux_next_unit()); | 1018 | ahc_set_unit(ahc, ahc_linux_unit++); |
1134 | sprintf(buf, "scsi%d", host->host_no); | 1019 | sprintf(buf, "scsi%d", host->host_no); |
1135 | new_name = malloc(strlen(buf) + 1, M_DEVBUF, M_NOWAIT); | 1020 | new_name = malloc(strlen(buf) + 1, M_DEVBUF, M_NOWAIT); |
1136 | if (new_name != NULL) { | 1021 | if (new_name != NULL) { |
@@ -1159,29 +1044,6 @@ ahc_linux_get_memsize(void) | |||
1159 | } | 1044 | } |
1160 | 1045 | ||
1161 | /* | 1046 | /* |
1162 | * Find the smallest available unit number to use | ||
1163 | * for a new device. We don't just use a static | ||
1164 | * count to handle the "repeated hot-(un)plug" | ||
1165 | * scenario. | ||
1166 | */ | ||
1167 | static int | ||
1168 | ahc_linux_next_unit(void) | ||
1169 | { | ||
1170 | struct ahc_softc *ahc; | ||
1171 | int unit; | ||
1172 | |||
1173 | unit = 0; | ||
1174 | retry: | ||
1175 | TAILQ_FOREACH(ahc, &ahc_tailq, links) { | ||
1176 | if (ahc->unit == unit) { | ||
1177 | unit++; | ||
1178 | goto retry; | ||
1179 | } | ||
1180 | } | ||
1181 | return (unit); | ||
1182 | } | ||
1183 | |||
1184 | /* | ||
1185 | * Place the SCSI bus into a known state by either resetting it, | 1047 | * Place the SCSI bus into a known state by either resetting it, |
1186 | * or forcing transfer negotiations on the next command to any | 1048 | * or forcing transfer negotiations on the next command to any |
1187 | * target. | 1049 | * target. |
@@ -2685,12 +2547,6 @@ ahc_linux_init(void) | |||
2685 | scsi_transport_reserve_device(ahc_linux_transport_template, | 2547 | scsi_transport_reserve_device(ahc_linux_transport_template, |
2686 | sizeof(struct ahc_linux_device)); | 2548 | sizeof(struct ahc_linux_device)); |
2687 | 2549 | ||
2688 | /* | ||
2689 | * Initialize our softc list lock prior to | ||
2690 | * probing for any adapters. | ||
2691 | */ | ||
2692 | ahc_list_lockinit(); | ||
2693 | |||
2694 | ahc_linux_pci_init(); | 2550 | ahc_linux_pci_init(); |
2695 | ahc_linux_eisa_init(); | 2551 | ahc_linux_eisa_init(); |
2696 | return 0; | 2552 | return 0; |