aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_init.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_init.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c49
1 files changed, 23 insertions, 26 deletions
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 27b7f9259f28..226bec05d4d1 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -195,6 +195,7 @@ qla2100_pci_config(scsi_qla_host_t *ha)
195{ 195{
196 uint16_t w, mwi; 196 uint16_t w, mwi;
197 unsigned long flags; 197 unsigned long flags;
198 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
198 199
199 qla_printk(KERN_INFO, ha, "Configuring PCI space...\n"); 200 qla_printk(KERN_INFO, ha, "Configuring PCI space...\n");
200 201
@@ -215,7 +216,7 @@ qla2100_pci_config(scsi_qla_host_t *ha)
215 216
216 /* Get PCI bus information. */ 217 /* Get PCI bus information. */
217 spin_lock_irqsave(&ha->hardware_lock, flags); 218 spin_lock_irqsave(&ha->hardware_lock, flags);
218 ha->pci_attr = RD_REG_WORD(&ha->iobase->ctrl_status); 219 ha->pci_attr = RD_REG_WORD(&reg->ctrl_status);
219 spin_unlock_irqrestore(&ha->hardware_lock, flags); 220 spin_unlock_irqrestore(&ha->hardware_lock, flags);
220 221
221 return QLA_SUCCESS; 222 return QLA_SUCCESS;
@@ -233,6 +234,7 @@ qla2300_pci_config(scsi_qla_host_t *ha)
233 uint16_t w, mwi; 234 uint16_t w, mwi;
234 unsigned long flags = 0; 235 unsigned long flags = 0;
235 uint32_t cnt; 236 uint32_t cnt;
237 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
236 238
237 qla_printk(KERN_INFO, ha, "Configuring PCI space...\n"); 239 qla_printk(KERN_INFO, ha, "Configuring PCI space...\n");
238 240
@@ -259,34 +261,32 @@ qla2300_pci_config(scsi_qla_host_t *ha)
259 spin_lock_irqsave(&ha->hardware_lock, flags); 261 spin_lock_irqsave(&ha->hardware_lock, flags);
260 262
261 /* Pause RISC. */ 263 /* Pause RISC. */
262 WRT_REG_WORD(&ha->iobase->hccr, HCCR_PAUSE_RISC); 264 WRT_REG_WORD(&reg->hccr, HCCR_PAUSE_RISC);
263 for (cnt = 0; cnt < 30000; cnt++) { 265 for (cnt = 0; cnt < 30000; cnt++) {
264 if ((RD_REG_WORD(&ha->iobase->hccr) & 266 if ((RD_REG_WORD(&reg->hccr) & HCCR_RISC_PAUSE) != 0)
265 HCCR_RISC_PAUSE) != 0)
266 break; 267 break;
267 268
268 udelay(10); 269 udelay(10);
269 } 270 }
270 271
271 /* Select FPM registers. */ 272 /* Select FPM registers. */
272 WRT_REG_WORD(&ha->iobase->ctrl_status, 0x20); 273 WRT_REG_WORD(&reg->ctrl_status, 0x20);
273 RD_REG_WORD(&ha->iobase->ctrl_status); 274 RD_REG_WORD(&reg->ctrl_status);
274 275
275 /* Get the fb rev level */ 276 /* Get the fb rev level */
276 ha->fb_rev = RD_FB_CMD_REG(ha, ha->iobase); 277 ha->fb_rev = RD_FB_CMD_REG(ha, reg);
277 278
278 if (ha->fb_rev == FPM_2300) 279 if (ha->fb_rev == FPM_2300)
279 w &= ~PCI_COMMAND_INVALIDATE; 280 w &= ~PCI_COMMAND_INVALIDATE;
280 281
281 /* Deselect FPM registers. */ 282 /* Deselect FPM registers. */
282 WRT_REG_WORD(&ha->iobase->ctrl_status, 0x0); 283 WRT_REG_WORD(&reg->ctrl_status, 0x0);
283 RD_REG_WORD(&ha->iobase->ctrl_status); 284 RD_REG_WORD(&reg->ctrl_status);
284 285
285 /* Release RISC module. */ 286 /* Release RISC module. */
286 WRT_REG_WORD(&ha->iobase->hccr, HCCR_RELEASE_RISC); 287 WRT_REG_WORD(&reg->hccr, HCCR_RELEASE_RISC);
287 for (cnt = 0; cnt < 30000; cnt++) { 288 for (cnt = 0; cnt < 30000; cnt++) {
288 if ((RD_REG_WORD(&ha->iobase->hccr) & 289 if ((RD_REG_WORD(&reg->hccr) & HCCR_RISC_PAUSE) == 0)
289 HCCR_RISC_PAUSE) == 0)
290 break; 290 break;
291 291
292 udelay(10); 292 udelay(10);
@@ -305,7 +305,7 @@ qla2300_pci_config(scsi_qla_host_t *ha)
305 305
306 /* Get PCI bus information. */ 306 /* Get PCI bus information. */
307 spin_lock_irqsave(&ha->hardware_lock, flags); 307 spin_lock_irqsave(&ha->hardware_lock, flags);
308 ha->pci_attr = RD_REG_WORD(&ha->iobase->ctrl_status); 308 ha->pci_attr = RD_REG_WORD(&reg->ctrl_status);
309 spin_unlock_irqrestore(&ha->hardware_lock, flags); 309 spin_unlock_irqrestore(&ha->hardware_lock, flags);
310 310
311 return QLA_SUCCESS; 311 return QLA_SUCCESS;
@@ -352,7 +352,7 @@ void
352qla2x00_reset_chip(scsi_qla_host_t *ha) 352qla2x00_reset_chip(scsi_qla_host_t *ha)
353{ 353{
354 unsigned long flags = 0; 354 unsigned long flags = 0;
355 device_reg_t __iomem *reg = ha->iobase; 355 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
356 uint32_t cnt; 356 uint32_t cnt;
357 unsigned long mbx_flags = 0; 357 unsigned long mbx_flags = 0;
358 uint16_t cmd; 358 uint16_t cmd;
@@ -505,7 +505,7 @@ int
505qla2x00_chip_diag(scsi_qla_host_t *ha) 505qla2x00_chip_diag(scsi_qla_host_t *ha)
506{ 506{
507 int rval; 507 int rval;
508 device_reg_t __iomem *reg = ha->iobase; 508 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
509 unsigned long flags = 0; 509 unsigned long flags = 0;
510 uint16_t data; 510 uint16_t data;
511 uint32_t cnt; 511 uint32_t cnt;
@@ -889,7 +889,7 @@ qla2x00_update_fw_options(scsi_qla_host_t *ha)
889void 889void
890qla2x00_config_rings(struct scsi_qla_host *ha) 890qla2x00_config_rings(struct scsi_qla_host *ha)
891{ 891{
892 device_reg_t __iomem *reg = ha->iobase; 892 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
893 893
894 /* Setup ring parameters in initialization control block. */ 894 /* Setup ring parameters in initialization control block. */
895 ha->init_cb->request_q_outpointer = __constant_cpu_to_le16(0); 895 ha->init_cb->request_q_outpointer = __constant_cpu_to_le16(0);
@@ -1196,7 +1196,7 @@ qla2x00_nvram_config(scsi_qla_host_t *ha)
1196 init_cb_t *icb = ha->init_cb; 1196 init_cb_t *icb = ha->init_cb;
1197 nvram_t *nv = (nvram_t *)ha->request_ring; 1197 nvram_t *nv = (nvram_t *)ha->request_ring;
1198 uint16_t *wptr = (uint16_t *)ha->request_ring; 1198 uint16_t *wptr = (uint16_t *)ha->request_ring;
1199 device_reg_t __iomem *reg = ha->iobase; 1199 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
1200 uint8_t timer_mode; 1200 uint8_t timer_mode;
1201 1201
1202 rval = QLA_SUCCESS; 1202 rval = QLA_SUCCESS;
@@ -1389,8 +1389,6 @@ qla2x00_nvram_config(scsi_qla_host_t *ha)
1389 /* 1389 /*
1390 * Set host adapter parameters. 1390 * Set host adapter parameters.
1391 */ 1391 */
1392 ha->nvram_version = nv->nvram_version;
1393
1394 ha->flags.disable_risc_code_load = ((nv->host_p[0] & BIT_4) ? 1 : 0); 1392 ha->flags.disable_risc_code_load = ((nv->host_p[0] & BIT_4) ? 1 : 0);
1395 /* Always load RISC code on non ISP2[12]00 chips. */ 1393 /* Always load RISC code on non ISP2[12]00 chips. */
1396 if (!IS_QLA2100(ha) && !IS_QLA2200(ha)) 1394 if (!IS_QLA2100(ha) && !IS_QLA2200(ha))
@@ -1410,7 +1408,8 @@ qla2x00_nvram_config(scsi_qla_host_t *ha)
1410 ha->serial0 = icb->port_name[5]; 1408 ha->serial0 = icb->port_name[5];
1411 ha->serial1 = icb->port_name[6]; 1409 ha->serial1 = icb->port_name[6];
1412 ha->serial2 = icb->port_name[7]; 1410 ha->serial2 = icb->port_name[7];
1413 memcpy(ha->node_name, icb->node_name, WWN_SIZE); 1411 ha->node_name = icb->node_name;
1412 ha->port_name = icb->port_name;
1414 1413
1415 icb->execution_throttle = __constant_cpu_to_le16(0xFFFF); 1414 icb->execution_throttle = __constant_cpu_to_le16(0xFFFF);
1416 1415
@@ -2158,7 +2157,7 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *ha, struct list_head *new_fcports)
2158 loop_id = ha->min_external_loopid; 2157 loop_id = ha->min_external_loopid;
2159 2158
2160 for (; loop_id <= ha->last_loop_id; loop_id++) { 2159 for (; loop_id <= ha->last_loop_id; loop_id++) {
2161 if (RESERVED_LOOP_ID(loop_id)) 2160 if (qla2x00_is_reserved_id(ha, loop_id))
2162 continue; 2161 continue;
2163 2162
2164 if (atomic_read(&ha->loop_down_timer) || 2163 if (atomic_read(&ha->loop_down_timer) ||
@@ -2328,7 +2327,7 @@ qla2x00_find_new_loop_id(scsi_qla_host_t *ha, fc_port_t *dev)
2328 } 2327 }
2329 2328
2330 /* Skip reserved loop IDs. */ 2329 /* Skip reserved loop IDs. */
2331 while (RESERVED_LOOP_ID(dev->loop_id)) { 2330 while (qla2x00_is_reserved_id(ha, dev->loop_id)) {
2332 dev->loop_id++; 2331 dev->loop_id++;
2333 } 2332 }
2334 2333
@@ -2888,7 +2887,7 @@ static int
2888qla2x00_restart_isp(scsi_qla_host_t *ha) 2887qla2x00_restart_isp(scsi_qla_host_t *ha)
2889{ 2888{
2890 uint8_t status = 0; 2889 uint8_t status = 0;
2891 device_reg_t __iomem *reg = ha->iobase; 2890 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
2892 unsigned long flags = 0; 2891 unsigned long flags = 0;
2893 uint32_t wait_time; 2892 uint32_t wait_time;
2894 2893
@@ -2901,8 +2900,6 @@ qla2x00_restart_isp(scsi_qla_host_t *ha)
2901 goto done; 2900 goto done;
2902 } 2901 }
2903 2902
2904 reg = ha->iobase;
2905
2906 spin_lock_irqsave(&ha->hardware_lock, flags); 2903 spin_lock_irqsave(&ha->hardware_lock, flags);
2907 2904
2908 /* Disable SRAM, Instruction RAM and GP RAM parity. */ 2905 /* Disable SRAM, Instruction RAM and GP RAM parity. */
@@ -2973,7 +2970,7 @@ void
2973qla2x00_reset_adapter(scsi_qla_host_t *ha) 2970qla2x00_reset_adapter(scsi_qla_host_t *ha)
2974{ 2971{
2975 unsigned long flags = 0; 2972 unsigned long flags = 0;
2976 device_reg_t __iomem *reg = ha->iobase; 2973 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
2977 2974
2978 ha->flags.online = 0; 2975 ha->flags.online = 0;
2979 ha->isp_ops.disable_intrs(ha); 2976 ha->isp_ops.disable_intrs(ha);