diff options
author | Matthew Wilcox <matthew@wil.cx> | 2007-10-02 21:55:35 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.localdomain> | 2007-10-12 14:53:41 -0400 |
commit | 9d0e96eba19e9973a1c21ddd1fdbc049b231bf3b (patch) | |
tree | 7c1ffef10e00bb358d4cd83c6e55137e0db9caae /drivers/scsi | |
parent | f092d2290f905b6e9928df6905f2fc9d18b6ae19 (diff) |
[SCSI] advansys: Get rid of board index number
It's always a mistake to have your own index of boards; just use the
scsi host number.
Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/advansys.c | 236 |
1 files changed, 100 insertions, 136 deletions
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index a4091ab8d363..93bf3ec514b8 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c | |||
@@ -66,8 +66,7 @@ | |||
66 | * 5. check DMA mapping functions for failure | 66 | * 5. check DMA mapping functions for failure |
67 | * 6. Use scsi_transport_spi | 67 | * 6. Use scsi_transport_spi |
68 | * 7. advansys_info is not safe against multiple simultaneous callers | 68 | * 7. advansys_info is not safe against multiple simultaneous callers |
69 | * 8. Kill boardp->id | 69 | * 8. Add module_param to override ISA/VLB ioport array |
70 | * 9. Add module_param to override ISA/VLB ioport array | ||
71 | */ | 70 | */ |
72 | #warning this driver is still not properly converted to the DMA API | 71 | #warning this driver is still not properly converted to the DMA API |
73 | 72 | ||
@@ -2416,7 +2415,6 @@ typedef struct adv_req { | |||
2416 | */ | 2415 | */ |
2417 | struct asc_board { | 2416 | struct asc_board { |
2418 | struct device *dev; | 2417 | struct device *dev; |
2419 | int id; /* Board Id */ | ||
2420 | uint flags; /* Board flags */ | 2418 | uint flags; /* Board flags */ |
2421 | unsigned int irq; | 2419 | unsigned int irq; |
2422 | union { | 2420 | union { |
@@ -2467,9 +2465,6 @@ struct asc_board { | |||
2467 | dvc_var.adv_dvc_var) | 2465 | dvc_var.adv_dvc_var) |
2468 | #define adv_dvc_to_pdev(adv_dvc) to_pci_dev(adv_dvc_to_board(adv_dvc)->dev) | 2466 | #define adv_dvc_to_pdev(adv_dvc) to_pci_dev(adv_dvc_to_board(adv_dvc)->dev) |
2469 | 2467 | ||
2470 | /* Number of boards detected in system. */ | ||
2471 | static int asc_board_count; | ||
2472 | |||
2473 | /* Overrun buffer used by all narrow boards. */ | 2468 | /* Overrun buffer used by all narrow boards. */ |
2474 | static uchar overrun_buf[ASC_OVERRUN_BSIZE] = { 0 }; | 2469 | static uchar overrun_buf[ASC_OVERRUN_BSIZE] = { 0 }; |
2475 | 2470 | ||
@@ -2848,9 +2843,8 @@ static const char *advansys_info(struct Scsi_Host *shost) | |||
2848 | } | 2843 | } |
2849 | } else { | 2844 | } else { |
2850 | busname = "?"; | 2845 | busname = "?"; |
2851 | ASC_PRINT2("advansys_info: board %d: unknown " | 2846 | shost_printk(KERN_ERR, shost, "unknown bus " |
2852 | "bus type %d\n", boardp->id, | 2847 | "type %d\n", asc_dvc_varp->bus_type); |
2853 | asc_dvc_varp->bus_type); | ||
2854 | } | 2848 | } |
2855 | sprintf(info, | 2849 | sprintf(info, |
2856 | "AdvanSys SCSI %s: %s: IO 0x%lX-0x%lX, IRQ 0x%X", | 2850 | "AdvanSys SCSI %s: %s: IO 0x%lX-0x%lX, IRQ 0x%X", |
@@ -4382,7 +4376,6 @@ static void AscSetBank(PortAddr iop_base, uchar bank) | |||
4382 | val &= ~CC_BANK_ONE; | 4376 | val &= ~CC_BANK_ONE; |
4383 | } | 4377 | } |
4384 | AscSetChipControl(iop_base, val); | 4378 | AscSetChipControl(iop_base, val); |
4385 | return; | ||
4386 | } | 4379 | } |
4387 | 4380 | ||
4388 | static void AscSetChipIH(PortAddr iop_base, ushort ins_code) | 4381 | static void AscSetChipIH(PortAddr iop_base, ushort ins_code) |
@@ -4390,7 +4383,6 @@ static void AscSetChipIH(PortAddr iop_base, ushort ins_code) | |||
4390 | AscSetBank(iop_base, 1); | 4383 | AscSetBank(iop_base, 1); |
4391 | AscWriteChipIH(iop_base, ins_code); | 4384 | AscWriteChipIH(iop_base, ins_code); |
4392 | AscSetBank(iop_base, 0); | 4385 | AscSetBank(iop_base, 0); |
4393 | return; | ||
4394 | } | 4386 | } |
4395 | 4387 | ||
4396 | static int AscStartChip(PortAddr iop_base) | 4388 | static int AscStartChip(PortAddr iop_base) |
@@ -4475,7 +4467,6 @@ static void AscEnableInterrupt(PortAddr iop_base) | |||
4475 | 4467 | ||
4476 | cfg = AscGetChipCfgLsw(iop_base); | 4468 | cfg = AscGetChipCfgLsw(iop_base); |
4477 | AscSetChipCfgLsw(iop_base, cfg | ASC_CFG0_HOST_INT_ON); | 4469 | AscSetChipCfgLsw(iop_base, cfg | ASC_CFG0_HOST_INT_ON); |
4478 | return; | ||
4479 | } | 4470 | } |
4480 | 4471 | ||
4481 | static void AscDisableInterrupt(PortAddr iop_base) | 4472 | static void AscDisableInterrupt(PortAddr iop_base) |
@@ -4484,7 +4475,6 @@ static void AscDisableInterrupt(PortAddr iop_base) | |||
4484 | 4475 | ||
4485 | cfg = AscGetChipCfgLsw(iop_base); | 4476 | cfg = AscGetChipCfgLsw(iop_base); |
4486 | AscSetChipCfgLsw(iop_base, cfg & (~ASC_CFG0_HOST_INT_ON)); | 4477 | AscSetChipCfgLsw(iop_base, cfg & (~ASC_CFG0_HOST_INT_ON)); |
4487 | return; | ||
4488 | } | 4478 | } |
4489 | 4479 | ||
4490 | static uchar AscReadLramByte(PortAddr iop_base, ushort addr) | 4480 | static uchar AscReadLramByte(PortAddr iop_base, ushort addr) |
@@ -4542,7 +4532,6 @@ static void AscWriteLramWord(PortAddr iop_base, ushort addr, ushort word_val) | |||
4542 | { | 4532 | { |
4543 | AscSetChipLramAddr(iop_base, addr); | 4533 | AscSetChipLramAddr(iop_base, addr); |
4544 | AscSetChipLramData(iop_base, word_val); | 4534 | AscSetChipLramData(iop_base, word_val); |
4545 | return; | ||
4546 | } | 4535 | } |
4547 | 4536 | ||
4548 | static void AscWriteLramByte(PortAddr iop_base, ushort addr, uchar byte_val) | 4537 | static void AscWriteLramByte(PortAddr iop_base, ushort addr, uchar byte_val) |
@@ -4560,7 +4549,6 @@ static void AscWriteLramByte(PortAddr iop_base, ushort addr, uchar byte_val) | |||
4560 | word_data |= ((ushort)byte_val & 0x00FF); | 4549 | word_data |= ((ushort)byte_val & 0x00FF); |
4561 | } | 4550 | } |
4562 | AscWriteLramWord(iop_base, addr, word_data); | 4551 | AscWriteLramWord(iop_base, addr, word_data); |
4563 | return; | ||
4564 | } | 4552 | } |
4565 | 4553 | ||
4566 | /* | 4554 | /* |
@@ -4588,7 +4576,6 @@ AscMemWordCopyPtrToLram(PortAddr iop_base, | |||
4588 | outpw(iop_base + IOP_RAM_DATA, | 4576 | outpw(iop_base + IOP_RAM_DATA, |
4589 | ((ushort)s_buffer[i + 1] << 8) | s_buffer[i]); | 4577 | ((ushort)s_buffer[i + 1] << 8) | s_buffer[i]); |
4590 | } | 4578 | } |
4591 | return; | ||
4592 | } | 4579 | } |
4593 | 4580 | ||
4594 | /* | 4581 | /* |
@@ -4608,7 +4595,6 @@ AscMemDWordCopyPtrToLram(PortAddr iop_base, | |||
4608 | outpw(iop_base + IOP_RAM_DATA, ((ushort)s_buffer[i + 1] << 8) | s_buffer[i]); /* LSW */ | 4595 | outpw(iop_base + IOP_RAM_DATA, ((ushort)s_buffer[i + 1] << 8) | s_buffer[i]); /* LSW */ |
4609 | outpw(iop_base + IOP_RAM_DATA, ((ushort)s_buffer[i + 3] << 8) | s_buffer[i + 2]); /* MSW */ | 4596 | outpw(iop_base + IOP_RAM_DATA, ((ushort)s_buffer[i + 3] << 8) | s_buffer[i + 2]); /* MSW */ |
4610 | } | 4597 | } |
4611 | return; | ||
4612 | } | 4598 | } |
4613 | 4599 | ||
4614 | /* | 4600 | /* |
@@ -4630,7 +4616,6 @@ AscMemWordCopyPtrFromLram(PortAddr iop_base, | |||
4630 | d_buffer[i] = word & 0xff; | 4616 | d_buffer[i] = word & 0xff; |
4631 | d_buffer[i + 1] = (word >> 8) & 0xff; | 4617 | d_buffer[i + 1] = (word >> 8) & 0xff; |
4632 | } | 4618 | } |
4633 | return; | ||
4634 | } | 4619 | } |
4635 | 4620 | ||
4636 | static ASC_DCNT AscMemSumLramWord(PortAddr iop_base, ushort s_addr, int words) | 4621 | static ASC_DCNT AscMemSumLramWord(PortAddr iop_base, ushort s_addr, int words) |
@@ -8397,8 +8382,6 @@ static void adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp) | |||
8397 | boardp->adv_reqp = reqp; | 8382 | boardp->adv_reqp = reqp; |
8398 | 8383 | ||
8399 | ASC_DBG(1, "done\n"); | 8384 | ASC_DBG(1, "done\n"); |
8400 | |||
8401 | return; | ||
8402 | } | 8385 | } |
8403 | 8386 | ||
8404 | /* | 8387 | /* |
@@ -8569,7 +8552,6 @@ static void AscAckInterrupt(PortAddr iop_base) | |||
8569 | } | 8552 | } |
8570 | } | 8553 | } |
8571 | AscWriteLramByte(iop_base, ASCV_HOST_FLAG_B, host_flag); | 8554 | AscWriteLramByte(iop_base, ASCV_HOST_FLAG_B, host_flag); |
8572 | return; | ||
8573 | } | 8555 | } |
8574 | 8556 | ||
8575 | static uchar AscGetSynPeriodIndex(ASC_DVC_VAR *asc_dvc, uchar syn_time) | 8557 | static uchar AscGetSynPeriodIndex(ASC_DVC_VAR *asc_dvc, uchar syn_time) |
@@ -9325,8 +9307,6 @@ static void asc_isr_callback(ASC_DVC_VAR *asc_dvc_varp, ASC_QDONE_INFO *qdonep) | |||
9325 | } | 9307 | } |
9326 | 9308 | ||
9327 | asc_scsi_done(scp); | 9309 | asc_scsi_done(scp); |
9328 | |||
9329 | return; | ||
9330 | } | 9310 | } |
9331 | 9311 | ||
9332 | static int AscIsrQDone(ASC_DVC_VAR *asc_dvc) | 9312 | static int AscIsrQDone(ASC_DVC_VAR *asc_dvc) |
@@ -10055,9 +10035,9 @@ static int asc_build_req(struct asc_board *boardp, struct scsi_cmnd *scp, | |||
10055 | scp->sc_data_direction); | 10035 | scp->sc_data_direction); |
10056 | 10036 | ||
10057 | if (use_sg > scp->device->host->sg_tablesize) { | 10037 | if (use_sg > scp->device->host->sg_tablesize) { |
10058 | ASC_PRINT3("asc_build_req: board %d: use_sg %d > " | 10038 | scmd_printk(KERN_ERR, scp, "use_sg %d > " |
10059 | "sg_tablesize %d\n", boardp->id, use_sg, | 10039 | "sg_tablesize %d\n", use_sg, |
10060 | scp->device->host->sg_tablesize); | 10040 | scp->device->host->sg_tablesize); |
10061 | dma_unmap_sg(boardp->dev, slp, scp->use_sg, | 10041 | dma_unmap_sg(boardp->dev, slp, scp->use_sg, |
10062 | scp->sc_data_direction); | 10042 | scp->sc_data_direction); |
10063 | scp->result = HOST_BYTE(DID_ERROR); | 10043 | scp->result = HOST_BYTE(DID_ERROR); |
@@ -10332,8 +10312,8 @@ adv_build_req(struct asc_board *boardp, struct scsi_cmnd *scp, | |||
10332 | scp->sc_data_direction); | 10312 | scp->sc_data_direction); |
10333 | 10313 | ||
10334 | if (use_sg > ADV_MAX_SG_LIST) { | 10314 | if (use_sg > ADV_MAX_SG_LIST) { |
10335 | ASC_PRINT3("adv_build_req: board %d: use_sg %d > " | 10315 | scmd_printk(KERN_ERR, scp, "use_sg %d > " |
10336 | "ADV_MAX_SG_LIST %d\n", boardp->id, use_sg, | 10316 | "ADV_MAX_SG_LIST %d\n", use_sg, |
10337 | scp->device->host->sg_tablesize); | 10317 | scp->device->host->sg_tablesize); |
10338 | dma_unmap_sg(boardp->dev, slp, scp->use_sg, | 10318 | dma_unmap_sg(boardp->dev, slp, scp->use_sg, |
10339 | scp->sc_data_direction); | 10319 | scp->sc_data_direction); |
@@ -11174,14 +11154,14 @@ static int asc_execute_scsi_cmnd(struct scsi_cmnd *scp) | |||
11174 | ASC_STATS(scp->device->host, exe_busy); | 11154 | ASC_STATS(scp->device->host, exe_busy); |
11175 | break; | 11155 | break; |
11176 | case ASC_ERROR: | 11156 | case ASC_ERROR: |
11177 | ASC_PRINT2("asc_execute_scsi_cmnd: board %d: ExeScsiQueue() " | 11157 | scmd_printk(KERN_ERR, scp, "ExeScsiQueue() ASC_ERROR, " |
11178 | "ASC_ERROR, err_code 0x%x\n", boardp->id, err_code); | 11158 | "err_code 0x%x\n", err_code); |
11179 | ASC_STATS(scp->device->host, exe_error); | 11159 | ASC_STATS(scp->device->host, exe_error); |
11180 | scp->result = HOST_BYTE(DID_ERROR); | 11160 | scp->result = HOST_BYTE(DID_ERROR); |
11181 | break; | 11161 | break; |
11182 | default: | 11162 | default: |
11183 | ASC_PRINT2("asc_execute_scsi_cmnd: board %d: ExeScsiQueue() " | 11163 | scmd_printk(KERN_ERR, scp, "ExeScsiQueue() unknown, " |
11184 | "unknown, err_code 0x%x\n", boardp->id, err_code); | 11164 | "err_code 0x%x\n", err_code); |
11185 | ASC_STATS(scp->device->host, exe_unknown); | 11165 | ASC_STATS(scp->device->host, exe_unknown); |
11186 | scp->result = HOST_BYTE(DID_ERROR); | 11166 | scp->result = HOST_BYTE(DID_ERROR); |
11187 | break; | 11167 | break; |
@@ -11314,7 +11294,6 @@ static void __devinit AscEnableIsaDma(uchar dma_channel) | |||
11314 | outp(0x00D6, (ushort)(0xC0 | (dma_channel - 4))); | 11294 | outp(0x00D6, (ushort)(0xC0 | (dma_channel - 4))); |
11315 | outp(0x00D4, (ushort)(dma_channel - 4)); | 11295 | outp(0x00D4, (ushort)(dma_channel - 4)); |
11316 | } | 11296 | } |
11317 | return; | ||
11318 | } | 11297 | } |
11319 | #endif /* CONFIG_ISA */ | 11298 | #endif /* CONFIG_ISA */ |
11320 | 11299 | ||
@@ -11613,7 +11592,6 @@ static int __devinit AscTestExternalLram(ASC_DVC_VAR *asc_dvc) | |||
11613 | static void __devinit AscWaitEEPWrite(void) | 11592 | static void __devinit AscWaitEEPWrite(void) |
11614 | { | 11593 | { |
11615 | mdelay(20); | 11594 | mdelay(20); |
11616 | return; | ||
11617 | } | 11595 | } |
11618 | 11596 | ||
11619 | static int __devinit AscWriteEEPDataReg(PortAddr iop_base, ushort data_reg) | 11597 | static int __devinit AscWriteEEPDataReg(PortAddr iop_base, ushort data_reg) |
@@ -11936,9 +11914,10 @@ static ushort __devinit AscInitFromEEP(ASC_DVC_VAR *asc_dvc) | |||
11936 | return (warn_code); | 11914 | return (warn_code); |
11937 | } | 11915 | } |
11938 | 11916 | ||
11939 | static int __devinit AscInitGetConfig(struct asc_board *boardp) | 11917 | static int __devinit AscInitGetConfig(struct Scsi_Host *shost) |
11940 | { | 11918 | { |
11941 | ASC_DVC_VAR *asc_dvc = &boardp->dvc_var.asc_dvc_var; | 11919 | struct asc_board *board = shost_priv(shost); |
11920 | ASC_DVC_VAR *asc_dvc = &board->dvc_var.asc_dvc_var; | ||
11942 | unsigned short warn_code = 0; | 11921 | unsigned short warn_code = 0; |
11943 | 11922 | ||
11944 | asc_dvc->init_state = ASC_INIT_STATE_BEG_GET_CFG; | 11923 | asc_dvc->init_state = ASC_INIT_STATE_BEG_GET_CFG; |
@@ -11959,43 +11938,40 @@ static int __devinit AscInitGetConfig(struct asc_board *boardp) | |||
11959 | case 0: /* No error */ | 11938 | case 0: /* No error */ |
11960 | break; | 11939 | break; |
11961 | case ASC_WARN_IO_PORT_ROTATE: | 11940 | case ASC_WARN_IO_PORT_ROTATE: |
11962 | ASC_PRINT1("AscInitGetConfig: board %d: I/O port address " | 11941 | shost_printk(KERN_WARNING, shost, "I/O port address " |
11963 | "modified\n", boardp->id); | 11942 | "modified\n"); |
11964 | break; | 11943 | break; |
11965 | case ASC_WARN_AUTO_CONFIG: | 11944 | case ASC_WARN_AUTO_CONFIG: |
11966 | ASC_PRINT1("AscInitGetConfig: board %d: I/O port increment " | 11945 | shost_printk(KERN_WARNING, shost, "I/O port increment switch " |
11967 | "switch enabled\n", boardp->id); | 11946 | "enabled\n"); |
11968 | break; | 11947 | break; |
11969 | case ASC_WARN_EEPROM_CHKSUM: | 11948 | case ASC_WARN_EEPROM_CHKSUM: |
11970 | ASC_PRINT1("AscInitGetConfig: board %d: EEPROM checksum " | 11949 | shost_printk(KERN_WARNING, shost, "EEPROM checksum error\n"); |
11971 | "error\n", boardp->id); | ||
11972 | break; | 11950 | break; |
11973 | case ASC_WARN_IRQ_MODIFIED: | 11951 | case ASC_WARN_IRQ_MODIFIED: |
11974 | ASC_PRINT1("AscInitGetConfig: board %d: IRQ modified\n", | 11952 | shost_printk(KERN_WARNING, shost, "IRQ modified\n"); |
11975 | boardp->id); | ||
11976 | break; | 11953 | break; |
11977 | case ASC_WARN_CMD_QNG_CONFLICT: | 11954 | case ASC_WARN_CMD_QNG_CONFLICT: |
11978 | ASC_PRINT1("AscInitGetConfig: board %d: tag queuing enabled " | 11955 | shost_printk(KERN_WARNING, shost, "tag queuing enabled w/o " |
11979 | "w/o disconnects\n", boardp->id); | 11956 | "disconnects\n"); |
11980 | break; | 11957 | break; |
11981 | default: | 11958 | default: |
11982 | ASC_PRINT2("AscInitGetConfig: board %d: unknown warning: " | 11959 | shost_printk(KERN_WARNING, shost, "unknown warning: 0x%x\n", |
11983 | "0x%x\n", boardp->id, warn_code); | 11960 | warn_code); |
11984 | break; | 11961 | break; |
11985 | } | 11962 | } |
11986 | 11963 | ||
11987 | if (asc_dvc->err_code != 0) { | 11964 | if (asc_dvc->err_code != 0) |
11988 | ASC_PRINT3("AscInitGetConfig: board %d error: init_state 0x%x, " | 11965 | shost_printk(KERN_ERR, shost, "error 0x%x at init_state " |
11989 | "err_code 0x%x\n", boardp->id, asc_dvc->init_state, | 11966 | "0x%x\n", asc_dvc->err_code, asc_dvc->init_state); |
11990 | asc_dvc->err_code); | ||
11991 | } | ||
11992 | 11967 | ||
11993 | return asc_dvc->err_code; | 11968 | return asc_dvc->err_code; |
11994 | } | 11969 | } |
11995 | 11970 | ||
11996 | static int __devinit AscInitSetConfig(struct pci_dev *pdev, struct asc_board *boardp) | 11971 | static int __devinit AscInitSetConfig(struct pci_dev *pdev, struct Scsi_Host *shost) |
11997 | { | 11972 | { |
11998 | ASC_DVC_VAR *asc_dvc = &boardp->dvc_var.asc_dvc_var; | 11973 | struct asc_board *board = shost_priv(shost); |
11974 | ASC_DVC_VAR *asc_dvc = &board->dvc_var.asc_dvc_var; | ||
11999 | PortAddr iop_base = asc_dvc->iop_base; | 11975 | PortAddr iop_base = asc_dvc->iop_base; |
12000 | unsigned short cfg_msw; | 11976 | unsigned short cfg_msw; |
12001 | unsigned short warn_code = 0; | 11977 | unsigned short warn_code = 0; |
@@ -12060,37 +12036,32 @@ static int __devinit AscInitSetConfig(struct pci_dev *pdev, struct asc_board *bo | |||
12060 | case 0: /* No error. */ | 12036 | case 0: /* No error. */ |
12061 | break; | 12037 | break; |
12062 | case ASC_WARN_IO_PORT_ROTATE: | 12038 | case ASC_WARN_IO_PORT_ROTATE: |
12063 | ASC_PRINT1("AscInitSetConfig: board %d: I/O port address " | 12039 | shost_printk(KERN_WARNING, shost, "I/O port address " |
12064 | "modified\n", boardp->id); | 12040 | "modified\n"); |
12065 | break; | 12041 | break; |
12066 | case ASC_WARN_AUTO_CONFIG: | 12042 | case ASC_WARN_AUTO_CONFIG: |
12067 | ASC_PRINT1("AscInitSetConfig: board %d: I/O port increment " | 12043 | shost_printk(KERN_WARNING, shost, "I/O port increment switch " |
12068 | "switch enabled\n", boardp->id); | 12044 | "enabled\n"); |
12069 | break; | 12045 | break; |
12070 | case ASC_WARN_EEPROM_CHKSUM: | 12046 | case ASC_WARN_EEPROM_CHKSUM: |
12071 | ASC_PRINT1("AscInitSetConfig: board %d: EEPROM checksum " | 12047 | shost_printk(KERN_WARNING, shost, "EEPROM checksum error\n"); |
12072 | "error\n", boardp->id); | ||
12073 | break; | 12048 | break; |
12074 | case ASC_WARN_IRQ_MODIFIED: | 12049 | case ASC_WARN_IRQ_MODIFIED: |
12075 | ASC_PRINT1("AscInitSetConfig: board %d: IRQ modified\n", | 12050 | shost_printk(KERN_WARNING, shost, "IRQ modified\n"); |
12076 | boardp->id); | ||
12077 | break; | 12051 | break; |
12078 | case ASC_WARN_CMD_QNG_CONFLICT: | 12052 | case ASC_WARN_CMD_QNG_CONFLICT: |
12079 | ASC_PRINT1("AscInitSetConfig: board %d: tag queuing w/o " | 12053 | shost_printk(KERN_WARNING, shost, "tag queuing w/o " |
12080 | "disconnects\n", | 12054 | "disconnects\n"); |
12081 | boardp->id); | ||
12082 | break; | 12055 | break; |
12083 | default: | 12056 | default: |
12084 | ASC_PRINT2("AscInitSetConfig: board %d: unknown warning: " | 12057 | shost_printk(KERN_WARNING, shost, "unknown warning: 0x%x\n", |
12085 | "0x%x\n", boardp->id, warn_code); | 12058 | warn_code); |
12086 | break; | 12059 | break; |
12087 | } | 12060 | } |
12088 | 12061 | ||
12089 | if (asc_dvc->err_code != 0) { | 12062 | if (asc_dvc->err_code != 0) |
12090 | ASC_PRINT3("AscInitSetConfig: board %d error: init_state 0x%x, " | 12063 | shost_printk(KERN_ERR, shost, "error 0x%x at init_state " |
12091 | "err_code 0x%x\n", boardp->id, asc_dvc->init_state, | 12064 | "0x%x\n", asc_dvc->err_code, asc_dvc->init_state); |
12092 | asc_dvc->err_code); | ||
12093 | } | ||
12094 | 12065 | ||
12095 | return asc_dvc->err_code; | 12066 | return asc_dvc->err_code; |
12096 | } | 12067 | } |
@@ -13390,9 +13361,10 @@ static int __devinit AdvInitFrom38C1600EEP(ADV_DVC_VAR *asc_dvc) | |||
13390 | * then 0 is returned. | 13361 | * then 0 is returned. |
13391 | */ | 13362 | */ |
13392 | static int __devinit | 13363 | static int __devinit |
13393 | AdvInitGetConfig(struct pci_dev *pdev, struct asc_board *boardp) | 13364 | AdvInitGetConfig(struct pci_dev *pdev, struct Scsi_Host *shost) |
13394 | { | 13365 | { |
13395 | ADV_DVC_VAR *asc_dvc = &boardp->dvc_var.adv_dvc_var; | 13366 | struct asc_board *board = shost_priv(shost); |
13367 | ADV_DVC_VAR *asc_dvc = &board->dvc_var.adv_dvc_var; | ||
13396 | unsigned short warn_code = 0; | 13368 | unsigned short warn_code = 0; |
13397 | AdvPortAddr iop_base = asc_dvc->iop_base; | 13369 | AdvPortAddr iop_base = asc_dvc->iop_base; |
13398 | u16 cmd; | 13370 | u16 cmd; |
@@ -13458,15 +13430,12 @@ AdvInitGetConfig(struct pci_dev *pdev, struct asc_board *boardp) | |||
13458 | warn_code |= status; | 13430 | warn_code |= status; |
13459 | } | 13431 | } |
13460 | 13432 | ||
13461 | if (warn_code != 0) { | 13433 | if (warn_code != 0) |
13462 | ASC_PRINT2("AdvInitGetConfig: board %d: warning: 0x%x\n", | 13434 | shost_printk(KERN_WARNING, shost, "warning: 0x%x\n", warn_code); |
13463 | boardp->id, warn_code); | ||
13464 | } | ||
13465 | 13435 | ||
13466 | if (asc_dvc->err_code) { | 13436 | if (asc_dvc->err_code) |
13467 | ASC_PRINT2("AdvInitGetConfig: board %d error: err_code 0x%x\n", | 13437 | shost_printk(KERN_ERR, shost, "error code 0x%x\n", |
13468 | boardp->id, asc_dvc->err_code); | 13438 | asc_dvc->err_code); |
13469 | } | ||
13470 | 13439 | ||
13471 | return asc_dvc->err_code; | 13440 | return asc_dvc->err_code; |
13472 | } | 13441 | } |
@@ -13499,9 +13468,10 @@ static struct scsi_host_template advansys_template = { | |||
13499 | .use_clustering = ENABLE_CLUSTERING, | 13468 | .use_clustering = ENABLE_CLUSTERING, |
13500 | }; | 13469 | }; |
13501 | 13470 | ||
13502 | static int __devinit | 13471 | static int __devinit advansys_wide_init_chip(struct Scsi_Host *shost) |
13503 | advansys_wide_init_chip(struct asc_board *boardp, ADV_DVC_VAR *adv_dvc_varp) | ||
13504 | { | 13472 | { |
13473 | struct asc_board *board = shost_priv(shost); | ||
13474 | struct adv_dvc_var *adv_dvc = &board->dvc_var.adv_dvc_var; | ||
13505 | int req_cnt = 0; | 13475 | int req_cnt = 0; |
13506 | adv_req_t *reqp = NULL; | 13476 | adv_req_t *reqp = NULL; |
13507 | int sg_cnt = 0; | 13477 | int sg_cnt = 0; |
@@ -13512,10 +13482,10 @@ advansys_wide_init_chip(struct asc_board *boardp, ADV_DVC_VAR *adv_dvc_varp) | |||
13512 | * Allocate buffer carrier structures. The total size | 13482 | * Allocate buffer carrier structures. The total size |
13513 | * is about 4 KB, so allocate all at once. | 13483 | * is about 4 KB, so allocate all at once. |
13514 | */ | 13484 | */ |
13515 | boardp->carrp = kmalloc(ADV_CARRIER_BUFSIZE, GFP_KERNEL); | 13485 | board->carrp = kmalloc(ADV_CARRIER_BUFSIZE, GFP_KERNEL); |
13516 | ASC_DBG(1, "carrp 0x%p\n", boardp->carrp); | 13486 | ASC_DBG(1, "carrp 0x%p\n", board->carrp); |
13517 | 13487 | ||
13518 | if (!boardp->carrp) | 13488 | if (!board->carrp) |
13519 | goto kmalloc_failed; | 13489 | goto kmalloc_failed; |
13520 | 13490 | ||
13521 | /* | 13491 | /* |
@@ -13523,7 +13493,7 @@ advansys_wide_init_chip(struct asc_board *boardp, ADV_DVC_VAR *adv_dvc_varp) | |||
13523 | * board. The total size is about 16 KB, so allocate all at once. | 13493 | * board. The total size is about 16 KB, so allocate all at once. |
13524 | * If the allocation fails decrement and try again. | 13494 | * If the allocation fails decrement and try again. |
13525 | */ | 13495 | */ |
13526 | for (req_cnt = adv_dvc_varp->max_host_qng; req_cnt > 0; req_cnt--) { | 13496 | for (req_cnt = adv_dvc->max_host_qng; req_cnt > 0; req_cnt--) { |
13527 | reqp = kmalloc(sizeof(adv_req_t) * req_cnt, GFP_KERNEL); | 13497 | reqp = kmalloc(sizeof(adv_req_t) * req_cnt, GFP_KERNEL); |
13528 | 13498 | ||
13529 | ASC_DBG(1, "reqp 0x%p, req_cnt %d, bytes %lu\n", reqp, req_cnt, | 13499 | ASC_DBG(1, "reqp 0x%p, req_cnt %d, bytes %lu\n", reqp, req_cnt, |
@@ -13536,31 +13506,31 @@ advansys_wide_init_chip(struct asc_board *boardp, ADV_DVC_VAR *adv_dvc_varp) | |||
13536 | if (!reqp) | 13506 | if (!reqp) |
13537 | goto kmalloc_failed; | 13507 | goto kmalloc_failed; |
13538 | 13508 | ||
13539 | boardp->orig_reqp = reqp; | 13509 | board->orig_reqp = reqp; |
13540 | 13510 | ||
13541 | /* | 13511 | /* |
13542 | * Allocate up to ADV_TOT_SG_BLOCK request structures for | 13512 | * Allocate up to ADV_TOT_SG_BLOCK request structures for |
13543 | * the Wide board. Each structure is about 136 bytes. | 13513 | * the Wide board. Each structure is about 136 bytes. |
13544 | */ | 13514 | */ |
13545 | boardp->adv_sgblkp = NULL; | 13515 | board->adv_sgblkp = NULL; |
13546 | for (sg_cnt = 0; sg_cnt < ADV_TOT_SG_BLOCK; sg_cnt++) { | 13516 | for (sg_cnt = 0; sg_cnt < ADV_TOT_SG_BLOCK; sg_cnt++) { |
13547 | sgp = kmalloc(sizeof(adv_sgblk_t), GFP_KERNEL); | 13517 | sgp = kmalloc(sizeof(adv_sgblk_t), GFP_KERNEL); |
13548 | 13518 | ||
13549 | if (!sgp) | 13519 | if (!sgp) |
13550 | break; | 13520 | break; |
13551 | 13521 | ||
13552 | sgp->next_sgblkp = boardp->adv_sgblkp; | 13522 | sgp->next_sgblkp = board->adv_sgblkp; |
13553 | boardp->adv_sgblkp = sgp; | 13523 | board->adv_sgblkp = sgp; |
13554 | 13524 | ||
13555 | } | 13525 | } |
13556 | 13526 | ||
13557 | ASC_DBG(1, "sg_cnt %d * %u = %u bytes\n", sg_cnt, sizeof(adv_sgblk_t), | 13527 | ASC_DBG(1, "sg_cnt %d * %u = %u bytes\n", sg_cnt, sizeof(adv_sgblk_t), |
13558 | (unsigned)(sizeof(adv_sgblk_t) * sg_cnt)); | 13528 | (unsigned)(sizeof(adv_sgblk_t) * sg_cnt)); |
13559 | 13529 | ||
13560 | if (!boardp->adv_sgblkp) | 13530 | if (!board->adv_sgblkp) |
13561 | goto kmalloc_failed; | 13531 | goto kmalloc_failed; |
13562 | 13532 | ||
13563 | adv_dvc_varp->carrier_buf = boardp->carrp; | 13533 | adv_dvc->carrier_buf = board->carrp; |
13564 | 13534 | ||
13565 | /* | 13535 | /* |
13566 | * Point 'adv_reqp' to the request structures and | 13536 | * Point 'adv_reqp' to the request structures and |
@@ -13571,30 +13541,29 @@ advansys_wide_init_chip(struct asc_board *boardp, ADV_DVC_VAR *adv_dvc_varp) | |||
13571 | for (; req_cnt > 0; req_cnt--) { | 13541 | for (; req_cnt > 0; req_cnt--) { |
13572 | reqp[req_cnt - 1].next_reqp = &reqp[req_cnt]; | 13542 | reqp[req_cnt - 1].next_reqp = &reqp[req_cnt]; |
13573 | } | 13543 | } |
13574 | boardp->adv_reqp = &reqp[0]; | 13544 | board->adv_reqp = &reqp[0]; |
13575 | 13545 | ||
13576 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { | 13546 | if (adv_dvc->chip_type == ADV_CHIP_ASC3550) { |
13577 | ASC_DBG(2, "AdvInitAsc3550Driver()\n"); | 13547 | ASC_DBG(2, "AdvInitAsc3550Driver()\n"); |
13578 | warn_code = AdvInitAsc3550Driver(adv_dvc_varp); | 13548 | warn_code = AdvInitAsc3550Driver(adv_dvc); |
13579 | } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) { | 13549 | } else if (adv_dvc->chip_type == ADV_CHIP_ASC38C0800) { |
13580 | ASC_DBG(2, "AdvInitAsc38C0800Driver()\n"); | 13550 | ASC_DBG(2, "AdvInitAsc38C0800Driver()\n"); |
13581 | warn_code = AdvInitAsc38C0800Driver(adv_dvc_varp); | 13551 | warn_code = AdvInitAsc38C0800Driver(adv_dvc); |
13582 | } else { | 13552 | } else { |
13583 | ASC_DBG(2, "AdvInitAsc38C1600Driver()\n"); | 13553 | ASC_DBG(2, "AdvInitAsc38C1600Driver()\n"); |
13584 | warn_code = AdvInitAsc38C1600Driver(adv_dvc_varp); | 13554 | warn_code = AdvInitAsc38C1600Driver(adv_dvc); |
13585 | } | 13555 | } |
13586 | err_code = adv_dvc_varp->err_code; | 13556 | err_code = adv_dvc->err_code; |
13587 | 13557 | ||
13588 | if (warn_code || err_code) { | 13558 | if (warn_code || err_code) { |
13589 | ASC_PRINT3("advansys_wide_init_chip: board %d error: warn 0x%x," | 13559 | shost_printk(KERN_WARNING, shost, "error: warn 0x%x, error " |
13590 | " error 0x%x\n", boardp->id, warn_code, err_code); | 13560 | "0x%x\n", warn_code, err_code); |
13591 | } | 13561 | } |
13592 | 13562 | ||
13593 | goto exit; | 13563 | goto exit; |
13594 | 13564 | ||
13595 | kmalloc_failed: | 13565 | kmalloc_failed: |
13596 | ASC_PRINT1("advansys_wide_init_chip: board %d error: kmalloc() " | 13566 | shost_printk(KERN_ERR, shost, "error: kmalloc() failed\n"); |
13597 | "failed\n", boardp->id); | ||
13598 | err_code = ADV_ERROR; | 13567 | err_code = ADV_ERROR; |
13599 | exit: | 13568 | exit: |
13600 | return err_code; | 13569 | return err_code; |
@@ -13622,7 +13591,6 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost, | |||
13622 | ADV_DVC_VAR *adv_dvc_varp = NULL; | 13591 | ADV_DVC_VAR *adv_dvc_varp = NULL; |
13623 | int share_irq, warn_code, ret; | 13592 | int share_irq, warn_code, ret; |
13624 | 13593 | ||
13625 | boardp->id = asc_board_count++; | ||
13626 | pdev = (bus_type == ASC_IS_PCI) ? to_pci_dev(boardp->dev) : NULL; | 13594 | pdev = (bus_type == ASC_IS_PCI) ? to_pci_dev(boardp->dev) : NULL; |
13627 | 13595 | ||
13628 | if (ASC_NARROW_BOARD(boardp)) { | 13596 | if (ASC_NARROW_BOARD(boardp)) { |
@@ -13653,10 +13621,10 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost, | |||
13653 | boardp->ioremap_addr = ioremap(pci_resource_start(pdev, 1), | 13621 | boardp->ioremap_addr = ioremap(pci_resource_start(pdev, 1), |
13654 | boardp->asc_n_io_port); | 13622 | boardp->asc_n_io_port); |
13655 | if (!boardp->ioremap_addr) { | 13623 | if (!boardp->ioremap_addr) { |
13656 | ASC_PRINT3 | 13624 | shost_printk(KERN_ERR, shost, "ioremap(%x, %d) " |
13657 | ("advansys_board_found: board %d: ioremap(%x, %d) returned NULL\n", | 13625 | "returned NULL\n", |
13658 | boardp->id, pci_resource_start(pdev, 1), | 13626 | pci_resource_start(pdev, 1), |
13659 | boardp->asc_n_io_port); | 13627 | boardp->asc_n_io_port); |
13660 | ret = -ENODEV; | 13628 | ret = -ENODEV; |
13661 | goto err_shost; | 13629 | goto err_shost; |
13662 | } | 13630 | } |
@@ -13682,8 +13650,8 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost, | |||
13682 | */ | 13650 | */ |
13683 | boardp->prtbuf = kmalloc(ASC_PRTBUF_SIZE, GFP_KERNEL); | 13651 | boardp->prtbuf = kmalloc(ASC_PRTBUF_SIZE, GFP_KERNEL); |
13684 | if (!boardp->prtbuf) { | 13652 | if (!boardp->prtbuf) { |
13685 | ASC_PRINT2("advansys_board_found: board %d: kmalloc(%d) " | 13653 | shost_printk(KERN_ERR, shost, "kmalloc(%d) returned NULL\n", |
13686 | "returned NULL\n", boardp->id, ASC_PRTBUF_SIZE); | 13654 | ASC_PRTBUF_SIZE); |
13687 | ret = -ENOMEM; | 13655 | ret = -ENOMEM; |
13688 | goto err_unmap; | 13656 | goto err_unmap; |
13689 | } | 13657 | } |
@@ -13716,9 +13684,8 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost, | |||
13716 | break; | 13684 | break; |
13717 | #endif /* CONFIG_PCI */ | 13685 | #endif /* CONFIG_PCI */ |
13718 | default: | 13686 | default: |
13719 | ASC_PRINT2 | 13687 | shost_printk(KERN_ERR, shost, "unknown adapter type: " |
13720 | ("advansys_board_found: board %d: unknown adapter type: %d\n", | 13688 | "%d\n", asc_dvc_varp->bus_type); |
13721 | boardp->id, asc_dvc_varp->bus_type); | ||
13722 | shost->unchecked_isa_dma = TRUE; | 13689 | shost->unchecked_isa_dma = TRUE; |
13723 | share_irq = 0; | 13690 | share_irq = 0; |
13724 | break; | 13691 | break; |
@@ -13731,7 +13698,7 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost, | |||
13731 | * referenced only use the bit-wise AND operator "&". | 13698 | * referenced only use the bit-wise AND operator "&". |
13732 | */ | 13699 | */ |
13733 | ASC_DBG(2, "AscInitGetConfig()\n"); | 13700 | ASC_DBG(2, "AscInitGetConfig()\n"); |
13734 | ret = AscInitGetConfig(boardp) ? -ENODEV : 0; | 13701 | ret = AscInitGetConfig(shost) ? -ENODEV : 0; |
13735 | } else { | 13702 | } else { |
13736 | #ifdef CONFIG_PCI | 13703 | #ifdef CONFIG_PCI |
13737 | /* | 13704 | /* |
@@ -13742,7 +13709,7 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost, | |||
13742 | share_irq = IRQF_SHARED; | 13709 | share_irq = IRQF_SHARED; |
13743 | ASC_DBG(2, "AdvInitGetConfig()\n"); | 13710 | ASC_DBG(2, "AdvInitGetConfig()\n"); |
13744 | 13711 | ||
13745 | ret = AdvInitGetConfig(pdev, boardp) ? -ENODEV : 0; | 13712 | ret = AdvInitGetConfig(pdev, shost) ? -ENODEV : 0; |
13746 | #endif /* CONFIG_PCI */ | 13713 | #endif /* CONFIG_PCI */ |
13747 | } | 13714 | } |
13748 | 13715 | ||
@@ -13790,7 +13757,7 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost, | |||
13790 | * Modify board configuration. | 13757 | * Modify board configuration. |
13791 | */ | 13758 | */ |
13792 | ASC_DBG(2, "AscInitSetConfig()\n"); | 13759 | ASC_DBG(2, "AscInitSetConfig()\n"); |
13793 | ret = AscInitSetConfig(pdev, boardp) ? -ENODEV : 0; | 13760 | ret = AscInitSetConfig(pdev, shost) ? -ENODEV : 0; |
13794 | if (ret) | 13761 | if (ret) |
13795 | goto err_free_proc; | 13762 | goto err_free_proc; |
13796 | } else { | 13763 | } else { |
@@ -14024,9 +13991,9 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost, | |||
14024 | shost->dma_channel = asc_dvc_varp->cfg->isa_dma_channel; | 13991 | shost->dma_channel = asc_dvc_varp->cfg->isa_dma_channel; |
14025 | ret = request_dma(shost->dma_channel, DRV_NAME); | 13992 | ret = request_dma(shost->dma_channel, DRV_NAME); |
14026 | if (ret) { | 13993 | if (ret) { |
14027 | ASC_PRINT3 | 13994 | shost_printk(KERN_ERR, shost, "request_dma() " |
14028 | ("advansys_board_found: board %d: request_dma() %d failed %d\n", | 13995 | "%d failed %d\n", |
14029 | boardp->id, shost->dma_channel, ret); | 13996 | shost->dma_channel, ret); |
14030 | goto err_free_proc; | 13997 | goto err_free_proc; |
14031 | } | 13998 | } |
14032 | AscEnableIsaDma(shost->dma_channel); | 13999 | AscEnableIsaDma(shost->dma_channel); |
@@ -14042,17 +14009,14 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost, | |||
14042 | 14009 | ||
14043 | if (ret) { | 14010 | if (ret) { |
14044 | if (ret == -EBUSY) { | 14011 | if (ret == -EBUSY) { |
14045 | ASC_PRINT2 | 14012 | shost_printk(KERN_ERR, shost, "request_irq(): IRQ 0x%x " |
14046 | ("advansys_board_found: board %d: request_irq(): IRQ 0x%x already in use.\n", | 14013 | "already in use\n", boardp->irq); |
14047 | boardp->id, boardp->irq); | ||
14048 | } else if (ret == -EINVAL) { | 14014 | } else if (ret == -EINVAL) { |
14049 | ASC_PRINT2 | 14015 | shost_printk(KERN_ERR, shost, "request_irq(): IRQ 0x%x " |
14050 | ("advansys_board_found: board %d: request_irq(): IRQ 0x%x not valid.\n", | 14016 | "not valid\n", boardp->irq); |
14051 | boardp->id, boardp->irq); | ||
14052 | } else { | 14017 | } else { |
14053 | ASC_PRINT3 | 14018 | shost_printk(KERN_ERR, shost, "request_irq(): IRQ 0x%x " |
14054 | ("advansys_board_found: board %d: request_irq(): IRQ 0x%x failed with %d\n", | 14019 | "failed with %d\n", boardp->irq, ret); |
14055 | boardp->id, boardp->irq, ret); | ||
14056 | } | 14020 | } |
14057 | goto err_free_dma; | 14021 | goto err_free_dma; |
14058 | } | 14022 | } |
@@ -14065,15 +14029,15 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost, | |||
14065 | warn_code = AscInitAsc1000Driver(asc_dvc_varp); | 14029 | warn_code = AscInitAsc1000Driver(asc_dvc_varp); |
14066 | 14030 | ||
14067 | if (warn_code || asc_dvc_varp->err_code) { | 14031 | if (warn_code || asc_dvc_varp->err_code) { |
14068 | ASC_PRINT4("advansys_board_found: board %d error: " | 14032 | shost_printk(KERN_ERR, shost, "error: init_state 0x%x, " |
14069 | "init_state 0x%x, warn 0x%x, error 0x%x\n", | 14033 | "warn 0x%x, error 0x%x\n", |
14070 | boardp->id, asc_dvc_varp->init_state, | 14034 | asc_dvc_varp->init_state, warn_code, |
14071 | warn_code, asc_dvc_varp->err_code); | 14035 | asc_dvc_varp->err_code); |
14072 | if (asc_dvc_varp->err_code) | 14036 | if (asc_dvc_varp->err_code) |
14073 | ret = -ENODEV; | 14037 | ret = -ENODEV; |
14074 | } | 14038 | } |
14075 | } else { | 14039 | } else { |
14076 | if (advansys_wide_init_chip(boardp, adv_dvc_varp)) | 14040 | if (advansys_wide_init_chip(shost)) |
14077 | ret = -ENODEV; | 14041 | ret = -ENODEV; |
14078 | } | 14042 | } |
14079 | 14043 | ||