diff options
Diffstat (limited to 'drivers/scsi')
54 files changed, 778 insertions, 641 deletions
diff --git a/drivers/scsi/53c7xx.c b/drivers/scsi/53c7xx.c index c690c2b89e41..acf292736b4e 100644 --- a/drivers/scsi/53c7xx.c +++ b/drivers/scsi/53c7xx.c | |||
@@ -3451,12 +3451,12 @@ create_cmd (Scsi_Cmnd *cmd) { | |||
3451 | for (i = 0; cmd->use_sg ? (i < cmd->use_sg) : !i; cmd_datain += 4, | 3451 | for (i = 0; cmd->use_sg ? (i < cmd->use_sg) : !i; cmd_datain += 4, |
3452 | cmd_dataout += 4, ++i) { | 3452 | cmd_dataout += 4, ++i) { |
3453 | u32 vbuf = cmd->use_sg | 3453 | u32 vbuf = cmd->use_sg |
3454 | ? (u32)page_address(((struct scatterlist *)cmd->buffer)[i].page)+ | 3454 | ? (u32)page_address(((struct scatterlist *)cmd->request_buffer)[i].page)+ |
3455 | ((struct scatterlist *)cmd->buffer)[i].offset | 3455 | ((struct scatterlist *)cmd->request_buffer)[i].offset |
3456 | : (u32)(cmd->request_buffer); | 3456 | : (u32)(cmd->request_buffer); |
3457 | u32 bbuf = virt_to_bus((void *)vbuf); | 3457 | u32 bbuf = virt_to_bus((void *)vbuf); |
3458 | u32 count = cmd->use_sg ? | 3458 | u32 count = cmd->use_sg ? |
3459 | ((struct scatterlist *)cmd->buffer)[i].length : | 3459 | ((struct scatterlist *)cmd->request_buffer)[i].length : |
3460 | cmd->request_bufflen; | 3460 | cmd->request_bufflen; |
3461 | 3461 | ||
3462 | /* | 3462 | /* |
@@ -5417,7 +5417,7 @@ insn_to_offset (Scsi_Cmnd *cmd, u32 *insn) { | |||
5417 | 5417 | ||
5418 | if ((buffers = cmd->use_sg)) { | 5418 | if ((buffers = cmd->use_sg)) { |
5419 | for (offset = 0, | 5419 | for (offset = 0, |
5420 | segment = (struct scatterlist *) cmd->buffer; | 5420 | segment = (struct scatterlist *) cmd->request_buffer; |
5421 | buffers && !((found = ((ptr >= (char *)page_address(segment->page)+segment->offset) && | 5421 | buffers && !((found = ((ptr >= (char *)page_address(segment->page)+segment->offset) && |
5422 | (ptr < ((char *)page_address(segment->page)+segment->offset+segment->length))))); | 5422 | (ptr < ((char *)page_address(segment->page)+segment->offset+segment->length))))); |
5423 | --buffers, offset += segment->length, ++segment) | 5423 | --buffers, offset += segment->length, ++segment) |
diff --git a/drivers/scsi/NCR53C9x.c b/drivers/scsi/NCR53C9x.c index 8a4659e94105..bdc6bb262bce 100644 --- a/drivers/scsi/NCR53C9x.c +++ b/drivers/scsi/NCR53C9x.c | |||
@@ -911,7 +911,7 @@ static void esp_get_dmabufs(struct NCR_ESP *esp, Scsi_Cmnd *sp) | |||
911 | sp->SCp.ptr = | 911 | sp->SCp.ptr = |
912 | (char *) virt_to_phys(sp->request_buffer); | 912 | (char *) virt_to_phys(sp->request_buffer); |
913 | } else { | 913 | } else { |
914 | sp->SCp.buffer = (struct scatterlist *) sp->buffer; | 914 | sp->SCp.buffer = (struct scatterlist *) sp->request_buffer; |
915 | sp->SCp.buffers_residual = sp->use_sg - 1; | 915 | sp->SCp.buffers_residual = sp->use_sg - 1; |
916 | sp->SCp.this_residual = sp->SCp.buffer->length; | 916 | sp->SCp.this_residual = sp->SCp.buffer->length; |
917 | if (esp->dma_mmu_get_scsi_sgl) | 917 | if (esp->dma_mmu_get_scsi_sgl) |
@@ -2152,29 +2152,23 @@ static int esp_do_data_finale(struct NCR_ESP *esp, | |||
2152 | */ | 2152 | */ |
2153 | static int esp_should_clear_sync(Scsi_Cmnd *sp) | 2153 | static int esp_should_clear_sync(Scsi_Cmnd *sp) |
2154 | { | 2154 | { |
2155 | unchar cmd1 = sp->cmnd[0]; | 2155 | unchar cmd = sp->cmnd[0]; |
2156 | unchar cmd2 = sp->data_cmnd[0]; | ||
2157 | 2156 | ||
2158 | /* These cases are for spinning up a disk and | 2157 | /* These cases are for spinning up a disk and |
2159 | * waiting for that spinup to complete. | 2158 | * waiting for that spinup to complete. |
2160 | */ | 2159 | */ |
2161 | if(cmd1 == START_STOP || | 2160 | if(cmd == START_STOP) |
2162 | cmd2 == START_STOP) | ||
2163 | return 0; | 2161 | return 0; |
2164 | 2162 | ||
2165 | if(cmd1 == TEST_UNIT_READY || | 2163 | if(cmd == TEST_UNIT_READY) |
2166 | cmd2 == TEST_UNIT_READY) | ||
2167 | return 0; | 2164 | return 0; |
2168 | 2165 | ||
2169 | /* One more special case for SCSI tape drives, | 2166 | /* One more special case for SCSI tape drives, |
2170 | * this is what is used to probe the device for | 2167 | * this is what is used to probe the device for |
2171 | * completion of a rewind or tape load operation. | 2168 | * completion of a rewind or tape load operation. |
2172 | */ | 2169 | */ |
2173 | if(sp->device->type == TYPE_TAPE) { | 2170 | if(sp->device->type == TYPE_TAPE && cmd == MODE_SENSE) |
2174 | if(cmd1 == MODE_SENSE || | 2171 | return 0; |
2175 | cmd2 == MODE_SENSE) | ||
2176 | return 0; | ||
2177 | } | ||
2178 | 2172 | ||
2179 | return 1; | 2173 | return 1; |
2180 | } | 2174 | } |
diff --git a/drivers/scsi/NCR_D700.c b/drivers/scsi/NCR_D700.c index a06f547e87f7..d05681f9d81a 100644 --- a/drivers/scsi/NCR_D700.c +++ b/drivers/scsi/NCR_D700.c | |||
@@ -114,7 +114,7 @@ MODULE_DESCRIPTION("NCR Dual700 SCSI Driver"); | |||
114 | MODULE_LICENSE("GPL"); | 114 | MODULE_LICENSE("GPL"); |
115 | module_param(NCR_D700, charp, 0); | 115 | module_param(NCR_D700, charp, 0); |
116 | 116 | ||
117 | static __u8 __initdata id_array[2*(MCA_MAX_SLOT_NR + 1)] = | 117 | static __u8 __devinitdata id_array[2*(MCA_MAX_SLOT_NR + 1)] = |
118 | { [0 ... 2*(MCA_MAX_SLOT_NR + 1)-1] = 7 }; | 118 | { [0 ... 2*(MCA_MAX_SLOT_NR + 1)-1] = 7 }; |
119 | 119 | ||
120 | #ifdef MODULE | 120 | #ifdef MODULE |
@@ -173,7 +173,7 @@ struct NCR_D700_private { | |||
173 | char pad; | 173 | char pad; |
174 | }; | 174 | }; |
175 | 175 | ||
176 | static int | 176 | static int __devinit |
177 | NCR_D700_probe_one(struct NCR_D700_private *p, int siop, int irq, | 177 | NCR_D700_probe_one(struct NCR_D700_private *p, int siop, int irq, |
178 | int slot, u32 region, int differential) | 178 | int slot, u32 region, int differential) |
179 | { | 179 | { |
@@ -243,7 +243,7 @@ NCR_D700_intr(int irq, void *data, struct pt_regs *regs) | |||
243 | * essentially connectecd to the MCA bus independently, it is easier | 243 | * essentially connectecd to the MCA bus independently, it is easier |
244 | * to set them up as two separate host adapters, rather than one | 244 | * to set them up as two separate host adapters, rather than one |
245 | * adapter with two channels */ | 245 | * adapter with two channels */ |
246 | static int | 246 | static int __devinit |
247 | NCR_D700_probe(struct device *dev) | 247 | NCR_D700_probe(struct device *dev) |
248 | { | 248 | { |
249 | struct NCR_D700_private *p; | 249 | struct NCR_D700_private *p; |
@@ -329,7 +329,7 @@ NCR_D700_probe(struct device *dev) | |||
329 | for (i = 0; i < 2; i++) { | 329 | for (i = 0; i < 2; i++) { |
330 | int err; | 330 | int err; |
331 | 331 | ||
332 | if ((err = NCR_D700_probe_one(p, i, slot, irq, | 332 | if ((err = NCR_D700_probe_one(p, i, irq, slot, |
333 | offset_addr + (0x80 * i), | 333 | offset_addr + (0x80 * i), |
334 | differential)) != 0) | 334 | differential)) != 0) |
335 | printk("D700: SIOP%d: probe failed, error = %d\n", | 335 | printk("D700: SIOP%d: probe failed, error = %d\n", |
@@ -349,7 +349,7 @@ NCR_D700_probe(struct device *dev) | |||
349 | return 0; | 349 | return 0; |
350 | } | 350 | } |
351 | 351 | ||
352 | static void | 352 | static void __devexit |
353 | NCR_D700_remove_one(struct Scsi_Host *host) | 353 | NCR_D700_remove_one(struct Scsi_Host *host) |
354 | { | 354 | { |
355 | scsi_remove_host(host); | 355 | scsi_remove_host(host); |
@@ -359,7 +359,7 @@ NCR_D700_remove_one(struct Scsi_Host *host) | |||
359 | release_region(host->base, 64); | 359 | release_region(host->base, 64); |
360 | } | 360 | } |
361 | 361 | ||
362 | static int | 362 | static int __devexit |
363 | NCR_D700_remove(struct device *dev) | 363 | NCR_D700_remove(struct device *dev) |
364 | { | 364 | { |
365 | struct NCR_D700_private *p = dev_get_drvdata(dev); | 365 | struct NCR_D700_private *p = dev_get_drvdata(dev); |
@@ -380,7 +380,7 @@ static struct mca_driver NCR_D700_driver = { | |||
380 | .name = "NCR_D700", | 380 | .name = "NCR_D700", |
381 | .bus = &mca_bus_type, | 381 | .bus = &mca_bus_type, |
382 | .probe = NCR_D700_probe, | 382 | .probe = NCR_D700_probe, |
383 | .remove = NCR_D700_remove, | 383 | .remove = __devexit_p(NCR_D700_remove), |
384 | }, | 384 | }, |
385 | }; | 385 | }; |
386 | 386 | ||
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c index 36e63f82d9f8..f974869ea323 100644 --- a/drivers/scsi/aha152x.c +++ b/drivers/scsi/aha152x.c | |||
@@ -551,6 +551,11 @@ struct aha152x_hostdata { | |||
551 | struct aha152x_scdata { | 551 | struct aha152x_scdata { |
552 | Scsi_Cmnd *next; /* next sc in queue */ | 552 | Scsi_Cmnd *next; /* next sc in queue */ |
553 | struct semaphore *sem; /* semaphore to block on */ | 553 | struct semaphore *sem; /* semaphore to block on */ |
554 | unsigned char cmd_len; | ||
555 | unsigned char cmnd[MAX_COMMAND_SIZE]; | ||
556 | unsigned short use_sg; | ||
557 | unsigned request_bufflen; | ||
558 | void *request_buffer; | ||
554 | }; | 559 | }; |
555 | 560 | ||
556 | 561 | ||
@@ -1006,11 +1011,20 @@ static int aha152x_internal_queue(Scsi_Cmnd *SCpnt, struct semaphore *sem, int p | |||
1006 | return FAILED; | 1011 | return FAILED; |
1007 | } | 1012 | } |
1008 | } else { | 1013 | } else { |
1014 | struct aha152x_scdata *sc; | ||
1015 | |||
1009 | SCpnt->host_scribble = kmalloc(sizeof(struct aha152x_scdata), GFP_ATOMIC); | 1016 | SCpnt->host_scribble = kmalloc(sizeof(struct aha152x_scdata), GFP_ATOMIC); |
1010 | if(SCpnt->host_scribble==0) { | 1017 | if(SCpnt->host_scribble==0) { |
1011 | printk(ERR_LEAD "allocation failed\n", CMDINFO(SCpnt)); | 1018 | printk(ERR_LEAD "allocation failed\n", CMDINFO(SCpnt)); |
1012 | return FAILED; | 1019 | return FAILED; |
1013 | } | 1020 | } |
1021 | |||
1022 | sc = SCDATA(SCpnt); | ||
1023 | memcpy(sc->cmnd, SCpnt->cmnd, sizeof(sc->cmnd)); | ||
1024 | sc->request_buffer = SCpnt->request_buffer; | ||
1025 | sc->request_bufflen = SCpnt->request_bufflen; | ||
1026 | sc->use_sg = SCpnt->use_sg; | ||
1027 | sc->cmd_len = SCpnt->cmd_len; | ||
1014 | } | 1028 | } |
1015 | 1029 | ||
1016 | SCNEXT(SCpnt) = NULL; | 1030 | SCNEXT(SCpnt) = NULL; |
@@ -1165,6 +1179,10 @@ static int aha152x_device_reset(Scsi_Cmnd * SCpnt) | |||
1165 | DECLARE_MUTEX_LOCKED(sem); | 1179 | DECLARE_MUTEX_LOCKED(sem); |
1166 | struct timer_list timer; | 1180 | struct timer_list timer; |
1167 | int ret, issued, disconnected; | 1181 | int ret, issued, disconnected; |
1182 | unsigned char old_cmd_len = SCpnt->cmd_len; | ||
1183 | unsigned short old_use_sg = SCpnt->use_sg; | ||
1184 | void *old_buffer = SCpnt->request_buffer; | ||
1185 | unsigned old_bufflen = SCpnt->request_bufflen; | ||
1168 | unsigned long flags; | 1186 | unsigned long flags; |
1169 | 1187 | ||
1170 | #if defined(AHA152X_DEBUG) | 1188 | #if defined(AHA152X_DEBUG) |
@@ -1198,11 +1216,11 @@ static int aha152x_device_reset(Scsi_Cmnd * SCpnt) | |||
1198 | add_timer(&timer); | 1216 | add_timer(&timer); |
1199 | down(&sem); | 1217 | down(&sem); |
1200 | del_timer(&timer); | 1218 | del_timer(&timer); |
1201 | 1219 | ||
1202 | SCpnt->cmd_len = SCpnt->old_cmd_len; | 1220 | SCpnt->cmd_len = old_cmd_len; |
1203 | SCpnt->use_sg = SCpnt->old_use_sg; | 1221 | SCpnt->use_sg = old_use_sg; |
1204 | SCpnt->request_buffer = SCpnt->buffer; | 1222 | SCpnt->request_buffer = old_buffer; |
1205 | SCpnt->request_bufflen = SCpnt->bufflen; | 1223 | SCpnt->request_bufflen = old_bufflen; |
1206 | 1224 | ||
1207 | DO_LOCK(flags); | 1225 | DO_LOCK(flags); |
1208 | 1226 | ||
@@ -1565,6 +1583,9 @@ static void busfree_run(struct Scsi_Host *shpnt) | |||
1565 | #endif | 1583 | #endif |
1566 | 1584 | ||
1567 | if(DONE_SC->SCp.phase & check_condition) { | 1585 | if(DONE_SC->SCp.phase & check_condition) { |
1586 | struct scsi_cmnd *cmd = HOSTDATA(shpnt)->done_SC; | ||
1587 | struct aha152x_scdata *sc = SCDATA(cmd); | ||
1588 | |||
1568 | #if 0 | 1589 | #if 0 |
1569 | if(HOSTDATA(shpnt)->debug & debug_eh) { | 1590 | if(HOSTDATA(shpnt)->debug & debug_eh) { |
1570 | printk(ERR_LEAD "received sense: ", CMDINFO(DONE_SC)); | 1591 | printk(ERR_LEAD "received sense: ", CMDINFO(DONE_SC)); |
@@ -1573,13 +1594,13 @@ static void busfree_run(struct Scsi_Host *shpnt) | |||
1573 | #endif | 1594 | #endif |
1574 | 1595 | ||
1575 | /* restore old command */ | 1596 | /* restore old command */ |
1576 | memcpy((void *) DONE_SC->cmnd, (void *) DONE_SC->data_cmnd, sizeof(DONE_SC->data_cmnd)); | 1597 | memcpy(cmd->cmnd, sc->cmnd, sizeof(sc->cmnd)); |
1577 | DONE_SC->request_buffer = DONE_SC->buffer; | 1598 | cmd->request_buffer = sc->request_buffer; |
1578 | DONE_SC->request_bufflen = DONE_SC->bufflen; | 1599 | cmd->request_bufflen = sc->request_bufflen; |
1579 | DONE_SC->use_sg = DONE_SC->old_use_sg; | 1600 | cmd->use_sg = sc->use_sg; |
1580 | DONE_SC->cmd_len = DONE_SC->old_cmd_len; | 1601 | cmd->cmd_len = sc->cmd_len; |
1581 | 1602 | ||
1582 | DONE_SC->SCp.Status = 0x02; | 1603 | cmd->SCp.Status = 0x02; |
1583 | 1604 | ||
1584 | HOSTDATA(shpnt)->commands--; | 1605 | HOSTDATA(shpnt)->commands--; |
1585 | if (!HOSTDATA(shpnt)->commands) | 1606 | if (!HOSTDATA(shpnt)->commands) |
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c index 77e7202a0eba..904c25fb4ba4 100644 --- a/drivers/scsi/ahci.c +++ b/drivers/scsi/ahci.c | |||
@@ -940,14 +940,8 @@ static void ahci_host_intr(struct ata_port *ap) | |||
940 | return; | 940 | return; |
941 | 941 | ||
942 | /* ignore interim PIO setup fis interrupts */ | 942 | /* ignore interim PIO setup fis interrupts */ |
943 | if (ata_tag_valid(ap->active_tag)) { | 943 | if (ata_tag_valid(ap->active_tag) && (status & PORT_IRQ_PIOS_FIS)) |
944 | struct ata_queued_cmd *qc = | 944 | return; |
945 | ata_qc_from_tag(ap, ap->active_tag); | ||
946 | |||
947 | if (qc && qc->tf.protocol == ATA_PROT_PIO && | ||
948 | (status & PORT_IRQ_PIOS_FIS)) | ||
949 | return; | ||
950 | } | ||
951 | 945 | ||
952 | if (ata_ratelimit()) | 946 | if (ata_ratelimit()) |
953 | ata_port_printk(ap, KERN_INFO, "spurious interrupt " | 947 | ata_port_printk(ap, KERN_INFO, "spurious interrupt " |
diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c index a1e8ca758594..653818d2f802 100644 --- a/drivers/scsi/aic7xxx/aic79xx_core.c +++ b/drivers/scsi/aic7xxx/aic79xx_core.c | |||
@@ -7289,7 +7289,7 @@ ahd_reset_cmds_pending(struct ahd_softc *ahd) | |||
7289 | ahd->flags &= ~AHD_UPDATE_PEND_CMDS; | 7289 | ahd->flags &= ~AHD_UPDATE_PEND_CMDS; |
7290 | } | 7290 | } |
7291 | 7291 | ||
7292 | void | 7292 | static void |
7293 | ahd_done_with_status(struct ahd_softc *ahd, struct scb *scb, uint32_t status) | 7293 | ahd_done_with_status(struct ahd_softc *ahd, struct scb *scb, uint32_t status) |
7294 | { | 7294 | { |
7295 | cam_status ostat; | 7295 | cam_status ostat; |
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c index b244c7124179..998999c0a972 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.c +++ b/drivers/scsi/aic7xxx/aic79xx_osm.c | |||
@@ -243,25 +243,6 @@ ahd_print_path(struct ahd_softc *ahd, struct scb *scb) | |||
243 | static uint32_t aic79xx_no_reset; | 243 | static uint32_t aic79xx_no_reset; |
244 | 244 | ||
245 | /* | 245 | /* |
246 | * Certain PCI motherboards will scan PCI devices from highest to lowest, | ||
247 | * others scan from lowest to highest, and they tend to do all kinds of | ||
248 | * strange things when they come into contact with PCI bridge chips. The | ||
249 | * net result of all this is that the PCI card that is actually used to boot | ||
250 | * the machine is very hard to detect. Most motherboards go from lowest | ||
251 | * PCI slot number to highest, and the first SCSI controller found is the | ||
252 | * one you boot from. The only exceptions to this are when a controller | ||
253 | * has its BIOS disabled. So, we by default sort all of our SCSI controllers | ||
254 | * from lowest PCI slot number to highest PCI slot number. We also force | ||
255 | * all controllers with their BIOS disabled to the end of the list. This | ||
256 | * works on *almost* all computers. Where it doesn't work, we have this | ||
257 | * option. Setting this option to non-0 will reverse the order of the sort | ||
258 | * to highest first, then lowest, but will still leave cards with their BIOS | ||
259 | * disabled at the very end. That should fix everyone up unless there are | ||
260 | * really strange cirumstances. | ||
261 | */ | ||
262 | static uint32_t aic79xx_reverse_scan; | ||
263 | |||
264 | /* | ||
265 | * Should we force EXTENDED translation on a controller. | 246 | * Should we force EXTENDED translation on a controller. |
266 | * 0 == Use whatever is in the SEEPROM or default to off | 247 | * 0 == Use whatever is in the SEEPROM or default to off |
267 | * 1 == Use whatever is in the SEEPROM or default to on | 248 | * 1 == Use whatever is in the SEEPROM or default to on |
@@ -350,7 +331,6 @@ MODULE_PARM_DESC(aic79xx, | |||
350 | " periodically to prevent tag starvation.\n" | 331 | " periodically to prevent tag starvation.\n" |
351 | " This may be required by some older disk\n" | 332 | " This may be required by some older disk\n" |
352 | " or drives/RAID arrays.\n" | 333 | " or drives/RAID arrays.\n" |
353 | " reverse_scan Sort PCI devices highest Bus/Slot to lowest\n" | ||
354 | " tag_info:<tag_str> Set per-target tag depth\n" | 334 | " tag_info:<tag_str> Set per-target tag depth\n" |
355 | " global_tag_depth:<int> Global tag depth for all targets on all buses\n" | 335 | " global_tag_depth:<int> Global tag depth for all targets on all buses\n" |
356 | " slewrate:<slewrate_list>Set the signal slew rate (0-15).\n" | 336 | " slewrate:<slewrate_list>Set the signal slew rate (0-15).\n" |
@@ -1031,7 +1011,6 @@ aic79xx_setup(char *s) | |||
1031 | #ifdef AHD_DEBUG | 1011 | #ifdef AHD_DEBUG |
1032 | { "debug", &ahd_debug }, | 1012 | { "debug", &ahd_debug }, |
1033 | #endif | 1013 | #endif |
1034 | { "reverse_scan", &aic79xx_reverse_scan }, | ||
1035 | { "periodic_otag", &aic79xx_periodic_otag }, | 1014 | { "periodic_otag", &aic79xx_periodic_otag }, |
1036 | { "pci_parity", &aic79xx_pci_parity }, | 1015 | { "pci_parity", &aic79xx_pci_parity }, |
1037 | { "seltime", &aic79xx_seltime }, | 1016 | { "seltime", &aic79xx_seltime }, |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c index debf3e2a0798..aa4be8a31415 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c | |||
@@ -353,7 +353,6 @@ MODULE_PARM_DESC(aic7xxx, | |||
353 | " periodically to prevent tag starvation.\n" | 353 | " periodically to prevent tag starvation.\n" |
354 | " This may be required by some older disk\n" | 354 | " This may be required by some older disk\n" |
355 | " drives or RAID arrays.\n" | 355 | " drives or RAID arrays.\n" |
356 | " reverse_scan Sort PCI devices highest Bus/Slot to lowest\n" | ||
357 | " tag_info:<tag_str> Set per-target tag depth\n" | 356 | " tag_info:<tag_str> Set per-target tag depth\n" |
358 | " global_tag_depth:<int> Global tag depth for every target\n" | 357 | " global_tag_depth:<int> Global tag depth for every target\n" |
359 | " on every bus\n" | 358 | " on every bus\n" |
diff --git a/drivers/scsi/aic7xxx/aicasm/Makefile b/drivers/scsi/aic7xxx/aicasm/Makefile index 8c91fda6482c..b98c5c1056c3 100644 --- a/drivers/scsi/aic7xxx/aicasm/Makefile +++ b/drivers/scsi/aic7xxx/aicasm/Makefile | |||
@@ -14,6 +14,8 @@ LIBS= -ldb | |||
14 | clean-files:= ${GENSRCS} ${GENHDRS} $(YSRCS:.y=.output) $(PROG) | 14 | clean-files:= ${GENSRCS} ${GENHDRS} $(YSRCS:.y=.output) $(PROG) |
15 | # Override default kernel CFLAGS. This is a userland app. | 15 | # Override default kernel CFLAGS. This is a userland app. |
16 | AICASM_CFLAGS:= -I/usr/include -I. | 16 | AICASM_CFLAGS:= -I/usr/include -I. |
17 | LEX= flex | ||
18 | YACC= bison | ||
17 | YFLAGS= -d | 19 | YFLAGS= -d |
18 | 20 | ||
19 | NOMAN= noman | 21 | NOMAN= noman |
diff --git a/drivers/scsi/arm/Kconfig b/drivers/scsi/arm/Kconfig index 06d7601cdf56..d006a8cb4a74 100644 --- a/drivers/scsi/arm/Kconfig +++ b/drivers/scsi/arm/Kconfig | |||
@@ -69,6 +69,7 @@ comment "The following drivers are not fully supported" | |||
69 | config SCSI_CUMANA_1 | 69 | config SCSI_CUMANA_1 |
70 | tristate "CumanaSCSI I support (EXPERIMENTAL)" | 70 | tristate "CumanaSCSI I support (EXPERIMENTAL)" |
71 | depends on ARCH_ACORN && EXPERIMENTAL && SCSI | 71 | depends on ARCH_ACORN && EXPERIMENTAL && SCSI |
72 | select SCSI_SPI_ATTRS | ||
72 | help | 73 | help |
73 | This enables support for the Cumana SCSI I card. If you have an | 74 | This enables support for the Cumana SCSI I card. If you have an |
74 | Acorn system with one of these, say Y. If unsure, say N. | 75 | Acorn system with one of these, say Y. If unsure, say N. |
@@ -76,6 +77,7 @@ config SCSI_CUMANA_1 | |||
76 | config SCSI_ECOSCSI | 77 | config SCSI_ECOSCSI |
77 | tristate "EcoScsi support (EXPERIMENTAL)" | 78 | tristate "EcoScsi support (EXPERIMENTAL)" |
78 | depends on ARCH_ACORN && EXPERIMENTAL && (ARCH_ARC || ARCH_A5K) && SCSI | 79 | depends on ARCH_ACORN && EXPERIMENTAL && (ARCH_ARC || ARCH_A5K) && SCSI |
80 | select SCSI_SPI_ATTRS | ||
79 | help | 81 | help |
80 | This enables support for the EcoSCSI card -- a small card that sits | 82 | This enables support for the EcoSCSI card -- a small card that sits |
81 | in the Econet socket. If you have an Acorn system with one of these, | 83 | in the Econet socket. If you have an Acorn system with one of these, |
@@ -84,6 +86,7 @@ config SCSI_ECOSCSI | |||
84 | config SCSI_OAK1 | 86 | config SCSI_OAK1 |
85 | tristate "Oak SCSI support (EXPERIMENTAL)" | 87 | tristate "Oak SCSI support (EXPERIMENTAL)" |
86 | depends on ARCH_ACORN && EXPERIMENTAL && SCSI | 88 | depends on ARCH_ACORN && EXPERIMENTAL && SCSI |
89 | select SCSI_SPI_ATTRS | ||
87 | help | 90 | help |
88 | This enables support for the Oak SCSI card. If you have an Acorn | 91 | This enables support for the Oak SCSI card. If you have an Acorn |
89 | system with one of these, say Y. If unsure, say N. | 92 | system with one of these, say Y. If unsure, say N. |
diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c index 3e1053f111dc..4cf7afc31cc7 100644 --- a/drivers/scsi/arm/fas216.c +++ b/drivers/scsi/arm/fas216.c | |||
@@ -2427,7 +2427,7 @@ int fas216_eh_abort(Scsi_Cmnd *SCpnt) | |||
2427 | info->stats.aborts += 1; | 2427 | info->stats.aborts += 1; |
2428 | 2428 | ||
2429 | printk(KERN_WARNING "scsi%d: abort command ", info->host->host_no); | 2429 | printk(KERN_WARNING "scsi%d: abort command ", info->host->host_no); |
2430 | __scsi_print_command(SCpnt->data_cmnd); | 2430 | __scsi_print_command(SCpnt->cmnd); |
2431 | 2431 | ||
2432 | print_debug_list(); | 2432 | print_debug_list(); |
2433 | fas216_dumpstate(info); | 2433 | fas216_dumpstate(info); |
diff --git a/drivers/scsi/arm/scsi.h b/drivers/scsi/arm/scsi.h index 6dd544a5eb56..8c2600ffc6af 100644 --- a/drivers/scsi/arm/scsi.h +++ b/drivers/scsi/arm/scsi.h | |||
@@ -74,7 +74,7 @@ static inline void init_SCp(Scsi_Cmnd *SCpnt) | |||
74 | unsigned long len = 0; | 74 | unsigned long len = 0; |
75 | int buf; | 75 | int buf; |
76 | 76 | ||
77 | SCpnt->SCp.buffer = (struct scatterlist *) SCpnt->buffer; | 77 | SCpnt->SCp.buffer = (struct scatterlist *) SCpnt->request_buffer; |
78 | SCpnt->SCp.buffers_residual = SCpnt->use_sg - 1; | 78 | SCpnt->SCp.buffers_residual = SCpnt->use_sg - 1; |
79 | SCpnt->SCp.ptr = (char *) | 79 | SCpnt->SCp.ptr = (char *) |
80 | (page_address(SCpnt->SCp.buffer->page) + | 80 | (page_address(SCpnt->SCp.buffer->page) + |
diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c index 94b1261a259d..5e8afc876980 100644 --- a/drivers/scsi/ata_piix.c +++ b/drivers/scsi/ata_piix.c | |||
@@ -105,9 +105,6 @@ enum { | |||
105 | PIIX_FLAG_SCR = (1 << 26), /* SCR available */ | 105 | PIIX_FLAG_SCR = (1 << 26), /* SCR available */ |
106 | PIIX_FLAG_AHCI = (1 << 27), /* AHCI possible */ | 106 | PIIX_FLAG_AHCI = (1 << 27), /* AHCI possible */ |
107 | PIIX_FLAG_CHECKINTR = (1 << 28), /* make sure PCI INTx enabled */ | 107 | PIIX_FLAG_CHECKINTR = (1 << 28), /* make sure PCI INTx enabled */ |
108 | PIIX_FLAG_COMBINED = (1 << 29), /* combined mode possible */ | ||
109 | /* ICH6/7 use different scheme for map value */ | ||
110 | PIIX_FLAG_COMBINED_ICH6 = PIIX_FLAG_COMBINED | (1 << 30), | ||
111 | 108 | ||
112 | /* combined mode. if set, PATA is channel 0. | 109 | /* combined mode. if set, PATA is channel 0. |
113 | * if clear, PATA is channel 1. | 110 | * if clear, PATA is channel 1. |
@@ -126,6 +123,7 @@ enum { | |||
126 | ich6_sata = 4, | 123 | ich6_sata = 4, |
127 | ich6_sata_ahci = 5, | 124 | ich6_sata_ahci = 5, |
128 | ich6m_sata_ahci = 6, | 125 | ich6m_sata_ahci = 6, |
126 | ich8_sata_ahci = 7, | ||
129 | 127 | ||
130 | /* constants for mapping table */ | 128 | /* constants for mapping table */ |
131 | P0 = 0, /* port 0 */ | 129 | P0 = 0, /* port 0 */ |
@@ -141,11 +139,19 @@ enum { | |||
141 | 139 | ||
142 | struct piix_map_db { | 140 | struct piix_map_db { |
143 | const u32 mask; | 141 | const u32 mask; |
142 | const u16 port_enable; | ||
143 | const int present_shift; | ||
144 | const int map[][4]; | 144 | const int map[][4]; |
145 | }; | 145 | }; |
146 | 146 | ||
147 | struct piix_host_priv { | ||
148 | const int *map; | ||
149 | const struct piix_map_db *map_db; | ||
150 | }; | ||
151 | |||
147 | static int piix_init_one (struct pci_dev *pdev, | 152 | static int piix_init_one (struct pci_dev *pdev, |
148 | const struct pci_device_id *ent); | 153 | const struct pci_device_id *ent); |
154 | static void piix_host_stop(struct ata_host_set *host_set); | ||
149 | static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev); | 155 | static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev); |
150 | static void piix_set_dmamode (struct ata_port *ap, struct ata_device *adev); | 156 | static void piix_set_dmamode (struct ata_port *ap, struct ata_device *adev); |
151 | static void piix_pata_error_handler(struct ata_port *ap); | 157 | static void piix_pata_error_handler(struct ata_port *ap); |
@@ -186,11 +192,11 @@ static const struct pci_device_id piix_pci_tbl[] = { | |||
186 | /* Enterprise Southbridge 2 (where's the datasheet?) */ | 192 | /* Enterprise Southbridge 2 (where's the datasheet?) */ |
187 | { 0x8086, 0x2680, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci }, | 193 | { 0x8086, 0x2680, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci }, |
188 | /* SATA Controller 1 IDE (ICH8, no datasheet yet) */ | 194 | /* SATA Controller 1 IDE (ICH8, no datasheet yet) */ |
189 | { 0x8086, 0x2820, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci }, | 195 | { 0x8086, 0x2820, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, |
190 | /* SATA Controller 2 IDE (ICH8, ditto) */ | 196 | /* SATA Controller 2 IDE (ICH8, ditto) */ |
191 | { 0x8086, 0x2825, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci }, | 197 | { 0x8086, 0x2825, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, |
192 | /* Mobile SATA Controller IDE (ICH8M, ditto) */ | 198 | /* Mobile SATA Controller IDE (ICH8M, ditto) */ |
193 | { 0x8086, 0x2828, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6m_sata_ahci }, | 199 | { 0x8086, 0x2828, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, |
194 | 200 | ||
195 | { } /* terminate list */ | 201 | { } /* terminate list */ |
196 | }; | 202 | }; |
@@ -254,7 +260,7 @@ static const struct ata_port_operations piix_pata_ops = { | |||
254 | 260 | ||
255 | .port_start = ata_port_start, | 261 | .port_start = ata_port_start, |
256 | .port_stop = ata_port_stop, | 262 | .port_stop = ata_port_stop, |
257 | .host_stop = ata_host_stop, | 263 | .host_stop = piix_host_stop, |
258 | }; | 264 | }; |
259 | 265 | ||
260 | static const struct ata_port_operations piix_sata_ops = { | 266 | static const struct ata_port_operations piix_sata_ops = { |
@@ -284,11 +290,13 @@ static const struct ata_port_operations piix_sata_ops = { | |||
284 | 290 | ||
285 | .port_start = ata_port_start, | 291 | .port_start = ata_port_start, |
286 | .port_stop = ata_port_stop, | 292 | .port_stop = ata_port_stop, |
287 | .host_stop = ata_host_stop, | 293 | .host_stop = piix_host_stop, |
288 | }; | 294 | }; |
289 | 295 | ||
290 | static struct piix_map_db ich5_map_db = { | 296 | static const struct piix_map_db ich5_map_db = { |
291 | .mask = 0x7, | 297 | .mask = 0x7, |
298 | .port_enable = 0x3, | ||
299 | .present_shift = 4, | ||
292 | .map = { | 300 | .map = { |
293 | /* PM PS SM SS MAP */ | 301 | /* PM PS SM SS MAP */ |
294 | { P0, NA, P1, NA }, /* 000b */ | 302 | { P0, NA, P1, NA }, /* 000b */ |
@@ -302,8 +310,10 @@ static struct piix_map_db ich5_map_db = { | |||
302 | }, | 310 | }, |
303 | }; | 311 | }; |
304 | 312 | ||
305 | static struct piix_map_db ich6_map_db = { | 313 | static const struct piix_map_db ich6_map_db = { |
306 | .mask = 0x3, | 314 | .mask = 0x3, |
315 | .port_enable = 0xf, | ||
316 | .present_shift = 4, | ||
307 | .map = { | 317 | .map = { |
308 | /* PM PS SM SS MAP */ | 318 | /* PM PS SM SS MAP */ |
309 | { P0, P2, P1, P3 }, /* 00b */ | 319 | { P0, P2, P1, P3 }, /* 00b */ |
@@ -313,8 +323,10 @@ static struct piix_map_db ich6_map_db = { | |||
313 | }, | 323 | }, |
314 | }; | 324 | }; |
315 | 325 | ||
316 | static struct piix_map_db ich6m_map_db = { | 326 | static const struct piix_map_db ich6m_map_db = { |
317 | .mask = 0x3, | 327 | .mask = 0x3, |
328 | .port_enable = 0x5, | ||
329 | .present_shift = 4, | ||
318 | .map = { | 330 | .map = { |
319 | /* PM PS SM SS MAP */ | 331 | /* PM PS SM SS MAP */ |
320 | { P0, P2, RV, RV }, /* 00b */ | 332 | { P0, P2, RV, RV }, /* 00b */ |
@@ -324,6 +336,28 @@ static struct piix_map_db ich6m_map_db = { | |||
324 | }, | 336 | }, |
325 | }; | 337 | }; |
326 | 338 | ||
339 | static const struct piix_map_db ich8_map_db = { | ||
340 | .mask = 0x3, | ||
341 | .port_enable = 0x3, | ||
342 | .present_shift = 8, | ||
343 | .map = { | ||
344 | /* PM PS SM SS MAP */ | ||
345 | { P0, NA, P1, NA }, /* 00b (hardwired) */ | ||
346 | { RV, RV, RV, RV }, | ||
347 | { RV, RV, RV, RV }, /* 10b (never) */ | ||
348 | { RV, RV, RV, RV }, | ||
349 | }, | ||
350 | }; | ||
351 | |||
352 | static const struct piix_map_db *piix_map_db_table[] = { | ||
353 | [ich5_sata] = &ich5_map_db, | ||
354 | [esb_sata] = &ich5_map_db, | ||
355 | [ich6_sata] = &ich6_map_db, | ||
356 | [ich6_sata_ahci] = &ich6_map_db, | ||
357 | [ich6m_sata_ahci] = &ich6m_map_db, | ||
358 | [ich8_sata_ahci] = &ich8_map_db, | ||
359 | }; | ||
360 | |||
327 | static struct ata_port_info piix_port_info[] = { | 361 | static struct ata_port_info piix_port_info[] = { |
328 | /* piix4_pata */ | 362 | /* piix4_pata */ |
329 | { | 363 | { |
@@ -356,63 +390,69 @@ static struct ata_port_info piix_port_info[] = { | |||
356 | /* ich5_sata */ | 390 | /* ich5_sata */ |
357 | { | 391 | { |
358 | .sht = &piix_sht, | 392 | .sht = &piix_sht, |
359 | .host_flags = ATA_FLAG_SATA | PIIX_FLAG_COMBINED | | 393 | .host_flags = ATA_FLAG_SATA | PIIX_FLAG_CHECKINTR, |
360 | PIIX_FLAG_CHECKINTR, | ||
361 | .pio_mask = 0x1f, /* pio0-4 */ | 394 | .pio_mask = 0x1f, /* pio0-4 */ |
362 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 395 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
363 | .udma_mask = 0x7f, /* udma0-6 */ | 396 | .udma_mask = 0x7f, /* udma0-6 */ |
364 | .port_ops = &piix_sata_ops, | 397 | .port_ops = &piix_sata_ops, |
365 | .private_data = &ich5_map_db, | ||
366 | }, | 398 | }, |
367 | 399 | ||
368 | /* i6300esb_sata */ | 400 | /* i6300esb_sata */ |
369 | { | 401 | { |
370 | .sht = &piix_sht, | 402 | .sht = &piix_sht, |
371 | .host_flags = ATA_FLAG_SATA | PIIX_FLAG_COMBINED | | 403 | .host_flags = ATA_FLAG_SATA | |
372 | PIIX_FLAG_CHECKINTR | PIIX_FLAG_IGNORE_PCS, | 404 | PIIX_FLAG_CHECKINTR | PIIX_FLAG_IGNORE_PCS, |
373 | .pio_mask = 0x1f, /* pio0-4 */ | 405 | .pio_mask = 0x1f, /* pio0-4 */ |
374 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 406 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
375 | .udma_mask = 0x7f, /* udma0-6 */ | 407 | .udma_mask = 0x7f, /* udma0-6 */ |
376 | .port_ops = &piix_sata_ops, | 408 | .port_ops = &piix_sata_ops, |
377 | .private_data = &ich5_map_db, | ||
378 | }, | 409 | }, |
379 | 410 | ||
380 | /* ich6_sata */ | 411 | /* ich6_sata */ |
381 | { | 412 | { |
382 | .sht = &piix_sht, | 413 | .sht = &piix_sht, |
383 | .host_flags = ATA_FLAG_SATA | PIIX_FLAG_COMBINED_ICH6 | | 414 | .host_flags = ATA_FLAG_SATA | |
384 | PIIX_FLAG_CHECKINTR | PIIX_FLAG_SCR, | 415 | PIIX_FLAG_CHECKINTR | PIIX_FLAG_SCR, |
385 | .pio_mask = 0x1f, /* pio0-4 */ | 416 | .pio_mask = 0x1f, /* pio0-4 */ |
386 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 417 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
387 | .udma_mask = 0x7f, /* udma0-6 */ | 418 | .udma_mask = 0x7f, /* udma0-6 */ |
388 | .port_ops = &piix_sata_ops, | 419 | .port_ops = &piix_sata_ops, |
389 | .private_data = &ich6_map_db, | ||
390 | }, | 420 | }, |
391 | 421 | ||
392 | /* ich6_sata_ahci */ | 422 | /* ich6_sata_ahci */ |
393 | { | 423 | { |
394 | .sht = &piix_sht, | 424 | .sht = &piix_sht, |
395 | .host_flags = ATA_FLAG_SATA | PIIX_FLAG_COMBINED_ICH6 | | 425 | .host_flags = ATA_FLAG_SATA | |
396 | PIIX_FLAG_CHECKINTR | PIIX_FLAG_SCR | | 426 | PIIX_FLAG_CHECKINTR | PIIX_FLAG_SCR | |
397 | PIIX_FLAG_AHCI, | 427 | PIIX_FLAG_AHCI, |
398 | .pio_mask = 0x1f, /* pio0-4 */ | 428 | .pio_mask = 0x1f, /* pio0-4 */ |
399 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 429 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
400 | .udma_mask = 0x7f, /* udma0-6 */ | 430 | .udma_mask = 0x7f, /* udma0-6 */ |
401 | .port_ops = &piix_sata_ops, | 431 | .port_ops = &piix_sata_ops, |
402 | .private_data = &ich6_map_db, | ||
403 | }, | 432 | }, |
404 | 433 | ||
405 | /* ich6m_sata_ahci */ | 434 | /* ich6m_sata_ahci */ |
406 | { | 435 | { |
407 | .sht = &piix_sht, | 436 | .sht = &piix_sht, |
408 | .host_flags = ATA_FLAG_SATA | PIIX_FLAG_COMBINED_ICH6 | | 437 | .host_flags = ATA_FLAG_SATA | |
438 | PIIX_FLAG_CHECKINTR | PIIX_FLAG_SCR | | ||
439 | PIIX_FLAG_AHCI, | ||
440 | .pio_mask = 0x1f, /* pio0-4 */ | ||
441 | .mwdma_mask = 0x07, /* mwdma0-2 */ | ||
442 | .udma_mask = 0x7f, /* udma0-6 */ | ||
443 | .port_ops = &piix_sata_ops, | ||
444 | }, | ||
445 | |||
446 | /* ich8_sata_ahci */ | ||
447 | { | ||
448 | .sht = &piix_sht, | ||
449 | .host_flags = ATA_FLAG_SATA | | ||
409 | PIIX_FLAG_CHECKINTR | PIIX_FLAG_SCR | | 450 | PIIX_FLAG_CHECKINTR | PIIX_FLAG_SCR | |
410 | PIIX_FLAG_AHCI, | 451 | PIIX_FLAG_AHCI, |
411 | .pio_mask = 0x1f, /* pio0-4 */ | 452 | .pio_mask = 0x1f, /* pio0-4 */ |
412 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 453 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
413 | .udma_mask = 0x7f, /* udma0-6 */ | 454 | .udma_mask = 0x7f, /* udma0-6 */ |
414 | .port_ops = &piix_sata_ops, | 455 | .port_ops = &piix_sata_ops, |
415 | .private_data = &ich6m_map_db, | ||
416 | }, | 456 | }, |
417 | }; | 457 | }; |
418 | 458 | ||
@@ -508,46 +548,29 @@ static void piix_pata_error_handler(struct ata_port *ap) | |||
508 | static int piix_sata_prereset(struct ata_port *ap) | 548 | static int piix_sata_prereset(struct ata_port *ap) |
509 | { | 549 | { |
510 | struct pci_dev *pdev = to_pci_dev(ap->host_set->dev); | 550 | struct pci_dev *pdev = to_pci_dev(ap->host_set->dev); |
511 | const unsigned int *map = ap->host_set->private_data; | 551 | struct piix_host_priv *hpriv = ap->host_set->private_data; |
552 | const unsigned int *map = hpriv->map; | ||
512 | int base = 2 * ap->hard_port_no; | 553 | int base = 2 * ap->hard_port_no; |
513 | unsigned int present_mask = 0; | 554 | unsigned int present = 0; |
514 | int port, i; | 555 | int port, i; |
515 | u8 pcs; | 556 | u16 pcs; |
516 | 557 | ||
517 | pci_read_config_byte(pdev, ICH5_PCS, &pcs); | 558 | pci_read_config_word(pdev, ICH5_PCS, &pcs); |
518 | DPRINTK("ata%u: ENTER, pcs=0x%x base=%d\n", ap->id, pcs, base); | 559 | DPRINTK("ata%u: ENTER, pcs=0x%x base=%d\n", ap->id, pcs, base); |
519 | 560 | ||
520 | /* enable all ports on this ap and wait for them to settle */ | ||
521 | for (i = 0; i < 2; i++) { | ||
522 | port = map[base + i]; | ||
523 | if (port >= 0) | ||
524 | pcs |= 1 << port; | ||
525 | } | ||
526 | |||
527 | pci_write_config_byte(pdev, ICH5_PCS, pcs); | ||
528 | msleep(100); | ||
529 | |||
530 | /* let's see which devices are present */ | ||
531 | pci_read_config_byte(pdev, ICH5_PCS, &pcs); | ||
532 | |||
533 | for (i = 0; i < 2; i++) { | 561 | for (i = 0; i < 2; i++) { |
534 | port = map[base + i]; | 562 | port = map[base + i]; |
535 | if (port < 0) | 563 | if (port < 0) |
536 | continue; | 564 | continue; |
537 | if (ap->flags & PIIX_FLAG_IGNORE_PCS || pcs & 1 << (4 + port)) | 565 | if ((ap->flags & PIIX_FLAG_IGNORE_PCS) || |
538 | present_mask |= 1 << i; | 566 | (pcs & 1 << (hpriv->map_db->present_shift + port))) |
539 | else | 567 | present = 1; |
540 | pcs &= ~(1 << port); | ||
541 | } | 568 | } |
542 | 569 | ||
543 | /* disable offline ports on non-AHCI controllers */ | 570 | DPRINTK("ata%u: LEAVE, pcs=0x%x present=0x%x\n", |
544 | if (!(ap->flags & PIIX_FLAG_AHCI)) | 571 | ap->id, pcs, present); |
545 | pci_write_config_byte(pdev, ICH5_PCS, pcs); | ||
546 | |||
547 | DPRINTK("ata%u: LEAVE, pcs=0x%x present_mask=0x%x\n", | ||
548 | ap->id, pcs, present_mask); | ||
549 | 572 | ||
550 | if (!present_mask) { | 573 | if (!present) { |
551 | ata_port_printk(ap, KERN_INFO, "SATA port has no device.\n"); | 574 | ata_port_printk(ap, KERN_INFO, "SATA port has no device.\n"); |
552 | ap->eh_context.i.action &= ~ATA_EH_RESET_MASK; | 575 | ap->eh_context.i.action &= ~ATA_EH_RESET_MASK; |
553 | return 0; | 576 | return 0; |
@@ -761,10 +784,27 @@ static int __devinit piix_check_450nx_errata(struct pci_dev *ata_dev) | |||
761 | return no_piix_dma; | 784 | return no_piix_dma; |
762 | } | 785 | } |
763 | 786 | ||
787 | static void __devinit piix_init_pcs(struct pci_dev *pdev, | ||
788 | const struct piix_map_db *map_db) | ||
789 | { | ||
790 | u16 pcs, new_pcs; | ||
791 | |||
792 | pci_read_config_word(pdev, ICH5_PCS, &pcs); | ||
793 | |||
794 | new_pcs = pcs | map_db->port_enable; | ||
795 | |||
796 | if (new_pcs != pcs) { | ||
797 | DPRINTK("updating PCS from 0x%x to 0x%x\n", pcs, new_pcs); | ||
798 | pci_write_config_word(pdev, ICH5_PCS, new_pcs); | ||
799 | msleep(150); | ||
800 | } | ||
801 | } | ||
802 | |||
764 | static void __devinit piix_init_sata_map(struct pci_dev *pdev, | 803 | static void __devinit piix_init_sata_map(struct pci_dev *pdev, |
765 | struct ata_port_info *pinfo) | 804 | struct ata_port_info *pinfo, |
805 | const struct piix_map_db *map_db) | ||
766 | { | 806 | { |
767 | struct piix_map_db *map_db = pinfo[0].private_data; | 807 | struct piix_host_priv *hpriv = pinfo[0].private_data; |
768 | const unsigned int *map; | 808 | const unsigned int *map; |
769 | int i, invalid_map = 0; | 809 | int i, invalid_map = 0; |
770 | u8 map_value; | 810 | u8 map_value; |
@@ -788,6 +828,7 @@ static void __devinit piix_init_sata_map(struct pci_dev *pdev, | |||
788 | case IDE: | 828 | case IDE: |
789 | WARN_ON((i & 1) || map[i + 1] != IDE); | 829 | WARN_ON((i & 1) || map[i + 1] != IDE); |
790 | pinfo[i / 2] = piix_port_info[ich5_pata]; | 830 | pinfo[i / 2] = piix_port_info[ich5_pata]; |
831 | pinfo[i / 2].private_data = hpriv; | ||
791 | i++; | 832 | i++; |
792 | printk(" IDE IDE"); | 833 | printk(" IDE IDE"); |
793 | break; | 834 | break; |
@@ -805,8 +846,8 @@ static void __devinit piix_init_sata_map(struct pci_dev *pdev, | |||
805 | dev_printk(KERN_ERR, &pdev->dev, | 846 | dev_printk(KERN_ERR, &pdev->dev, |
806 | "invalid MAP value %u\n", map_value); | 847 | "invalid MAP value %u\n", map_value); |
807 | 848 | ||
808 | pinfo[0].private_data = (void *)map; | 849 | hpriv->map = map; |
809 | pinfo[1].private_data = (void *)map; | 850 | hpriv->map_db = map_db; |
810 | } | 851 | } |
811 | 852 | ||
812 | /** | 853 | /** |
@@ -829,6 +870,7 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
829 | static int printed_version; | 870 | static int printed_version; |
830 | struct ata_port_info port_info[2]; | 871 | struct ata_port_info port_info[2]; |
831 | struct ata_port_info *ppinfo[2] = { &port_info[0], &port_info[1] }; | 872 | struct ata_port_info *ppinfo[2] = { &port_info[0], &port_info[1] }; |
873 | struct piix_host_priv *hpriv; | ||
832 | unsigned long host_flags; | 874 | unsigned long host_flags; |
833 | 875 | ||
834 | if (!printed_version++) | 876 | if (!printed_version++) |
@@ -839,8 +881,14 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
839 | if (!in_module_init) | 881 | if (!in_module_init) |
840 | return -ENODEV; | 882 | return -ENODEV; |
841 | 883 | ||
884 | hpriv = kzalloc(sizeof(*hpriv), GFP_KERNEL); | ||
885 | if (!hpriv) | ||
886 | return -ENOMEM; | ||
887 | |||
842 | port_info[0] = piix_port_info[ent->driver_data]; | 888 | port_info[0] = piix_port_info[ent->driver_data]; |
843 | port_info[1] = piix_port_info[ent->driver_data]; | 889 | port_info[1] = piix_port_info[ent->driver_data]; |
890 | port_info[0].private_data = hpriv; | ||
891 | port_info[1].private_data = hpriv; | ||
844 | 892 | ||
845 | host_flags = port_info[0].host_flags; | 893 | host_flags = port_info[0].host_flags; |
846 | 894 | ||
@@ -855,8 +903,11 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
855 | } | 903 | } |
856 | 904 | ||
857 | /* Initialize SATA map */ | 905 | /* Initialize SATA map */ |
858 | if (host_flags & ATA_FLAG_SATA) | 906 | if (host_flags & ATA_FLAG_SATA) { |
859 | piix_init_sata_map(pdev, port_info); | 907 | piix_init_sata_map(pdev, port_info, |
908 | piix_map_db_table[ent->driver_data]); | ||
909 | piix_init_pcs(pdev, piix_map_db_table[ent->driver_data]); | ||
910 | } | ||
860 | 911 | ||
861 | /* On ICH5, some BIOSen disable the interrupt using the | 912 | /* On ICH5, some BIOSen disable the interrupt using the |
862 | * PCI_COMMAND_INTX_DISABLE bit added in PCI 2.3. | 913 | * PCI_COMMAND_INTX_DISABLE bit added in PCI 2.3. |
@@ -879,6 +930,13 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
879 | return ata_pci_init_one(pdev, ppinfo, 2); | 930 | return ata_pci_init_one(pdev, ppinfo, 2); |
880 | } | 931 | } |
881 | 932 | ||
933 | static void piix_host_stop(struct ata_host_set *host_set) | ||
934 | { | ||
935 | if (host_set->next == NULL) | ||
936 | kfree(host_set->private_data); | ||
937 | ata_host_stop(host_set); | ||
938 | } | ||
939 | |||
882 | static int __init piix_init(void) | 940 | static int __init piix_init(void) |
883 | { | 941 | { |
884 | int rc; | 942 | int rc; |
diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c index 007a14e5c3fd..e397129c90d1 100644 --- a/drivers/scsi/atari_NCR5380.c +++ b/drivers/scsi/atari_NCR5380.c | |||
@@ -507,7 +507,7 @@ static __inline__ void initialize_SCp(Scsi_Cmnd *cmd) | |||
507 | */ | 507 | */ |
508 | 508 | ||
509 | if (cmd->use_sg) { | 509 | if (cmd->use_sg) { |
510 | cmd->SCp.buffer = (struct scatterlist *) cmd->buffer; | 510 | cmd->SCp.buffer = (struct scatterlist *) cmd->request_buffer; |
511 | cmd->SCp.buffers_residual = cmd->use_sg - 1; | 511 | cmd->SCp.buffers_residual = cmd->use_sg - 1; |
512 | cmd->SCp.ptr = (char *)page_address(cmd->SCp.buffer->page)+ | 512 | cmd->SCp.ptr = (char *)page_address(cmd->SCp.buffer->page)+ |
513 | cmd->SCp.buffer->offset; | 513 | cmd->SCp.buffer->offset; |
diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c index dddd2acce76f..61f6024b61ba 100644 --- a/drivers/scsi/constants.c +++ b/drivers/scsi/constants.c | |||
@@ -5,6 +5,7 @@ | |||
5 | * Additions for SCSI 3+ (SPC-3 T10/1416-D Rev 07 3 May 2002) | 5 | * Additions for SCSI 3+ (SPC-3 T10/1416-D Rev 07 3 May 2002) |
6 | * by D. Gilbert and aeb (20020609) | 6 | * by D. Gilbert and aeb (20020609) |
7 | * Additions for SPC-3 T10/1416-D Rev 21 22 Sept 2004, D. Gilbert 20041025 | 7 | * Additions for SPC-3 T10/1416-D Rev 21 22 Sept 2004, D. Gilbert 20041025 |
8 | * Update to SPC-4 T10/1713-D Rev 5a, 14 June 2006, D. Gilbert 20060702 | ||
8 | */ | 9 | */ |
9 | 10 | ||
10 | #include <linux/blkdev.h> | 11 | #include <linux/blkdev.h> |
@@ -36,55 +37,56 @@ static const char * cdb_byte0_names[] = { | |||
36 | /* 00-03 */ "Test Unit Ready", "Rezero Unit/Rewind", NULL, "Request Sense", | 37 | /* 00-03 */ "Test Unit Ready", "Rezero Unit/Rewind", NULL, "Request Sense", |
37 | /* 04-07 */ "Format Unit/Medium", "Read Block Limits", NULL, | 38 | /* 04-07 */ "Format Unit/Medium", "Read Block Limits", NULL, |
38 | "Reasssign Blocks", | 39 | "Reasssign Blocks", |
39 | /* 08-0d */ "Read (6)", NULL, "Write (6)", "Seek (6)", NULL, NULL, | 40 | /* 08-0d */ "Read(6)", NULL, "Write(6)", "Seek(6)", NULL, NULL, |
40 | /* 0e-12 */ NULL, "Read Reverse", "Write Filemarks", "Space", "Inquiry", | 41 | /* 0e-12 */ NULL, "Read Reverse", "Write Filemarks", "Space", "Inquiry", |
41 | /* 13-16 */ "Verify (6)", "Recover Buffered Data", "Mode Select (6)", | 42 | /* 13-16 */ "Verify(6)", "Recover Buffered Data", "Mode Select(6)", |
42 | "Reserve (6)", | 43 | "Reserve(6)", |
43 | /* 17-1a */ "Release (6)", "Copy", "Erase", "Mode Sense (6)", | 44 | /* 17-1a */ "Release(6)", "Copy", "Erase", "Mode Sense(6)", |
44 | /* 1b-1d */ "Start/Stop Unit", "Receive Diagnostic", "Send Diagnostic", | 45 | /* 1b-1d */ "Start/Stop Unit", "Receive Diagnostic", "Send Diagnostic", |
45 | /* 1e-1f */ "Prevent/Allow Medium Removal", NULL, | 46 | /* 1e-1f */ "Prevent/Allow Medium Removal", NULL, |
46 | /* 20-22 */ NULL, NULL, NULL, | 47 | /* 20-22 */ NULL, NULL, NULL, |
47 | /* 23-28 */ "Read Format Capacities", "Set Window", | 48 | /* 23-28 */ "Read Format Capacities", "Set Window", |
48 | "Read Capacity (10)", NULL, NULL, "Read (10)", | 49 | "Read Capacity(10)", NULL, NULL, "Read(10)", |
49 | /* 29-2d */ "Read Generation", "Write (10)", "Seek (10)", "Erase (10)", | 50 | /* 29-2d */ "Read Generation", "Write(10)", "Seek(10)", "Erase(10)", |
50 | "Read updated block", | 51 | "Read updated block", |
51 | /* 2e-31 */ "Write Verify (10)", "Verify (10)", "Search High", "Search Equal", | 52 | /* 2e-31 */ "Write Verify(10)", "Verify(10)", "Search High", "Search Equal", |
52 | /* 32-34 */ "Search Low", "Set Limits", "Prefetch/Read Position", | 53 | /* 32-34 */ "Search Low", "Set Limits", "Prefetch/Read Position", |
53 | /* 35-37 */ "Synchronize Cache (10)", "Lock/Unlock Cache (10)", | 54 | /* 35-37 */ "Synchronize Cache(10)", "Lock/Unlock Cache(10)", |
54 | "Read Defect Data(10)", | 55 | "Read Defect Data(10)", |
55 | /* 38-3c */ "Medium Scan", "Compare", "Copy Verify", "Write Buffer", | 56 | /* 38-3c */ "Medium Scan", "Compare", "Copy Verify", "Write Buffer", |
56 | "Read Buffer", | 57 | "Read Buffer", |
57 | /* 3d-3f */ "Update Block", "Read Long (10)", "Write Long (10)", | 58 | /* 3d-3f */ "Update Block", "Read Long(10)", "Write Long(10)", |
58 | /* 40-41 */ "Change Definition", "Write Same (10)", | 59 | /* 40-41 */ "Change Definition", "Write Same(10)", |
59 | /* 42-48 */ "Read sub-channel", "Read TOC/PMA/ATIP", "Read density support", | 60 | /* 42-48 */ "Read sub-channel", "Read TOC/PMA/ATIP", "Read density support", |
60 | "Play audio (10)", "Get configuration", "Play audio msf", | 61 | "Play audio(10)", "Get configuration", "Play audio msf", |
61 | "Play audio track/index", | 62 | "Play audio track/index", |
62 | /* 49-4f */ "Play track relative (10)", "Get event status notification", | 63 | /* 49-4f */ "Play track relative(10)", "Get event status notification", |
63 | "Pause/resume", "Log Select", "Log Sense", "Stop play/scan", | 64 | "Pause/resume", "Log Select", "Log Sense", "Stop play/scan", |
64 | NULL, | 65 | NULL, |
65 | /* 50-55 */ "Xdwrite", "Xpwrite, Read disk info", "Xdread, Read track info", | 66 | /* 50-55 */ "Xdwrite", "Xpwrite, Read disk info", "Xdread, Read track info", |
66 | "Reserve track", "Send OPC info", "Mode Select (10)", | 67 | "Reserve track", "Send OPC info", "Mode Select(10)", |
67 | /* 56-5b */ "Reserve (10)", "Release (10)", "Repair track", "Read master cue", | 68 | /* 56-5b */ "Reserve(10)", "Release(10)", "Repair track", "Read master cue", |
68 | "Mode Sense (10)", "Close track/session", | 69 | "Mode Sense(10)", "Close track/session", |
69 | /* 5c-5f */ "Read buffer capacity", "Send cue sheet", "Persistent reserve in", | 70 | /* 5c-5f */ "Read buffer capacity", "Send cue sheet", "Persistent reserve in", |
70 | "Persistent reserve out", | 71 | "Persistent reserve out", |
71 | /* 60-67 */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | 72 | /* 60-67 */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
72 | /* 68-6f */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | 73 | /* 68-6f */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
73 | /* 70-77 */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | 74 | /* 70-77 */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
74 | /* 78-7f */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, "Variable length", | 75 | /* 78-7f */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, "Variable length", |
75 | /* 80-84 */ "Xdwrite (16)", "Rebuild (16)", "Regenerate (16)", "Extended copy", | 76 | /* 80-84 */ "Xdwrite(16)", "Rebuild(16)", "Regenerate(16)", "Extended copy", |
76 | "Receive copy results", | 77 | "Receive copy results", |
77 | /* 85-89 */ "Memory Export In (16)", "Access control in", "Access control out", | 78 | /* 85-89 */ "ATA command pass through(16)", "Access control in", |
78 | "Read (16)", "Memory Export Out (16)", | 79 | "Access control out", "Read(16)", "Memory Export Out(16)", |
79 | /* 8a-8f */ "Write (16)", NULL, "Read attributes", "Write attributes", | 80 | /* 8a-8f */ "Write(16)", NULL, "Read attributes", "Write attributes", |
80 | "Write and verify (16)", "Verify (16)", | 81 | "Write and verify(16)", "Verify(16)", |
81 | /* 90-94 */ "Pre-fetch (16)", "Synchronize cache (16)", | 82 | /* 90-94 */ "Pre-fetch(16)", "Synchronize cache(16)", |
82 | "Lock/unlock cache (16)", "Write same (16)", NULL, | 83 | "Lock/unlock cache(16)", "Write same(16)", NULL, |
83 | /* 95-99 */ NULL, NULL, NULL, NULL, NULL, | 84 | /* 95-99 */ NULL, NULL, NULL, NULL, NULL, |
84 | /* 9a-9f */ NULL, NULL, NULL, NULL, "Service action in (16)", | 85 | /* 9a-9f */ NULL, NULL, NULL, NULL, "Service action in(16)", |
85 | "Service action out (16)", | 86 | "Service action out(16)", |
86 | /* a0-a5 */ "Report luns", "Blank", "Send event", "Maintenance in", | 87 | /* a0-a5 */ "Report luns", "ATA command pass through(12)/Blank", |
87 | "Maintenance out", "Move medium/play audio(12)", | 88 | "Security protocol in", "Maintenance in", "Maintenance out", |
89 | "Move medium/play audio(12)", | ||
88 | /* a6-a9 */ "Exchange medium", "Move medium attached", "Read(12)", | 90 | /* a6-a9 */ "Exchange medium", "Move medium attached", "Read(12)", |
89 | "Play track relative(12)", | 91 | "Play track relative(12)", |
90 | /* aa-ae */ "Write(12)", NULL, "Erase(12), Get Performance", | 92 | /* aa-ae */ "Write(12)", NULL, "Erase(12), Get Performance", |
@@ -92,12 +94,12 @@ static const char * cdb_byte0_names[] = { | |||
92 | /* af-b1 */ "Verify(12)", "Search data high(12)", "Search data equal(12)", | 94 | /* af-b1 */ "Verify(12)", "Search data high(12)", "Search data equal(12)", |
93 | /* b2-b4 */ "Search data low(12)", "Set limits(12)", | 95 | /* b2-b4 */ "Search data low(12)", "Set limits(12)", |
94 | "Read element status attached", | 96 | "Read element status attached", |
95 | /* b5-b6 */ "Request volume element address", "Send volume tag, set streaming", | 97 | /* b5-b6 */ "Security protocol out", "Send volume tag, set streaming", |
96 | /* b7-b9 */ "Read defect data(12)", "Read element status", "Read CD msf", | 98 | /* b7-b9 */ "Read defect data(12)", "Read element status", "Read CD msf", |
97 | /* ba-bc */ "Redundancy group (in), Scan", | 99 | /* ba-bc */ "Redundancy group (in), Scan", |
98 | "Redundancy group (out), Set cd-rom speed", "Spare in, Play cd", | 100 | "Redundancy group (out), Set cd-rom speed", "Spare (in), Play cd", |
99 | /* bd-bf */ "Spare out, Mechanism status", "Volume set in, Read cd", | 101 | /* bd-bf */ "Spare (out), Mechanism status", "Volume set (in), Read cd", |
100 | "Volume set out, Send DVD structure", | 102 | "Volume set (out), Send DVD structure", |
101 | }; | 103 | }; |
102 | 104 | ||
103 | struct value_name_pair { | 105 | struct value_name_pair { |
@@ -112,6 +114,7 @@ static const struct value_name_pair maint_in_arr[] = { | |||
112 | {0xc, "Report supported operation codes"}, | 114 | {0xc, "Report supported operation codes"}, |
113 | {0xd, "Report supported task management functions"}, | 115 | {0xd, "Report supported task management functions"}, |
114 | {0xe, "Report priority"}, | 116 | {0xe, "Report priority"}, |
117 | {0xf, "Report timestamp"}, | ||
115 | }; | 118 | }; |
116 | #define MAINT_IN_SZ ARRAY_SIZE(maint_in_arr) | 119 | #define MAINT_IN_SZ ARRAY_SIZE(maint_in_arr) |
117 | 120 | ||
@@ -120,6 +123,7 @@ static const struct value_name_pair maint_out_arr[] = { | |||
120 | {0xa, "Set target port groups"}, | 123 | {0xa, "Set target port groups"}, |
121 | {0xb, "Change aliases"}, | 124 | {0xb, "Change aliases"}, |
122 | {0xe, "Set priority"}, | 125 | {0xe, "Set priority"}, |
126 | {0xe, "Set timestamp"}, | ||
123 | }; | 127 | }; |
124 | #define MAINT_OUT_SZ ARRAY_SIZE(maint_out_arr) | 128 | #define MAINT_OUT_SZ ARRAY_SIZE(maint_out_arr) |
125 | 129 | ||
@@ -427,6 +431,7 @@ static struct error_info additional[] = | |||
427 | {0x001A, "Rewind operation in progress"}, | 431 | {0x001A, "Rewind operation in progress"}, |
428 | {0x001B, "Set capacity operation in progress"}, | 432 | {0x001B, "Set capacity operation in progress"}, |
429 | {0x001C, "Verify operation in progress"}, | 433 | {0x001C, "Verify operation in progress"}, |
434 | {0x001D, "ATA pass through information available"}, | ||
430 | 435 | ||
431 | {0x0100, "No index/sector signal"}, | 436 | {0x0100, "No index/sector signal"}, |
432 | 437 | ||
@@ -438,7 +443,7 @@ static struct error_info additional[] = | |||
438 | 443 | ||
439 | {0x0400, "Logical unit not ready, cause not reportable"}, | 444 | {0x0400, "Logical unit not ready, cause not reportable"}, |
440 | {0x0401, "Logical unit is in process of becoming ready"}, | 445 | {0x0401, "Logical unit is in process of becoming ready"}, |
441 | {0x0402, "Logical unit not ready, initializing cmd. required"}, | 446 | {0x0402, "Logical unit not ready, initializing command required"}, |
442 | {0x0403, "Logical unit not ready, manual intervention required"}, | 447 | {0x0403, "Logical unit not ready, manual intervention required"}, |
443 | {0x0404, "Logical unit not ready, format in progress"}, | 448 | {0x0404, "Logical unit not ready, format in progress"}, |
444 | {0x0405, "Logical unit not ready, rebuild in progress"}, | 449 | {0x0405, "Logical unit not ready, rebuild in progress"}, |
@@ -478,6 +483,9 @@ static struct error_info additional[] = | |||
478 | {0x0B00, "Warning"}, | 483 | {0x0B00, "Warning"}, |
479 | {0x0B01, "Warning - specified temperature exceeded"}, | 484 | {0x0B01, "Warning - specified temperature exceeded"}, |
480 | {0x0B02, "Warning - enclosure degraded"}, | 485 | {0x0B02, "Warning - enclosure degraded"}, |
486 | {0x0B03, "Warning - background self-test failed"}, | ||
487 | {0x0B04, "Warning - background pre-scan detected medium error"}, | ||
488 | {0x0B05, "Warning - background medium scan detected medium error"}, | ||
481 | 489 | ||
482 | {0x0C00, "Write error"}, | 490 | {0x0C00, "Write error"}, |
483 | {0x0C01, "Write error - recovered with auto reallocation"}, | 491 | {0x0C01, "Write error - recovered with auto reallocation"}, |
@@ -493,6 +501,7 @@ static struct error_info additional[] = | |||
493 | {0x0C0B, "Auxiliary memory write error"}, | 501 | {0x0C0B, "Auxiliary memory write error"}, |
494 | {0x0C0C, "Write error - unexpected unsolicited data"}, | 502 | {0x0C0C, "Write error - unexpected unsolicited data"}, |
495 | {0x0C0D, "Write error - not enough unsolicited data"}, | 503 | {0x0C0D, "Write error - not enough unsolicited data"}, |
504 | {0x0C0F, "Defects in error window"}, | ||
496 | 505 | ||
497 | {0x0D00, "Error detected by third party temporary initiator"}, | 506 | {0x0D00, "Error detected by third party temporary initiator"}, |
498 | {0x0D01, "Third party device failure"}, | 507 | {0x0D01, "Third party device failure"}, |
@@ -504,11 +513,12 @@ static struct error_info additional[] = | |||
504 | {0x0E00, "Invalid information unit"}, | 513 | {0x0E00, "Invalid information unit"}, |
505 | {0x0E01, "Information unit too short"}, | 514 | {0x0E01, "Information unit too short"}, |
506 | {0x0E02, "Information unit too long"}, | 515 | {0x0E02, "Information unit too long"}, |
516 | {0x0E03, "Invalid field in command information unit"}, | ||
507 | 517 | ||
508 | {0x1000, "Id CRC or ECC error"}, | 518 | {0x1000, "Id CRC or ECC error"}, |
509 | {0x1001, "Data block guard check failed"}, | 519 | {0x1001, "Logical block guard check failed"}, |
510 | {0x1002, "Data block application tag check failed"}, | 520 | {0x1002, "Logical block application tag check failed"}, |
511 | {0x1003, "Data block reference tag check failed"}, | 521 | {0x1003, "Logical block reference tag check failed"}, |
512 | 522 | ||
513 | {0x1100, "Unrecovered read error"}, | 523 | {0x1100, "Unrecovered read error"}, |
514 | {0x1101, "Read retries exhausted"}, | 524 | {0x1101, "Read retries exhausted"}, |
@@ -530,6 +540,7 @@ static struct error_info additional[] = | |||
530 | {0x1111, "Read error - loss of streaming"}, | 540 | {0x1111, "Read error - loss of streaming"}, |
531 | {0x1112, "Auxiliary memory read error"}, | 541 | {0x1112, "Auxiliary memory read error"}, |
532 | {0x1113, "Read error - failed retransmission request"}, | 542 | {0x1113, "Read error - failed retransmission request"}, |
543 | {0x1114, "Read error - lba marked bad by application client"}, | ||
533 | 544 | ||
534 | {0x1200, "Address mark not found for id field"}, | 545 | {0x1200, "Address mark not found for id field"}, |
535 | 546 | ||
@@ -610,11 +621,14 @@ static struct error_info additional[] = | |||
610 | {0x2100, "Logical block address out of range"}, | 621 | {0x2100, "Logical block address out of range"}, |
611 | {0x2101, "Invalid element address"}, | 622 | {0x2101, "Invalid element address"}, |
612 | {0x2102, "Invalid address for write"}, | 623 | {0x2102, "Invalid address for write"}, |
624 | {0x2103, "Invalid write crossing layer jump"}, | ||
613 | 625 | ||
614 | {0x2200, "Illegal function (use 20 00, 24 00, or 26 00)"}, | 626 | {0x2200, "Illegal function (use 20 00, 24 00, or 26 00)"}, |
615 | 627 | ||
616 | {0x2400, "Invalid field in cdb"}, | 628 | {0x2400, "Invalid field in cdb"}, |
617 | {0x2401, "CDB decryption error"}, | 629 | {0x2401, "CDB decryption error"}, |
630 | {0x2402, "Obsolete"}, | ||
631 | {0x2403, "Obsolete"}, | ||
618 | {0x2404, "Security audit value frozen"}, | 632 | {0x2404, "Security audit value frozen"}, |
619 | {0x2405, "Security working key frozen"}, | 633 | {0x2405, "Security working key frozen"}, |
620 | {0x2406, "Nonce not unique"}, | 634 | {0x2406, "Nonce not unique"}, |
@@ -637,7 +651,10 @@ static struct error_info additional[] = | |||
637 | {0x260C, "Invalid operation for copy source or destination"}, | 651 | {0x260C, "Invalid operation for copy source or destination"}, |
638 | {0x260D, "Copy segment granularity violation"}, | 652 | {0x260D, "Copy segment granularity violation"}, |
639 | {0x260E, "Invalid parameter while port is enabled"}, | 653 | {0x260E, "Invalid parameter while port is enabled"}, |
640 | {0x260F, "Invalid data-out buffer integrity"}, | 654 | {0x260F, "Invalid data-out buffer integrity check value"}, |
655 | {0x2610, "Data decryption key fail limit reached"}, | ||
656 | {0x2611, "Incomplete key-associated data set"}, | ||
657 | {0x2612, "Vendor specific key reference not found"}, | ||
641 | 658 | ||
642 | {0x2700, "Write protected"}, | 659 | {0x2700, "Write protected"}, |
643 | {0x2701, "Hardware write protected"}, | 660 | {0x2701, "Hardware write protected"}, |
@@ -649,6 +666,7 @@ static struct error_info additional[] = | |||
649 | 666 | ||
650 | {0x2800, "Not ready to ready change, medium may have changed"}, | 667 | {0x2800, "Not ready to ready change, medium may have changed"}, |
651 | {0x2801, "Import or export element accessed"}, | 668 | {0x2801, "Import or export element accessed"}, |
669 | {0x2802, "Format-layer may have changed"}, | ||
652 | 670 | ||
653 | {0x2900, "Power on, reset, or bus device reset occurred"}, | 671 | {0x2900, "Power on, reset, or bus device reset occurred"}, |
654 | {0x2901, "Power on occurred"}, | 672 | {0x2901, "Power on occurred"}, |
@@ -669,6 +687,11 @@ static struct error_info additional[] = | |||
669 | {0x2A07, "Implicit asymmetric access state transition failed"}, | 687 | {0x2A07, "Implicit asymmetric access state transition failed"}, |
670 | {0x2A08, "Priority changed"}, | 688 | {0x2A08, "Priority changed"}, |
671 | {0x2A09, "Capacity data has changed"}, | 689 | {0x2A09, "Capacity data has changed"}, |
690 | {0x2A10, "Timestamp changed"}, | ||
691 | {0x2A11, "Data encryption parameters changed by another i_t nexus"}, | ||
692 | {0x2A12, "Data encryption parameters changed by vendor specific " | ||
693 | "event"}, | ||
694 | {0x2A13, "Data encryption key instance counter has changed"}, | ||
672 | 695 | ||
673 | {0x2B00, "Copy cannot execute since host cannot disconnect"}, | 696 | {0x2B00, "Copy cannot execute since host cannot disconnect"}, |
674 | 697 | ||
@@ -690,6 +713,7 @@ static struct error_info additional[] = | |||
690 | {0x2E00, "Insufficient time for operation"}, | 713 | {0x2E00, "Insufficient time for operation"}, |
691 | 714 | ||
692 | {0x2F00, "Commands cleared by another initiator"}, | 715 | {0x2F00, "Commands cleared by another initiator"}, |
716 | {0x2F01, "Commands cleared by power loss notification"}, | ||
693 | 717 | ||
694 | {0x3000, "Incompatible medium installed"}, | 718 | {0x3000, "Incompatible medium installed"}, |
695 | {0x3001, "Cannot read medium - unknown format"}, | 719 | {0x3001, "Cannot read medium - unknown format"}, |
@@ -702,7 +726,8 @@ static struct error_info additional[] = | |||
702 | {0x3008, "Cannot write - application code mismatch"}, | 726 | {0x3008, "Cannot write - application code mismatch"}, |
703 | {0x3009, "Current session not fixated for append"}, | 727 | {0x3009, "Current session not fixated for append"}, |
704 | {0x300A, "Cleaning request rejected"}, | 728 | {0x300A, "Cleaning request rejected"}, |
705 | {0x300C, "WORM medium, overwrite attempted"}, | 729 | {0x300C, "WORM medium - overwrite attempted"}, |
730 | {0x300D, "WORM medium - integrity check"}, | ||
706 | {0x3010, "Medium not formatted"}, | 731 | {0x3010, "Medium not formatted"}, |
707 | 732 | ||
708 | {0x3100, "Medium format corrupted"}, | 733 | {0x3100, "Medium format corrupted"}, |
@@ -790,6 +815,9 @@ static struct error_info additional[] = | |||
790 | {0x3F0F, "Echo buffer overwritten"}, | 815 | {0x3F0F, "Echo buffer overwritten"}, |
791 | {0x3F10, "Medium loadable"}, | 816 | {0x3F10, "Medium loadable"}, |
792 | {0x3F11, "Medium auxiliary memory accessible"}, | 817 | {0x3F11, "Medium auxiliary memory accessible"}, |
818 | {0x3F12, "iSCSI IP address added"}, | ||
819 | {0x3F13, "iSCSI IP address removed"}, | ||
820 | {0x3F14, "iSCSI IP address changed"}, | ||
793 | /* | 821 | /* |
794 | * {0x40NN, "Ram failure"}, | 822 | * {0x40NN, "Ram failure"}, |
795 | * {0x40NN, "Diagnostic failure on component nn"}, | 823 | * {0x40NN, "Diagnostic failure on component nn"}, |
@@ -799,6 +827,7 @@ static struct error_info additional[] = | |||
799 | {0x4300, "Message error"}, | 827 | {0x4300, "Message error"}, |
800 | 828 | ||
801 | {0x4400, "Internal target failure"}, | 829 | {0x4400, "Internal target failure"}, |
830 | {0x4471, "ATA device failed set features"}, | ||
802 | 831 | ||
803 | {0x4500, "Select or reselect failure"}, | 832 | {0x4500, "Select or reselect failure"}, |
804 | 833 | ||
@@ -807,9 +836,10 @@ static struct error_info additional[] = | |||
807 | {0x4700, "Scsi parity error"}, | 836 | {0x4700, "Scsi parity error"}, |
808 | {0x4701, "Data phase CRC error detected"}, | 837 | {0x4701, "Data phase CRC error detected"}, |
809 | {0x4702, "Scsi parity error detected during st data phase"}, | 838 | {0x4702, "Scsi parity error detected during st data phase"}, |
810 | {0x4703, "Information unit CRC error detected"}, | 839 | {0x4703, "Information unit iuCRC error detected"}, |
811 | {0x4704, "Asynchronous information protection error detected"}, | 840 | {0x4704, "Asynchronous information protection error detected"}, |
812 | {0x4705, "Protocol service CRC error"}, | 841 | {0x4705, "Protocol service CRC error"}, |
842 | {0x4706, "Phy test function in progress"}, | ||
813 | {0x477f, "Some commands cleared by iSCSI Protocol event"}, | 843 | {0x477f, "Some commands cleared by iSCSI Protocol event"}, |
814 | 844 | ||
815 | {0x4800, "Initiator detected error message received"}, | 845 | {0x4800, "Initiator detected error message received"}, |
@@ -844,6 +874,8 @@ static struct error_info additional[] = | |||
844 | {0x5300, "Media load or eject failed"}, | 874 | {0x5300, "Media load or eject failed"}, |
845 | {0x5301, "Unload tape failure"}, | 875 | {0x5301, "Unload tape failure"}, |
846 | {0x5302, "Medium removal prevented"}, | 876 | {0x5302, "Medium removal prevented"}, |
877 | {0x5303, "Medium removal prevented by data transfer element"}, | ||
878 | {0x5304, "Medium thread or unthread failure"}, | ||
847 | 879 | ||
848 | {0x5400, "Scsi to host system interface failure"}, | 880 | {0x5400, "Scsi to host system interface failure"}, |
849 | 881 | ||
@@ -855,6 +887,7 @@ static struct error_info additional[] = | |||
855 | {0x5505, "Insufficient access control resources"}, | 887 | {0x5505, "Insufficient access control resources"}, |
856 | {0x5506, "Auxiliary memory out of space"}, | 888 | {0x5506, "Auxiliary memory out of space"}, |
857 | {0x5507, "Quota error"}, | 889 | {0x5507, "Quota error"}, |
890 | {0x5508, "Maximum number of supplemental decryption keys exceeded"}, | ||
858 | 891 | ||
859 | {0x5700, "Unable to recover table-of-contents"}, | 892 | {0x5700, "Unable to recover table-of-contents"}, |
860 | 893 | ||
@@ -1004,6 +1037,7 @@ static struct error_info additional[] = | |||
1004 | {0x6708, "Assign failure occurred"}, | 1037 | {0x6708, "Assign failure occurred"}, |
1005 | {0x6709, "Multiply assigned logical unit"}, | 1038 | {0x6709, "Multiply assigned logical unit"}, |
1006 | {0x670A, "Set target port groups command failed"}, | 1039 | {0x670A, "Set target port groups command failed"}, |
1040 | {0x670B, "ATA device feature not enabled"}, | ||
1007 | 1041 | ||
1008 | {0x6800, "Logical unit not configured"}, | 1042 | {0x6800, "Logical unit not configured"}, |
1009 | 1043 | ||
@@ -1030,6 +1064,8 @@ static struct error_info additional[] = | |||
1030 | {0x6F03, "Read of scrambled sector without authentication"}, | 1064 | {0x6F03, "Read of scrambled sector without authentication"}, |
1031 | {0x6F04, "Media region code is mismatched to logical unit region"}, | 1065 | {0x6F04, "Media region code is mismatched to logical unit region"}, |
1032 | {0x6F05, "Drive region must be permanent/region reset count error"}, | 1066 | {0x6F05, "Drive region must be permanent/region reset count error"}, |
1067 | {0x6F06, "Insufficient block count for binding nonce recording"}, | ||
1068 | {0x6F07, "Conflict in binding nonce recording"}, | ||
1033 | /* | 1069 | /* |
1034 | * {0x70NN, "Decompression exception short algorithm id of nn"}, | 1070 | * {0x70NN, "Decompression exception short algorithm id of nn"}, |
1035 | */ | 1071 | */ |
@@ -1041,6 +1077,8 @@ static struct error_info additional[] = | |||
1041 | {0x7203, "Session fixation error - incomplete track in session"}, | 1077 | {0x7203, "Session fixation error - incomplete track in session"}, |
1042 | {0x7204, "Empty or partially written reserved track"}, | 1078 | {0x7204, "Empty or partially written reserved track"}, |
1043 | {0x7205, "No more track reservations allowed"}, | 1079 | {0x7205, "No more track reservations allowed"}, |
1080 | {0x7206, "RMZ extension is not allowed"}, | ||
1081 | {0x7207, "No more test zone extensions are allowed"}, | ||
1044 | 1082 | ||
1045 | {0x7300, "Cd control error"}, | 1083 | {0x7300, "Cd control error"}, |
1046 | {0x7301, "Power calibration area almost full"}, | 1084 | {0x7301, "Power calibration area almost full"}, |
@@ -1049,6 +1087,18 @@ static struct error_info additional[] = | |||
1049 | {0x7304, "Program memory area update failure"}, | 1087 | {0x7304, "Program memory area update failure"}, |
1050 | {0x7305, "Program memory area is full"}, | 1088 | {0x7305, "Program memory area is full"}, |
1051 | {0x7306, "RMA/PMA is almost full"}, | 1089 | {0x7306, "RMA/PMA is almost full"}, |
1090 | {0x7310, "Current power calibration area almost full"}, | ||
1091 | {0x7311, "Current power calibration area is full"}, | ||
1092 | {0x7317, "RDZ is full"}, | ||
1093 | |||
1094 | {0x7400, "Security error"}, | ||
1095 | {0x7401, "Unable to decrypt data"}, | ||
1096 | {0x7402, "Unencrypted data encountered while decrypting"}, | ||
1097 | {0x7403, "Incorrect data encryption key"}, | ||
1098 | {0x7404, "Cryptographic integrity validation failed"}, | ||
1099 | {0x7405, "Error decrypting data"}, | ||
1100 | {0x7471, "Logical unit access not authorized"}, | ||
1101 | |||
1052 | {0, NULL} | 1102 | {0, NULL} |
1053 | }; | 1103 | }; |
1054 | 1104 | ||
diff --git a/drivers/scsi/esp.c b/drivers/scsi/esp.c index 10573c24a50b..98bd22714d0d 100644 --- a/drivers/scsi/esp.c +++ b/drivers/scsi/esp.c | |||
@@ -1397,7 +1397,7 @@ static void esp_get_dmabufs(struct esp *esp, struct scsi_cmnd *sp) | |||
1397 | sp->SCp.ptr = NULL; | 1397 | sp->SCp.ptr = NULL; |
1398 | } | 1398 | } |
1399 | } else { | 1399 | } else { |
1400 | sp->SCp.buffer = (struct scatterlist *) sp->buffer; | 1400 | sp->SCp.buffer = (struct scatterlist *) sp->request_buffer; |
1401 | sp->SCp.buffers_residual = sbus_map_sg(esp->sdev, | 1401 | sp->SCp.buffers_residual = sbus_map_sg(esp->sdev, |
1402 | sp->SCp.buffer, | 1402 | sp->SCp.buffer, |
1403 | sp->use_sg, | 1403 | sp->use_sg, |
@@ -1410,7 +1410,7 @@ static void esp_get_dmabufs(struct esp *esp, struct scsi_cmnd *sp) | |||
1410 | static void esp_release_dmabufs(struct esp *esp, struct scsi_cmnd *sp) | 1410 | static void esp_release_dmabufs(struct esp *esp, struct scsi_cmnd *sp) |
1411 | { | 1411 | { |
1412 | if (sp->use_sg) { | 1412 | if (sp->use_sg) { |
1413 | sbus_unmap_sg(esp->sdev, sp->buffer, sp->use_sg, | 1413 | sbus_unmap_sg(esp->sdev, sp->request_buffer, sp->use_sg, |
1414 | sp->sc_data_direction); | 1414 | sp->sc_data_direction); |
1415 | } else if (sp->request_bufflen) { | 1415 | } else if (sp->request_bufflen) { |
1416 | sbus_unmap_single(esp->sdev, | 1416 | sbus_unmap_single(esp->sdev, |
@@ -2754,18 +2754,15 @@ static int esp_do_data_finale(struct esp *esp) | |||
2754 | */ | 2754 | */ |
2755 | static int esp_should_clear_sync(struct scsi_cmnd *sp) | 2755 | static int esp_should_clear_sync(struct scsi_cmnd *sp) |
2756 | { | 2756 | { |
2757 | u8 cmd1 = sp->cmnd[0]; | 2757 | u8 cmd = sp->cmnd[0]; |
2758 | u8 cmd2 = sp->data_cmnd[0]; | ||
2759 | 2758 | ||
2760 | /* These cases are for spinning up a disk and | 2759 | /* These cases are for spinning up a disk and |
2761 | * waiting for that spinup to complete. | 2760 | * waiting for that spinup to complete. |
2762 | */ | 2761 | */ |
2763 | if (cmd1 == START_STOP || | 2762 | if (cmd == START_STOP) |
2764 | cmd2 == START_STOP) | ||
2765 | return 0; | 2763 | return 0; |
2766 | 2764 | ||
2767 | if (cmd1 == TEST_UNIT_READY || | 2765 | if (cmd == TEST_UNIT_READY) |
2768 | cmd2 == TEST_UNIT_READY) | ||
2769 | return 0; | 2766 | return 0; |
2770 | 2767 | ||
2771 | /* One more special case for SCSI tape drives, | 2768 | /* One more special case for SCSI tape drives, |
@@ -2773,8 +2770,7 @@ static int esp_should_clear_sync(struct scsi_cmnd *sp) | |||
2773 | * completion of a rewind or tape load operation. | 2770 | * completion of a rewind or tape load operation. |
2774 | */ | 2771 | */ |
2775 | if (sp->device->type == TYPE_TAPE) { | 2772 | if (sp->device->type == TYPE_TAPE) { |
2776 | if (cmd1 == MODE_SENSE || | 2773 | if (cmd == MODE_SENSE) |
2777 | cmd2 == MODE_SENSE) | ||
2778 | return 0; | 2774 | return 0; |
2779 | } | 2775 | } |
2780 | 2776 | ||
diff --git a/drivers/scsi/ibmvscsi/iseries_vscsi.c b/drivers/scsi/ibmvscsi/iseries_vscsi.c index 7eed0b098171..6aeb5f003c3c 100644 --- a/drivers/scsi/ibmvscsi/iseries_vscsi.c +++ b/drivers/scsi/ibmvscsi/iseries_vscsi.c | |||
@@ -81,7 +81,7 @@ int ibmvscsi_init_crq_queue(struct crq_queue *queue, | |||
81 | int rc; | 81 | int rc; |
82 | 82 | ||
83 | single_host_data = hostdata; | 83 | single_host_data = hostdata; |
84 | rc = viopath_open(viopath_hostLp, viomajorsubtype_scsi, 0); | 84 | rc = viopath_open(viopath_hostLp, viomajorsubtype_scsi, max_requests); |
85 | if (rc < 0) { | 85 | if (rc < 0) { |
86 | printk("viopath_open failed with rc %d in open_event_path\n", | 86 | printk("viopath_open failed with rc %d in open_event_path\n", |
87 | rc); | 87 | rc); |
diff --git a/drivers/scsi/ibmvscsi/rpa_vscsi.c b/drivers/scsi/ibmvscsi/rpa_vscsi.c index 242b8873b333..ed22b96580c6 100644 --- a/drivers/scsi/ibmvscsi/rpa_vscsi.c +++ b/drivers/scsi/ibmvscsi/rpa_vscsi.c | |||
@@ -238,6 +238,7 @@ int ibmvscsi_init_crq_queue(struct crq_queue *queue, | |||
238 | if (rc == 2) { | 238 | if (rc == 2) { |
239 | /* Adapter is good, but other end is not ready */ | 239 | /* Adapter is good, but other end is not ready */ |
240 | printk(KERN_WARNING "ibmvscsi: Partner adapter not ready\n"); | 240 | printk(KERN_WARNING "ibmvscsi: Partner adapter not ready\n"); |
241 | retrc = 0; | ||
241 | } else if (rc != 0) { | 242 | } else if (rc != 0) { |
242 | printk(KERN_WARNING "ibmvscsi: Error %d opening adapter\n", rc); | 243 | printk(KERN_WARNING "ibmvscsi: Error %d opening adapter\n", rc); |
243 | goto reg_crq_failed; | 244 | goto reg_crq_failed; |
diff --git a/drivers/scsi/jazz_esp.c b/drivers/scsi/jazz_esp.c index 3fd8a96f2af3..bfac4441d89f 100644 --- a/drivers/scsi/jazz_esp.c +++ b/drivers/scsi/jazz_esp.c | |||
@@ -257,7 +257,7 @@ static void dma_mmu_release_scsi_one (struct NCR_ESP *esp, struct scsi_cmnd *sp) | |||
257 | static void dma_mmu_release_scsi_sgl (struct NCR_ESP *esp, struct scsi_cmnd *sp) | 257 | static void dma_mmu_release_scsi_sgl (struct NCR_ESP *esp, struct scsi_cmnd *sp) |
258 | { | 258 | { |
259 | int sz = sp->use_sg - 1; | 259 | int sz = sp->use_sg - 1; |
260 | struct scatterlist *sg = (struct scatterlist *)sp->buffer; | 260 | struct scatterlist *sg = (struct scatterlist *)sp->request_buffer; |
261 | 261 | ||
262 | while(sz >= 0) { | 262 | while(sz >= 0) { |
263 | vdma_free(sg[sz].dma_address); | 263 | vdma_free(sg[sz].dma_address); |
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 386e5f21e191..16fc2dd8f2f7 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -5185,28 +5185,6 @@ void ata_host_stop (struct ata_host_set *host_set) | |||
5185 | iounmap(host_set->mmio_base); | 5185 | iounmap(host_set->mmio_base); |
5186 | } | 5186 | } |
5187 | 5187 | ||
5188 | |||
5189 | /** | ||
5190 | * ata_host_remove - Unregister SCSI host structure with upper layers | ||
5191 | * @ap: Port to unregister | ||
5192 | * @do_unregister: 1 if we fully unregister, 0 to just stop the port | ||
5193 | * | ||
5194 | * LOCKING: | ||
5195 | * Inherited from caller. | ||
5196 | */ | ||
5197 | |||
5198 | static void ata_host_remove(struct ata_port *ap, unsigned int do_unregister) | ||
5199 | { | ||
5200 | struct Scsi_Host *sh = ap->host; | ||
5201 | |||
5202 | DPRINTK("ENTER\n"); | ||
5203 | |||
5204 | if (do_unregister) | ||
5205 | scsi_remove_host(sh); | ||
5206 | |||
5207 | ap->ops->port_stop(ap); | ||
5208 | } | ||
5209 | |||
5210 | /** | 5188 | /** |
5211 | * ata_dev_init - Initialize an ata_device structure | 5189 | * ata_dev_init - Initialize an ata_device structure |
5212 | * @dev: Device structure to initialize | 5190 | * @dev: Device structure to initialize |
@@ -5532,8 +5510,11 @@ int ata_device_add(const struct ata_probe_ent *ent) | |||
5532 | 5510 | ||
5533 | err_out: | 5511 | err_out: |
5534 | for (i = 0; i < count; i++) { | 5512 | for (i = 0; i < count; i++) { |
5535 | ata_host_remove(host_set->ports[i], 1); | 5513 | struct ata_port *ap = host_set->ports[i]; |
5536 | scsi_host_put(host_set->ports[i]->host); | 5514 | if (ap) { |
5515 | ap->ops->port_stop(ap); | ||
5516 | scsi_host_put(ap->host); | ||
5517 | } | ||
5537 | } | 5518 | } |
5538 | err_free_ret: | 5519 | err_free_ret: |
5539 | kfree(host_set); | 5520 | kfree(host_set); |
@@ -5558,7 +5539,7 @@ void ata_port_detach(struct ata_port *ap) | |||
5558 | int i; | 5539 | int i; |
5559 | 5540 | ||
5560 | if (!ap->ops->error_handler) | 5541 | if (!ap->ops->error_handler) |
5561 | return; | 5542 | goto skip_eh; |
5562 | 5543 | ||
5563 | /* tell EH we're leaving & flush EH */ | 5544 | /* tell EH we're leaving & flush EH */ |
5564 | spin_lock_irqsave(ap->lock, flags); | 5545 | spin_lock_irqsave(ap->lock, flags); |
@@ -5594,6 +5575,7 @@ void ata_port_detach(struct ata_port *ap) | |||
5594 | cancel_delayed_work(&ap->hotplug_task); | 5575 | cancel_delayed_work(&ap->hotplug_task); |
5595 | flush_workqueue(ata_aux_wq); | 5576 | flush_workqueue(ata_aux_wq); |
5596 | 5577 | ||
5578 | skip_eh: | ||
5597 | /* remove the associated SCSI host */ | 5579 | /* remove the associated SCSI host */ |
5598 | scsi_remove_host(ap->host); | 5580 | scsi_remove_host(ap->host); |
5599 | } | 5581 | } |
@@ -5662,7 +5644,7 @@ int ata_scsi_release(struct Scsi_Host *host) | |||
5662 | DPRINTK("ENTER\n"); | 5644 | DPRINTK("ENTER\n"); |
5663 | 5645 | ||
5664 | ap->ops->port_disable(ap); | 5646 | ap->ops->port_disable(ap); |
5665 | ata_host_remove(ap, 0); | 5647 | ap->ops->port_stop(ap); |
5666 | 5648 | ||
5667 | DPRINTK("EXIT\n"); | 5649 | DPRINTK("EXIT\n"); |
5668 | return 1; | 5650 | return 1; |
diff --git a/drivers/scsi/libata-eh.c b/drivers/scsi/libata-eh.c index 4b6aa30f4d68..29f59345305d 100644 --- a/drivers/scsi/libata-eh.c +++ b/drivers/scsi/libata-eh.c | |||
@@ -764,12 +764,27 @@ static void ata_eh_about_to_do(struct ata_port *ap, struct ata_device *dev, | |||
764 | unsigned int action) | 764 | unsigned int action) |
765 | { | 765 | { |
766 | unsigned long flags; | 766 | unsigned long flags; |
767 | struct ata_eh_info *ehi = &ap->eh_info; | ||
768 | struct ata_eh_context *ehc = &ap->eh_context; | ||
767 | 769 | ||
768 | spin_lock_irqsave(ap->lock, flags); | 770 | spin_lock_irqsave(ap->lock, flags); |
769 | 771 | ||
770 | ata_eh_clear_action(dev, &ap->eh_info, action); | 772 | /* Reset is represented by combination of actions and EHI |
773 | * flags. Suck in all related bits before clearing eh_info to | ||
774 | * avoid losing requested action. | ||
775 | */ | ||
776 | if (action & ATA_EH_RESET_MASK) { | ||
777 | ehc->i.action |= ehi->action & ATA_EH_RESET_MASK; | ||
778 | ehc->i.flags |= ehi->flags & ATA_EHI_RESET_MODIFIER_MASK; | ||
779 | |||
780 | /* make sure all reset actions are cleared & clear EHI flags */ | ||
781 | action |= ATA_EH_RESET_MASK; | ||
782 | ehi->flags &= ~ATA_EHI_RESET_MODIFIER_MASK; | ||
783 | } | ||
784 | |||
785 | ata_eh_clear_action(dev, ehi, action); | ||
771 | 786 | ||
772 | if (!(ap->eh_context.i.flags & ATA_EHI_QUIET)) | 787 | if (!(ehc->i.flags & ATA_EHI_QUIET)) |
773 | ap->pflags |= ATA_PFLAG_RECOVERED; | 788 | ap->pflags |= ATA_PFLAG_RECOVERED; |
774 | 789 | ||
775 | spin_unlock_irqrestore(ap->lock, flags); | 790 | spin_unlock_irqrestore(ap->lock, flags); |
@@ -790,6 +805,12 @@ static void ata_eh_about_to_do(struct ata_port *ap, struct ata_device *dev, | |||
790 | static void ata_eh_done(struct ata_port *ap, struct ata_device *dev, | 805 | static void ata_eh_done(struct ata_port *ap, struct ata_device *dev, |
791 | unsigned int action) | 806 | unsigned int action) |
792 | { | 807 | { |
808 | /* if reset is complete, clear all reset actions & reset modifier */ | ||
809 | if (action & ATA_EH_RESET_MASK) { | ||
810 | action |= ATA_EH_RESET_MASK; | ||
811 | ap->eh_context.i.flags &= ~ATA_EHI_RESET_MODIFIER_MASK; | ||
812 | } | ||
813 | |||
793 | ata_eh_clear_action(dev, &ap->eh_context.i, action); | 814 | ata_eh_clear_action(dev, &ap->eh_context.i, action); |
794 | } | 815 | } |
795 | 816 | ||
@@ -1276,8 +1297,6 @@ static int ata_eh_speed_down(struct ata_device *dev, int is_io, | |||
1276 | static void ata_eh_autopsy(struct ata_port *ap) | 1297 | static void ata_eh_autopsy(struct ata_port *ap) |
1277 | { | 1298 | { |
1278 | struct ata_eh_context *ehc = &ap->eh_context; | 1299 | struct ata_eh_context *ehc = &ap->eh_context; |
1279 | unsigned int action = ehc->i.action; | ||
1280 | struct ata_device *failed_dev = NULL; | ||
1281 | unsigned int all_err_mask = 0; | 1300 | unsigned int all_err_mask = 0; |
1282 | int tag, is_io = 0; | 1301 | int tag, is_io = 0; |
1283 | u32 serror; | 1302 | u32 serror; |
@@ -1294,7 +1313,7 @@ static void ata_eh_autopsy(struct ata_port *ap) | |||
1294 | ehc->i.serror |= serror; | 1313 | ehc->i.serror |= serror; |
1295 | ata_eh_analyze_serror(ap); | 1314 | ata_eh_analyze_serror(ap); |
1296 | } else if (rc != -EOPNOTSUPP) | 1315 | } else if (rc != -EOPNOTSUPP) |
1297 | action |= ATA_EH_HARDRESET; | 1316 | ehc->i.action |= ATA_EH_HARDRESET; |
1298 | 1317 | ||
1299 | /* analyze NCQ failure */ | 1318 | /* analyze NCQ failure */ |
1300 | ata_eh_analyze_ncq_error(ap); | 1319 | ata_eh_analyze_ncq_error(ap); |
@@ -1315,7 +1334,7 @@ static void ata_eh_autopsy(struct ata_port *ap) | |||
1315 | qc->err_mask |= ehc->i.err_mask; | 1334 | qc->err_mask |= ehc->i.err_mask; |
1316 | 1335 | ||
1317 | /* analyze TF */ | 1336 | /* analyze TF */ |
1318 | action |= ata_eh_analyze_tf(qc, &qc->result_tf); | 1337 | ehc->i.action |= ata_eh_analyze_tf(qc, &qc->result_tf); |
1319 | 1338 | ||
1320 | /* DEV errors are probably spurious in case of ATA_BUS error */ | 1339 | /* DEV errors are probably spurious in case of ATA_BUS error */ |
1321 | if (qc->err_mask & AC_ERR_ATA_BUS) | 1340 | if (qc->err_mask & AC_ERR_ATA_BUS) |
@@ -1329,11 +1348,11 @@ static void ata_eh_autopsy(struct ata_port *ap) | |||
1329 | /* SENSE_VALID trumps dev/unknown error and revalidation */ | 1348 | /* SENSE_VALID trumps dev/unknown error and revalidation */ |
1330 | if (qc->flags & ATA_QCFLAG_SENSE_VALID) { | 1349 | if (qc->flags & ATA_QCFLAG_SENSE_VALID) { |
1331 | qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER); | 1350 | qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER); |
1332 | action &= ~ATA_EH_REVALIDATE; | 1351 | ehc->i.action &= ~ATA_EH_REVALIDATE; |
1333 | } | 1352 | } |
1334 | 1353 | ||
1335 | /* accumulate error info */ | 1354 | /* accumulate error info */ |
1336 | failed_dev = qc->dev; | 1355 | ehc->i.dev = qc->dev; |
1337 | all_err_mask |= qc->err_mask; | 1356 | all_err_mask |= qc->err_mask; |
1338 | if (qc->flags & ATA_QCFLAG_IO) | 1357 | if (qc->flags & ATA_QCFLAG_IO) |
1339 | is_io = 1; | 1358 | is_io = 1; |
@@ -1342,25 +1361,22 @@ static void ata_eh_autopsy(struct ata_port *ap) | |||
1342 | /* enforce default EH actions */ | 1361 | /* enforce default EH actions */ |
1343 | if (ap->pflags & ATA_PFLAG_FROZEN || | 1362 | if (ap->pflags & ATA_PFLAG_FROZEN || |
1344 | all_err_mask & (AC_ERR_HSM | AC_ERR_TIMEOUT)) | 1363 | all_err_mask & (AC_ERR_HSM | AC_ERR_TIMEOUT)) |
1345 | action |= ATA_EH_SOFTRESET; | 1364 | ehc->i.action |= ATA_EH_SOFTRESET; |
1346 | else if (all_err_mask) | 1365 | else if (all_err_mask) |
1347 | action |= ATA_EH_REVALIDATE; | 1366 | ehc->i.action |= ATA_EH_REVALIDATE; |
1348 | 1367 | ||
1349 | /* if we have offending qcs and the associated failed device */ | 1368 | /* if we have offending qcs and the associated failed device */ |
1350 | if (failed_dev) { | 1369 | if (ehc->i.dev) { |
1351 | /* speed down */ | 1370 | /* speed down */ |
1352 | action |= ata_eh_speed_down(failed_dev, is_io, all_err_mask); | 1371 | ehc->i.action |= ata_eh_speed_down(ehc->i.dev, is_io, |
1372 | all_err_mask); | ||
1353 | 1373 | ||
1354 | /* perform per-dev EH action only on the offending device */ | 1374 | /* perform per-dev EH action only on the offending device */ |
1355 | ehc->i.dev_action[failed_dev->devno] |= | 1375 | ehc->i.dev_action[ehc->i.dev->devno] |= |
1356 | action & ATA_EH_PERDEV_MASK; | 1376 | ehc->i.action & ATA_EH_PERDEV_MASK; |
1357 | action &= ~ATA_EH_PERDEV_MASK; | 1377 | ehc->i.action &= ~ATA_EH_PERDEV_MASK; |
1358 | } | 1378 | } |
1359 | 1379 | ||
1360 | /* record autopsy result */ | ||
1361 | ehc->i.dev = failed_dev; | ||
1362 | ehc->i.action |= action; | ||
1363 | |||
1364 | DPRINTK("EXIT\n"); | 1380 | DPRINTK("EXIT\n"); |
1365 | } | 1381 | } |
1366 | 1382 | ||
@@ -1483,6 +1499,9 @@ static int ata_eh_reset(struct ata_port *ap, int classify, | |||
1483 | ata_reset_fn_t reset; | 1499 | ata_reset_fn_t reset; |
1484 | int i, did_followup_srst, rc; | 1500 | int i, did_followup_srst, rc; |
1485 | 1501 | ||
1502 | /* about to reset */ | ||
1503 | ata_eh_about_to_do(ap, NULL, ehc->i.action & ATA_EH_RESET_MASK); | ||
1504 | |||
1486 | /* Determine which reset to use and record in ehc->i.action. | 1505 | /* Determine which reset to use and record in ehc->i.action. |
1487 | * prereset() may examine and modify it. | 1506 | * prereset() may examine and modify it. |
1488 | */ | 1507 | */ |
@@ -1531,8 +1550,7 @@ static int ata_eh_reset(struct ata_port *ap, int classify, | |||
1531 | ata_port_printk(ap, KERN_INFO, "%s resetting port\n", | 1550 | ata_port_printk(ap, KERN_INFO, "%s resetting port\n", |
1532 | reset == softreset ? "soft" : "hard"); | 1551 | reset == softreset ? "soft" : "hard"); |
1533 | 1552 | ||
1534 | /* reset */ | 1553 | /* mark that this EH session started with reset */ |
1535 | ata_eh_about_to_do(ap, NULL, ATA_EH_RESET_MASK); | ||
1536 | ehc->i.flags |= ATA_EHI_DID_RESET; | 1554 | ehc->i.flags |= ATA_EHI_DID_RESET; |
1537 | 1555 | ||
1538 | rc = ata_do_reset(ap, reset, classes); | 1556 | rc = ata_do_reset(ap, reset, classes); |
@@ -1595,7 +1613,7 @@ static int ata_eh_reset(struct ata_port *ap, int classify, | |||
1595 | postreset(ap, classes); | 1613 | postreset(ap, classes); |
1596 | 1614 | ||
1597 | /* reset successful, schedule revalidation */ | 1615 | /* reset successful, schedule revalidation */ |
1598 | ata_eh_done(ap, NULL, ATA_EH_RESET_MASK); | 1616 | ata_eh_done(ap, NULL, ehc->i.action & ATA_EH_RESET_MASK); |
1599 | ehc->i.action |= ATA_EH_REVALIDATE; | 1617 | ehc->i.action |= ATA_EH_REVALIDATE; |
1600 | } | 1618 | } |
1601 | 1619 | ||
@@ -1848,15 +1866,16 @@ static int ata_eh_skip_recovery(struct ata_port *ap) | |||
1848 | for (i = 0; i < ata_port_max_devices(ap); i++) { | 1866 | for (i = 0; i < ata_port_max_devices(ap); i++) { |
1849 | struct ata_device *dev = &ap->device[i]; | 1867 | struct ata_device *dev = &ap->device[i]; |
1850 | 1868 | ||
1851 | if (ata_dev_absent(dev) || ata_dev_ready(dev)) | 1869 | if (!(dev->flags & ATA_DFLAG_SUSPENDED)) |
1852 | break; | 1870 | break; |
1853 | } | 1871 | } |
1854 | 1872 | ||
1855 | if (i == ata_port_max_devices(ap)) | 1873 | if (i == ata_port_max_devices(ap)) |
1856 | return 1; | 1874 | return 1; |
1857 | 1875 | ||
1858 | /* always thaw frozen port and recover failed devices */ | 1876 | /* thaw frozen port, resume link and recover failed devices */ |
1859 | if (ap->pflags & ATA_PFLAG_FROZEN || ata_port_nr_enabled(ap)) | 1877 | if ((ap->pflags & ATA_PFLAG_FROZEN) || |
1878 | (ehc->i.flags & ATA_EHI_RESUME_LINK) || ata_port_nr_enabled(ap)) | ||
1860 | return 0; | 1879 | return 0; |
1861 | 1880 | ||
1862 | /* skip if class codes for all vacant slots are ATA_DEV_NONE */ | 1881 | /* skip if class codes for all vacant slots are ATA_DEV_NONE */ |
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index 7ced41ecde86..e92c31d698ff 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c | |||
@@ -2353,6 +2353,19 @@ static void atapi_qc_complete(struct ata_queued_cmd *qc) | |||
2353 | ata_gen_ata_desc_sense(qc); | 2353 | ata_gen_ata_desc_sense(qc); |
2354 | } | 2354 | } |
2355 | 2355 | ||
2356 | /* SCSI EH automatically locks door if sdev->locked is | ||
2357 | * set. Sometimes door lock request continues to | ||
2358 | * fail, for example, when no media is present. This | ||
2359 | * creates a loop - SCSI EH issues door lock which | ||
2360 | * fails and gets invoked again to acquire sense data | ||
2361 | * for the failed command. | ||
2362 | * | ||
2363 | * If door lock fails, always clear sdev->locked to | ||
2364 | * avoid this infinite loop. | ||
2365 | */ | ||
2366 | if (qc->cdb[0] == ALLOW_MEDIUM_REMOVAL) | ||
2367 | qc->dev->sdev->locked = 0; | ||
2368 | |||
2356 | qc->scsicmd->result = SAM_STAT_CHECK_CONDITION; | 2369 | qc->scsicmd->result = SAM_STAT_CHECK_CONDITION; |
2357 | qc->scsidone(cmd); | 2370 | qc->scsidone(cmd); |
2358 | ata_qc_free(qc); | 2371 | ata_qc_free(qc); |
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index f81691fcf177..d44f9aac6b8f 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h | |||
@@ -21,10 +21,12 @@ | |||
21 | 21 | ||
22 | struct lpfc_sli2_slim; | 22 | struct lpfc_sli2_slim; |
23 | 23 | ||
24 | #define LPFC_MAX_TARGET 256 /* max targets supported */ | ||
25 | #define LPFC_MAX_DISC_THREADS 64 /* max outstanding discovery els req */ | ||
26 | #define LPFC_MAX_NS_RETRY 3 /* max NameServer retries */ | ||
27 | 24 | ||
25 | #define LPFC_MAX_TARGET 256 /* max number of targets supported */ | ||
26 | #define LPFC_MAX_DISC_THREADS 64 /* max outstanding discovery els | ||
27 | requests */ | ||
28 | #define LPFC_MAX_NS_RETRY 3 /* Number of retry attempts to contact | ||
29 | the NameServer before giving up. */ | ||
28 | #define LPFC_DFT_HBA_Q_DEPTH 2048 /* max cmds per hba */ | 30 | #define LPFC_DFT_HBA_Q_DEPTH 2048 /* max cmds per hba */ |
29 | #define LPFC_LC_HBA_Q_DEPTH 1024 /* max cmds per low cost hba */ | 31 | #define LPFC_LC_HBA_Q_DEPTH 1024 /* max cmds per low cost hba */ |
30 | #define LPFC_LP101_HBA_Q_DEPTH 128 /* max cmds per low cost hba */ | 32 | #define LPFC_LP101_HBA_Q_DEPTH 128 /* max cmds per low cost hba */ |
@@ -41,7 +43,6 @@ struct lpfc_sli2_slim; | |||
41 | (( (u64)(high)<<16 ) << 16)|( (u64)(low)))) | 43 | (( (u64)(high)<<16 ) << 16)|( (u64)(low)))) |
42 | /* Provide maximum configuration definitions. */ | 44 | /* Provide maximum configuration definitions. */ |
43 | #define LPFC_DRVR_TIMEOUT 16 /* driver iocb timeout value in sec */ | 45 | #define LPFC_DRVR_TIMEOUT 16 /* driver iocb timeout value in sec */ |
44 | #define MAX_FCP_TARGET 256 /* max num of FCP targets supported */ | ||
45 | #define FC_MAX_ADPTMSG 64 | 46 | #define FC_MAX_ADPTMSG 64 |
46 | 47 | ||
47 | #define MAX_HBAEVT 32 | 48 | #define MAX_HBAEVT 32 |
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index b62a72dfab29..5c68cdd8736f 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c | |||
@@ -219,9 +219,19 @@ lpfc_issue_lip(struct Scsi_Host *host) | |||
219 | return -ENOMEM; | 219 | return -ENOMEM; |
220 | 220 | ||
221 | memset((void *)pmboxq, 0, sizeof (LPFC_MBOXQ_t)); | 221 | memset((void *)pmboxq, 0, sizeof (LPFC_MBOXQ_t)); |
222 | lpfc_init_link(phba, pmboxq, phba->cfg_topology, phba->cfg_link_speed); | 222 | pmboxq->mb.mbxCommand = MBX_DOWN_LINK; |
223 | pmboxq->mb.mbxOwner = OWN_HOST; | ||
224 | |||
223 | mbxstatus = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); | 225 | mbxstatus = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); |
224 | 226 | ||
227 | if ((mbxstatus == MBX_SUCCESS) && (pmboxq->mb.mbxStatus == 0)) { | ||
228 | memset((void *)pmboxq, 0, sizeof (LPFC_MBOXQ_t)); | ||
229 | lpfc_init_link(phba, pmboxq, phba->cfg_topology, | ||
230 | phba->cfg_link_speed); | ||
231 | mbxstatus = lpfc_sli_issue_mbox_wait(phba, pmboxq, | ||
232 | phba->fc_ratov * 2); | ||
233 | } | ||
234 | |||
225 | if (mbxstatus == MBX_TIMEOUT) | 235 | if (mbxstatus == MBX_TIMEOUT) |
226 | pmboxq->mbox_cmpl = lpfc_sli_def_mbox_cmpl; | 236 | pmboxq->mbox_cmpl = lpfc_sli_def_mbox_cmpl; |
227 | else | 237 | else |
@@ -233,51 +243,53 @@ lpfc_issue_lip(struct Scsi_Host *host) | |||
233 | return 0; | 243 | return 0; |
234 | } | 244 | } |
235 | 245 | ||
236 | static ssize_t | 246 | static int |
237 | lpfc_nport_evt_cnt_show(struct class_device *cdev, char *buf) | 247 | lpfc_selective_reset(struct lpfc_hba *phba) |
238 | { | 248 | { |
239 | struct Scsi_Host *host = class_to_shost(cdev); | 249 | struct completion online_compl; |
240 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; | 250 | int status = 0; |
241 | return snprintf(buf, PAGE_SIZE, "%d\n", phba->nport_event_cnt); | 251 | |
252 | init_completion(&online_compl); | ||
253 | lpfc_workq_post_event(phba, &status, &online_compl, | ||
254 | LPFC_EVT_OFFLINE); | ||
255 | wait_for_completion(&online_compl); | ||
256 | |||
257 | if (status != 0) | ||
258 | return -EIO; | ||
259 | |||
260 | init_completion(&online_compl); | ||
261 | lpfc_workq_post_event(phba, &status, &online_compl, | ||
262 | LPFC_EVT_ONLINE); | ||
263 | wait_for_completion(&online_compl); | ||
264 | |||
265 | if (status != 0) | ||
266 | return -EIO; | ||
267 | |||
268 | return 0; | ||
242 | } | 269 | } |
243 | 270 | ||
244 | static ssize_t | 271 | static ssize_t |
245 | lpfc_board_online_show(struct class_device *cdev, char *buf) | 272 | lpfc_issue_reset(struct class_device *cdev, const char *buf, size_t count) |
246 | { | 273 | { |
247 | struct Scsi_Host *host = class_to_shost(cdev); | 274 | struct Scsi_Host *host = class_to_shost(cdev); |
248 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; | 275 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
276 | int status = -EINVAL; | ||
249 | 277 | ||
250 | if (phba->fc_flag & FC_OFFLINE_MODE) | 278 | if (strncmp(buf, "selective", sizeof("selective") - 1) == 0) |
251 | return snprintf(buf, PAGE_SIZE, "0\n"); | 279 | status = lpfc_selective_reset(phba); |
280 | |||
281 | if (status == 0) | ||
282 | return strlen(buf); | ||
252 | else | 283 | else |
253 | return snprintf(buf, PAGE_SIZE, "1\n"); | 284 | return status; |
254 | } | 285 | } |
255 | 286 | ||
256 | static ssize_t | 287 | static ssize_t |
257 | lpfc_board_online_store(struct class_device *cdev, const char *buf, | 288 | lpfc_nport_evt_cnt_show(struct class_device *cdev, char *buf) |
258 | size_t count) | ||
259 | { | 289 | { |
260 | struct Scsi_Host *host = class_to_shost(cdev); | 290 | struct Scsi_Host *host = class_to_shost(cdev); |
261 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; | 291 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
262 | struct completion online_compl; | 292 | return snprintf(buf, PAGE_SIZE, "%d\n", phba->nport_event_cnt); |
263 | int val=0, status=0; | ||
264 | |||
265 | if (sscanf(buf, "%d", &val) != 1) | ||
266 | return -EINVAL; | ||
267 | |||
268 | init_completion(&online_compl); | ||
269 | |||
270 | if (val) | ||
271 | lpfc_workq_post_event(phba, &status, &online_compl, | ||
272 | LPFC_EVT_ONLINE); | ||
273 | else | ||
274 | lpfc_workq_post_event(phba, &status, &online_compl, | ||
275 | LPFC_EVT_OFFLINE); | ||
276 | wait_for_completion(&online_compl); | ||
277 | if (!status) | ||
278 | return strlen(buf); | ||
279 | else | ||
280 | return -EIO; | ||
281 | } | 293 | } |
282 | 294 | ||
283 | static ssize_t | 295 | static ssize_t |
@@ -532,10 +544,9 @@ static CLASS_DEVICE_ATTR(lpfc_drvr_version, S_IRUGO, lpfc_drvr_version_show, | |||
532 | NULL); | 544 | NULL); |
533 | static CLASS_DEVICE_ATTR(management_version, S_IRUGO, management_version_show, | 545 | static CLASS_DEVICE_ATTR(management_version, S_IRUGO, management_version_show, |
534 | NULL); | 546 | NULL); |
535 | static CLASS_DEVICE_ATTR(board_online, S_IRUGO | S_IWUSR, | ||
536 | lpfc_board_online_show, lpfc_board_online_store); | ||
537 | static CLASS_DEVICE_ATTR(board_mode, S_IRUGO | S_IWUSR, | 547 | static CLASS_DEVICE_ATTR(board_mode, S_IRUGO | S_IWUSR, |
538 | lpfc_board_mode_show, lpfc_board_mode_store); | 548 | lpfc_board_mode_show, lpfc_board_mode_store); |
549 | static CLASS_DEVICE_ATTR(issue_reset, S_IWUSR, NULL, lpfc_issue_reset); | ||
539 | 550 | ||
540 | static int lpfc_poll = 0; | 551 | static int lpfc_poll = 0; |
541 | module_param(lpfc_poll, int, 0); | 552 | module_param(lpfc_poll, int, 0); |
@@ -695,12 +706,12 @@ LPFC_ATTR(discovery_threads, 32, 1, 64, "Maximum number of ELS commands " | |||
695 | "during discovery"); | 706 | "during discovery"); |
696 | 707 | ||
697 | /* | 708 | /* |
698 | # lpfc_max_luns: maximum number of LUNs per target driver will support | 709 | # lpfc_max_luns: maximum allowed LUN. |
699 | # Value range is [1,32768]. Default value is 256. | 710 | # Value range is [0,65535]. Default value is 255. |
700 | # NOTE: The SCSI layer will scan each target for this many luns | 711 | # NOTE: The SCSI layer might probe all allowed LUN on some old targets. |
701 | */ | 712 | */ |
702 | LPFC_ATTR_R(max_luns, 256, 1, 32768, | 713 | LPFC_ATTR_R(max_luns, 255, 0, 65535, |
703 | "Maximum number of LUNs per target driver will support"); | 714 | "Maximum allowed LUN"); |
704 | 715 | ||
705 | /* | 716 | /* |
706 | # lpfc_poll_tmo: .Milliseconds driver will wait between polling FCP ring. | 717 | # lpfc_poll_tmo: .Milliseconds driver will wait between polling FCP ring. |
@@ -739,8 +750,8 @@ struct class_device_attribute *lpfc_host_attrs[] = { | |||
739 | &class_device_attr_lpfc_max_luns, | 750 | &class_device_attr_lpfc_max_luns, |
740 | &class_device_attr_nport_evt_cnt, | 751 | &class_device_attr_nport_evt_cnt, |
741 | &class_device_attr_management_version, | 752 | &class_device_attr_management_version, |
742 | &class_device_attr_board_online, | ||
743 | &class_device_attr_board_mode, | 753 | &class_device_attr_board_mode, |
754 | &class_device_attr_issue_reset, | ||
744 | &class_device_attr_lpfc_poll, | 755 | &class_device_attr_lpfc_poll, |
745 | &class_device_attr_lpfc_poll_tmo, | 756 | &class_device_attr_lpfc_poll_tmo, |
746 | NULL, | 757 | NULL, |
diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h index ee22173fce43..517e9e4dd461 100644 --- a/drivers/scsi/lpfc/lpfc_crtn.h +++ b/drivers/scsi/lpfc/lpfc_crtn.h | |||
@@ -147,6 +147,7 @@ int lpfc_sli_hba_setup(struct lpfc_hba *); | |||
147 | int lpfc_sli_hba_down(struct lpfc_hba *); | 147 | int lpfc_sli_hba_down(struct lpfc_hba *); |
148 | int lpfc_sli_issue_mbox(struct lpfc_hba *, LPFC_MBOXQ_t *, uint32_t); | 148 | int lpfc_sli_issue_mbox(struct lpfc_hba *, LPFC_MBOXQ_t *, uint32_t); |
149 | int lpfc_sli_handle_mb_event(struct lpfc_hba *); | 149 | int lpfc_sli_handle_mb_event(struct lpfc_hba *); |
150 | int lpfc_sli_flush_mbox_queue(struct lpfc_hba *); | ||
150 | int lpfc_sli_handle_slow_ring_event(struct lpfc_hba *, | 151 | int lpfc_sli_handle_slow_ring_event(struct lpfc_hba *, |
151 | struct lpfc_sli_ring *, uint32_t); | 152 | struct lpfc_sli_ring *, uint32_t); |
152 | void lpfc_sli_def_mbox_cmpl(struct lpfc_hba *, LPFC_MBOXQ_t *); | 153 | void lpfc_sli_def_mbox_cmpl(struct lpfc_hba *, LPFC_MBOXQ_t *); |
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 4126fd87956f..b89f6cb641e6 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c | |||
@@ -648,33 +648,32 @@ lpfc_more_plogi(struct lpfc_hba * phba) | |||
648 | } | 648 | } |
649 | 649 | ||
650 | static struct lpfc_nodelist * | 650 | static struct lpfc_nodelist * |
651 | lpfc_plogi_confirm_nport(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | 651 | lpfc_plogi_confirm_nport(struct lpfc_hba * phba, struct lpfc_dmabuf *prsp, |
652 | struct lpfc_nodelist *ndlp) | 652 | struct lpfc_nodelist *ndlp) |
653 | { | 653 | { |
654 | struct lpfc_nodelist *new_ndlp; | 654 | struct lpfc_nodelist *new_ndlp; |
655 | struct lpfc_dmabuf *pcmd, *prsp; | ||
656 | uint32_t *lp; | 655 | uint32_t *lp; |
657 | struct serv_parm *sp; | 656 | struct serv_parm *sp; |
658 | uint8_t name[sizeof (struct lpfc_name)]; | 657 | uint8_t name[sizeof (struct lpfc_name)]; |
659 | uint32_t rc; | 658 | uint32_t rc; |
660 | 659 | ||
661 | pcmd = (struct lpfc_dmabuf *) cmdiocb->context2; | ||
662 | prsp = (struct lpfc_dmabuf *) pcmd->list.next; | ||
663 | lp = (uint32_t *) prsp->virt; | 660 | lp = (uint32_t *) prsp->virt; |
664 | sp = (struct serv_parm *) ((uint8_t *) lp + sizeof (uint32_t)); | 661 | sp = (struct serv_parm *) ((uint8_t *) lp + sizeof (uint32_t)); |
662 | memset(name, 0, sizeof (struct lpfc_name)); | ||
665 | 663 | ||
666 | /* Now we to find out if the NPort we are logging into, matches the WWPN | 664 | /* Now we to find out if the NPort we are logging into, matches the WWPN |
667 | * we have for that ndlp. If not, we have some work to do. | 665 | * we have for that ndlp. If not, we have some work to do. |
668 | */ | 666 | */ |
669 | new_ndlp = lpfc_findnode_wwpn(phba, NLP_SEARCH_ALL, &sp->portName); | 667 | new_ndlp = lpfc_findnode_wwpn(phba, NLP_SEARCH_ALL, &sp->portName); |
670 | 668 | ||
671 | memset(name, 0, sizeof (struct lpfc_name)); | 669 | if (new_ndlp == ndlp) |
672 | rc = memcmp(&ndlp->nlp_portname, name, sizeof(struct lpfc_name)); | ||
673 | if (!rc || (new_ndlp == ndlp)) { | ||
674 | return ndlp; | 670 | return ndlp; |
675 | } | ||
676 | 671 | ||
677 | if (!new_ndlp) { | 672 | if (!new_ndlp) { |
673 | rc = | ||
674 | memcmp(&ndlp->nlp_portname, name, sizeof(struct lpfc_name)); | ||
675 | if (!rc) | ||
676 | return ndlp; | ||
678 | new_ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_ATOMIC); | 677 | new_ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_ATOMIC); |
679 | if (!new_ndlp) | 678 | if (!new_ndlp) |
680 | return ndlp; | 679 | return ndlp; |
@@ -683,17 +682,21 @@ lpfc_plogi_confirm_nport(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
683 | } | 682 | } |
684 | 683 | ||
685 | lpfc_unreg_rpi(phba, new_ndlp); | 684 | lpfc_unreg_rpi(phba, new_ndlp); |
686 | new_ndlp->nlp_prev_state = ndlp->nlp_state; | ||
687 | new_ndlp->nlp_DID = ndlp->nlp_DID; | 685 | new_ndlp->nlp_DID = ndlp->nlp_DID; |
688 | new_ndlp->nlp_state = NLP_STE_PLOGI_ISSUE; | 686 | new_ndlp->nlp_prev_state = ndlp->nlp_prev_state; |
689 | lpfc_nlp_list(phba, new_ndlp, NLP_PLOGI_LIST); | 687 | new_ndlp->nlp_state = ndlp->nlp_state; |
688 | lpfc_nlp_list(phba, new_ndlp, ndlp->nlp_flag & NLP_LIST_MASK); | ||
690 | 689 | ||
691 | /* Move this back to NPR list */ | 690 | /* Move this back to NPR list */ |
692 | lpfc_unreg_rpi(phba, ndlp); | 691 | if (memcmp(&ndlp->nlp_portname, name, sizeof(struct lpfc_name)) == 0) { |
693 | ndlp->nlp_DID = 0; /* Two ndlps cannot have the same did */ | 692 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); |
694 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 693 | } |
695 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | 694 | else { |
696 | 695 | lpfc_unreg_rpi(phba, ndlp); | |
696 | ndlp->nlp_DID = 0; /* Two ndlps cannot have the same did */ | ||
697 | ndlp->nlp_state = NLP_STE_NPR_NODE; | ||
698 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | ||
699 | } | ||
697 | return new_ndlp; | 700 | return new_ndlp; |
698 | } | 701 | } |
699 | 702 | ||
@@ -703,6 +706,7 @@ lpfc_cmpl_els_plogi(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
703 | { | 706 | { |
704 | IOCB_t *irsp; | 707 | IOCB_t *irsp; |
705 | struct lpfc_nodelist *ndlp; | 708 | struct lpfc_nodelist *ndlp; |
709 | struct lpfc_dmabuf *prsp; | ||
706 | int disc, rc, did, type; | 710 | int disc, rc, did, type; |
707 | 711 | ||
708 | 712 | ||
@@ -769,7 +773,10 @@ lpfc_cmpl_els_plogi(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
769 | } | 773 | } |
770 | } else { | 774 | } else { |
771 | /* Good status, call state machine */ | 775 | /* Good status, call state machine */ |
772 | ndlp = lpfc_plogi_confirm_nport(phba, cmdiocb, ndlp); | 776 | prsp = list_entry(((struct lpfc_dmabuf *) |
777 | cmdiocb->context2)->list.next, | ||
778 | struct lpfc_dmabuf, list); | ||
779 | ndlp = lpfc_plogi_confirm_nport(phba, prsp, ndlp); | ||
773 | rc = lpfc_disc_state_machine(phba, ndlp, cmdiocb, | 780 | rc = lpfc_disc_state_machine(phba, ndlp, cmdiocb, |
774 | NLP_EVT_CMPL_PLOGI); | 781 | NLP_EVT_CMPL_PLOGI); |
775 | } | 782 | } |
@@ -3282,10 +3289,9 @@ lpfc_els_timeout_handler(struct lpfc_hba *phba) | |||
3282 | } else | 3289 | } else |
3283 | lpfc_sli_release_iocbq(phba, piocb); | 3290 | lpfc_sli_release_iocbq(phba, piocb); |
3284 | } | 3291 | } |
3285 | if (phba->sli.ring[LPFC_ELS_RING].txcmplq_cnt) { | 3292 | if (phba->sli.ring[LPFC_ELS_RING].txcmplq_cnt) |
3286 | phba->els_tmofunc.expires = jiffies + HZ * timeout; | 3293 | mod_timer(&phba->els_tmofunc, jiffies + HZ * timeout); |
3287 | add_timer(&phba->els_tmofunc); | 3294 | |
3288 | } | ||
3289 | spin_unlock_irq(phba->host->host_lock); | 3295 | spin_unlock_irq(phba->host->host_lock); |
3290 | } | 3296 | } |
3291 | 3297 | ||
@@ -3442,6 +3448,8 @@ lpfc_els_unsol_event(struct lpfc_hba * phba, | |||
3442 | if ((did & Fabric_DID_MASK) == Fabric_DID_MASK) { | 3448 | if ((did & Fabric_DID_MASK) == Fabric_DID_MASK) { |
3443 | ndlp->nlp_type |= NLP_FABRIC; | 3449 | ndlp->nlp_type |= NLP_FABRIC; |
3444 | } | 3450 | } |
3451 | ndlp->nlp_state = NLP_STE_UNUSED_NODE; | ||
3452 | lpfc_nlp_list(phba, ndlp, NLP_UNUSED_LIST); | ||
3445 | } | 3453 | } |
3446 | 3454 | ||
3447 | phba->fc_stat.elsRcvFrame++; | 3455 | phba->fc_stat.elsRcvFrame++; |
@@ -3463,13 +3471,14 @@ lpfc_els_unsol_event(struct lpfc_hba * phba, | |||
3463 | rjt_err = 1; | 3471 | rjt_err = 1; |
3464 | break; | 3472 | break; |
3465 | } | 3473 | } |
3474 | ndlp = lpfc_plogi_confirm_nport(phba, mp, ndlp); | ||
3466 | lpfc_disc_state_machine(phba, ndlp, elsiocb, NLP_EVT_RCV_PLOGI); | 3475 | lpfc_disc_state_machine(phba, ndlp, elsiocb, NLP_EVT_RCV_PLOGI); |
3467 | break; | 3476 | break; |
3468 | case ELS_CMD_FLOGI: | 3477 | case ELS_CMD_FLOGI: |
3469 | phba->fc_stat.elsRcvFLOGI++; | 3478 | phba->fc_stat.elsRcvFLOGI++; |
3470 | lpfc_els_rcv_flogi(phba, elsiocb, ndlp, newnode); | 3479 | lpfc_els_rcv_flogi(phba, elsiocb, ndlp, newnode); |
3471 | if (newnode) { | 3480 | if (newnode) { |
3472 | mempool_free( ndlp, phba->nlp_mem_pool); | 3481 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); |
3473 | } | 3482 | } |
3474 | break; | 3483 | break; |
3475 | case ELS_CMD_LOGO: | 3484 | case ELS_CMD_LOGO: |
@@ -3492,7 +3501,7 @@ lpfc_els_unsol_event(struct lpfc_hba * phba, | |||
3492 | phba->fc_stat.elsRcvRSCN++; | 3501 | phba->fc_stat.elsRcvRSCN++; |
3493 | lpfc_els_rcv_rscn(phba, elsiocb, ndlp, newnode); | 3502 | lpfc_els_rcv_rscn(phba, elsiocb, ndlp, newnode); |
3494 | if (newnode) { | 3503 | if (newnode) { |
3495 | mempool_free( ndlp, phba->nlp_mem_pool); | 3504 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); |
3496 | } | 3505 | } |
3497 | break; | 3506 | break; |
3498 | case ELS_CMD_ADISC: | 3507 | case ELS_CMD_ADISC: |
@@ -3535,28 +3544,28 @@ lpfc_els_unsol_event(struct lpfc_hba * phba, | |||
3535 | phba->fc_stat.elsRcvLIRR++; | 3544 | phba->fc_stat.elsRcvLIRR++; |
3536 | lpfc_els_rcv_lirr(phba, elsiocb, ndlp); | 3545 | lpfc_els_rcv_lirr(phba, elsiocb, ndlp); |
3537 | if (newnode) { | 3546 | if (newnode) { |
3538 | mempool_free( ndlp, phba->nlp_mem_pool); | 3547 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); |
3539 | } | 3548 | } |
3540 | break; | 3549 | break; |
3541 | case ELS_CMD_RPS: | 3550 | case ELS_CMD_RPS: |
3542 | phba->fc_stat.elsRcvRPS++; | 3551 | phba->fc_stat.elsRcvRPS++; |
3543 | lpfc_els_rcv_rps(phba, elsiocb, ndlp); | 3552 | lpfc_els_rcv_rps(phba, elsiocb, ndlp); |
3544 | if (newnode) { | 3553 | if (newnode) { |
3545 | mempool_free( ndlp, phba->nlp_mem_pool); | 3554 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); |
3546 | } | 3555 | } |
3547 | break; | 3556 | break; |
3548 | case ELS_CMD_RPL: | 3557 | case ELS_CMD_RPL: |
3549 | phba->fc_stat.elsRcvRPL++; | 3558 | phba->fc_stat.elsRcvRPL++; |
3550 | lpfc_els_rcv_rpl(phba, elsiocb, ndlp); | 3559 | lpfc_els_rcv_rpl(phba, elsiocb, ndlp); |
3551 | if (newnode) { | 3560 | if (newnode) { |
3552 | mempool_free( ndlp, phba->nlp_mem_pool); | 3561 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); |
3553 | } | 3562 | } |
3554 | break; | 3563 | break; |
3555 | case ELS_CMD_RNID: | 3564 | case ELS_CMD_RNID: |
3556 | phba->fc_stat.elsRcvRNID++; | 3565 | phba->fc_stat.elsRcvRNID++; |
3557 | lpfc_els_rcv_rnid(phba, elsiocb, ndlp); | 3566 | lpfc_els_rcv_rnid(phba, elsiocb, ndlp); |
3558 | if (newnode) { | 3567 | if (newnode) { |
3559 | mempool_free( ndlp, phba->nlp_mem_pool); | 3568 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); |
3560 | } | 3569 | } |
3561 | break; | 3570 | break; |
3562 | default: | 3571 | default: |
@@ -3568,7 +3577,7 @@ lpfc_els_unsol_event(struct lpfc_hba * phba, | |||
3568 | "%d:0115 Unknown ELS command x%x received from " | 3577 | "%d:0115 Unknown ELS command x%x received from " |
3569 | "NPORT x%x\n", phba->brd_no, cmd, did); | 3578 | "NPORT x%x\n", phba->brd_no, cmd, did); |
3570 | if (newnode) { | 3579 | if (newnode) { |
3571 | mempool_free( ndlp, phba->nlp_mem_pool); | 3580 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); |
3572 | } | 3581 | } |
3573 | break; | 3582 | break; |
3574 | } | 3583 | } |
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index adb086009ae0..4d6cf990c4fc 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c | |||
@@ -1084,7 +1084,7 @@ lpfc_register_remote_port(struct lpfc_hba * phba, | |||
1084 | fc_remote_port_rolechg(rport, rport_ids.roles); | 1084 | fc_remote_port_rolechg(rport, rport_ids.roles); |
1085 | 1085 | ||
1086 | if ((rport->scsi_target_id != -1) && | 1086 | if ((rport->scsi_target_id != -1) && |
1087 | (rport->scsi_target_id < MAX_FCP_TARGET)) { | 1087 | (rport->scsi_target_id < LPFC_MAX_TARGET)) { |
1088 | ndlp->nlp_sid = rport->scsi_target_id; | 1088 | ndlp->nlp_sid = rport->scsi_target_id; |
1089 | } | 1089 | } |
1090 | 1090 | ||
@@ -1313,7 +1313,7 @@ lpfc_nlp_list(struct lpfc_hba * phba, struct lpfc_nodelist * nlp, int list) | |||
1313 | if ((rport_add == mapped) && | 1313 | if ((rport_add == mapped) && |
1314 | ((!nlp->rport) || | 1314 | ((!nlp->rport) || |
1315 | (nlp->rport->scsi_target_id == -1) || | 1315 | (nlp->rport->scsi_target_id == -1) || |
1316 | (nlp->rport->scsi_target_id >= MAX_FCP_TARGET))) { | 1316 | (nlp->rport->scsi_target_id >= LPFC_MAX_TARGET))) { |
1317 | nlp->nlp_state = NLP_STE_UNMAPPED_NODE; | 1317 | nlp->nlp_state = NLP_STE_UNMAPPED_NODE; |
1318 | spin_lock_irq(phba->host->host_lock); | 1318 | spin_lock_irq(phba->host->host_lock); |
1319 | nlp->nlp_flag |= NLP_TGT_NO_SCSIID; | 1319 | nlp->nlp_flag |= NLP_TGT_NO_SCSIID; |
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 81755a3f7c68..ef47b824cbed 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -71,6 +71,7 @@ lpfc_config_port_prep(struct lpfc_hba * phba) | |||
71 | uint16_t offset = 0; | 71 | uint16_t offset = 0; |
72 | static char licensed[56] = | 72 | static char licensed[56] = |
73 | "key unlock for use with gnu public licensed code only\0"; | 73 | "key unlock for use with gnu public licensed code only\0"; |
74 | static int init_key = 1; | ||
74 | 75 | ||
75 | pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | 76 | pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
76 | if (!pmb) { | 77 | if (!pmb) { |
@@ -82,10 +83,13 @@ lpfc_config_port_prep(struct lpfc_hba * phba) | |||
82 | phba->hba_state = LPFC_INIT_MBX_CMDS; | 83 | phba->hba_state = LPFC_INIT_MBX_CMDS; |
83 | 84 | ||
84 | if (lpfc_is_LC_HBA(phba->pcidev->device)) { | 85 | if (lpfc_is_LC_HBA(phba->pcidev->device)) { |
85 | uint32_t *ptext = (uint32_t *) licensed; | 86 | if (init_key) { |
87 | uint32_t *ptext = (uint32_t *) licensed; | ||
86 | 88 | ||
87 | for (i = 0; i < 56; i += sizeof (uint32_t), ptext++) | 89 | for (i = 0; i < 56; i += sizeof (uint32_t), ptext++) |
88 | *ptext = cpu_to_be32(*ptext); | 90 | *ptext = cpu_to_be32(*ptext); |
91 | init_key = 0; | ||
92 | } | ||
89 | 93 | ||
90 | lpfc_read_nv(phba, pmb); | 94 | lpfc_read_nv(phba, pmb); |
91 | memset((char*)mb->un.varRDnvp.rsvd3, 0, | 95 | memset((char*)mb->un.varRDnvp.rsvd3, 0, |
@@ -405,19 +409,26 @@ lpfc_config_port_post(struct lpfc_hba * phba) | |||
405 | } | 409 | } |
406 | /* MBOX buffer will be freed in mbox compl */ | 410 | /* MBOX buffer will be freed in mbox compl */ |
407 | 411 | ||
408 | i = 0; | 412 | return (0); |
413 | } | ||
414 | |||
415 | static int | ||
416 | lpfc_discovery_wait(struct lpfc_hba *phba) | ||
417 | { | ||
418 | int i = 0; | ||
419 | |||
409 | while ((phba->hba_state != LPFC_HBA_READY) || | 420 | while ((phba->hba_state != LPFC_HBA_READY) || |
410 | (phba->num_disc_nodes) || (phba->fc_prli_sent) || | 421 | (phba->num_disc_nodes) || (phba->fc_prli_sent) || |
411 | ((phba->fc_map_cnt == 0) && (i<2)) || | 422 | ((phba->fc_map_cnt == 0) && (i<2)) || |
412 | (psli->sli_flag & LPFC_SLI_MBOX_ACTIVE)) { | 423 | (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE)) { |
413 | /* Check every second for 30 retries. */ | 424 | /* Check every second for 30 retries. */ |
414 | i++; | 425 | i++; |
415 | if (i > 30) { | 426 | if (i > 30) { |
416 | break; | 427 | return -ETIMEDOUT; |
417 | } | 428 | } |
418 | if ((i >= 15) && (phba->hba_state <= LPFC_LINK_DOWN)) { | 429 | if ((i >= 15) && (phba->hba_state <= LPFC_LINK_DOWN)) { |
419 | /* The link is down. Set linkdown timeout */ | 430 | /* The link is down. Set linkdown timeout */ |
420 | break; | 431 | return -ETIMEDOUT; |
421 | } | 432 | } |
422 | 433 | ||
423 | /* Delay for 1 second to give discovery time to complete. */ | 434 | /* Delay for 1 second to give discovery time to complete. */ |
@@ -425,12 +436,7 @@ lpfc_config_port_post(struct lpfc_hba * phba) | |||
425 | 436 | ||
426 | } | 437 | } |
427 | 438 | ||
428 | /* Since num_disc_nodes keys off of PLOGI, delay a bit to let | 439 | return 0; |
429 | * any potential PRLIs to flush thru the SLI sub-system. | ||
430 | */ | ||
431 | msleep(50); | ||
432 | |||
433 | return (0); | ||
434 | } | 440 | } |
435 | 441 | ||
436 | /************************************************************************/ | 442 | /************************************************************************/ |
@@ -1339,7 +1345,8 @@ lpfc_offline(struct lpfc_hba * phba) | |||
1339 | struct lpfc_sli_ring *pring; | 1345 | struct lpfc_sli_ring *pring; |
1340 | struct lpfc_sli *psli; | 1346 | struct lpfc_sli *psli; |
1341 | unsigned long iflag; | 1347 | unsigned long iflag; |
1342 | int i = 0; | 1348 | int i; |
1349 | int cnt = 0; | ||
1343 | 1350 | ||
1344 | if (!phba) | 1351 | if (!phba) |
1345 | return 0; | 1352 | return 0; |
@@ -1348,17 +1355,27 @@ lpfc_offline(struct lpfc_hba * phba) | |||
1348 | return 0; | 1355 | return 0; |
1349 | 1356 | ||
1350 | psli = &phba->sli; | 1357 | psli = &phba->sli; |
1351 | pring = &psli->ring[psli->fcp_ring]; | ||
1352 | 1358 | ||
1353 | lpfc_linkdown(phba); | 1359 | lpfc_linkdown(phba); |
1360 | lpfc_sli_flush_mbox_queue(phba); | ||
1354 | 1361 | ||
1355 | /* The linkdown event takes 30 seconds to timeout. */ | 1362 | for (i = 0; i < psli->num_rings; i++) { |
1356 | while (pring->txcmplq_cnt) { | 1363 | pring = &psli->ring[i]; |
1357 | mdelay(10); | 1364 | /* The linkdown event takes 30 seconds to timeout. */ |
1358 | if (i++ > 3000) | 1365 | while (pring->txcmplq_cnt) { |
1359 | break; | 1366 | mdelay(10); |
1367 | if (cnt++ > 3000) { | ||
1368 | lpfc_printf_log(phba, | ||
1369 | KERN_WARNING, LOG_INIT, | ||
1370 | "%d:0466 Outstanding IO when " | ||
1371 | "bringing Adapter offline\n", | ||
1372 | phba->brd_no); | ||
1373 | break; | ||
1374 | } | ||
1375 | } | ||
1360 | } | 1376 | } |
1361 | 1377 | ||
1378 | |||
1362 | /* stop all timers associated with this hba */ | 1379 | /* stop all timers associated with this hba */ |
1363 | lpfc_stop_timer(phba); | 1380 | lpfc_stop_timer(phba); |
1364 | phba->work_hba_events = 0; | 1381 | phba->work_hba_events = 0; |
@@ -1639,6 +1656,8 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
1639 | goto out_free_irq; | 1656 | goto out_free_irq; |
1640 | } | 1657 | } |
1641 | 1658 | ||
1659 | lpfc_discovery_wait(phba); | ||
1660 | |||
1642 | if (phba->cfg_poll & DISABLE_FCP_RING_INT) { | 1661 | if (phba->cfg_poll & DISABLE_FCP_RING_INT) { |
1643 | spin_lock_irq(phba->host->host_lock); | 1662 | spin_lock_irq(phba->host->host_lock); |
1644 | lpfc_poll_start_timer(phba); | 1663 | lpfc_poll_start_timer(phba); |
diff --git a/drivers/scsi/lpfc/lpfc_mem.c b/drivers/scsi/lpfc/lpfc_mem.c index 07017658ac56..066292d3995a 100644 --- a/drivers/scsi/lpfc/lpfc_mem.c +++ b/drivers/scsi/lpfc/lpfc_mem.c | |||
@@ -133,6 +133,11 @@ lpfc_mem_free(struct lpfc_hba * phba) | |||
133 | 133 | ||
134 | pci_pool_destroy(phba->lpfc_scsi_dma_buf_pool); | 134 | pci_pool_destroy(phba->lpfc_scsi_dma_buf_pool); |
135 | pci_pool_destroy(phba->lpfc_mbuf_pool); | 135 | pci_pool_destroy(phba->lpfc_mbuf_pool); |
136 | |||
137 | /* Free the iocb lookup array */ | ||
138 | kfree(psli->iocbq_lookup); | ||
139 | psli->iocbq_lookup = NULL; | ||
140 | |||
136 | } | 141 | } |
137 | 142 | ||
138 | void * | 143 | void * |
diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c index 27d60ad897cd..bd0b0e293d63 100644 --- a/drivers/scsi/lpfc/lpfc_nportdisc.c +++ b/drivers/scsi/lpfc/lpfc_nportdisc.c | |||
@@ -1110,6 +1110,17 @@ lpfc_cmpl_reglogin_reglogin_issue(struct lpfc_hba * phba, | |||
1110 | phba->brd_no, | 1110 | phba->brd_no, |
1111 | did, mb->mbxStatus, phba->hba_state); | 1111 | did, mb->mbxStatus, phba->hba_state); |
1112 | 1112 | ||
1113 | /* | ||
1114 | * If RegLogin failed due to lack of HBA resources do not | ||
1115 | * retry discovery. | ||
1116 | */ | ||
1117 | if (mb->mbxStatus == MBXERR_RPI_FULL) { | ||
1118 | ndlp->nlp_prev_state = NLP_STE_UNUSED_NODE; | ||
1119 | ndlp->nlp_state = NLP_STE_UNUSED_NODE; | ||
1120 | lpfc_nlp_list(phba, ndlp, NLP_UNUSED_LIST); | ||
1121 | return ndlp->nlp_state; | ||
1122 | } | ||
1123 | |||
1113 | /* Put ndlp in npr list set plogi timer for 1 sec */ | 1124 | /* Put ndlp in npr list set plogi timer for 1 sec */ |
1114 | mod_timer(&ndlp->nlp_delayfunc, jiffies + HZ * 1); | 1125 | mod_timer(&ndlp->nlp_delayfunc, jiffies + HZ * 1); |
1115 | spin_lock_irq(phba->host->host_lock); | 1126 | spin_lock_irq(phba->host->host_lock); |
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index aea1ee472f3d..a760a44173df 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c | |||
@@ -153,22 +153,6 @@ static void | |||
153 | lpfc_release_scsi_buf(struct lpfc_hba * phba, struct lpfc_scsi_buf * psb) | 153 | lpfc_release_scsi_buf(struct lpfc_hba * phba, struct lpfc_scsi_buf * psb) |
154 | { | 154 | { |
155 | unsigned long iflag = 0; | 155 | unsigned long iflag = 0; |
156 | /* | ||
157 | * There are only two special cases to consider. (1) the scsi command | ||
158 | * requested scatter-gather usage or (2) the scsi command allocated | ||
159 | * a request buffer, but did not request use_sg. There is a third | ||
160 | * case, but it does not require resource deallocation. | ||
161 | */ | ||
162 | if ((psb->seg_cnt > 0) && (psb->pCmd->use_sg)) { | ||
163 | dma_unmap_sg(&phba->pcidev->dev, psb->pCmd->request_buffer, | ||
164 | psb->seg_cnt, psb->pCmd->sc_data_direction); | ||
165 | } else { | ||
166 | if ((psb->nonsg_phys) && (psb->pCmd->request_bufflen)) { | ||
167 | dma_unmap_single(&phba->pcidev->dev, psb->nonsg_phys, | ||
168 | psb->pCmd->request_bufflen, | ||
169 | psb->pCmd->sc_data_direction); | ||
170 | } | ||
171 | } | ||
172 | 156 | ||
173 | spin_lock_irqsave(&phba->scsi_buf_list_lock, iflag); | 157 | spin_lock_irqsave(&phba->scsi_buf_list_lock, iflag); |
174 | psb->pCmd = NULL; | 158 | psb->pCmd = NULL; |
@@ -282,6 +266,27 @@ lpfc_scsi_prep_dma_buf(struct lpfc_hba * phba, struct lpfc_scsi_buf * lpfc_cmd) | |||
282 | } | 266 | } |
283 | 267 | ||
284 | static void | 268 | static void |
269 | lpfc_scsi_unprep_dma_buf(struct lpfc_hba * phba, struct lpfc_scsi_buf * psb) | ||
270 | { | ||
271 | /* | ||
272 | * There are only two special cases to consider. (1) the scsi command | ||
273 | * requested scatter-gather usage or (2) the scsi command allocated | ||
274 | * a request buffer, but did not request use_sg. There is a third | ||
275 | * case, but it does not require resource deallocation. | ||
276 | */ | ||
277 | if ((psb->seg_cnt > 0) && (psb->pCmd->use_sg)) { | ||
278 | dma_unmap_sg(&phba->pcidev->dev, psb->pCmd->request_buffer, | ||
279 | psb->seg_cnt, psb->pCmd->sc_data_direction); | ||
280 | } else { | ||
281 | if ((psb->nonsg_phys) && (psb->pCmd->request_bufflen)) { | ||
282 | dma_unmap_single(&phba->pcidev->dev, psb->nonsg_phys, | ||
283 | psb->pCmd->request_bufflen, | ||
284 | psb->pCmd->sc_data_direction); | ||
285 | } | ||
286 | } | ||
287 | } | ||
288 | |||
289 | static void | ||
285 | lpfc_handle_fcp_err(struct lpfc_scsi_buf *lpfc_cmd) | 290 | lpfc_handle_fcp_err(struct lpfc_scsi_buf *lpfc_cmd) |
286 | { | 291 | { |
287 | struct scsi_cmnd *cmnd = lpfc_cmd->pCmd; | 292 | struct scsi_cmnd *cmnd = lpfc_cmd->pCmd; |
@@ -454,6 +459,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, | |||
454 | cmd->scsi_done(cmd); | 459 | cmd->scsi_done(cmd); |
455 | 460 | ||
456 | if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { | 461 | if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { |
462 | lpfc_scsi_unprep_dma_buf(phba, lpfc_cmd); | ||
457 | lpfc_release_scsi_buf(phba, lpfc_cmd); | 463 | lpfc_release_scsi_buf(phba, lpfc_cmd); |
458 | return; | 464 | return; |
459 | } | 465 | } |
@@ -511,6 +517,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, | |||
511 | } | 517 | } |
512 | } | 518 | } |
513 | 519 | ||
520 | lpfc_scsi_unprep_dma_buf(phba, lpfc_cmd); | ||
514 | lpfc_release_scsi_buf(phba, lpfc_cmd); | 521 | lpfc_release_scsi_buf(phba, lpfc_cmd); |
515 | } | 522 | } |
516 | 523 | ||
@@ -609,6 +616,7 @@ lpfc_scsi_prep_cmnd(struct lpfc_hba * phba, struct lpfc_scsi_buf * lpfc_cmd, | |||
609 | static int | 616 | static int |
610 | lpfc_scsi_prep_task_mgmt_cmd(struct lpfc_hba *phba, | 617 | lpfc_scsi_prep_task_mgmt_cmd(struct lpfc_hba *phba, |
611 | struct lpfc_scsi_buf *lpfc_cmd, | 618 | struct lpfc_scsi_buf *lpfc_cmd, |
619 | unsigned int lun, | ||
612 | uint8_t task_mgmt_cmd) | 620 | uint8_t task_mgmt_cmd) |
613 | { | 621 | { |
614 | struct lpfc_sli *psli; | 622 | struct lpfc_sli *psli; |
@@ -627,8 +635,7 @@ lpfc_scsi_prep_task_mgmt_cmd(struct lpfc_hba *phba, | |||
627 | piocb = &piocbq->iocb; | 635 | piocb = &piocbq->iocb; |
628 | 636 | ||
629 | fcp_cmnd = lpfc_cmd->fcp_cmnd; | 637 | fcp_cmnd = lpfc_cmd->fcp_cmnd; |
630 | int_to_scsilun(lpfc_cmd->pCmd->device->lun, | 638 | int_to_scsilun(lun, &lpfc_cmd->fcp_cmnd->fcp_lun); |
631 | &lpfc_cmd->fcp_cmnd->fcp_lun); | ||
632 | fcp_cmnd->fcpCntl2 = task_mgmt_cmd; | 639 | fcp_cmnd->fcpCntl2 = task_mgmt_cmd; |
633 | 640 | ||
634 | piocb->ulpCommand = CMD_FCP_ICMND64_CR; | 641 | piocb->ulpCommand = CMD_FCP_ICMND64_CR; |
@@ -655,14 +662,16 @@ lpfc_scsi_prep_task_mgmt_cmd(struct lpfc_hba *phba, | |||
655 | 662 | ||
656 | static int | 663 | static int |
657 | lpfc_scsi_tgt_reset(struct lpfc_scsi_buf * lpfc_cmd, struct lpfc_hba * phba, | 664 | lpfc_scsi_tgt_reset(struct lpfc_scsi_buf * lpfc_cmd, struct lpfc_hba * phba, |
658 | unsigned tgt_id, struct lpfc_rport_data *rdata) | 665 | unsigned tgt_id, unsigned int lun, |
666 | struct lpfc_rport_data *rdata) | ||
659 | { | 667 | { |
660 | struct lpfc_iocbq *iocbq; | 668 | struct lpfc_iocbq *iocbq; |
661 | struct lpfc_iocbq *iocbqrsp; | 669 | struct lpfc_iocbq *iocbqrsp; |
662 | int ret; | 670 | int ret; |
663 | 671 | ||
664 | lpfc_cmd->rdata = rdata; | 672 | lpfc_cmd->rdata = rdata; |
665 | ret = lpfc_scsi_prep_task_mgmt_cmd(phba, lpfc_cmd, FCP_TARGET_RESET); | 673 | ret = lpfc_scsi_prep_task_mgmt_cmd(phba, lpfc_cmd, lun, |
674 | FCP_TARGET_RESET); | ||
666 | if (!ret) | 675 | if (!ret) |
667 | return FAILED; | 676 | return FAILED; |
668 | 677 | ||
@@ -822,6 +831,7 @@ lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *)) | |||
822 | return 0; | 831 | return 0; |
823 | 832 | ||
824 | out_host_busy_free_buf: | 833 | out_host_busy_free_buf: |
834 | lpfc_scsi_unprep_dma_buf(phba, lpfc_cmd); | ||
825 | lpfc_release_scsi_buf(phba, lpfc_cmd); | 835 | lpfc_release_scsi_buf(phba, lpfc_cmd); |
826 | out_host_busy: | 836 | out_host_busy: |
827 | return SCSI_MLQUEUE_HOST_BUSY; | 837 | return SCSI_MLQUEUE_HOST_BUSY; |
@@ -969,12 +979,12 @@ lpfc_reset_lun_handler(struct scsi_cmnd *cmnd) | |||
969 | if (lpfc_cmd == NULL) | 979 | if (lpfc_cmd == NULL) |
970 | goto out; | 980 | goto out; |
971 | 981 | ||
972 | lpfc_cmd->pCmd = cmnd; | ||
973 | lpfc_cmd->timeout = 60; | 982 | lpfc_cmd->timeout = 60; |
974 | lpfc_cmd->scsi_hba = phba; | 983 | lpfc_cmd->scsi_hba = phba; |
975 | lpfc_cmd->rdata = rdata; | 984 | lpfc_cmd->rdata = rdata; |
976 | 985 | ||
977 | ret = lpfc_scsi_prep_task_mgmt_cmd(phba, lpfc_cmd, FCP_LUN_RESET); | 986 | ret = lpfc_scsi_prep_task_mgmt_cmd(phba, lpfc_cmd, cmnd->device->lun, |
987 | FCP_LUN_RESET); | ||
978 | if (!ret) | 988 | if (!ret) |
979 | goto out_free_scsi_buf; | 989 | goto out_free_scsi_buf; |
980 | 990 | ||
@@ -1001,7 +1011,6 @@ lpfc_reset_lun_handler(struct scsi_cmnd *cmnd) | |||
1001 | cmd_status = iocbqrsp->iocb.ulpStatus; | 1011 | cmd_status = iocbqrsp->iocb.ulpStatus; |
1002 | 1012 | ||
1003 | lpfc_sli_release_iocbq(phba, iocbqrsp); | 1013 | lpfc_sli_release_iocbq(phba, iocbqrsp); |
1004 | lpfc_release_scsi_buf(phba, lpfc_cmd); | ||
1005 | 1014 | ||
1006 | /* | 1015 | /* |
1007 | * All outstanding txcmplq I/Os should have been aborted by the device. | 1016 | * All outstanding txcmplq I/Os should have been aborted by the device. |
@@ -1040,6 +1049,8 @@ lpfc_reset_lun_handler(struct scsi_cmnd *cmnd) | |||
1040 | } | 1049 | } |
1041 | 1050 | ||
1042 | out_free_scsi_buf: | 1051 | out_free_scsi_buf: |
1052 | lpfc_release_scsi_buf(phba, lpfc_cmd); | ||
1053 | |||
1043 | lpfc_printf_log(phba, KERN_ERR, LOG_FCP, | 1054 | lpfc_printf_log(phba, KERN_ERR, LOG_FCP, |
1044 | "%d:0713 SCSI layer issued LUN reset (%d, %d) " | 1055 | "%d:0713 SCSI layer issued LUN reset (%d, %d) " |
1045 | "Data: x%x x%x x%x\n", | 1056 | "Data: x%x x%x x%x\n", |
@@ -1070,7 +1081,6 @@ lpfc_reset_bus_handler(struct scsi_cmnd *cmnd) | |||
1070 | 1081 | ||
1071 | /* The lpfc_cmd storage is reused. Set all loop invariants. */ | 1082 | /* The lpfc_cmd storage is reused. Set all loop invariants. */ |
1072 | lpfc_cmd->timeout = 60; | 1083 | lpfc_cmd->timeout = 60; |
1073 | lpfc_cmd->pCmd = cmnd; | ||
1074 | lpfc_cmd->scsi_hba = phba; | 1084 | lpfc_cmd->scsi_hba = phba; |
1075 | 1085 | ||
1076 | /* | 1086 | /* |
@@ -1078,7 +1088,7 @@ lpfc_reset_bus_handler(struct scsi_cmnd *cmnd) | |||
1078 | * targets known to the driver. Should any target reset | 1088 | * targets known to the driver. Should any target reset |
1079 | * fail, this routine returns failure to the midlayer. | 1089 | * fail, this routine returns failure to the midlayer. |
1080 | */ | 1090 | */ |
1081 | for (i = 0; i < MAX_FCP_TARGET; i++) { | 1091 | for (i = 0; i < LPFC_MAX_TARGET; i++) { |
1082 | /* Search the mapped list for this target ID */ | 1092 | /* Search the mapped list for this target ID */ |
1083 | match = 0; | 1093 | match = 0; |
1084 | list_for_each_entry(ndlp, &phba->fc_nlpmap_list, nlp_listp) { | 1094 | list_for_each_entry(ndlp, &phba->fc_nlpmap_list, nlp_listp) { |
@@ -1090,8 +1100,8 @@ lpfc_reset_bus_handler(struct scsi_cmnd *cmnd) | |||
1090 | if (!match) | 1100 | if (!match) |
1091 | continue; | 1101 | continue; |
1092 | 1102 | ||
1093 | ret = lpfc_scsi_tgt_reset(lpfc_cmd, phba, | 1103 | ret = lpfc_scsi_tgt_reset(lpfc_cmd, phba, i, cmnd->device->lun, |
1094 | i, ndlp->rport->dd_data); | 1104 | ndlp->rport->dd_data); |
1095 | if (ret != SUCCESS) { | 1105 | if (ret != SUCCESS) { |
1096 | lpfc_printf_log(phba, KERN_ERR, LOG_FCP, | 1106 | lpfc_printf_log(phba, KERN_ERR, LOG_FCP, |
1097 | "%d:0713 Bus Reset on target %d failed\n", | 1107 | "%d:0713 Bus Reset on target %d failed\n", |
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index bb69a7a1ec59..350a625fa224 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c | |||
@@ -191,35 +191,12 @@ static int | |||
191 | lpfc_sli_ringtxcmpl_put(struct lpfc_hba * phba, | 191 | lpfc_sli_ringtxcmpl_put(struct lpfc_hba * phba, |
192 | struct lpfc_sli_ring * pring, struct lpfc_iocbq * piocb) | 192 | struct lpfc_sli_ring * pring, struct lpfc_iocbq * piocb) |
193 | { | 193 | { |
194 | uint16_t iotag; | ||
195 | |||
196 | list_add_tail(&piocb->list, &pring->txcmplq); | 194 | list_add_tail(&piocb->list, &pring->txcmplq); |
197 | pring->txcmplq_cnt++; | 195 | pring->txcmplq_cnt++; |
198 | if (unlikely(pring->ringno == LPFC_ELS_RING)) | 196 | if (unlikely(pring->ringno == LPFC_ELS_RING)) |
199 | mod_timer(&phba->els_tmofunc, | 197 | mod_timer(&phba->els_tmofunc, |
200 | jiffies + HZ * (phba->fc_ratov << 1)); | 198 | jiffies + HZ * (phba->fc_ratov << 1)); |
201 | 199 | ||
202 | if (pring->fast_lookup) { | ||
203 | /* Setup fast lookup based on iotag for completion */ | ||
204 | iotag = piocb->iocb.ulpIoTag; | ||
205 | if (iotag && (iotag < pring->fast_iotag)) | ||
206 | *(pring->fast_lookup + iotag) = piocb; | ||
207 | else { | ||
208 | |||
209 | /* Cmd ring <ringno> put: iotag <iotag> greater then | ||
210 | configured max <fast_iotag> wd0 <icmd> */ | ||
211 | lpfc_printf_log(phba, | ||
212 | KERN_ERR, | ||
213 | LOG_SLI, | ||
214 | "%d:0316 Cmd ring %d put: iotag x%x " | ||
215 | "greater then configured max x%x " | ||
216 | "wd0 x%x\n", | ||
217 | phba->brd_no, | ||
218 | pring->ringno, iotag, | ||
219 | pring->fast_iotag, | ||
220 | *(((uint32_t *)(&piocb->iocb)) + 7)); | ||
221 | } | ||
222 | } | ||
223 | return (0); | 200 | return (0); |
224 | } | 201 | } |
225 | 202 | ||
@@ -601,7 +578,7 @@ lpfc_sli_handle_mb_event(struct lpfc_hba * phba) | |||
601 | /* Stray Mailbox Interrupt, mbxCommand <cmd> mbxStatus | 578 | /* Stray Mailbox Interrupt, mbxCommand <cmd> mbxStatus |
602 | <status> */ | 579 | <status> */ |
603 | lpfc_printf_log(phba, | 580 | lpfc_printf_log(phba, |
604 | KERN_ERR, | 581 | KERN_WARNING, |
605 | LOG_MBOX | LOG_SLI, | 582 | LOG_MBOX | LOG_SLI, |
606 | "%d:0304 Stray Mailbox Interrupt " | 583 | "%d:0304 Stray Mailbox Interrupt " |
607 | "mbxCommand x%x mbxStatus x%x\n", | 584 | "mbxCommand x%x mbxStatus x%x\n", |
@@ -1570,8 +1547,8 @@ lpfc_sli_brdready(struct lpfc_hba * phba, uint32_t mask) | |||
1570 | 1547 | ||
1571 | void lpfc_reset_barrier(struct lpfc_hba * phba) | 1548 | void lpfc_reset_barrier(struct lpfc_hba * phba) |
1572 | { | 1549 | { |
1573 | uint32_t * resp_buf; | 1550 | uint32_t __iomem *resp_buf; |
1574 | uint32_t * mbox_buf; | 1551 | uint32_t __iomem *mbox_buf; |
1575 | volatile uint32_t mbox; | 1552 | volatile uint32_t mbox; |
1576 | uint32_t hc_copy; | 1553 | uint32_t hc_copy; |
1577 | int i; | 1554 | int i; |
@@ -1587,7 +1564,7 @@ void lpfc_reset_barrier(struct lpfc_hba * phba) | |||
1587 | * Tell the other part of the chip to suspend temporarily all | 1564 | * Tell the other part of the chip to suspend temporarily all |
1588 | * its DMA activity. | 1565 | * its DMA activity. |
1589 | */ | 1566 | */ |
1590 | resp_buf = (uint32_t *)phba->MBslimaddr; | 1567 | resp_buf = phba->MBslimaddr; |
1591 | 1568 | ||
1592 | /* Disable the error attention */ | 1569 | /* Disable the error attention */ |
1593 | hc_copy = readl(phba->HCregaddr); | 1570 | hc_copy = readl(phba->HCregaddr); |
@@ -1605,7 +1582,7 @@ void lpfc_reset_barrier(struct lpfc_hba * phba) | |||
1605 | ((MAILBOX_t *)&mbox)->mbxOwner = OWN_CHIP; | 1582 | ((MAILBOX_t *)&mbox)->mbxOwner = OWN_CHIP; |
1606 | 1583 | ||
1607 | writel(BARRIER_TEST_PATTERN, (resp_buf + 1)); | 1584 | writel(BARRIER_TEST_PATTERN, (resp_buf + 1)); |
1608 | mbox_buf = (uint32_t *)phba->MBslimaddr; | 1585 | mbox_buf = phba->MBslimaddr; |
1609 | writel(mbox, mbox_buf); | 1586 | writel(mbox, mbox_buf); |
1610 | 1587 | ||
1611 | for (i = 0; | 1588 | for (i = 0; |
@@ -1805,7 +1782,7 @@ lpfc_sli_brdrestart(struct lpfc_hba * phba) | |||
1805 | skip_post = 0; | 1782 | skip_post = 0; |
1806 | word0 = 0; /* This is really setting up word1 */ | 1783 | word0 = 0; /* This is really setting up word1 */ |
1807 | } | 1784 | } |
1808 | to_slim = (uint8_t *) phba->MBslimaddr + sizeof (uint32_t); | 1785 | to_slim = phba->MBslimaddr + sizeof (uint32_t); |
1809 | writel(*(uint32_t *) mb, to_slim); | 1786 | writel(*(uint32_t *) mb, to_slim); |
1810 | readl(to_slim); /* flush */ | 1787 | readl(to_slim); /* flush */ |
1811 | 1788 | ||
@@ -2659,8 +2636,6 @@ lpfc_sli_hba_down(struct lpfc_hba * phba) | |||
2659 | 2636 | ||
2660 | INIT_LIST_HEAD(&(pring->txq)); | 2637 | INIT_LIST_HEAD(&(pring->txq)); |
2661 | 2638 | ||
2662 | kfree(pring->fast_lookup); | ||
2663 | pring->fast_lookup = NULL; | ||
2664 | } | 2639 | } |
2665 | 2640 | ||
2666 | spin_unlock_irqrestore(phba->host->host_lock, flags); | 2641 | spin_unlock_irqrestore(phba->host->host_lock, flags); |
@@ -3110,6 +3085,24 @@ lpfc_sli_issue_mbox_wait(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq, | |||
3110 | return retval; | 3085 | return retval; |
3111 | } | 3086 | } |
3112 | 3087 | ||
3088 | int | ||
3089 | lpfc_sli_flush_mbox_queue(struct lpfc_hba * phba) | ||
3090 | { | ||
3091 | int i = 0; | ||
3092 | |||
3093 | while (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE && !phba->stopped) { | ||
3094 | if (i++ > LPFC_MBOX_TMO * 1000) | ||
3095 | return 1; | ||
3096 | |||
3097 | if (lpfc_sli_handle_mb_event(phba) == 0) | ||
3098 | i = 0; | ||
3099 | |||
3100 | msleep(1); | ||
3101 | } | ||
3102 | |||
3103 | return (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) ? 1 : 0; | ||
3104 | } | ||
3105 | |||
3113 | irqreturn_t | 3106 | irqreturn_t |
3114 | lpfc_intr_handler(int irq, void *dev_id, struct pt_regs * regs) | 3107 | lpfc_intr_handler(int irq, void *dev_id, struct pt_regs * regs) |
3115 | { | 3108 | { |
diff --git a/drivers/scsi/lpfc/lpfc_sli.h b/drivers/scsi/lpfc/lpfc_sli.h index a52d6c6cf083..d8ef0d2894d4 100644 --- a/drivers/scsi/lpfc/lpfc_sli.h +++ b/drivers/scsi/lpfc/lpfc_sli.h | |||
@@ -135,8 +135,6 @@ struct lpfc_sli_ring { | |||
135 | uint32_t fast_iotag; /* max fastlookup based iotag */ | 135 | uint32_t fast_iotag; /* max fastlookup based iotag */ |
136 | uint32_t iotag_ctr; /* keeps track of the next iotag to use */ | 136 | uint32_t iotag_ctr; /* keeps track of the next iotag to use */ |
137 | uint32_t iotag_max; /* max iotag value to use */ | 137 | uint32_t iotag_max; /* max iotag value to use */ |
138 | struct lpfc_iocbq ** fast_lookup; /* array of IOCB ptrs indexed by | ||
139 | iotag */ | ||
140 | struct list_head txq; | 138 | struct list_head txq; |
141 | uint16_t txq_cnt; /* current length of queue */ | 139 | uint16_t txq_cnt; /* current length of queue */ |
142 | uint16_t txq_max; /* max length */ | 140 | uint16_t txq_max; /* max length */ |
diff --git a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h index 6b737568b831..10e89c6ae823 100644 --- a/drivers/scsi/lpfc/lpfc_version.h +++ b/drivers/scsi/lpfc/lpfc_version.h | |||
@@ -18,7 +18,7 @@ | |||
18 | * included with this package. * | 18 | * included with this package. * |
19 | *******************************************************************/ | 19 | *******************************************************************/ |
20 | 20 | ||
21 | #define LPFC_DRIVER_VERSION "8.1.6" | 21 | #define LPFC_DRIVER_VERSION "8.1.7" |
22 | 22 | ||
23 | #define LPFC_DRIVER_NAME "lpfc" | 23 | #define LPFC_DRIVER_NAME "lpfc" |
24 | 24 | ||
diff --git a/drivers/scsi/mac53c94.c b/drivers/scsi/mac53c94.c index 93edaa8696cf..89ef34df5a1d 100644 --- a/drivers/scsi/mac53c94.c +++ b/drivers/scsi/mac53c94.c | |||
@@ -378,7 +378,7 @@ static void set_dma_cmds(struct fsc_state *state, struct scsi_cmnd *cmd) | |||
378 | int nseg; | 378 | int nseg; |
379 | 379 | ||
380 | total = 0; | 380 | total = 0; |
381 | scl = (struct scatterlist *) cmd->buffer; | 381 | scl = (struct scatterlist *) cmd->request_buffer; |
382 | nseg = pci_map_sg(state->pdev, scl, cmd->use_sg, | 382 | nseg = pci_map_sg(state->pdev, scl, cmd->use_sg, |
383 | cmd->sc_data_direction); | 383 | cmd->sc_data_direction); |
384 | for (i = 0; i < nseg; ++i) { | 384 | for (i = 0; i < nseg; ++i) { |
diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c index c88717727be8..5572981a9f92 100644 --- a/drivers/scsi/mesh.c +++ b/drivers/scsi/mesh.c | |||
@@ -1268,7 +1268,7 @@ static void set_dma_cmds(struct mesh_state *ms, struct scsi_cmnd *cmd) | |||
1268 | if (cmd->use_sg > 0) { | 1268 | if (cmd->use_sg > 0) { |
1269 | int nseg; | 1269 | int nseg; |
1270 | total = 0; | 1270 | total = 0; |
1271 | scl = (struct scatterlist *) cmd->buffer; | 1271 | scl = (struct scatterlist *) cmd->request_buffer; |
1272 | off = ms->data_ptr; | 1272 | off = ms->data_ptr; |
1273 | nseg = pci_map_sg(ms->pdev, scl, cmd->use_sg, | 1273 | nseg = pci_map_sg(ms->pdev, scl, cmd->use_sg, |
1274 | cmd->sc_data_direction); | 1274 | cmd->sc_data_direction); |
diff --git a/drivers/scsi/pluto.c b/drivers/scsi/pluto.c index 7abf64d1bfc9..0bd9c60e6455 100644 --- a/drivers/scsi/pluto.c +++ b/drivers/scsi/pluto.c | |||
@@ -169,8 +169,6 @@ int __init pluto_detect(struct scsi_host_template *tpnt) | |||
169 | SCpnt->request->rq_status = RQ_SCSI_BUSY; | 169 | SCpnt->request->rq_status = RQ_SCSI_BUSY; |
170 | 170 | ||
171 | SCpnt->done = pluto_detect_done; | 171 | SCpnt->done = pluto_detect_done; |
172 | SCpnt->bufflen = 256; | ||
173 | SCpnt->buffer = fcs[i].inquiry; | ||
174 | SCpnt->request_bufflen = 256; | 172 | SCpnt->request_bufflen = 256; |
175 | SCpnt->request_buffer = fcs[i].inquiry; | 173 | SCpnt->request_buffer = fcs[i].inquiry; |
176 | PLD(("set up %d %08lx\n", i, (long)SCpnt)) | 174 | PLD(("set up %d %08lx\n", i, (long)SCpnt)) |
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c index 69e0551a81d2..5b2f0741a55b 100644 --- a/drivers/scsi/qlogicpti.c +++ b/drivers/scsi/qlogicpti.c | |||
@@ -874,7 +874,7 @@ static inline int load_cmd(struct scsi_cmnd *Cmnd, struct Command_Entry *cmd, | |||
874 | if (Cmnd->use_sg) { | 874 | if (Cmnd->use_sg) { |
875 | int sg_count; | 875 | int sg_count; |
876 | 876 | ||
877 | sg = (struct scatterlist *) Cmnd->buffer; | 877 | sg = (struct scatterlist *) Cmnd->request_buffer; |
878 | sg_count = sbus_map_sg(qpti->sdev, sg, Cmnd->use_sg, Cmnd->sc_data_direction); | 878 | sg_count = sbus_map_sg(qpti->sdev, sg, Cmnd->use_sg, Cmnd->sc_data_direction); |
879 | 879 | ||
880 | ds = cmd->dataseg; | 880 | ds = cmd->dataseg; |
@@ -1278,7 +1278,7 @@ static struct scsi_cmnd *qlogicpti_intr_handler(struct qlogicpti *qpti) | |||
1278 | 1278 | ||
1279 | if (Cmnd->use_sg) { | 1279 | if (Cmnd->use_sg) { |
1280 | sbus_unmap_sg(qpti->sdev, | 1280 | sbus_unmap_sg(qpti->sdev, |
1281 | (struct scatterlist *)Cmnd->buffer, | 1281 | (struct scatterlist *)Cmnd->request_buffer, |
1282 | Cmnd->use_sg, | 1282 | Cmnd->use_sg, |
1283 | Cmnd->sc_data_direction); | 1283 | Cmnd->sc_data_direction); |
1284 | } else { | 1284 | } else { |
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c index 64631bd38952..4776f4e55839 100644 --- a/drivers/scsi/sata_promise.c +++ b/drivers/scsi/sata_promise.c | |||
@@ -269,8 +269,15 @@ static const struct pci_device_id pdc_ata_pci_tbl[] = { | |||
269 | { PCI_VENDOR_ID_PROMISE, 0x6629, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 269 | { PCI_VENDOR_ID_PROMISE, 0x6629, PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
270 | board_20619 }, | 270 | board_20619 }, |
271 | 271 | ||
272 | /* TODO: remove all associated board_20771 code, as it completely | ||
273 | * duplicates board_2037x code, unless reason for separation can be | ||
274 | * divined. | ||
275 | */ | ||
276 | #if 0 | ||
272 | { PCI_VENDOR_ID_PROMISE, 0x3570, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 277 | { PCI_VENDOR_ID_PROMISE, 0x3570, PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
273 | board_20771 }, | 278 | board_20771 }, |
279 | #endif | ||
280 | |||
274 | { } /* terminate list */ | 281 | { } /* terminate list */ |
275 | }; | 282 | }; |
276 | 283 | ||
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c index 2e0f4a4076af..3f368c7d3ef9 100644 --- a/drivers/scsi/sata_sil24.c +++ b/drivers/scsi/sata_sil24.c | |||
@@ -1106,7 +1106,6 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1106 | 1106 | ||
1107 | probe_ent->irq = pdev->irq; | 1107 | probe_ent->irq = pdev->irq; |
1108 | probe_ent->irq_flags = IRQF_SHARED; | 1108 | probe_ent->irq_flags = IRQF_SHARED; |
1109 | probe_ent->mmio_base = port_base; | ||
1110 | probe_ent->private_data = hpriv; | 1109 | probe_ent->private_data = hpriv; |
1111 | 1110 | ||
1112 | hpriv->host_base = host_base; | 1111 | hpriv->host_base = host_base; |
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 2ab7df0dcfe8..b332caddd5b3 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c | |||
@@ -346,7 +346,7 @@ void scsi_log_send(struct scsi_cmnd *cmd) | |||
346 | if (level > 3) { | 346 | if (level > 3) { |
347 | printk(KERN_INFO "buffer = 0x%p, bufflen = %d," | 347 | printk(KERN_INFO "buffer = 0x%p, bufflen = %d," |
348 | " done = 0x%p, queuecommand 0x%p\n", | 348 | " done = 0x%p, queuecommand 0x%p\n", |
349 | cmd->buffer, cmd->bufflen, | 349 | cmd->request_buffer, cmd->request_bufflen, |
350 | cmd->done, | 350 | cmd->done, |
351 | sdev->host->hostt->queuecommand); | 351 | sdev->host->hostt->queuecommand); |
352 | 352 | ||
@@ -661,11 +661,6 @@ void __scsi_done(struct scsi_cmnd *cmd) | |||
661 | */ | 661 | */ |
662 | int scsi_retry_command(struct scsi_cmnd *cmd) | 662 | int scsi_retry_command(struct scsi_cmnd *cmd) |
663 | { | 663 | { |
664 | /* | ||
665 | * Restore the SCSI command state. | ||
666 | */ | ||
667 | scsi_setup_cmd_retry(cmd); | ||
668 | |||
669 | /* | 664 | /* |
670 | * Zero the sense information from the last time we tried | 665 | * Zero the sense information from the last time we tried |
671 | * this command. | 666 | * this command. |
@@ -711,10 +706,6 @@ void scsi_finish_command(struct scsi_cmnd *cmd) | |||
711 | "Notifying upper driver of completion " | 706 | "Notifying upper driver of completion " |
712 | "(result %x)\n", cmd->result)); | 707 | "(result %x)\n", cmd->result)); |
713 | 708 | ||
714 | /* | ||
715 | * We can get here with use_sg=0, causing a panic in the upper level | ||
716 | */ | ||
717 | cmd->use_sg = cmd->old_use_sg; | ||
718 | cmd->done(cmd); | 709 | cmd->done(cmd); |
719 | } | 710 | } |
720 | EXPORT_SYMBOL(scsi_finish_command); | 711 | EXPORT_SYMBOL(scsi_finish_command); |
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 9c63b00773c4..a80303c6b3fd 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c | |||
@@ -286,7 +286,7 @@ static int inquiry_evpd_83(unsigned char * arr, int target_dev_id, | |||
286 | int dev_id_num, const char * dev_id_str, | 286 | int dev_id_num, const char * dev_id_str, |
287 | int dev_id_str_len); | 287 | int dev_id_str_len); |
288 | static int inquiry_evpd_88(unsigned char * arr, int target_dev_id); | 288 | static int inquiry_evpd_88(unsigned char * arr, int target_dev_id); |
289 | static void do_create_driverfs_files(void); | 289 | static int do_create_driverfs_files(void); |
290 | static void do_remove_driverfs_files(void); | 290 | static void do_remove_driverfs_files(void); |
291 | 291 | ||
292 | static int sdebug_add_adapter(void); | 292 | static int sdebug_add_adapter(void); |
@@ -2487,19 +2487,22 @@ static ssize_t sdebug_add_host_store(struct device_driver * ddp, | |||
2487 | DRIVER_ATTR(add_host, S_IRUGO | S_IWUSR, sdebug_add_host_show, | 2487 | DRIVER_ATTR(add_host, S_IRUGO | S_IWUSR, sdebug_add_host_show, |
2488 | sdebug_add_host_store); | 2488 | sdebug_add_host_store); |
2489 | 2489 | ||
2490 | static void do_create_driverfs_files(void) | 2490 | static int do_create_driverfs_files(void) |
2491 | { | 2491 | { |
2492 | driver_create_file(&sdebug_driverfs_driver, &driver_attr_add_host); | 2492 | int ret; |
2493 | driver_create_file(&sdebug_driverfs_driver, &driver_attr_delay); | 2493 | |
2494 | driver_create_file(&sdebug_driverfs_driver, &driver_attr_dev_size_mb); | 2494 | ret = driver_create_file(&sdebug_driverfs_driver, &driver_attr_add_host); |
2495 | driver_create_file(&sdebug_driverfs_driver, &driver_attr_dsense); | 2495 | ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_delay); |
2496 | driver_create_file(&sdebug_driverfs_driver, &driver_attr_every_nth); | 2496 | ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_dev_size_mb); |
2497 | driver_create_file(&sdebug_driverfs_driver, &driver_attr_max_luns); | 2497 | ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_dsense); |
2498 | driver_create_file(&sdebug_driverfs_driver, &driver_attr_num_tgts); | 2498 | ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_every_nth); |
2499 | driver_create_file(&sdebug_driverfs_driver, &driver_attr_num_parts); | 2499 | ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_max_luns); |
2500 | driver_create_file(&sdebug_driverfs_driver, &driver_attr_ptype); | 2500 | ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_num_tgts); |
2501 | driver_create_file(&sdebug_driverfs_driver, &driver_attr_opts); | 2501 | ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_num_parts); |
2502 | driver_create_file(&sdebug_driverfs_driver, &driver_attr_scsi_level); | 2502 | ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_ptype); |
2503 | ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_opts); | ||
2504 | ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_scsi_level); | ||
2505 | return ret; | ||
2503 | } | 2506 | } |
2504 | 2507 | ||
2505 | static void do_remove_driverfs_files(void) | 2508 | static void do_remove_driverfs_files(void) |
@@ -2522,6 +2525,7 @@ static int __init scsi_debug_init(void) | |||
2522 | unsigned int sz; | 2525 | unsigned int sz; |
2523 | int host_to_add; | 2526 | int host_to_add; |
2524 | int k; | 2527 | int k; |
2528 | int ret; | ||
2525 | 2529 | ||
2526 | if (scsi_debug_dev_size_mb < 1) | 2530 | if (scsi_debug_dev_size_mb < 1) |
2527 | scsi_debug_dev_size_mb = 1; /* force minimum 1 MB ramdisk */ | 2531 | scsi_debug_dev_size_mb = 1; /* force minimum 1 MB ramdisk */ |
@@ -2560,12 +2564,32 @@ static int __init scsi_debug_init(void) | |||
2560 | if (scsi_debug_num_parts > 0) | 2564 | if (scsi_debug_num_parts > 0) |
2561 | sdebug_build_parts(fake_storep); | 2565 | sdebug_build_parts(fake_storep); |
2562 | 2566 | ||
2563 | init_all_queued(); | 2567 | ret = device_register(&pseudo_primary); |
2568 | if (ret < 0) { | ||
2569 | printk(KERN_WARNING "scsi_debug: device_register error: %d\n", | ||
2570 | ret); | ||
2571 | goto free_vm; | ||
2572 | } | ||
2573 | ret = bus_register(&pseudo_lld_bus); | ||
2574 | if (ret < 0) { | ||
2575 | printk(KERN_WARNING "scsi_debug: bus_register error: %d\n", | ||
2576 | ret); | ||
2577 | goto dev_unreg; | ||
2578 | } | ||
2579 | ret = driver_register(&sdebug_driverfs_driver); | ||
2580 | if (ret < 0) { | ||
2581 | printk(KERN_WARNING "scsi_debug: driver_register error: %d\n", | ||
2582 | ret); | ||
2583 | goto bus_unreg; | ||
2584 | } | ||
2585 | ret = do_create_driverfs_files(); | ||
2586 | if (ret < 0) { | ||
2587 | printk(KERN_WARNING "scsi_debug: driver_create_file error: %d\n", | ||
2588 | ret); | ||
2589 | goto del_files; | ||
2590 | } | ||
2564 | 2591 | ||
2565 | device_register(&pseudo_primary); | 2592 | init_all_queued(); |
2566 | bus_register(&pseudo_lld_bus); | ||
2567 | driver_register(&sdebug_driverfs_driver); | ||
2568 | do_create_driverfs_files(); | ||
2569 | 2593 | ||
2570 | sdebug_driver_template.proc_name = (char *)sdebug_proc_name; | 2594 | sdebug_driver_template.proc_name = (char *)sdebug_proc_name; |
2571 | 2595 | ||
@@ -2585,6 +2609,18 @@ static int __init scsi_debug_init(void) | |||
2585 | scsi_debug_add_host); | 2609 | scsi_debug_add_host); |
2586 | } | 2610 | } |
2587 | return 0; | 2611 | return 0; |
2612 | |||
2613 | del_files: | ||
2614 | do_remove_driverfs_files(); | ||
2615 | driver_unregister(&sdebug_driverfs_driver); | ||
2616 | bus_unreg: | ||
2617 | bus_unregister(&pseudo_lld_bus); | ||
2618 | dev_unreg: | ||
2619 | device_unregister(&pseudo_primary); | ||
2620 | free_vm: | ||
2621 | vfree(fake_storep); | ||
2622 | |||
2623 | return ret; | ||
2588 | } | 2624 | } |
2589 | 2625 | ||
2590 | static void __exit scsi_debug_exit(void) | 2626 | static void __exit scsi_debug_exit(void) |
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 6683d596234a..6a5b731bd5ba 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
@@ -460,19 +460,67 @@ static void scsi_eh_done(struct scsi_cmnd *scmd) | |||
460 | * Return value: | 460 | * Return value: |
461 | * SUCCESS or FAILED or NEEDS_RETRY | 461 | * SUCCESS or FAILED or NEEDS_RETRY |
462 | **/ | 462 | **/ |
463 | static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, int timeout) | 463 | static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, int timeout, int copy_sense) |
464 | { | 464 | { |
465 | struct scsi_device *sdev = scmd->device; | 465 | struct scsi_device *sdev = scmd->device; |
466 | struct Scsi_Host *shost = sdev->host; | 466 | struct Scsi_Host *shost = sdev->host; |
467 | int old_result = scmd->result; | ||
467 | DECLARE_COMPLETION(done); | 468 | DECLARE_COMPLETION(done); |
468 | unsigned long timeleft; | 469 | unsigned long timeleft; |
469 | unsigned long flags; | 470 | unsigned long flags; |
471 | unsigned char old_cmnd[MAX_COMMAND_SIZE]; | ||
472 | enum dma_data_direction old_data_direction; | ||
473 | unsigned short old_use_sg; | ||
474 | unsigned char old_cmd_len; | ||
475 | unsigned old_bufflen; | ||
476 | void *old_buffer; | ||
470 | int rtn; | 477 | int rtn; |
471 | 478 | ||
479 | /* | ||
480 | * We need saved copies of a number of fields - this is because | ||
481 | * error handling may need to overwrite these with different values | ||
482 | * to run different commands, and once error handling is complete, | ||
483 | * we will need to restore these values prior to running the actual | ||
484 | * command. | ||
485 | */ | ||
486 | old_buffer = scmd->request_buffer; | ||
487 | old_bufflen = scmd->request_bufflen; | ||
488 | memcpy(old_cmnd, scmd->cmnd, sizeof(scmd->cmnd)); | ||
489 | old_data_direction = scmd->sc_data_direction; | ||
490 | old_cmd_len = scmd->cmd_len; | ||
491 | old_use_sg = scmd->use_sg; | ||
492 | |||
493 | if (copy_sense) { | ||
494 | int gfp_mask = GFP_ATOMIC; | ||
495 | |||
496 | if (shost->hostt->unchecked_isa_dma) | ||
497 | gfp_mask |= __GFP_DMA; | ||
498 | |||
499 | scmd->sc_data_direction = DMA_FROM_DEVICE; | ||
500 | scmd->request_bufflen = 252; | ||
501 | scmd->request_buffer = kzalloc(scmd->request_bufflen, gfp_mask); | ||
502 | if (!scmd->request_buffer) | ||
503 | return FAILED; | ||
504 | } else { | ||
505 | scmd->request_buffer = NULL; | ||
506 | scmd->request_bufflen = 0; | ||
507 | scmd->sc_data_direction = DMA_NONE; | ||
508 | } | ||
509 | |||
510 | scmd->underflow = 0; | ||
511 | scmd->use_sg = 0; | ||
512 | scmd->cmd_len = COMMAND_SIZE(scmd->cmnd[0]); | ||
513 | |||
472 | if (sdev->scsi_level <= SCSI_2) | 514 | if (sdev->scsi_level <= SCSI_2) |
473 | scmd->cmnd[1] = (scmd->cmnd[1] & 0x1f) | | 515 | scmd->cmnd[1] = (scmd->cmnd[1] & 0x1f) | |
474 | (sdev->lun << 5 & 0xe0); | 516 | (sdev->lun << 5 & 0xe0); |
475 | 517 | ||
518 | /* | ||
519 | * Zero the sense buffer. The scsi spec mandates that any | ||
520 | * untransferred sense data should be interpreted as being zero. | ||
521 | */ | ||
522 | memset(scmd->sense_buffer, 0, sizeof(scmd->sense_buffer)); | ||
523 | |||
476 | shost->eh_action = &done; | 524 | shost->eh_action = &done; |
477 | 525 | ||
478 | spin_lock_irqsave(shost->host_lock, flags); | 526 | spin_lock_irqsave(shost->host_lock, flags); |
@@ -522,6 +570,29 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, int timeout) | |||
522 | rtn = FAILED; | 570 | rtn = FAILED; |
523 | } | 571 | } |
524 | 572 | ||
573 | |||
574 | /* | ||
575 | * Last chance to have valid sense data. | ||
576 | */ | ||
577 | if (copy_sense) { | ||
578 | if (!SCSI_SENSE_VALID(scmd)) { | ||
579 | memcpy(scmd->sense_buffer, scmd->request_buffer, | ||
580 | sizeof(scmd->sense_buffer)); | ||
581 | } | ||
582 | kfree(scmd->request_buffer); | ||
583 | } | ||
584 | |||
585 | |||
586 | /* | ||
587 | * Restore original data | ||
588 | */ | ||
589 | scmd->request_buffer = old_buffer; | ||
590 | scmd->request_bufflen = old_bufflen; | ||
591 | memcpy(scmd->cmnd, old_cmnd, sizeof(scmd->cmnd)); | ||
592 | scmd->sc_data_direction = old_data_direction; | ||
593 | scmd->cmd_len = old_cmd_len; | ||
594 | scmd->use_sg = old_use_sg; | ||
595 | scmd->result = old_result; | ||
525 | return rtn; | 596 | return rtn; |
526 | } | 597 | } |
527 | 598 | ||
@@ -537,56 +608,10 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, int timeout) | |||
537 | static int scsi_request_sense(struct scsi_cmnd *scmd) | 608 | static int scsi_request_sense(struct scsi_cmnd *scmd) |
538 | { | 609 | { |
539 | static unsigned char generic_sense[6] = | 610 | static unsigned char generic_sense[6] = |
540 | {REQUEST_SENSE, 0, 0, 0, 252, 0}; | 611 | {REQUEST_SENSE, 0, 0, 0, 252, 0}; |
541 | unsigned char *scsi_result; | ||
542 | int saved_result; | ||
543 | int rtn; | ||
544 | 612 | ||
545 | memcpy(scmd->cmnd, generic_sense, sizeof(generic_sense)); | 613 | memcpy(scmd->cmnd, generic_sense, sizeof(generic_sense)); |
546 | 614 | return scsi_send_eh_cmnd(scmd, SENSE_TIMEOUT, 1); | |
547 | scsi_result = kmalloc(252, GFP_ATOMIC | ((scmd->device->host->hostt->unchecked_isa_dma) ? __GFP_DMA : 0)); | ||
548 | |||
549 | |||
550 | if (unlikely(!scsi_result)) { | ||
551 | printk(KERN_ERR "%s: cannot allocate scsi_result.\n", | ||
552 | __FUNCTION__); | ||
553 | return FAILED; | ||
554 | } | ||
555 | |||
556 | /* | ||
557 | * zero the sense buffer. some host adapters automatically always | ||
558 | * request sense, so it is not a good idea that | ||
559 | * scmd->request_buffer and scmd->sense_buffer point to the same | ||
560 | * address (db). 0 is not a valid sense code. | ||
561 | */ | ||
562 | memset(scmd->sense_buffer, 0, sizeof(scmd->sense_buffer)); | ||
563 | memset(scsi_result, 0, 252); | ||
564 | |||
565 | saved_result = scmd->result; | ||
566 | scmd->request_buffer = scsi_result; | ||
567 | scmd->request_bufflen = 252; | ||
568 | scmd->use_sg = 0; | ||
569 | scmd->cmd_len = COMMAND_SIZE(scmd->cmnd[0]); | ||
570 | scmd->sc_data_direction = DMA_FROM_DEVICE; | ||
571 | scmd->underflow = 0; | ||
572 | |||
573 | rtn = scsi_send_eh_cmnd(scmd, SENSE_TIMEOUT); | ||
574 | |||
575 | /* last chance to have valid sense data */ | ||
576 | if(!SCSI_SENSE_VALID(scmd)) { | ||
577 | memcpy(scmd->sense_buffer, scmd->request_buffer, | ||
578 | sizeof(scmd->sense_buffer)); | ||
579 | } | ||
580 | |||
581 | kfree(scsi_result); | ||
582 | |||
583 | /* | ||
584 | * when we eventually call scsi_finish, we really wish to complete | ||
585 | * the original request, so let's restore the original data. (db) | ||
586 | */ | ||
587 | scsi_setup_cmd_retry(scmd); | ||
588 | scmd->result = saved_result; | ||
589 | return rtn; | ||
590 | } | 615 | } |
591 | 616 | ||
592 | /** | 617 | /** |
@@ -605,12 +630,6 @@ void scsi_eh_finish_cmd(struct scsi_cmnd *scmd, struct list_head *done_q) | |||
605 | { | 630 | { |
606 | scmd->device->host->host_failed--; | 631 | scmd->device->host->host_failed--; |
607 | scmd->eh_eflags = 0; | 632 | scmd->eh_eflags = 0; |
608 | |||
609 | /* | ||
610 | * set this back so that the upper level can correctly free up | ||
611 | * things. | ||
612 | */ | ||
613 | scsi_setup_cmd_retry(scmd); | ||
614 | list_move_tail(&scmd->eh_entry, done_q); | 633 | list_move_tail(&scmd->eh_entry, done_q); |
615 | } | 634 | } |
616 | EXPORT_SYMBOL(scsi_eh_finish_cmd); | 635 | EXPORT_SYMBOL(scsi_eh_finish_cmd); |
@@ -715,47 +734,26 @@ static int scsi_eh_tur(struct scsi_cmnd *scmd) | |||
715 | { | 734 | { |
716 | static unsigned char tur_command[6] = {TEST_UNIT_READY, 0, 0, 0, 0, 0}; | 735 | static unsigned char tur_command[6] = {TEST_UNIT_READY, 0, 0, 0, 0, 0}; |
717 | int retry_cnt = 1, rtn; | 736 | int retry_cnt = 1, rtn; |
718 | int saved_result; | ||
719 | 737 | ||
720 | retry_tur: | 738 | retry_tur: |
721 | memcpy(scmd->cmnd, tur_command, sizeof(tur_command)); | 739 | memcpy(scmd->cmnd, tur_command, sizeof(tur_command)); |
722 | 740 | ||
723 | /* | ||
724 | * zero the sense buffer. the scsi spec mandates that any | ||
725 | * untransferred sense data should be interpreted as being zero. | ||
726 | */ | ||
727 | memset(scmd->sense_buffer, 0, sizeof(scmd->sense_buffer)); | ||
728 | |||
729 | saved_result = scmd->result; | ||
730 | scmd->request_buffer = NULL; | ||
731 | scmd->request_bufflen = 0; | ||
732 | scmd->use_sg = 0; | ||
733 | scmd->cmd_len = COMMAND_SIZE(scmd->cmnd[0]); | ||
734 | scmd->underflow = 0; | ||
735 | scmd->sc_data_direction = DMA_NONE; | ||
736 | 741 | ||
737 | rtn = scsi_send_eh_cmnd(scmd, SENSE_TIMEOUT); | 742 | rtn = scsi_send_eh_cmnd(scmd, SENSE_TIMEOUT, 0); |
738 | 743 | ||
739 | /* | ||
740 | * when we eventually call scsi_finish, we really wish to complete | ||
741 | * the original request, so let's restore the original data. (db) | ||
742 | */ | ||
743 | scsi_setup_cmd_retry(scmd); | ||
744 | scmd->result = saved_result; | ||
745 | |||
746 | /* | ||
747 | * hey, we are done. let's look to see what happened. | ||
748 | */ | ||
749 | SCSI_LOG_ERROR_RECOVERY(3, printk("%s: scmd %p rtn %x\n", | 744 | SCSI_LOG_ERROR_RECOVERY(3, printk("%s: scmd %p rtn %x\n", |
750 | __FUNCTION__, scmd, rtn)); | 745 | __FUNCTION__, scmd, rtn)); |
751 | if (rtn == SUCCESS) | 746 | |
752 | return 0; | 747 | switch (rtn) { |
753 | else if (rtn == NEEDS_RETRY) { | 748 | case NEEDS_RETRY: |
754 | if (retry_cnt--) | 749 | if (retry_cnt--) |
755 | goto retry_tur; | 750 | goto retry_tur; |
751 | /*FALLTHRU*/ | ||
752 | case SUCCESS: | ||
756 | return 0; | 753 | return 0; |
754 | default: | ||
755 | return 1; | ||
757 | } | 756 | } |
758 | return 1; | ||
759 | } | 757 | } |
760 | 758 | ||
761 | /** | 759 | /** |
@@ -837,44 +835,16 @@ static int scsi_try_bus_device_reset(struct scsi_cmnd *scmd) | |||
837 | static int scsi_eh_try_stu(struct scsi_cmnd *scmd) | 835 | static int scsi_eh_try_stu(struct scsi_cmnd *scmd) |
838 | { | 836 | { |
839 | static unsigned char stu_command[6] = {START_STOP, 0, 0, 0, 1, 0}; | 837 | static unsigned char stu_command[6] = {START_STOP, 0, 0, 0, 1, 0}; |
840 | int rtn; | ||
841 | int saved_result; | ||
842 | 838 | ||
843 | if (!scmd->device->allow_restart) | 839 | if (scmd->device->allow_restart) { |
844 | return 1; | 840 | int rtn; |
845 | |||
846 | memcpy(scmd->cmnd, stu_command, sizeof(stu_command)); | ||
847 | |||
848 | /* | ||
849 | * zero the sense buffer. the scsi spec mandates that any | ||
850 | * untransferred sense data should be interpreted as being zero. | ||
851 | */ | ||
852 | memset(scmd->sense_buffer, 0, sizeof(scmd->sense_buffer)); | ||
853 | |||
854 | saved_result = scmd->result; | ||
855 | scmd->request_buffer = NULL; | ||
856 | scmd->request_bufflen = 0; | ||
857 | scmd->use_sg = 0; | ||
858 | scmd->cmd_len = COMMAND_SIZE(scmd->cmnd[0]); | ||
859 | scmd->underflow = 0; | ||
860 | scmd->sc_data_direction = DMA_NONE; | ||
861 | 841 | ||
862 | rtn = scsi_send_eh_cmnd(scmd, START_UNIT_TIMEOUT); | 842 | memcpy(scmd->cmnd, stu_command, sizeof(stu_command)); |
863 | 843 | rtn = scsi_send_eh_cmnd(scmd, START_UNIT_TIMEOUT, 0); | |
864 | /* | 844 | if (rtn == SUCCESS) |
865 | * when we eventually call scsi_finish, we really wish to complete | 845 | return 0; |
866 | * the original request, so let's restore the original data. (db) | 846 | } |
867 | */ | ||
868 | scsi_setup_cmd_retry(scmd); | ||
869 | scmd->result = saved_result; | ||
870 | 847 | ||
871 | /* | ||
872 | * hey, we are done. let's look to see what happened. | ||
873 | */ | ||
874 | SCSI_LOG_ERROR_RECOVERY(3, printk("%s: scmd %p rtn %x\n", | ||
875 | __FUNCTION__, scmd, rtn)); | ||
876 | if (rtn == SUCCESS) | ||
877 | return 0; | ||
878 | return 1; | 848 | return 1; |
879 | } | 849 | } |
880 | 850 | ||
@@ -1684,8 +1654,6 @@ scsi_reset_provider(struct scsi_device *dev, int flag) | |||
1684 | 1654 | ||
1685 | scmd->scsi_done = scsi_reset_provider_done_command; | 1655 | scmd->scsi_done = scsi_reset_provider_done_command; |
1686 | scmd->done = NULL; | 1656 | scmd->done = NULL; |
1687 | scmd->buffer = NULL; | ||
1688 | scmd->bufflen = 0; | ||
1689 | scmd->request_buffer = NULL; | 1657 | scmd->request_buffer = NULL; |
1690 | scmd->request_bufflen = 0; | 1658 | scmd->request_bufflen = 0; |
1691 | 1659 | ||
diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c index a89c4115cfba..32293f451669 100644 --- a/drivers/scsi/scsi_ioctl.c +++ b/drivers/scsi/scsi_ioctl.c | |||
@@ -110,11 +110,8 @@ static int ioctl_internal_command(struct scsi_device *sdev, char *cmd, | |||
110 | sshdr.asc, sshdr.ascq); | 110 | sshdr.asc, sshdr.ascq); |
111 | break; | 111 | break; |
112 | case NOT_READY: /* This happens if there is no disc in drive */ | 112 | case NOT_READY: /* This happens if there is no disc in drive */ |
113 | if (sdev->removable && (cmd[0] != TEST_UNIT_READY)) { | 113 | if (sdev->removable) |
114 | printk(KERN_INFO "Device not ready. Make sure" | ||
115 | " there is a disc in the drive.\n"); | ||
116 | break; | 114 | break; |
117 | } | ||
118 | case UNIT_ATTENTION: | 115 | case UNIT_ATTENTION: |
119 | if (sdev->removable) { | 116 | if (sdev->removable) { |
120 | sdev->changed = 1; | 117 | sdev->changed = 1; |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 08af9aae7df3..077c1c691210 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -436,60 +436,16 @@ EXPORT_SYMBOL_GPL(scsi_execute_async); | |||
436 | * | 436 | * |
437 | * Arguments: cmd - command that is ready to be queued. | 437 | * Arguments: cmd - command that is ready to be queued. |
438 | * | 438 | * |
439 | * Returns: Nothing | ||
440 | * | ||
441 | * Notes: This function has the job of initializing a number of | 439 | * Notes: This function has the job of initializing a number of |
442 | * fields related to error handling. Typically this will | 440 | * fields related to error handling. Typically this will |
443 | * be called once for each command, as required. | 441 | * be called once for each command, as required. |
444 | */ | 442 | */ |
445 | static int scsi_init_cmd_errh(struct scsi_cmnd *cmd) | 443 | static void scsi_init_cmd_errh(struct scsi_cmnd *cmd) |
446 | { | 444 | { |
447 | cmd->serial_number = 0; | 445 | cmd->serial_number = 0; |
448 | |||
449 | memset(cmd->sense_buffer, 0, sizeof cmd->sense_buffer); | 446 | memset(cmd->sense_buffer, 0, sizeof cmd->sense_buffer); |
450 | |||
451 | if (cmd->cmd_len == 0) | 447 | if (cmd->cmd_len == 0) |
452 | cmd->cmd_len = COMMAND_SIZE(cmd->cmnd[0]); | 448 | cmd->cmd_len = COMMAND_SIZE(cmd->cmnd[0]); |
453 | |||
454 | /* | ||
455 | * We need saved copies of a number of fields - this is because | ||
456 | * error handling may need to overwrite these with different values | ||
457 | * to run different commands, and once error handling is complete, | ||
458 | * we will need to restore these values prior to running the actual | ||
459 | * command. | ||
460 | */ | ||
461 | cmd->old_use_sg = cmd->use_sg; | ||
462 | cmd->old_cmd_len = cmd->cmd_len; | ||
463 | cmd->sc_old_data_direction = cmd->sc_data_direction; | ||
464 | cmd->old_underflow = cmd->underflow; | ||
465 | memcpy(cmd->data_cmnd, cmd->cmnd, sizeof(cmd->cmnd)); | ||
466 | cmd->buffer = cmd->request_buffer; | ||
467 | cmd->bufflen = cmd->request_bufflen; | ||
468 | |||
469 | return 1; | ||
470 | } | ||
471 | |||
472 | /* | ||
473 | * Function: scsi_setup_cmd_retry() | ||
474 | * | ||
475 | * Purpose: Restore the command state for a retry | ||
476 | * | ||
477 | * Arguments: cmd - command to be restored | ||
478 | * | ||
479 | * Returns: Nothing | ||
480 | * | ||
481 | * Notes: Immediately prior to retrying a command, we need | ||
482 | * to restore certain fields that we saved above. | ||
483 | */ | ||
484 | void scsi_setup_cmd_retry(struct scsi_cmnd *cmd) | ||
485 | { | ||
486 | memcpy(cmd->cmnd, cmd->data_cmnd, sizeof(cmd->data_cmnd)); | ||
487 | cmd->request_buffer = cmd->buffer; | ||
488 | cmd->request_bufflen = cmd->bufflen; | ||
489 | cmd->use_sg = cmd->old_use_sg; | ||
490 | cmd->cmd_len = cmd->old_cmd_len; | ||
491 | cmd->sc_data_direction = cmd->sc_old_data_direction; | ||
492 | cmd->underflow = cmd->old_underflow; | ||
493 | } | 449 | } |
494 | 450 | ||
495 | void scsi_device_unbusy(struct scsi_device *sdev) | 451 | void scsi_device_unbusy(struct scsi_device *sdev) |
@@ -807,22 +763,13 @@ static void scsi_free_sgtable(struct scatterlist *sgl, int index) | |||
807 | */ | 763 | */ |
808 | static void scsi_release_buffers(struct scsi_cmnd *cmd) | 764 | static void scsi_release_buffers(struct scsi_cmnd *cmd) |
809 | { | 765 | { |
810 | struct request *req = cmd->request; | ||
811 | |||
812 | /* | ||
813 | * Free up any indirection buffers we allocated for DMA purposes. | ||
814 | */ | ||
815 | if (cmd->use_sg) | 766 | if (cmd->use_sg) |
816 | scsi_free_sgtable(cmd->request_buffer, cmd->sglist_len); | 767 | scsi_free_sgtable(cmd->request_buffer, cmd->sglist_len); |
817 | else if (cmd->request_buffer != req->buffer) | ||
818 | kfree(cmd->request_buffer); | ||
819 | 768 | ||
820 | /* | 769 | /* |
821 | * Zero these out. They now point to freed memory, and it is | 770 | * Zero these out. They now point to freed memory, and it is |
822 | * dangerous to hang onto the pointers. | 771 | * dangerous to hang onto the pointers. |
823 | */ | 772 | */ |
824 | cmd->buffer = NULL; | ||
825 | cmd->bufflen = 0; | ||
826 | cmd->request_buffer = NULL; | 773 | cmd->request_buffer = NULL; |
827 | cmd->request_bufflen = 0; | 774 | cmd->request_bufflen = 0; |
828 | } | 775 | } |
@@ -858,7 +805,7 @@ static void scsi_release_buffers(struct scsi_cmnd *cmd) | |||
858 | void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) | 805 | void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) |
859 | { | 806 | { |
860 | int result = cmd->result; | 807 | int result = cmd->result; |
861 | int this_count = cmd->bufflen; | 808 | int this_count = cmd->request_bufflen; |
862 | request_queue_t *q = cmd->device->request_queue; | 809 | request_queue_t *q = cmd->device->request_queue; |
863 | struct request *req = cmd->request; | 810 | struct request *req = cmd->request; |
864 | int clear_errors = 1; | 811 | int clear_errors = 1; |
@@ -866,28 +813,14 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) | |||
866 | int sense_valid = 0; | 813 | int sense_valid = 0; |
867 | int sense_deferred = 0; | 814 | int sense_deferred = 0; |
868 | 815 | ||
869 | /* | 816 | scsi_release_buffers(cmd); |
870 | * Free up any indirection buffers we allocated for DMA purposes. | ||
871 | * For the case of a READ, we need to copy the data out of the | ||
872 | * bounce buffer and into the real buffer. | ||
873 | */ | ||
874 | if (cmd->use_sg) | ||
875 | scsi_free_sgtable(cmd->buffer, cmd->sglist_len); | ||
876 | else if (cmd->buffer != req->buffer) { | ||
877 | if (rq_data_dir(req) == READ) { | ||
878 | unsigned long flags; | ||
879 | char *to = bio_kmap_irq(req->bio, &flags); | ||
880 | memcpy(to, cmd->buffer, cmd->bufflen); | ||
881 | bio_kunmap_irq(to, &flags); | ||
882 | } | ||
883 | kfree(cmd->buffer); | ||
884 | } | ||
885 | 817 | ||
886 | if (result) { | 818 | if (result) { |
887 | sense_valid = scsi_command_normalize_sense(cmd, &sshdr); | 819 | sense_valid = scsi_command_normalize_sense(cmd, &sshdr); |
888 | if (sense_valid) | 820 | if (sense_valid) |
889 | sense_deferred = scsi_sense_is_deferred(&sshdr); | 821 | sense_deferred = scsi_sense_is_deferred(&sshdr); |
890 | } | 822 | } |
823 | |||
891 | if (blk_pc_request(req)) { /* SG_IO ioctl from block level */ | 824 | if (blk_pc_request(req)) { /* SG_IO ioctl from block level */ |
892 | req->errors = result; | 825 | req->errors = result; |
893 | if (result) { | 826 | if (result) { |
@@ -908,15 +841,6 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) | |||
908 | } | 841 | } |
909 | 842 | ||
910 | /* | 843 | /* |
911 | * Zero these out. They now point to freed memory, and it is | ||
912 | * dangerous to hang onto the pointers. | ||
913 | */ | ||
914 | cmd->buffer = NULL; | ||
915 | cmd->bufflen = 0; | ||
916 | cmd->request_buffer = NULL; | ||
917 | cmd->request_bufflen = 0; | ||
918 | |||
919 | /* | ||
920 | * Next deal with any sectors which we were able to correctly | 844 | * Next deal with any sectors which we were able to correctly |
921 | * handle. | 845 | * handle. |
922 | */ | 846 | */ |
@@ -1012,7 +936,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) | |||
1012 | if (!(req->flags & REQ_QUIET)) { | 936 | if (!(req->flags & REQ_QUIET)) { |
1013 | scmd_printk(KERN_INFO, cmd, | 937 | scmd_printk(KERN_INFO, cmd, |
1014 | "Volume overflow, CDB: "); | 938 | "Volume overflow, CDB: "); |
1015 | __scsi_print_command(cmd->data_cmnd); | 939 | __scsi_print_command(cmd->cmnd); |
1016 | scsi_print_sense("", cmd); | 940 | scsi_print_sense("", cmd); |
1017 | } | 941 | } |
1018 | /* See SSC3rXX or current. */ | 942 | /* See SSC3rXX or current. */ |
@@ -1143,7 +1067,7 @@ static void scsi_blk_pc_done(struct scsi_cmnd *cmd) | |||
1143 | * successfully. Since this is a REQ_BLOCK_PC command the | 1067 | * successfully. Since this is a REQ_BLOCK_PC command the |
1144 | * caller should check the request's errors value | 1068 | * caller should check the request's errors value |
1145 | */ | 1069 | */ |
1146 | scsi_io_completion(cmd, cmd->bufflen); | 1070 | scsi_io_completion(cmd, cmd->request_bufflen); |
1147 | } | 1071 | } |
1148 | 1072 | ||
1149 | static void scsi_setup_blk_pc_cmnd(struct scsi_cmnd *cmd) | 1073 | static void scsi_setup_blk_pc_cmnd(struct scsi_cmnd *cmd) |
diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h index e2fbe9a9d5a9..ae24c85aaeea 100644 --- a/drivers/scsi/scsi_priv.h +++ b/drivers/scsi/scsi_priv.h | |||
@@ -57,7 +57,6 @@ extern int scsi_eh_scmd_add(struct scsi_cmnd *, int); | |||
57 | 57 | ||
58 | /* scsi_lib.c */ | 58 | /* scsi_lib.c */ |
59 | extern int scsi_maybe_unblock_host(struct scsi_device *sdev); | 59 | extern int scsi_maybe_unblock_host(struct scsi_device *sdev); |
60 | extern void scsi_setup_cmd_retry(struct scsi_cmnd *cmd); | ||
61 | extern void scsi_device_unbusy(struct scsi_device *sdev); | 60 | extern void scsi_device_unbusy(struct scsi_device *sdev); |
62 | extern int scsi_queue_insert(struct scsi_cmnd *cmd, int reason); | 61 | extern int scsi_queue_insert(struct scsi_cmnd *cmd, int reason); |
63 | extern void scsi_next_command(struct scsi_cmnd *cmd); | 62 | extern void scsi_next_command(struct scsi_cmnd *cmd); |
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c index dd075627e605..5a625c3fddae 100644 --- a/drivers/scsi/scsi_transport_sas.c +++ b/drivers/scsi/scsi_transport_sas.c | |||
@@ -41,6 +41,7 @@ struct sas_host_attrs { | |||
41 | struct mutex lock; | 41 | struct mutex lock; |
42 | u32 next_target_id; | 42 | u32 next_target_id; |
43 | u32 next_expander_id; | 43 | u32 next_expander_id; |
44 | int next_port_id; | ||
44 | }; | 45 | }; |
45 | #define to_sas_host_attrs(host) ((struct sas_host_attrs *)(host)->shost_data) | 46 | #define to_sas_host_attrs(host) ((struct sas_host_attrs *)(host)->shost_data) |
46 | 47 | ||
@@ -146,6 +147,7 @@ static int sas_host_setup(struct transport_container *tc, struct device *dev, | |||
146 | mutex_init(&sas_host->lock); | 147 | mutex_init(&sas_host->lock); |
147 | sas_host->next_target_id = 0; | 148 | sas_host->next_target_id = 0; |
148 | sas_host->next_expander_id = 0; | 149 | sas_host->next_expander_id = 0; |
150 | sas_host->next_port_id = 0; | ||
149 | return 0; | 151 | return 0; |
150 | } | 152 | } |
151 | 153 | ||
@@ -327,7 +329,7 @@ sas_phy_protocol_attr(identify.target_port_protocols, | |||
327 | sas_phy_simple_attr(identify.sas_address, sas_address, "0x%016llx\n", | 329 | sas_phy_simple_attr(identify.sas_address, sas_address, "0x%016llx\n", |
328 | unsigned long long); | 330 | unsigned long long); |
329 | sas_phy_simple_attr(identify.phy_identifier, phy_identifier, "%d\n", u8); | 331 | sas_phy_simple_attr(identify.phy_identifier, phy_identifier, "%d\n", u8); |
330 | //sas_phy_simple_attr(port_identifier, port_identifier, "%d\n", u8); | 332 | //sas_phy_simple_attr(port_identifier, port_identifier, "%d\n", int); |
331 | sas_phy_linkspeed_attr(negotiated_linkrate); | 333 | sas_phy_linkspeed_attr(negotiated_linkrate); |
332 | sas_phy_linkspeed_attr(minimum_linkrate_hw); | 334 | sas_phy_linkspeed_attr(minimum_linkrate_hw); |
333 | sas_phy_linkspeed_attr(minimum_linkrate); | 335 | sas_phy_linkspeed_attr(minimum_linkrate); |
@@ -590,6 +592,38 @@ struct sas_port *sas_port_alloc(struct device *parent, int port_id) | |||
590 | } | 592 | } |
591 | EXPORT_SYMBOL(sas_port_alloc); | 593 | EXPORT_SYMBOL(sas_port_alloc); |
592 | 594 | ||
595 | /** sas_port_alloc_num - allocate and initialize a SAS port structure | ||
596 | * | ||
597 | * @parent: parent device | ||
598 | * | ||
599 | * Allocates a SAS port structure and a number to go with it. This | ||
600 | * interface is really for adapters where the port number has no | ||
601 | * meansing, so the sas class should manage them. It will be added to | ||
602 | * the device tree below the device specified by @parent which must be | ||
603 | * either a Scsi_Host or a sas_expander_device. | ||
604 | * | ||
605 | * Returns %NULL on error | ||
606 | */ | ||
607 | struct sas_port *sas_port_alloc_num(struct device *parent) | ||
608 | { | ||
609 | int index; | ||
610 | struct Scsi_Host *shost = dev_to_shost(parent); | ||
611 | struct sas_host_attrs *sas_host = to_sas_host_attrs(shost); | ||
612 | |||
613 | /* FIXME: use idr for this eventually */ | ||
614 | mutex_lock(&sas_host->lock); | ||
615 | if (scsi_is_sas_expander_device(parent)) { | ||
616 | struct sas_rphy *rphy = dev_to_rphy(parent); | ||
617 | struct sas_expander_device *exp = rphy_to_expander_device(rphy); | ||
618 | |||
619 | index = exp->next_port_id++; | ||
620 | } else | ||
621 | index = sas_host->next_port_id++; | ||
622 | mutex_unlock(&sas_host->lock); | ||
623 | return sas_port_alloc(parent, index); | ||
624 | } | ||
625 | EXPORT_SYMBOL(sas_port_alloc_num); | ||
626 | |||
593 | /** | 627 | /** |
594 | * sas_port_add - add a SAS port to the device hierarchy | 628 | * sas_port_add - add a SAS port to the device hierarchy |
595 | * | 629 | * |
@@ -658,6 +692,13 @@ void sas_port_delete(struct sas_port *port) | |||
658 | } | 692 | } |
659 | mutex_unlock(&port->phy_list_mutex); | 693 | mutex_unlock(&port->phy_list_mutex); |
660 | 694 | ||
695 | if (port->is_backlink) { | ||
696 | struct device *parent = port->dev.parent; | ||
697 | |||
698 | sysfs_remove_link(&port->dev.kobj, parent->bus_id); | ||
699 | port->is_backlink = 0; | ||
700 | } | ||
701 | |||
661 | transport_remove_device(dev); | 702 | transport_remove_device(dev); |
662 | device_del(dev); | 703 | device_del(dev); |
663 | transport_destroy_device(dev); | 704 | transport_destroy_device(dev); |
@@ -733,6 +774,19 @@ void sas_port_delete_phy(struct sas_port *port, struct sas_phy *phy) | |||
733 | } | 774 | } |
734 | EXPORT_SYMBOL(sas_port_delete_phy); | 775 | EXPORT_SYMBOL(sas_port_delete_phy); |
735 | 776 | ||
777 | void sas_port_mark_backlink(struct sas_port *port) | ||
778 | { | ||
779 | struct device *parent = port->dev.parent->parent->parent; | ||
780 | |||
781 | if (port->is_backlink) | ||
782 | return; | ||
783 | port->is_backlink = 1; | ||
784 | sysfs_create_link(&port->dev.kobj, &parent->kobj, | ||
785 | parent->bus_id); | ||
786 | |||
787 | } | ||
788 | EXPORT_SYMBOL(sas_port_mark_backlink); | ||
789 | |||
736 | /* | 790 | /* |
737 | * SAS remote PHY attributes. | 791 | * SAS remote PHY attributes. |
738 | */ | 792 | */ |
@@ -1140,7 +1194,7 @@ int sas_rphy_add(struct sas_rphy *rphy) | |||
1140 | 1194 | ||
1141 | if (identify->device_type == SAS_END_DEVICE && | 1195 | if (identify->device_type == SAS_END_DEVICE && |
1142 | rphy->scsi_target_id != -1) { | 1196 | rphy->scsi_target_id != -1) { |
1143 | scsi_scan_target(&rphy->dev, parent->port_identifier, | 1197 | scsi_scan_target(&rphy->dev, 0, |
1144 | rphy->scsi_target_id, ~0, 0); | 1198 | rphy->scsi_target_id, ~0, 0); |
1145 | } | 1199 | } |
1146 | 1200 | ||
@@ -1242,15 +1296,13 @@ static int sas_user_scan(struct Scsi_Host *shost, uint channel, | |||
1242 | 1296 | ||
1243 | mutex_lock(&sas_host->lock); | 1297 | mutex_lock(&sas_host->lock); |
1244 | list_for_each_entry(rphy, &sas_host->rphy_list, list) { | 1298 | list_for_each_entry(rphy, &sas_host->rphy_list, list) { |
1245 | struct sas_port *parent = dev_to_sas_port(rphy->dev.parent); | ||
1246 | |||
1247 | if (rphy->identify.device_type != SAS_END_DEVICE || | 1299 | if (rphy->identify.device_type != SAS_END_DEVICE || |
1248 | rphy->scsi_target_id == -1) | 1300 | rphy->scsi_target_id == -1) |
1249 | continue; | 1301 | continue; |
1250 | 1302 | ||
1251 | if ((channel == SCAN_WILD_CARD || channel == parent->port_identifier) && | 1303 | if ((channel == SCAN_WILD_CARD || channel == 0) && |
1252 | (id == SCAN_WILD_CARD || id == rphy->scsi_target_id)) { | 1304 | (id == SCAN_WILD_CARD || id == rphy->scsi_target_id)) { |
1253 | scsi_scan_target(&rphy->dev, parent->port_identifier, | 1305 | scsi_scan_target(&rphy->dev, 0, |
1254 | rphy->scsi_target_id, lun, 1); | 1306 | rphy->scsi_target_id, lun, 1); |
1255 | } | 1307 | } |
1256 | } | 1308 | } |
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 3225d31449e1..98bd3aab9739 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -502,8 +502,7 @@ static int sd_init_command(struct scsi_cmnd * SCpnt) | |||
502 | SCpnt->cmnd[4] = (unsigned char) this_count; | 502 | SCpnt->cmnd[4] = (unsigned char) this_count; |
503 | SCpnt->cmnd[5] = 0; | 503 | SCpnt->cmnd[5] = 0; |
504 | } | 504 | } |
505 | SCpnt->request_bufflen = SCpnt->bufflen = | 505 | SCpnt->request_bufflen = this_count * sdp->sector_size; |
506 | this_count * sdp->sector_size; | ||
507 | 506 | ||
508 | /* | 507 | /* |
509 | * We shouldn't disconnect in the middle of a sector, so with a dumb | 508 | * We shouldn't disconnect in the middle of a sector, so with a dumb |
diff --git a/drivers/scsi/seagate.c b/drivers/scsi/seagate.c index 3f312a84c6a7..2679ea8bff1a 100644 --- a/drivers/scsi/seagate.c +++ b/drivers/scsi/seagate.c | |||
@@ -1002,7 +1002,7 @@ connect_loop: | |||
1002 | } | 1002 | } |
1003 | #endif | 1003 | #endif |
1004 | 1004 | ||
1005 | buffer = (struct scatterlist *) SCint->buffer; | 1005 | buffer = (struct scatterlist *) SCint->request_buffer; |
1006 | len = buffer->length; | 1006 | len = buffer->length; |
1007 | data = page_address(buffer->page) + buffer->offset; | 1007 | data = page_address(buffer->page) + buffer->offset; |
1008 | } else { | 1008 | } else { |
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index fd94408577e5..fae6e95a6298 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c | |||
@@ -360,7 +360,7 @@ static int sr_init_command(struct scsi_cmnd * SCpnt) | |||
360 | "mismatch count %d, bytes %d\n", | 360 | "mismatch count %d, bytes %d\n", |
361 | size, SCpnt->request_bufflen); | 361 | size, SCpnt->request_bufflen); |
362 | if (SCpnt->request_bufflen > size) | 362 | if (SCpnt->request_bufflen > size) |
363 | SCpnt->request_bufflen = SCpnt->bufflen = size; | 363 | SCpnt->request_bufflen = size; |
364 | } | 364 | } |
365 | } | 365 | } |
366 | 366 | ||
@@ -387,8 +387,7 @@ static int sr_init_command(struct scsi_cmnd * SCpnt) | |||
387 | 387 | ||
388 | if (this_count > 0xffff) { | 388 | if (this_count > 0xffff) { |
389 | this_count = 0xffff; | 389 | this_count = 0xffff; |
390 | SCpnt->request_bufflen = SCpnt->bufflen = | 390 | SCpnt->request_bufflen = this_count * s_size; |
391 | this_count * s_size; | ||
392 | } | 391 | } |
393 | 392 | ||
394 | SCpnt->cmnd[2] = (unsigned char) (block >> 24) & 0xff; | 393 | SCpnt->cmnd[2] = (unsigned char) (block >> 24) & 0xff; |
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index 756ceb93ddc8..7f669b600677 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c | |||
@@ -368,7 +368,7 @@ static int st_chk_result(struct scsi_tape *STp, struct st_request * SRpnt) | |||
368 | SRpnt->cmd[0], SRpnt->cmd[1], SRpnt->cmd[2], | 368 | SRpnt->cmd[0], SRpnt->cmd[1], SRpnt->cmd[2], |
369 | SRpnt->cmd[3], SRpnt->cmd[4], SRpnt->cmd[5]); | 369 | SRpnt->cmd[3], SRpnt->cmd[4], SRpnt->cmd[5]); |
370 | if (cmdstatp->have_sense) | 370 | if (cmdstatp->have_sense) |
371 | __scsi_print_sense("st", SRpnt->sense, SCSI_SENSE_BUFFERSIZE); | 371 | __scsi_print_sense(name, SRpnt->sense, SCSI_SENSE_BUFFERSIZE); |
372 | } ) /* end DEB */ | 372 | } ) /* end DEB */ |
373 | if (!debugging) { /* Abnormal conditions for tape */ | 373 | if (!debugging) { /* Abnormal conditions for tape */ |
374 | if (!cmdstatp->have_sense) | 374 | if (!cmdstatp->have_sense) |
@@ -384,9 +384,8 @@ static int st_chk_result(struct scsi_tape *STp, struct st_request * SRpnt) | |||
384 | scode != VOLUME_OVERFLOW && | 384 | scode != VOLUME_OVERFLOW && |
385 | SRpnt->cmd[0] != MODE_SENSE && | 385 | SRpnt->cmd[0] != MODE_SENSE && |
386 | SRpnt->cmd[0] != TEST_UNIT_READY) { | 386 | SRpnt->cmd[0] != TEST_UNIT_READY) { |
387 | printk(KERN_WARNING "%s: Error with sense data: ", name); | 387 | |
388 | __scsi_print_sense("st", SRpnt->sense, | 388 | __scsi_print_sense(name, SRpnt->sense, SCSI_SENSE_BUFFERSIZE); |
389 | SCSI_SENSE_BUFFERSIZE); | ||
390 | } | 389 | } |
391 | } | 390 | } |
392 | 391 | ||
diff --git a/drivers/scsi/sun3_NCR5380.c b/drivers/scsi/sun3_NCR5380.c index 2ebe0d663899..2f8073b73bf3 100644 --- a/drivers/scsi/sun3_NCR5380.c +++ b/drivers/scsi/sun3_NCR5380.c | |||
@@ -517,7 +517,7 @@ static __inline__ void initialize_SCp(Scsi_Cmnd *cmd) | |||
517 | */ | 517 | */ |
518 | 518 | ||
519 | if (cmd->use_sg) { | 519 | if (cmd->use_sg) { |
520 | cmd->SCp.buffer = (struct scatterlist *) cmd->buffer; | 520 | cmd->SCp.buffer = (struct scatterlist *) cmd->request_buffer; |
521 | cmd->SCp.buffers_residual = cmd->use_sg - 1; | 521 | cmd->SCp.buffers_residual = cmd->use_sg - 1; |
522 | cmd->SCp.ptr = (char *) SGADDR(cmd->SCp.buffer); | 522 | cmd->SCp.ptr = (char *) SGADDR(cmd->SCp.buffer); |
523 | cmd->SCp.this_residual = cmd->SCp.buffer->length; | 523 | cmd->SCp.this_residual = cmd->SCp.buffer->length; |
diff --git a/drivers/scsi/sun3x_esp.c b/drivers/scsi/sun3x_esp.c index 1f328cae5c05..6b60536ac92b 100644 --- a/drivers/scsi/sun3x_esp.c +++ b/drivers/scsi/sun3x_esp.c | |||
@@ -347,7 +347,7 @@ static void dma_mmu_release_scsi_one (struct NCR_ESP *esp, Scsi_Cmnd *sp) | |||
347 | static void dma_mmu_release_scsi_sgl (struct NCR_ESP *esp, Scsi_Cmnd *sp) | 347 | static void dma_mmu_release_scsi_sgl (struct NCR_ESP *esp, Scsi_Cmnd *sp) |
348 | { | 348 | { |
349 | int sz = sp->use_sg - 1; | 349 | int sz = sp->use_sg - 1; |
350 | struct scatterlist *sg = (struct scatterlist *)sp->buffer; | 350 | struct scatterlist *sg = (struct scatterlist *)sp->request_buffer; |
351 | 351 | ||
352 | while(sz >= 0) { | 352 | while(sz >= 0) { |
353 | dvma_unmap((char *)sg[sz].dma_address); | 353 | dvma_unmap((char *)sg[sz].dma_address); |
diff --git a/drivers/scsi/wd33c93.c b/drivers/scsi/wd33c93.c index 680f38ab60d8..2083454db511 100644 --- a/drivers/scsi/wd33c93.c +++ b/drivers/scsi/wd33c93.c | |||
@@ -373,7 +373,7 @@ wd33c93_queuecommand(struct scsi_cmnd *cmd, | |||
373 | */ | 373 | */ |
374 | 374 | ||
375 | if (cmd->use_sg) { | 375 | if (cmd->use_sg) { |
376 | cmd->SCp.buffer = (struct scatterlist *) cmd->buffer; | 376 | cmd->SCp.buffer = (struct scatterlist *) cmd->request_buffer; |
377 | cmd->SCp.buffers_residual = cmd->use_sg - 1; | 377 | cmd->SCp.buffers_residual = cmd->use_sg - 1; |
378 | cmd->SCp.ptr = page_address(cmd->SCp.buffer->page) + | 378 | cmd->SCp.ptr = page_address(cmd->SCp.buffer->page) + |
379 | cmd->SCp.buffer->offset; | 379 | cmd->SCp.buffer->offset; |