aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx
diff options
context:
space:
mode:
authorandrew.vasquez@qlogic.com <andrew.vasquez@qlogic.com>2006-03-09 17:27:08 -0500
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-03-12 10:37:24 -0500
commitea5b6382fde00e0dbcd0de2e4aa2fd15705e5fc3 (patch)
tree0ab005b73710821d916773c5d40eb3cfe69d84b1 /drivers/scsi/qla2xxx
parent93f56089898a1b27fc0c89b5c1c748291353f679 (diff)
[SCSI] qla2xxx: Convert IS_QLA*() defines to bit-operations.
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/qla2xxx')
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h115
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c1
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c49
-rw-r--r--drivers/scsi/qla2xxx/qla_sup.c5
4 files changed, 89 insertions, 81 deletions
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 2e16f3285d5f..00b7e82b99b3 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -31,82 +31,6 @@
31#include <scsi/scsi_cmnd.h> 31#include <scsi/scsi_cmnd.h>
32#include <scsi/scsi_transport_fc.h> 32#include <scsi/scsi_transport_fc.h>
33 33
34#if defined(CONFIG_SCSI_QLA2XXX_EMBEDDED_FIRMWARE)
35#if defined(CONFIG_SCSI_QLA21XX) || defined(CONFIG_SCSI_QLA21XX_MODULE)
36#define IS_QLA2100(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2100)
37#else
38#define IS_QLA2100(ha) 0
39#endif
40
41#if defined(CONFIG_SCSI_QLA22XX) || defined(CONFIG_SCSI_QLA22XX_MODULE)
42#define IS_QLA2200(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2200)
43#else
44#define IS_QLA2200(ha) 0
45#endif
46
47#if defined(CONFIG_SCSI_QLA2300) || defined(CONFIG_SCSI_QLA2300_MODULE)
48#define IS_QLA2300(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2300)
49#define IS_QLA2312(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2312)
50#else
51#define IS_QLA2300(ha) 0
52#define IS_QLA2312(ha) 0
53#endif
54
55#if defined(CONFIG_SCSI_QLA2322) || defined(CONFIG_SCSI_QLA2322_MODULE)
56#define IS_QLA2322(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2322)
57#else
58#define IS_QLA2322(ha) 0
59#endif
60
61#if defined(CONFIG_SCSI_QLA6312) || defined(CONFIG_SCSI_QLA6312_MODULE)
62#define IS_QLA6312(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP6312)
63#define IS_QLA6322(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP6322)
64#else
65#define IS_QLA6312(ha) 0
66#define IS_QLA6322(ha) 0
67#endif
68
69#if defined(CONFIG_SCSI_QLA24XX) || defined(CONFIG_SCSI_QLA24XX_MODULE)
70#define IS_QLA2422(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2422)
71#define IS_QLA2432(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2432)
72#else
73#define IS_QLA2422(ha) 0
74#define IS_QLA2432(ha) 0
75#endif
76
77#if defined(CONFIG_SCSI_QLA25XX) || defined(CONFIG_SCSI_QLA25XX_MODULE)
78#define IS_QLA2512(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2512)
79#define IS_QLA2522(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2522)
80#else
81#define IS_QLA2512(ha) 0
82#define IS_QLA2522(ha) 0
83#endif
84
85#else /* !defined(CONFIG_SCSI_QLA2XXX_EMBEDDED_FIRMWARE) */
86
87#define IS_QLA2100(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2100)
88#define IS_QLA2200(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2200)
89#define IS_QLA2300(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2300)
90#define IS_QLA2312(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2312)
91#define IS_QLA2322(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2322)
92#define IS_QLA6312(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP6312)
93#define IS_QLA6322(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP6322)
94#define IS_QLA2422(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2422)
95#define IS_QLA2432(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2432)
96#define IS_QLA2512(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2512)
97#define IS_QLA2522(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2522)
98#endif
99
100#define IS_QLA23XX(ha) (IS_QLA2300(ha) || IS_QLA2312(ha) || IS_QLA2322(ha) || \
101 IS_QLA6312(ha) || IS_QLA6322(ha))
102#define IS_QLA24XX(ha) (IS_QLA2422(ha) || IS_QLA2432(ha))
103#define IS_QLA25XX(ha) (IS_QLA2512(ha) || IS_QLA2522(ha))
104
105/*
106 * Only non-ISP2[12]00 have extended addressing support in the firmware.
107 */
108#define HAS_EXTENDED_IDS(ha) (!IS_QLA2100(ha) && !IS_QLA2200(ha))
109
110/* 34/*
111 * We have MAILBOX_REGISTER_COUNT sized arrays in a few places, 35 * We have MAILBOX_REGISTER_COUNT sized arrays in a few places,
112 * but that's fine as we don't look at the last 24 ones for 36 * but that's fine as we don't look at the last 24 ones for
@@ -2300,6 +2224,45 @@ typedef struct scsi_qla_host {
2300#define SWITCH_FOUND BIT_3 2224#define SWITCH_FOUND BIT_3
2301#define DFLG_NO_CABLE BIT_4 2225#define DFLG_NO_CABLE BIT_4
2302 2226
2227 uint32_t device_type;
2228#define DT_ISP2100 BIT_0
2229#define DT_ISP2200 BIT_1
2230#define DT_ISP2300 BIT_2
2231#define DT_ISP2312 BIT_3
2232#define DT_ISP2322 BIT_4
2233#define DT_ISP6312 BIT_5
2234#define DT_ISP6322 BIT_6
2235#define DT_ISP2422 BIT_7
2236#define DT_ISP2432 BIT_8
2237#define DT_ISP2512 BIT_9
2238#define DT_ISP2522 BIT_10
2239#define DT_ISP_LAST (DT_ISP2522 << 1)
2240
2241#define DT_OEM_001 BIT_29
2242#define DT_ISP2200A BIT_30
2243#define DT_EXTENDED_IDS BIT_31
2244
2245#define DT_MASK(ha) ((ha)->device_type & (DT_ISP_LAST - 1))
2246#define IS_QLA2100(ha) (DT_MASK(ha) & DT_ISP2100)
2247#define IS_QLA2200(ha) (DT_MASK(ha) & DT_ISP2200)
2248#define IS_QLA2300(ha) (DT_MASK(ha) & DT_ISP2300)
2249#define IS_QLA2312(ha) (DT_MASK(ha) & DT_ISP2312)
2250#define IS_QLA2322(ha) (DT_MASK(ha) & DT_ISP2322)
2251#define IS_QLA6312(ha) (DT_MASK(ha) & DT_ISP6312)
2252#define IS_QLA6322(ha) (DT_MASK(ha) & DT_ISP6322)
2253#define IS_QLA2422(ha) (DT_MASK(ha) & DT_ISP2422)
2254#define IS_QLA2432(ha) (DT_MASK(ha) & DT_ISP2432)
2255#define IS_QLA2512(ha) (DT_MASK(ha) & DT_ISP2512)
2256#define IS_QLA2522(ha) (DT_MASK(ha) & DT_ISP2522)
2257
2258#define IS_QLA23XX(ha) (IS_QLA2300(ha) || IS_QLA2312(ha) || IS_QLA2322(ha) || \
2259 IS_QLA6312(ha) || IS_QLA6322(ha))
2260#define IS_QLA24XX(ha) (IS_QLA2422(ha) || IS_QLA2432(ha))
2261#define IS_QLA25XX(ha) (IS_QLA2512(ha) || IS_QLA2522(ha))
2262
2263#define IS_OEM_001(ha) ((ha)->device_type & DT_OEM_001)
2264#define HAS_EXTENDED_IDS(ha) ((ha)->device_type & DT_EXTENDED_IDS)
2265
2303 /* SRB cache. */ 2266 /* SRB cache. */
2304#define SRB_MIN_REQ 128 2267#define SRB_MIN_REQ 128
2305 mempool_t *srb_mempool; 2268 mempool_t *srb_mempool;
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 634ee174bff2..f49eb06d0dbd 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -727,6 +727,7 @@ qla2x00_chip_diag(scsi_qla_host_t *ha)
727 DEBUG3(printk("scsi(%ld): Found QLA2200A chip.\n", 727 DEBUG3(printk("scsi(%ld): Found QLA2200A chip.\n",
728 ha->host_no)); 728 ha->host_no));
729 729
730 ha->device_type |= DT_ISP2200A;
730 ha->fw_transfer_size = 128; 731 ha->fw_transfer_size = 128;
731 } 732 }
732 733
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 43ca0d8ca384..757c4c43c453 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1146,6 +1146,52 @@ qla2x00_config_dma_addressing(scsi_qla_host_t *ha)
1146 pci_set_consistent_dma_mask(ha->pdev, DMA_32BIT_MASK); 1146 pci_set_consistent_dma_mask(ha->pdev, DMA_32BIT_MASK);
1147} 1147}
1148 1148
1149static inline void
1150qla2x00_set_isp_flags(scsi_qla_host_t *ha)
1151{
1152 ha->device_type = DT_EXTENDED_IDS;
1153 switch (ha->pdev->device) {
1154 case PCI_DEVICE_ID_QLOGIC_ISP2100:
1155 ha->device_type |= DT_ISP2100;
1156 ha->device_type &= ~DT_EXTENDED_IDS;
1157 break;
1158 case PCI_DEVICE_ID_QLOGIC_ISP2200:
1159 ha->device_type |= DT_ISP2200;
1160 ha->device_type &= ~DT_EXTENDED_IDS;
1161 break;
1162 case PCI_DEVICE_ID_QLOGIC_ISP2300:
1163 ha->device_type |= DT_ISP2300;
1164 break;
1165 case PCI_DEVICE_ID_QLOGIC_ISP2312:
1166 ha->device_type |= DT_ISP2312;
1167 break;
1168 case PCI_DEVICE_ID_QLOGIC_ISP2322:
1169 ha->device_type |= DT_ISP2322;
1170 if (ha->pdev->subsystem_vendor == 0x1028 &&
1171 ha->pdev->subsystem_device == 0x0170)
1172 ha->device_type |= DT_OEM_001;
1173 break;
1174 case PCI_DEVICE_ID_QLOGIC_ISP6312:
1175 ha->device_type |= DT_ISP6312;
1176 break;
1177 case PCI_DEVICE_ID_QLOGIC_ISP6322:
1178 ha->device_type |= DT_ISP6322;
1179 break;
1180 case PCI_DEVICE_ID_QLOGIC_ISP2422:
1181 ha->device_type |= DT_ISP2422;
1182 break;
1183 case PCI_DEVICE_ID_QLOGIC_ISP2432:
1184 ha->device_type |= DT_ISP2432;
1185 break;
1186 case PCI_DEVICE_ID_QLOGIC_ISP2512:
1187 ha->device_type |= DT_ISP2512;
1188 break;
1189 case PCI_DEVICE_ID_QLOGIC_ISP2522:
1190 ha->device_type |= DT_ISP2522;
1191 break;
1192 }
1193}
1194
1149static int 1195static int
1150qla2x00_iospace_config(scsi_qla_host_t *ha) 1196qla2x00_iospace_config(scsi_qla_host_t *ha)
1151{ 1197{
@@ -1307,6 +1353,9 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info)
1307 ha->brd_info = brd_info; 1353 ha->brd_info = brd_info;
1308 sprintf(ha->host_str, "%s_%ld", ha->brd_info->drv_name, ha->host_no); 1354 sprintf(ha->host_str, "%s_%ld", ha->brd_info->drv_name, ha->host_no);
1309 1355
1356 /* Set ISP-type information. */
1357 qla2x00_set_isp_flags(ha);
1358
1310 /* Configure PCI I/O space */ 1359 /* Configure PCI I/O space */
1311 ret = qla2x00_iospace_config(ha); 1360 ret = qla2x00_iospace_config(ha);
1312 if (ret) 1361 if (ret)
diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c
index 8d68c463cd5b..8b0121dceb01 100644
--- a/drivers/scsi/qla2xxx/qla_sup.c
+++ b/drivers/scsi/qla2xxx/qla_sup.c
@@ -1191,11 +1191,6 @@ qla2x00_poll_flash(scsi_qla_host_t *ha, uint32_t addr, uint8_t poll_data,
1191 return status; 1191 return status;
1192} 1192}
1193 1193
1194#define IS_OEM_001(ha) \
1195 ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2322 && \
1196 (ha)->pdev->subsystem_vendor == 0x1028 && \
1197 (ha)->pdev->subsystem_device == 0x0170)
1198
1199/** 1194/**
1200 * qla2x00_program_flash_address() - Programs a flash address 1195 * qla2x00_program_flash_address() - Programs a flash address
1201 * @ha: HA context 1196 * @ha: HA context