aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/aic7xxx
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/aic7xxx')
-rw-r--r--drivers/scsi/aic7xxx/aic7770.c2
-rw-r--r--drivers/scsi/aic7xxx/aic79xx.h2
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_core.c14
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.c20
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_pci.c2
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_proc.c4
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx.h3
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_core.c12
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm.c29
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_pci.c83
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_proc.c4
11 files changed, 126 insertions, 49 deletions
diff --git a/drivers/scsi/aic7xxx/aic7770.c b/drivers/scsi/aic7xxx/aic7770.c
index 527efd36f5c1..c4d17231c828 100644
--- a/drivers/scsi/aic7xxx/aic7770.c
+++ b/drivers/scsi/aic7xxx/aic7770.c
@@ -107,7 +107,7 @@ struct aic7770_identity aic7770_ident_table[] =
107 ahc_aic7770_EISA_setup 107 ahc_aic7770_EISA_setup
108 } 108 }
109}; 109};
110const int ahc_num_aic7770_devs = NUM_ELEMENTS(aic7770_ident_table); 110const int ahc_num_aic7770_devs = ARRAY_SIZE(aic7770_ident_table);
111 111
112struct aic7770_identity * 112struct aic7770_identity *
113aic7770_find_device(uint32_t id) 113aic7770_find_device(uint32_t id)
diff --git a/drivers/scsi/aic7xxx/aic79xx.h b/drivers/scsi/aic7xxx/aic79xx.h
index bb5166da4358..eb7745692682 100644
--- a/drivers/scsi/aic7xxx/aic79xx.h
+++ b/drivers/scsi/aic7xxx/aic79xx.h
@@ -68,8 +68,6 @@ struct scb_platform_data;
68#define FALSE 0 68#define FALSE 0
69#endif 69#endif
70 70
71#define NUM_ELEMENTS(array) (sizeof(array) / sizeof(*array))
72
73#define ALL_CHANNELS '\0' 71#define ALL_CHANNELS '\0'
74#define ALL_TARGETS_MASK 0xFFFF 72#define ALL_TARGETS_MASK 0xFFFF
75#define INITIATOR_WILDCARD (~0) 73#define INITIATOR_WILDCARD (~0)
diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c
index 08771f6f6859..801fc81d0b20 100644
--- a/drivers/scsi/aic7xxx/aic79xx_core.c
+++ b/drivers/scsi/aic7xxx/aic79xx_core.c
@@ -59,7 +59,7 @@ char *ahd_chip_names[] =
59 "aic7902", 59 "aic7902",
60 "aic7901A" 60 "aic7901A"
61}; 61};
62static const u_int num_chip_names = NUM_ELEMENTS(ahd_chip_names); 62static const u_int num_chip_names = ARRAY_SIZE(ahd_chip_names);
63 63
64/* 64/*
65 * Hardware error codes. 65 * Hardware error codes.
@@ -77,7 +77,7 @@ static struct ahd_hard_error_entry ahd_hard_errors[] = {
77 { MPARERR, "Scratch or SCB Memory Parity Error" }, 77 { MPARERR, "Scratch or SCB Memory Parity Error" },
78 { CIOPARERR, "CIOBUS Parity Error" }, 78 { CIOPARERR, "CIOBUS Parity Error" },
79}; 79};
80static const u_int num_errors = NUM_ELEMENTS(ahd_hard_errors); 80static const u_int num_errors = ARRAY_SIZE(ahd_hard_errors);
81 81
82static struct ahd_phase_table_entry ahd_phase_table[] = 82static struct ahd_phase_table_entry ahd_phase_table[] =
83{ 83{
@@ -97,7 +97,7 @@ static struct ahd_phase_table_entry ahd_phase_table[] =
97 * In most cases we only wish to itterate over real phases, so 97 * In most cases we only wish to itterate over real phases, so
98 * exclude the last element from the count. 98 * exclude the last element from the count.
99 */ 99 */
100static const u_int num_phases = NUM_ELEMENTS(ahd_phase_table) - 1; 100static const u_int num_phases = ARRAY_SIZE(ahd_phase_table) - 1;
101 101
102/* Our Sequencer Program */ 102/* Our Sequencer Program */
103#include "aic79xx_seq.h" 103#include "aic79xx_seq.h"
@@ -7259,7 +7259,7 @@ ahd_qinfifo_count(struct ahd_softc *ahd)
7259 return (wrap_qinfifonext - wrap_qinpos); 7259 return (wrap_qinfifonext - wrap_qinpos);
7260 else 7260 else
7261 return (wrap_qinfifonext 7261 return (wrap_qinfifonext
7262 + NUM_ELEMENTS(ahd->qinfifo) - wrap_qinpos); 7262 + ARRAY_SIZE(ahd->qinfifo) - wrap_qinpos);
7263} 7263}
7264 7264
7265void 7265void
@@ -8619,7 +8619,7 @@ ahd_check_patch(struct ahd_softc *ahd, struct patch **start_patch,
8619 struct patch *last_patch; 8619 struct patch *last_patch;
8620 u_int num_patches; 8620 u_int num_patches;
8621 8621
8622 num_patches = sizeof(patches)/sizeof(struct patch); 8622 num_patches = ARRAY_SIZE(patches);
8623 last_patch = &patches[num_patches]; 8623 last_patch = &patches[num_patches];
8624 cur_patch = *start_patch; 8624 cur_patch = *start_patch;
8625 8625
@@ -9396,8 +9396,8 @@ ahd_find_tmode_devs(struct ahd_softc *ahd, struct cam_sim *sim, union ccb *ccb,
9396 } else { 9396 } else {
9397 u_int max_id; 9397 u_int max_id;
9398 9398
9399 max_id = (ahd->features & AHD_WIDE) ? 15 : 7; 9399 max_id = (ahd->features & AHD_WIDE) ? 16 : 8;
9400 if (ccb->ccb_h.target_id > max_id) 9400 if (ccb->ccb_h.target_id >= max_id)
9401 return (CAM_TID_INVALID); 9401 return (CAM_TID_INVALID);
9402 9402
9403 if (ccb->ccb_h.target_lun >= AHD_NUM_LUNS) 9403 if (ccb->ccb_h.target_lun >= AHD_NUM_LUNS)
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index 66e4a47bb9ee..e0ccdf362200 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -916,7 +916,7 @@ ahd_linux_setup_iocell_info(u_long index, int instance, int targ, int32_t value)
916{ 916{
917 917
918 if ((instance >= 0) 918 if ((instance >= 0)
919 && (instance < NUM_ELEMENTS(aic79xx_iocell_info))) { 919 && (instance < ARRAY_SIZE(aic79xx_iocell_info))) {
920 uint8_t *iocell_info; 920 uint8_t *iocell_info;
921 921
922 iocell_info = (uint8_t*)&aic79xx_iocell_info[instance]; 922 iocell_info = (uint8_t*)&aic79xx_iocell_info[instance];
@@ -934,7 +934,7 @@ ahd_linux_setup_tag_info_global(char *p)
934 tags = simple_strtoul(p + 1, NULL, 0) & 0xff; 934 tags = simple_strtoul(p + 1, NULL, 0) & 0xff;
935 printf("Setting Global Tags= %d\n", tags); 935 printf("Setting Global Tags= %d\n", tags);
936 936
937 for (i = 0; i < NUM_ELEMENTS(aic79xx_tag_info); i++) { 937 for (i = 0; i < ARRAY_SIZE(aic79xx_tag_info); i++) {
938 for (j = 0; j < AHD_NUM_TARGETS; j++) { 938 for (j = 0; j < AHD_NUM_TARGETS; j++) {
939 aic79xx_tag_info[i].tag_commands[j] = tags; 939 aic79xx_tag_info[i].tag_commands[j] = tags;
940 } 940 }
@@ -946,7 +946,7 @@ ahd_linux_setup_tag_info(u_long arg, int instance, int targ, int32_t value)
946{ 946{
947 947
948 if ((instance >= 0) && (targ >= 0) 948 if ((instance >= 0) && (targ >= 0)
949 && (instance < NUM_ELEMENTS(aic79xx_tag_info)) 949 && (instance < ARRAY_SIZE(aic79xx_tag_info))
950 && (targ < AHD_NUM_TARGETS)) { 950 && (targ < AHD_NUM_TARGETS)) {
951 aic79xx_tag_info[instance].tag_commands[targ] = value & 0x1FF; 951 aic79xx_tag_info[instance].tag_commands[targ] = value & 0x1FF;
952 if (bootverbose) 952 if (bootverbose)
@@ -1072,21 +1072,21 @@ aic79xx_setup(char *s)
1072 end = strchr(s, '\0'); 1072 end = strchr(s, '\0');
1073 1073
1074 /* 1074 /*
1075 * XXX ia64 gcc isn't smart enough to know that NUM_ELEMENTS 1075 * XXX ia64 gcc isn't smart enough to know that ARRAY_SIZE
1076 * will never be 0 in this case. 1076 * will never be 0 in this case.
1077 */ 1077 */
1078 n = 0; 1078 n = 0;
1079 1079
1080 while ((p = strsep(&s, ",.")) != NULL) { 1080 while ((p = strsep(&s, ",.")) != NULL) {
1081 if (*p == '\0') 1081 if (*p == '\0')
1082 continue; 1082 continue;
1083 for (i = 0; i < NUM_ELEMENTS(options); i++) { 1083 for (i = 0; i < ARRAY_SIZE(options); i++) {
1084 1084
1085 n = strlen(options[i].name); 1085 n = strlen(options[i].name);
1086 if (strncmp(options[i].name, p, n) == 0) 1086 if (strncmp(options[i].name, p, n) == 0)
1087 break; 1087 break;
1088 } 1088 }
1089 if (i == NUM_ELEMENTS(options)) 1089 if (i == ARRAY_SIZE(options))
1090 continue; 1090 continue;
1091 1091
1092 if (strncmp(p, "global_tag_depth", n) == 0) { 1092 if (strncmp(p, "global_tag_depth", n) == 0) {
@@ -1294,7 +1294,7 @@ ahd_platform_init(struct ahd_softc *ahd)
1294 /* 1294 /*
1295 * Lookup and commit any modified IO Cell options. 1295 * Lookup and commit any modified IO Cell options.
1296 */ 1296 */
1297 if (ahd->unit < NUM_ELEMENTS(aic79xx_iocell_info)) { 1297 if (ahd->unit < ARRAY_SIZE(aic79xx_iocell_info)) {
1298 struct ahd_linux_iocell_opts *iocell_opts; 1298 struct ahd_linux_iocell_opts *iocell_opts;
1299 1299
1300 iocell_opts = &aic79xx_iocell_info[ahd->unit]; 1300 iocell_opts = &aic79xx_iocell_info[ahd->unit];
@@ -1426,7 +1426,7 @@ ahd_linux_user_tagdepth(struct ahd_softc *ahd, struct ahd_devinfo *devinfo)
1426 1426
1427 tags = 0; 1427 tags = 0;
1428 if ((ahd->user_discenable & devinfo->target_mask) != 0) { 1428 if ((ahd->user_discenable & devinfo->target_mask) != 0) {
1429 if (ahd->unit >= NUM_ELEMENTS(aic79xx_tag_info)) { 1429 if (ahd->unit >= ARRAY_SIZE(aic79xx_tag_info)) {
1430 1430
1431 if (warned_user == 0) { 1431 if (warned_user == 0) {
1432 printf(KERN_WARNING 1432 printf(KERN_WARNING
diff --git a/drivers/scsi/aic7xxx/aic79xx_pci.c b/drivers/scsi/aic7xxx/aic79xx_pci.c
index 757242e522c2..14850f31aafa 100644
--- a/drivers/scsi/aic7xxx/aic79xx_pci.c
+++ b/drivers/scsi/aic7xxx/aic79xx_pci.c
@@ -201,7 +201,7 @@ struct ahd_pci_identity ahd_pci_ident_table [] =
201 } 201 }
202}; 202};
203 203
204const u_int ahd_num_pci_devs = NUM_ELEMENTS(ahd_pci_ident_table); 204const u_int ahd_num_pci_devs = ARRAY_SIZE(ahd_pci_ident_table);
205 205
206#define DEVCONFIG 0x40 206#define DEVCONFIG 0x40
207#define PCIXINITPAT 0x0000E000ul 207#define PCIXINITPAT 0x0000E000ul
diff --git a/drivers/scsi/aic7xxx/aic79xx_proc.c b/drivers/scsi/aic7xxx/aic79xx_proc.c
index 39a27840fce6..24fd59a230bf 100644
--- a/drivers/scsi/aic7xxx/aic79xx_proc.c
+++ b/drivers/scsi/aic7xxx/aic79xx_proc.c
@@ -76,11 +76,9 @@ static u_int
76ahd_calc_syncsrate(u_int period_factor) 76ahd_calc_syncsrate(u_int period_factor)
77{ 77{
78 int i; 78 int i;
79 int num_syncrates;
80 79
81 num_syncrates = sizeof(scsi_syncrates) / sizeof(scsi_syncrates[0]);
82 /* See if the period is in the "exception" table */ 80 /* See if the period is in the "exception" table */
83 for (i = 0; i < num_syncrates; i++) { 81 for (i = 0; i < ARRAY_SIZE(scsi_syncrates); i++) {
84 82
85 if (period_factor == scsi_syncrates[i].period_factor) { 83 if (period_factor == scsi_syncrates[i].period_factor) {
86 /* Period in kHz */ 84 /* Period in kHz */
diff --git a/drivers/scsi/aic7xxx/aic7xxx.h b/drivers/scsi/aic7xxx/aic7xxx.h
index 91d294c6334e..62ff8c3dc2bb 100644
--- a/drivers/scsi/aic7xxx/aic7xxx.h
+++ b/drivers/scsi/aic7xxx/aic7xxx.h
@@ -69,8 +69,6 @@ struct seeprom_descriptor;
69#define FALSE 0 69#define FALSE 0
70#endif 70#endif
71 71
72#define NUM_ELEMENTS(array) (sizeof(array) / sizeof(*array))
73
74#define ALL_CHANNELS '\0' 72#define ALL_CHANNELS '\0'
75#define ALL_TARGETS_MASK 0xFFFF 73#define ALL_TARGETS_MASK 0xFFFF
76#define INITIATOR_WILDCARD (~0) 74#define INITIATOR_WILDCARD (~0)
@@ -233,6 +231,7 @@ typedef enum {
233 AHC_TARGETMODE = 0x20000, /* Has tested target mode support */ 231 AHC_TARGETMODE = 0x20000, /* Has tested target mode support */
234 AHC_MULTIROLE = 0x40000, /* Space for two roles at a time */ 232 AHC_MULTIROLE = 0x40000, /* Space for two roles at a time */
235 AHC_REMOVABLE = 0x80000, /* Hot-Swap supported */ 233 AHC_REMOVABLE = 0x80000, /* Hot-Swap supported */
234 AHC_HVD = 0x100000, /* HVD rather than SE */
236 AHC_AIC7770_FE = AHC_FENONE, 235 AHC_AIC7770_FE = AHC_FENONE,
237 /* 236 /*
238 * The real 7850 does not support Ultra modes, but there are 237 * The real 7850 does not support Ultra modes, but there are
diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c
index d37566978fba..93e4e40944b6 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_core.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_core.c
@@ -68,7 +68,7 @@ char *ahc_chip_names[] =
68 "aic7892", 68 "aic7892",
69 "aic7899" 69 "aic7899"
70}; 70};
71static const u_int num_chip_names = NUM_ELEMENTS(ahc_chip_names); 71static const u_int num_chip_names = ARRAY_SIZE(ahc_chip_names);
72 72
73/* 73/*
74 * Hardware error codes. 74 * Hardware error codes.
@@ -88,7 +88,7 @@ static struct ahc_hard_error_entry ahc_hard_errors[] = {
88 { PCIERRSTAT, "PCI Error detected" }, 88 { PCIERRSTAT, "PCI Error detected" },
89 { CIOPARERR, "CIOBUS Parity Error" }, 89 { CIOPARERR, "CIOBUS Parity Error" },
90}; 90};
91static const u_int num_errors = NUM_ELEMENTS(ahc_hard_errors); 91static const u_int num_errors = ARRAY_SIZE(ahc_hard_errors);
92 92
93static struct ahc_phase_table_entry ahc_phase_table[] = 93static struct ahc_phase_table_entry ahc_phase_table[] =
94{ 94{
@@ -108,7 +108,7 @@ static struct ahc_phase_table_entry ahc_phase_table[] =
108 * In most cases we only wish to itterate over real phases, so 108 * In most cases we only wish to itterate over real phases, so
109 * exclude the last element from the count. 109 * exclude the last element from the count.
110 */ 110 */
111static const u_int num_phases = NUM_ELEMENTS(ahc_phase_table) - 1; 111static const u_int num_phases = ARRAY_SIZE(ahc_phase_table) - 1;
112 112
113/* 113/*
114 * Valid SCSIRATE values. (p. 3-17) 114 * Valid SCSIRATE values. (p. 3-17)
@@ -6367,7 +6367,7 @@ ahc_check_patch(struct ahc_softc *ahc, struct patch **start_patch,
6367 struct patch *last_patch; 6367 struct patch *last_patch;
6368 u_int num_patches; 6368 u_int num_patches;
6369 6369
6370 num_patches = sizeof(patches)/sizeof(struct patch); 6370 num_patches = ARRAY_SIZE(patches);
6371 last_patch = &patches[num_patches]; 6371 last_patch = &patches[num_patches];
6372 cur_patch = *start_patch; 6372 cur_patch = *start_patch;
6373 6373
@@ -6774,8 +6774,8 @@ ahc_find_tmode_devs(struct ahc_softc *ahc, struct cam_sim *sim, union ccb *ccb,
6774 } else { 6774 } else {
6775 u_int max_id; 6775 u_int max_id;
6776 6776
6777 max_id = (ahc->features & AHC_WIDE) ? 15 : 7; 6777 max_id = (ahc->features & AHC_WIDE) ? 16 : 8;
6778 if (ccb->ccb_h.target_id > max_id) 6778 if (ccb->ccb_h.target_id >= max_id)
6779 return (CAM_TID_INVALID); 6779 return (CAM_TID_INVALID);
6780 6780
6781 if (ccb->ccb_h.target_lun >= AHC_NUM_LUNS) 6781 if (ccb->ccb_h.target_lun >= AHC_NUM_LUNS)
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index 2c801672d8bb..debf3e2a0798 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -886,7 +886,7 @@ ahc_linux_setup_tag_info_global(char *p)
886 tags = simple_strtoul(p + 1, NULL, 0) & 0xff; 886 tags = simple_strtoul(p + 1, NULL, 0) & 0xff;
887 printf("Setting Global Tags= %d\n", tags); 887 printf("Setting Global Tags= %d\n", tags);
888 888
889 for (i = 0; i < NUM_ELEMENTS(aic7xxx_tag_info); i++) { 889 for (i = 0; i < ARRAY_SIZE(aic7xxx_tag_info); i++) {
890 for (j = 0; j < AHC_NUM_TARGETS; j++) { 890 for (j = 0; j < AHC_NUM_TARGETS; j++) {
891 aic7xxx_tag_info[i].tag_commands[j] = tags; 891 aic7xxx_tag_info[i].tag_commands[j] = tags;
892 } 892 }
@@ -898,7 +898,7 @@ ahc_linux_setup_tag_info(u_long arg, int instance, int targ, int32_t value)
898{ 898{
899 899
900 if ((instance >= 0) && (targ >= 0) 900 if ((instance >= 0) && (targ >= 0)
901 && (instance < NUM_ELEMENTS(aic7xxx_tag_info)) 901 && (instance < ARRAY_SIZE(aic7xxx_tag_info))
902 && (targ < AHC_NUM_TARGETS)) { 902 && (targ < AHC_NUM_TARGETS)) {
903 aic7xxx_tag_info[instance].tag_commands[targ] = value & 0xff; 903 aic7xxx_tag_info[instance].tag_commands[targ] = value & 0xff;
904 if (bootverbose) 904 if (bootverbose)
@@ -1020,7 +1020,7 @@ aic7xxx_setup(char *s)
1020 end = strchr(s, '\0'); 1020 end = strchr(s, '\0');
1021 1021
1022 /* 1022 /*
1023 * XXX ia64 gcc isn't smart enough to know that NUM_ELEMENTS 1023 * XXX ia64 gcc isn't smart enough to know that ARRAY_SIZE
1024 * will never be 0 in this case. 1024 * will never be 0 in this case.
1025 */ 1025 */
1026 n = 0; 1026 n = 0;
@@ -1028,13 +1028,13 @@ aic7xxx_setup(char *s)
1028 while ((p = strsep(&s, ",.")) != NULL) { 1028 while ((p = strsep(&s, ",.")) != NULL) {
1029 if (*p == '\0') 1029 if (*p == '\0')
1030 continue; 1030 continue;
1031 for (i = 0; i < NUM_ELEMENTS(options); i++) { 1031 for (i = 0; i < ARRAY_SIZE(options); i++) {
1032 1032
1033 n = strlen(options[i].name); 1033 n = strlen(options[i].name);
1034 if (strncmp(options[i].name, p, n) == 0) 1034 if (strncmp(options[i].name, p, n) == 0)
1035 break; 1035 break;
1036 } 1036 }
1037 if (i == NUM_ELEMENTS(options)) 1037 if (i == ARRAY_SIZE(options))
1038 continue; 1038 continue;
1039 1039
1040 if (strncmp(p, "global_tag_depth", n) == 0) { 1040 if (strncmp(p, "global_tag_depth", n) == 0) {
@@ -1360,7 +1360,7 @@ ahc_linux_user_tagdepth(struct ahc_softc *ahc, struct ahc_devinfo *devinfo)
1360 1360
1361 tags = 0; 1361 tags = 0;
1362 if ((ahc->user_discenable & devinfo->target_mask) != 0) { 1362 if ((ahc->user_discenable & devinfo->target_mask) != 0) {
1363 if (ahc->unit >= NUM_ELEMENTS(aic7xxx_tag_info)) { 1363 if (ahc->unit >= ARRAY_SIZE(aic7xxx_tag_info)) {
1364 if (warned_user == 0) { 1364 if (warned_user == 0) {
1365 1365
1366 printf(KERN_WARNING 1366 printf(KERN_WARNING
@@ -2537,6 +2537,22 @@ static void ahc_linux_set_iu(struct scsi_target *starget, int iu)
2537} 2537}
2538#endif 2538#endif
2539 2539
2540static void ahc_linux_get_signalling(struct Scsi_Host *shost)
2541{
2542 struct ahc_softc *ahc = *(struct ahc_softc **)shost->hostdata;
2543 u8 mode = ahc_inb(ahc, SBLKCTL);
2544
2545 if (mode & ENAB40)
2546 spi_signalling(shost) = SPI_SIGNAL_LVD;
2547 else if (mode & ENAB20)
2548 spi_signalling(shost) =
2549 ahc->features & AHC_HVD ?
2550 SPI_SIGNAL_HVD :
2551 SPI_SIGNAL_SE;
2552 else
2553 spi_signalling(shost) = SPI_SIGNAL_UNKNOWN;
2554}
2555
2540static struct spi_function_template ahc_linux_transport_functions = { 2556static struct spi_function_template ahc_linux_transport_functions = {
2541 .set_offset = ahc_linux_set_offset, 2557 .set_offset = ahc_linux_set_offset,
2542 .show_offset = 1, 2558 .show_offset = 1,
@@ -2552,6 +2568,7 @@ static struct spi_function_template ahc_linux_transport_functions = {
2552 .set_qas = ahc_linux_set_qas, 2568 .set_qas = ahc_linux_set_qas,
2553 .show_qas = 1, 2569 .show_qas = 1,
2554#endif 2570#endif
2571 .get_signalling = ahc_linux_get_signalling,
2555}; 2572};
2556 2573
2557 2574
diff --git a/drivers/scsi/aic7xxx/aic7xxx_pci.c b/drivers/scsi/aic7xxx/aic7xxx_pci.c
index 3adecef21783..63cab2d74552 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_pci.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_pci.c
@@ -144,16 +144,22 @@ static ahc_device_setup_t ahc_aic785X_setup;
144static ahc_device_setup_t ahc_aic7860_setup; 144static ahc_device_setup_t ahc_aic7860_setup;
145static ahc_device_setup_t ahc_apa1480_setup; 145static ahc_device_setup_t ahc_apa1480_setup;
146static ahc_device_setup_t ahc_aic7870_setup; 146static ahc_device_setup_t ahc_aic7870_setup;
147static ahc_device_setup_t ahc_aic7870h_setup;
147static ahc_device_setup_t ahc_aha394X_setup; 148static ahc_device_setup_t ahc_aha394X_setup;
149static ahc_device_setup_t ahc_aha394Xh_setup;
148static ahc_device_setup_t ahc_aha494X_setup; 150static ahc_device_setup_t ahc_aha494X_setup;
151static ahc_device_setup_t ahc_aha494Xh_setup;
149static ahc_device_setup_t ahc_aha398X_setup; 152static ahc_device_setup_t ahc_aha398X_setup;
150static ahc_device_setup_t ahc_aic7880_setup; 153static ahc_device_setup_t ahc_aic7880_setup;
154static ahc_device_setup_t ahc_aic7880h_setup;
151static ahc_device_setup_t ahc_aha2940Pro_setup; 155static ahc_device_setup_t ahc_aha2940Pro_setup;
152static ahc_device_setup_t ahc_aha394XU_setup; 156static ahc_device_setup_t ahc_aha394XU_setup;
157static ahc_device_setup_t ahc_aha394XUh_setup;
153static ahc_device_setup_t ahc_aha398XU_setup; 158static ahc_device_setup_t ahc_aha398XU_setup;
154static ahc_device_setup_t ahc_aic7890_setup; 159static ahc_device_setup_t ahc_aic7890_setup;
155static ahc_device_setup_t ahc_aic7892_setup; 160static ahc_device_setup_t ahc_aic7892_setup;
156static ahc_device_setup_t ahc_aic7895_setup; 161static ahc_device_setup_t ahc_aic7895_setup;
162static ahc_device_setup_t ahc_aic7895h_setup;
157static ahc_device_setup_t ahc_aic7896_setup; 163static ahc_device_setup_t ahc_aic7896_setup;
158static ahc_device_setup_t ahc_aic7899_setup; 164static ahc_device_setup_t ahc_aic7899_setup;
159static ahc_device_setup_t ahc_aha29160C_setup; 165static ahc_device_setup_t ahc_aha29160C_setup;
@@ -225,19 +231,19 @@ struct ahc_pci_identity ahc_pci_ident_table [] =
225 ID_AHA_2944, 231 ID_AHA_2944,
226 ID_ALL_MASK, 232 ID_ALL_MASK,
227 "Adaptec 2944 SCSI adapter", 233 "Adaptec 2944 SCSI adapter",
228 ahc_aic7870_setup 234 ahc_aic7870h_setup
229 }, 235 },
230 { 236 {
231 ID_AHA_3944, 237 ID_AHA_3944,
232 ID_ALL_MASK, 238 ID_ALL_MASK,
233 "Adaptec 3944 SCSI adapter", 239 "Adaptec 3944 SCSI adapter",
234 ahc_aha394X_setup 240 ahc_aha394Xh_setup
235 }, 241 },
236 { 242 {
237 ID_AHA_4944, 243 ID_AHA_4944,
238 ID_ALL_MASK, 244 ID_ALL_MASK,
239 "Adaptec 4944 SCSI adapter", 245 "Adaptec 4944 SCSI adapter",
240 ahc_aha494X_setup 246 ahc_aha494Xh_setup
241 }, 247 },
242 /* aic7880 based controllers */ 248 /* aic7880 based controllers */
243 { 249 {
@@ -256,13 +262,13 @@ struct ahc_pci_identity ahc_pci_ident_table [] =
256 ID_AHA_2944U & ID_DEV_VENDOR_MASK, 262 ID_AHA_2944U & ID_DEV_VENDOR_MASK,
257 ID_DEV_VENDOR_MASK, 263 ID_DEV_VENDOR_MASK,
258 "Adaptec 2944 Ultra SCSI adapter", 264 "Adaptec 2944 Ultra SCSI adapter",
259 ahc_aic7880_setup 265 ahc_aic7880h_setup
260 }, 266 },
261 { 267 {
262 ID_AHA_3944U & ID_DEV_VENDOR_MASK, 268 ID_AHA_3944U & ID_DEV_VENDOR_MASK,
263 ID_DEV_VENDOR_MASK, 269 ID_DEV_VENDOR_MASK,
264 "Adaptec 3944 Ultra SCSI adapter", 270 "Adaptec 3944 Ultra SCSI adapter",
265 ahc_aha394XU_setup 271 ahc_aha394XUh_setup
266 }, 272 },
267 { 273 {
268 ID_AHA_398XU & ID_DEV_VENDOR_MASK, 274 ID_AHA_398XU & ID_DEV_VENDOR_MASK,
@@ -278,7 +284,7 @@ struct ahc_pci_identity ahc_pci_ident_table [] =
278 ID_AHA_4944U & ID_DEV_VENDOR_MASK, 284 ID_AHA_4944U & ID_DEV_VENDOR_MASK,
279 ID_DEV_VENDOR_MASK, 285 ID_DEV_VENDOR_MASK,
280 "Adaptec 4944 Ultra SCSI adapter", 286 "Adaptec 4944 Ultra SCSI adapter",
281 ahc_aic7880_setup 287 ahc_aic7880h_setup
282 }, 288 },
283 { 289 {
284 ID_AHA_2930U & ID_DEV_VENDOR_MASK, 290 ID_AHA_2930U & ID_DEV_VENDOR_MASK,
@@ -414,7 +420,7 @@ struct ahc_pci_identity ahc_pci_ident_table [] =
414 ID_AHA_3944AU, 420 ID_AHA_3944AU,
415 ID_ALL_MASK, 421 ID_ALL_MASK,
416 "Adaptec 3944A Ultra SCSI adapter", 422 "Adaptec 3944A Ultra SCSI adapter",
417 ahc_aic7895_setup 423 ahc_aic7895h_setup
418 }, 424 },
419 { 425 {
420 ID_AIC7895_ARO, 426 ID_AIC7895_ARO,
@@ -553,7 +559,7 @@ struct ahc_pci_identity ahc_pci_ident_table [] =
553 } 559 }
554}; 560};
555 561
556const u_int ahc_num_pci_devs = NUM_ELEMENTS(ahc_pci_ident_table); 562const u_int ahc_num_pci_devs = ARRAY_SIZE(ahc_pci_ident_table);
557 563
558#define AHC_394X_SLOT_CHANNEL_A 4 564#define AHC_394X_SLOT_CHANNEL_A 4
559#define AHC_394X_SLOT_CHANNEL_B 5 565#define AHC_394X_SLOT_CHANNEL_B 5
@@ -2121,6 +2127,16 @@ ahc_aic7870_setup(struct ahc_softc *ahc)
2121} 2127}
2122 2128
2123static int 2129static int
2130ahc_aic7870h_setup(struct ahc_softc *ahc)
2131{
2132 int error = ahc_aic7870_setup(ahc);
2133
2134 ahc->features |= AHC_HVD;
2135
2136 return error;
2137}
2138
2139static int
2124ahc_aha394X_setup(struct ahc_softc *ahc) 2140ahc_aha394X_setup(struct ahc_softc *ahc)
2125{ 2141{
2126 int error; 2142 int error;
@@ -2132,6 +2148,16 @@ ahc_aha394X_setup(struct ahc_softc *ahc)
2132} 2148}
2133 2149
2134static int 2150static int
2151ahc_aha394Xh_setup(struct ahc_softc *ahc)
2152{
2153 int error = ahc_aha394X_setup(ahc);
2154
2155 ahc->features |= AHC_HVD;
2156
2157 return error;
2158}
2159
2160static int
2135ahc_aha398X_setup(struct ahc_softc *ahc) 2161ahc_aha398X_setup(struct ahc_softc *ahc)
2136{ 2162{
2137 int error; 2163 int error;
@@ -2154,6 +2180,16 @@ ahc_aha494X_setup(struct ahc_softc *ahc)
2154} 2180}
2155 2181
2156static int 2182static int
2183ahc_aha494Xh_setup(struct ahc_softc *ahc)
2184{
2185 int error = ahc_aha494X_setup(ahc);
2186
2187 ahc->features |= AHC_HVD;
2188
2189 return error;
2190}
2191
2192static int
2157ahc_aic7880_setup(struct ahc_softc *ahc) 2193ahc_aic7880_setup(struct ahc_softc *ahc)
2158{ 2194{
2159 ahc_dev_softc_t pci; 2195 ahc_dev_softc_t pci;
@@ -2175,6 +2211,17 @@ ahc_aic7880_setup(struct ahc_softc *ahc)
2175} 2211}
2176 2212
2177static int 2213static int
2214ahc_aic7880h_setup(struct ahc_softc *ahc)
2215{
2216 int error = ahc_aic7880_setup(ahc);
2217
2218 ahc->features |= AHC_HVD;
2219
2220 return error;
2221}
2222
2223
2224static int
2178ahc_aha2940Pro_setup(struct ahc_softc *ahc) 2225ahc_aha2940Pro_setup(struct ahc_softc *ahc)
2179{ 2226{
2180 2227
@@ -2194,6 +2241,16 @@ ahc_aha394XU_setup(struct ahc_softc *ahc)
2194} 2241}
2195 2242
2196static int 2243static int
2244ahc_aha394XUh_setup(struct ahc_softc *ahc)
2245{
2246 int error = ahc_aha394XU_setup(ahc);
2247
2248 ahc->features |= AHC_HVD;
2249
2250 return error;
2251}
2252
2253static int
2197ahc_aha398XU_setup(struct ahc_softc *ahc) 2254ahc_aha398XU_setup(struct ahc_softc *ahc)
2198{ 2255{
2199 int error; 2256 int error;
@@ -2292,6 +2349,16 @@ ahc_aic7895_setup(struct ahc_softc *ahc)
2292} 2349}
2293 2350
2294static int 2351static int
2352ahc_aic7895h_setup(struct ahc_softc *ahc)
2353{
2354 int error = ahc_aic7895_setup(ahc);
2355
2356 ahc->features |= AHC_HVD;
2357
2358 return error;
2359}
2360
2361static int
2295ahc_aic7896_setup(struct ahc_softc *ahc) 2362ahc_aic7896_setup(struct ahc_softc *ahc)
2296{ 2363{
2297 ahc_dev_softc_t pci; 2364 ahc_dev_softc_t pci;
diff --git a/drivers/scsi/aic7xxx/aic7xxx_proc.c b/drivers/scsi/aic7xxx/aic7xxx_proc.c
index 04a3506cf340..5914b4aa4a8f 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_proc.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_proc.c
@@ -77,11 +77,9 @@ static u_int
77ahc_calc_syncsrate(u_int period_factor) 77ahc_calc_syncsrate(u_int period_factor)
78{ 78{
79 int i; 79 int i;
80 int num_syncrates;
81 80
82 num_syncrates = sizeof(scsi_syncrates) / sizeof(scsi_syncrates[0]);
83 /* See if the period is in the "exception" table */ 81 /* See if the period is in the "exception" table */
84 for (i = 0; i < num_syncrates; i++) { 82 for (i = 0; i < ARRAY_SIZE(scsi_syncrates); i++) {
85 83
86 if (period_factor == scsi_syncrates[i].period_factor) { 84 if (period_factor == scsi_syncrates[i].period_factor) {
87 /* Period in kHz */ 85 /* Period in kHz */