aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/Kconfig2
-rw-r--r--drivers/scsi/aacraid/aacraid.h6
-rw-r--r--drivers/scsi/aacraid/linit.c3
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm.c24
-rw-r--r--drivers/scsi/aic7xxx/aicasm/aicasm.c4
-rw-r--r--drivers/scsi/aic7xxx/aicasm/aicasm_insformat.h8
-rw-r--r--drivers/scsi/dc395x.c48
-rw-r--r--drivers/scsi/dpt_i2o.c9
-rw-r--r--drivers/scsi/ibmvscsi/srp.h2
-rw-r--r--drivers/scsi/ips.c8
-rw-r--r--drivers/scsi/ips.h39
-rw-r--r--drivers/scsi/libata-scsi.c1
-rw-r--r--drivers/scsi/sata_sx4.c2
-rw-r--r--drivers/scsi/scsi_scan.c16
-rw-r--r--drivers/scsi/scsi_transport_fc.c19
-rw-r--r--drivers/scsi/st.c8
16 files changed, 108 insertions, 91 deletions
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 96df148ed969..f1e8c4223ed1 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -424,7 +424,7 @@ config SCSI_IN2000
424source "drivers/scsi/megaraid/Kconfig.megaraid" 424source "drivers/scsi/megaraid/Kconfig.megaraid"
425 425
426config SCSI_SATA 426config SCSI_SATA
427 bool "Serial ATA (SATA) support" 427 tristate "Serial ATA (SATA) support"
428 depends on SCSI 428 depends on SCSI
429 help 429 help
430 This driver family supports Serial ATA host controllers 430 This driver family supports Serial ATA host controllers
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 3a11a536c0da..4ab07861b457 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -15,11 +15,7 @@
15#define AAC_MAX_LUN (8) 15#define AAC_MAX_LUN (8)
16 16
17#define AAC_MAX_HOSTPHYSMEMPAGES (0xfffff) 17#define AAC_MAX_HOSTPHYSMEMPAGES (0xfffff)
18/* 18#define AAC_MAX_32BIT_SGBCOUNT ((unsigned short)512)
19 * max_sectors is an unsigned short, otherwise limit is 0x100000000 / 512
20 * Linux has starvation problems if we permit larger than 4MB I/O ...
21 */
22#define AAC_MAX_32BIT_SGBCOUNT ((unsigned short)8192)
23 19
24/* 20/*
25 * These macros convert from physical channels to virtual channels 21 * These macros convert from physical channels to virtual channels
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index c1a4f978fcba..562da90480a1 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -374,7 +374,8 @@ static int aac_slave_configure(struct scsi_device *sdev)
374 else 374 else
375 scsi_adjust_queue_depth(sdev, 0, 1); 375 scsi_adjust_queue_depth(sdev, 0, 1);
376 376
377 if (host->max_sectors < AAC_MAX_32BIT_SGBCOUNT) 377 if (!(((struct aac_dev *)host->hostdata)->adapter_info.options
378 & AAC_OPT_NEW_COMM))
378 blk_queue_max_segment_size(sdev->request_queue, 65536); 379 blk_queue_max_segment_size(sdev->request_queue, 65536);
379 380
380 return 0; 381 return 0;
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index 116d0f51ca2c..687f19e9cf03 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -1264,14 +1264,12 @@ ahc_platform_set_tags(struct ahc_softc *ahc, struct ahc_devinfo *devinfo,
1264 } 1264 }
1265 switch ((dev->flags & (AHC_DEV_Q_BASIC|AHC_DEV_Q_TAGGED))) { 1265 switch ((dev->flags & (AHC_DEV_Q_BASIC|AHC_DEV_Q_TAGGED))) {
1266 case AHC_DEV_Q_BASIC: 1266 case AHC_DEV_Q_BASIC:
1267 scsi_adjust_queue_depth(sdev, 1267 scsi_set_tag_type(sdev, MSG_SIMPLE_TAG);
1268 MSG_SIMPLE_TASK, 1268 scsi_activate_tcq(sdev, dev->openings + dev->active);
1269 dev->openings + dev->active);
1270 break; 1269 break;
1271 case AHC_DEV_Q_TAGGED: 1270 case AHC_DEV_Q_TAGGED:
1272 scsi_adjust_queue_depth(sdev, 1271 scsi_set_tag_type(sdev, MSG_ORDERED_TAG);
1273 MSG_ORDERED_TASK, 1272 scsi_activate_tcq(sdev, dev->openings + dev->active);
1274 dev->openings + dev->active);
1275 break; 1273 break;
1276 default: 1274 default:
1277 /* 1275 /*
@@ -1280,9 +1278,7 @@ ahc_platform_set_tags(struct ahc_softc *ahc, struct ahc_devinfo *devinfo,
1280 * serially on the controller/device. This should 1278 * serially on the controller/device. This should
1281 * remove some latency. 1279 * remove some latency.
1282 */ 1280 */
1283 scsi_adjust_queue_depth(sdev, 1281 scsi_deactivate_tcq(sdev, 2);
1284 /*NON-TAGGED*/0,
1285 /*queue depth*/2);
1286 break; 1282 break;
1287 } 1283 }
1288} 1284}
@@ -1635,9 +1631,9 @@ ahc_send_async(struct ahc_softc *ahc, char channel,
1635 spi_period(starget) = tinfo->curr.period; 1631 spi_period(starget) = tinfo->curr.period;
1636 spi_width(starget) = tinfo->curr.width; 1632 spi_width(starget) = tinfo->curr.width;
1637 spi_offset(starget) = tinfo->curr.offset; 1633 spi_offset(starget) = tinfo->curr.offset;
1638 spi_dt(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_DT_REQ; 1634 spi_dt(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_DT_REQ ? 1 : 0;
1639 spi_qas(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_QAS_REQ; 1635 spi_qas(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_QAS_REQ ? 1 : 0;
1640 spi_iu(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_IU_REQ; 1636 spi_iu(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_IU_REQ ? 1 : 0;
1641 spi_display_xfer_agreement(starget); 1637 spi_display_xfer_agreement(starget);
1642 break; 1638 break;
1643 } 1639 }
@@ -2429,12 +2425,14 @@ static void ahc_linux_set_dt(struct scsi_target *starget, int dt)
2429 unsigned int ppr_options = tinfo->goal.ppr_options 2425 unsigned int ppr_options = tinfo->goal.ppr_options
2430 & ~MSG_EXT_PPR_DT_REQ; 2426 & ~MSG_EXT_PPR_DT_REQ;
2431 unsigned int period = tinfo->goal.period; 2427 unsigned int period = tinfo->goal.period;
2428 unsigned int width = tinfo->goal.width;
2432 unsigned long flags; 2429 unsigned long flags;
2433 struct ahc_syncrate *syncrate; 2430 struct ahc_syncrate *syncrate;
2434 2431
2435 if (dt) { 2432 if (dt) {
2436 period = 9; /* 12.5ns is the only period valid for DT */
2437 ppr_options |= MSG_EXT_PPR_DT_REQ; 2433 ppr_options |= MSG_EXT_PPR_DT_REQ;
2434 if (!width)
2435 ahc_linux_set_width(starget, 1);
2438 } else if (period == 9) 2436 } else if (period == 9)
2439 period = 10; /* if resetting DT, period must be >= 25ns */ 2437 period = 10; /* if resetting DT, period must be >= 25ns */
2440 2438
diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm.c b/drivers/scsi/aic7xxx/aicasm/aicasm.c
index c34639481904..f936b691232f 100644
--- a/drivers/scsi/aic7xxx/aicasm/aicasm.c
+++ b/drivers/scsi/aic7xxx/aicasm/aicasm.c
@@ -369,7 +369,7 @@ output_code()
369 369
370 fprintf(ofile, "%s\t0x%02x, 0x%02x, 0x%02x, 0x%02x", 370 fprintf(ofile, "%s\t0x%02x, 0x%02x, 0x%02x, 0x%02x",
371 cur_instr == STAILQ_FIRST(&seq_program) ? "" : ",\n", 371 cur_instr == STAILQ_FIRST(&seq_program) ? "" : ",\n",
372#if BYTE_ORDER == LITTLE_ENDIAN 372#ifdef __LITTLE_ENDIAN
373 cur_instr->format.bytes[0], 373 cur_instr->format.bytes[0],
374 cur_instr->format.bytes[1], 374 cur_instr->format.bytes[1],
375 cur_instr->format.bytes[2], 375 cur_instr->format.bytes[2],
@@ -613,7 +613,7 @@ output_listing(char *ifilename)
613 line++; 613 line++;
614 } 614 }
615 fprintf(listfile, "%03x %02x%02x%02x%02x", instrptr, 615 fprintf(listfile, "%03x %02x%02x%02x%02x", instrptr,
616#if BYTE_ORDER == LITTLE_ENDIAN 616#ifdef __LITTLE_ENDIAN
617 cur_instr->format.bytes[0], 617 cur_instr->format.bytes[0],
618 cur_instr->format.bytes[1], 618 cur_instr->format.bytes[1],
619 cur_instr->format.bytes[2], 619 cur_instr->format.bytes[2],
diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm_insformat.h b/drivers/scsi/aic7xxx/aicasm/aicasm_insformat.h
index 3e80f07df49c..e64f802bbaaa 100644
--- a/drivers/scsi/aic7xxx/aicasm/aicasm_insformat.h
+++ b/drivers/scsi/aic7xxx/aicasm/aicasm_insformat.h
@@ -42,8 +42,10 @@
42 * $FreeBSD$ 42 * $FreeBSD$
43 */ 43 */
44 44
45#include <asm/byteorder.h>
46
45struct ins_format1 { 47struct ins_format1 {
46#if BYTE_ORDER == LITTLE_ENDIAN 48#ifdef __LITTLE_ENDIAN
47 uint32_t immediate : 8, 49 uint32_t immediate : 8,
48 source : 9, 50 source : 9,
49 destination : 9, 51 destination : 9,
@@ -61,7 +63,7 @@ struct ins_format1 {
61}; 63};
62 64
63struct ins_format2 { 65struct ins_format2 {
64#if BYTE_ORDER == LITTLE_ENDIAN 66#ifdef __LITTLE_ENDIAN
65 uint32_t shift_control : 8, 67 uint32_t shift_control : 8,
66 source : 9, 68 source : 9,
67 destination : 9, 69 destination : 9,
@@ -79,7 +81,7 @@ struct ins_format2 {
79}; 81};
80 82
81struct ins_format3 { 83struct ins_format3 {
82#if BYTE_ORDER == LITTLE_ENDIAN 84#ifdef __LITTLE_ENDIAN
83 uint32_t immediate : 8, 85 uint32_t immediate : 8,
84 source : 9, 86 source : 9,
85 address : 10, 87 address : 10,
diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
index 929170dcd3cb..600ba1202864 100644
--- a/drivers/scsi/dc395x.c
+++ b/drivers/scsi/dc395x.c
@@ -183,7 +183,7 @@
183 * cross a page boundy. 183 * cross a page boundy.
184 */ 184 */
185#define SEGMENTX_LEN (sizeof(struct SGentry)*DC395x_MAX_SG_LISTENTRY) 185#define SEGMENTX_LEN (sizeof(struct SGentry)*DC395x_MAX_SG_LISTENTRY)
186#define VIRTX_LEN (sizeof(void *) * DC395x_MAX_SG_LISTENTRY) 186
187 187
188struct SGentry { 188struct SGentry {
189 u32 address; /* bus! address */ 189 u32 address; /* bus! address */
@@ -235,7 +235,6 @@ struct ScsiReqBlk {
235 u8 sg_count; /* No of HW sg entries for this request */ 235 u8 sg_count; /* No of HW sg entries for this request */
236 u8 sg_index; /* Index of HW sg entry for this request */ 236 u8 sg_index; /* Index of HW sg entry for this request */
237 u32 total_xfer_length; /* Total number of bytes remaining to be transfered */ 237 u32 total_xfer_length; /* Total number of bytes remaining to be transfered */
238 void **virt_map;
239 unsigned char *virt_addr; /* Virtual address of current transfer position */ 238 unsigned char *virt_addr; /* Virtual address of current transfer position */
240 239
241 /* 240 /*
@@ -1022,14 +1021,14 @@ static void build_srb(struct scsi_cmnd *cmd, struct DeviceCtlBlk *dcb,
1022 reqlen, cmd->request_buffer, cmd->use_sg, 1021 reqlen, cmd->request_buffer, cmd->use_sg,
1023 srb->sg_count); 1022 srb->sg_count);
1024 1023
1024 srb->virt_addr = page_address(sl->page);
1025 for (i = 0; i < srb->sg_count; i++) { 1025 for (i = 0; i < srb->sg_count; i++) {
1026 u32 seglen = (u32)sg_dma_len(sl + i); 1026 u32 busaddr = (u32)sg_dma_address(&sl[i]);
1027 sgp[i].address = (u32)sg_dma_address(sl + i); 1027 u32 seglen = (u32)sl[i].length;
1028 sgp[i].address = busaddr;
1028 sgp[i].length = seglen; 1029 sgp[i].length = seglen;
1029 srb->total_xfer_length += seglen; 1030 srb->total_xfer_length += seglen;
1030 srb->virt_map[i] = kmap(sl[i].page);
1031 } 1031 }
1032 srb->virt_addr = srb->virt_map[0];
1033 sgp += srb->sg_count - 1; 1032 sgp += srb->sg_count - 1;
1034 1033
1035 /* 1034 /*
@@ -1976,7 +1975,6 @@ static void sg_update_list(struct ScsiReqBlk *srb, u32 left)
1976 int segment = cmd->use_sg; 1975 int segment = cmd->use_sg;
1977 u32 xferred = srb->total_xfer_length - left; /* bytes transfered */ 1976 u32 xferred = srb->total_xfer_length - left; /* bytes transfered */
1978 struct SGentry *psge = srb->segment_x + srb->sg_index; 1977 struct SGentry *psge = srb->segment_x + srb->sg_index;
1979 void **virt = srb->virt_map;
1980 1978
1981 dprintkdbg(DBG_0, 1979 dprintkdbg(DBG_0,
1982 "sg_update_list: Transfered %i of %i bytes, %i remain\n", 1980 "sg_update_list: Transfered %i of %i bytes, %i remain\n",
@@ -2016,16 +2014,16 @@ static void sg_update_list(struct ScsiReqBlk *srb, u32 left)
2016 2014
2017 /* We have to walk the scatterlist to find it */ 2015 /* We have to walk the scatterlist to find it */
2018 sg = (struct scatterlist *)cmd->request_buffer; 2016 sg = (struct scatterlist *)cmd->request_buffer;
2019 idx = 0;
2020 while (segment--) { 2017 while (segment--) {
2021 unsigned long mask = 2018 unsigned long mask =
2022 ~((unsigned long)sg->length - 1) & PAGE_MASK; 2019 ~((unsigned long)sg->length - 1) & PAGE_MASK;
2023 if ((sg_dma_address(sg) & mask) == (psge->address & mask)) { 2020 if ((sg_dma_address(sg) & mask) == (psge->address & mask)) {
2024 srb->virt_addr = virt[idx] + (psge->address & ~PAGE_MASK); 2021 srb->virt_addr = (page_address(sg->page)
2022 + psge->address -
2023 (psge->address & PAGE_MASK));
2025 return; 2024 return;
2026 } 2025 }
2027 ++sg; 2026 ++sg;
2028 ++idx;
2029 } 2027 }
2030 2028
2031 dprintkl(KERN_ERR, "sg_update_list: sg_to_virt failed\n"); 2029 dprintkl(KERN_ERR, "sg_update_list: sg_to_virt failed\n");
@@ -2151,7 +2149,7 @@ static void data_out_phase0(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb,
2151 DC395x_read32(acb, TRM_S1040_DMA_CXCNT)); 2149 DC395x_read32(acb, TRM_S1040_DMA_CXCNT));
2152 } 2150 }
2153 /* 2151 /*
2154 * calculate all the residue data that not yet transfered 2152 * calculate all the residue data that not yet tranfered
2155 * SCSI transfer counter + left in SCSI FIFO data 2153 * SCSI transfer counter + left in SCSI FIFO data
2156 * 2154 *
2157 * .....TRM_S1040_SCSI_COUNTER (24bits) 2155 * .....TRM_S1040_SCSI_COUNTER (24bits)
@@ -3269,7 +3267,6 @@ static void pci_unmap_srb(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb)
3269 struct scsi_cmnd *cmd = srb->cmd; 3267 struct scsi_cmnd *cmd = srb->cmd;
3270 enum dma_data_direction dir = cmd->sc_data_direction; 3268 enum dma_data_direction dir = cmd->sc_data_direction;
3271 if (cmd->use_sg && dir != PCI_DMA_NONE) { 3269 if (cmd->use_sg && dir != PCI_DMA_NONE) {
3272 int i;
3273 /* unmap DC395x SG list */ 3270 /* unmap DC395x SG list */
3274 dprintkdbg(DBG_SG, "pci_unmap_srb: list=%08x(%05x)\n", 3271 dprintkdbg(DBG_SG, "pci_unmap_srb: list=%08x(%05x)\n",
3275 srb->sg_bus_addr, SEGMENTX_LEN); 3272 srb->sg_bus_addr, SEGMENTX_LEN);
@@ -3279,8 +3276,6 @@ static void pci_unmap_srb(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb)
3279 dprintkdbg(DBG_SG, "pci_unmap_srb: segs=%i buffer=%p\n", 3276 dprintkdbg(DBG_SG, "pci_unmap_srb: segs=%i buffer=%p\n",
3280 cmd->use_sg, cmd->request_buffer); 3277 cmd->use_sg, cmd->request_buffer);
3281 /* unmap the sg segments */ 3278 /* unmap the sg segments */
3282 for (i = 0; i < srb->sg_count; i++)
3283 kunmap(virt_to_page(srb->virt_map[i]));
3284 pci_unmap_sg(acb->dev, 3279 pci_unmap_sg(acb->dev,
3285 (struct scatterlist *)cmd->request_buffer, 3280 (struct scatterlist *)cmd->request_buffer,
3286 cmd->use_sg, dir); 3281 cmd->use_sg, dir);
@@ -3327,7 +3322,7 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb,
3327 3322
3328 if (cmd->use_sg) { 3323 if (cmd->use_sg) {
3329 struct scatterlist* sg = (struct scatterlist *)cmd->request_buffer; 3324 struct scatterlist* sg = (struct scatterlist *)cmd->request_buffer;
3330 ptr = (struct ScsiInqData *)(srb->virt_map[0] + sg->offset); 3325 ptr = (struct ScsiInqData *)(page_address(sg->page) + sg->offset);
3331 } else { 3326 } else {
3332 ptr = (struct ScsiInqData *)(cmd->request_buffer); 3327 ptr = (struct ScsiInqData *)(cmd->request_buffer);
3333 } 3328 }
@@ -4262,9 +4257,8 @@ static void adapter_sg_tables_free(struct AdapterCtlBlk *acb)
4262 const unsigned srbs_per_page = PAGE_SIZE/SEGMENTX_LEN; 4257 const unsigned srbs_per_page = PAGE_SIZE/SEGMENTX_LEN;
4263 4258
4264 for (i = 0; i < DC395x_MAX_SRB_CNT; i += srbs_per_page) 4259 for (i = 0; i < DC395x_MAX_SRB_CNT; i += srbs_per_page)
4265 kfree(acb->srb_array[i].segment_x); 4260 if (acb->srb_array[i].segment_x)
4266 4261 kfree(acb->srb_array[i].segment_x);
4267 vfree(acb->srb_array[0].virt_map);
4268} 4262}
4269 4263
4270 4264
@@ -4280,12 +4274,9 @@ static int __devinit adapter_sg_tables_alloc(struct AdapterCtlBlk *acb)
4280 int srb_idx = 0; 4274 int srb_idx = 0;
4281 unsigned i = 0; 4275 unsigned i = 0;
4282 struct SGentry *ptr; 4276 struct SGentry *ptr;
4283 void **virt_array;
4284 4277
4285 for (i = 0; i < DC395x_MAX_SRB_CNT; i++) { 4278 for (i = 0; i < DC395x_MAX_SRB_CNT; i++)
4286 acb->srb_array[i].segment_x = NULL; 4279 acb->srb_array[i].segment_x = NULL;
4287 acb->srb_array[i].virt_map = NULL;
4288 }
4289 4280
4290 dprintkdbg(DBG_1, "Allocate %i pages for SG tables\n", pages); 4281 dprintkdbg(DBG_1, "Allocate %i pages for SG tables\n", pages);
4291 while (pages--) { 4282 while (pages--) {
@@ -4306,19 +4297,6 @@ static int __devinit adapter_sg_tables_alloc(struct AdapterCtlBlk *acb)
4306 ptr + (i * DC395x_MAX_SG_LISTENTRY); 4297 ptr + (i * DC395x_MAX_SG_LISTENTRY);
4307 else 4298 else
4308 dprintkl(KERN_DEBUG, "No space for tmsrb SG table reserved?!\n"); 4299 dprintkl(KERN_DEBUG, "No space for tmsrb SG table reserved?!\n");
4309
4310 virt_array = vmalloc((DC395x_MAX_SRB_CNT + 1) * DC395x_MAX_SG_LISTENTRY * sizeof(void*));
4311
4312 if (!virt_array) {
4313 adapter_sg_tables_free(acb);
4314 return 1;
4315 }
4316
4317 for (i = 0; i < DC395x_MAX_SRB_CNT + 1; i++) {
4318 acb->srb_array[i].virt_map = virt_array;
4319 virt_array += DC395x_MAX_SG_LISTENTRY;
4320 }
4321
4322 return 0; 4300 return 0;
4323} 4301}
4324 4302
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index e2370529c632..7235f94f1191 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -907,9 +907,13 @@ static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev
907 raptorFlag = TRUE; 907 raptorFlag = TRUE;
908 } 908 }
909 909
910 910 if (pci_request_regions(pDev, "dpt_i2o")) {
911 PERROR("dpti: adpt_config_hba: pci request region failed\n");
912 return -EINVAL;
913 }
911 base_addr_virt = ioremap(base_addr0_phys,hba_map0_area_size); 914 base_addr_virt = ioremap(base_addr0_phys,hba_map0_area_size);
912 if (!base_addr_virt) { 915 if (!base_addr_virt) {
916 pci_release_regions(pDev);
913 PERROR("dpti: adpt_config_hba: io remap failed\n"); 917 PERROR("dpti: adpt_config_hba: io remap failed\n");
914 return -EINVAL; 918 return -EINVAL;
915 } 919 }
@@ -919,6 +923,7 @@ static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev
919 if (!msg_addr_virt) { 923 if (!msg_addr_virt) {
920 PERROR("dpti: adpt_config_hba: io remap failed on BAR1\n"); 924 PERROR("dpti: adpt_config_hba: io remap failed on BAR1\n");
921 iounmap(base_addr_virt); 925 iounmap(base_addr_virt);
926 pci_release_regions(pDev);
922 return -EINVAL; 927 return -EINVAL;
923 } 928 }
924 } else { 929 } else {
@@ -932,6 +937,7 @@ static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev
932 iounmap(msg_addr_virt); 937 iounmap(msg_addr_virt);
933 } 938 }
934 iounmap(base_addr_virt); 939 iounmap(base_addr_virt);
940 pci_release_regions(pDev);
935 return -ENOMEM; 941 return -ENOMEM;
936 } 942 }
937 memset(pHba, 0, sizeof(adpt_hba)); 943 memset(pHba, 0, sizeof(adpt_hba));
@@ -1027,6 +1033,7 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba)
1027 up(&adpt_configuration_lock); 1033 up(&adpt_configuration_lock);
1028 1034
1029 iounmap(pHba->base_addr_virt); 1035 iounmap(pHba->base_addr_virt);
1036 pci_release_regions(pHba->pDev);
1030 if(pHba->msg_addr_virt != pHba->base_addr_virt){ 1037 if(pHba->msg_addr_virt != pHba->base_addr_virt){
1031 iounmap(pHba->msg_addr_virt); 1038 iounmap(pHba->msg_addr_virt);
1032 } 1039 }
diff --git a/drivers/scsi/ibmvscsi/srp.h b/drivers/scsi/ibmvscsi/srp.h
index 2ae5154fd89c..7d8e4c4accb9 100644
--- a/drivers/scsi/ibmvscsi/srp.h
+++ b/drivers/scsi/ibmvscsi/srp.h
@@ -35,7 +35,7 @@
35enum srp_types { 35enum srp_types {
36 SRP_LOGIN_REQ_TYPE = 0x00, 36 SRP_LOGIN_REQ_TYPE = 0x00,
37 SRP_LOGIN_RSP_TYPE = 0xC0, 37 SRP_LOGIN_RSP_TYPE = 0xC0,
38 SRP_LOGIN_REJ_TYPE = 0x80, 38 SRP_LOGIN_REJ_TYPE = 0xC2,
39 SRP_I_LOGOUT_TYPE = 0x03, 39 SRP_I_LOGOUT_TYPE = 0x03,
40 SRP_T_LOGOUT_TYPE = 0x80, 40 SRP_T_LOGOUT_TYPE = 0x80,
41 SRP_TSK_MGMT_TYPE = 0x01, 41 SRP_TSK_MGMT_TYPE = 0x01,
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index 6dfcb4fbccdd..4cdd891781b1 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -133,10 +133,12 @@
133/* 6.10.00 - Remove 1G Addressing Limitations */ 133/* 6.10.00 - Remove 1G Addressing Limitations */
134/* 6.11.xx - Get VersionInfo buffer off the stack ! DDTS 60401 */ 134/* 6.11.xx - Get VersionInfo buffer off the stack ! DDTS 60401 */
135/* 6.11.xx - Make Logical Drive Info structure safe for DMA DDTS 60639 */ 135/* 6.11.xx - Make Logical Drive Info structure safe for DMA DDTS 60639 */
136/* 7.10.xx - Add highmem_io flag in SCSI Templete for 2.4 kernels */ 136/* 7.10.18 - Add highmem_io flag in SCSI Templete for 2.4 kernels */
137/* - Fix path/name for scsi_hosts.h include for 2.6 kernels */ 137/* - Fix path/name for scsi_hosts.h include for 2.6 kernels */
138/* - Fix sort order of 7k */ 138/* - Fix sort order of 7k */
139/* - Remove 3 unused "inline" functions */ 139/* - Remove 3 unused "inline" functions */
140/* 7.12.xx - Use STATIC functions whereever possible */
141/* - Clean up deprecated MODULE_PARM calls */
140/*****************************************************************************/ 142/*****************************************************************************/
141 143
142/* 144/*
@@ -207,8 +209,8 @@ module_param(ips, charp, 0);
207/* 209/*
208 * DRIVER_VER 210 * DRIVER_VER
209 */ 211 */
210#define IPS_VERSION_HIGH "7.10" 212#define IPS_VERSION_HIGH "7.12"
211#define IPS_VERSION_LOW ".18 " 213#define IPS_VERSION_LOW ".02 "
212 214
213#if !defined(__i386__) && !defined(__ia64__) && !defined(__x86_64__) 215#if !defined(__i386__) && !defined(__ia64__) && !defined(__x86_64__)
214#warning "This driver has only been tested on the x86/ia64/x86_64 platforms" 216#warning "This driver has only been tested on the x86/ia64/x86_64 platforms"
diff --git a/drivers/scsi/ips.h b/drivers/scsi/ips.h
index 480e06f4d6ae..505e967013de 100644
--- a/drivers/scsi/ips.h
+++ b/drivers/scsi/ips.h
@@ -87,15 +87,14 @@
87 #define scsi_set_pci_device(sh,dev) (0) 87 #define scsi_set_pci_device(sh,dev) (0)
88 #endif 88 #endif
89 89
90 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) 90 #ifndef IRQ_NONE
91 91 typedef void irqreturn_t;
92 #ifndef irqreturn_t
93 typedef void irqreturn_t;
94 #endif
95
96 #define IRQ_NONE 92 #define IRQ_NONE
97 #define IRQ_HANDLED 93 #define IRQ_HANDLED
98 #define IRQ_RETVAL(x) 94 #define IRQ_RETVAL(x)
95 #endif
96
97 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
99 #define IPS_REGISTER_HOSTS(SHT) scsi_register_module(MODULE_SCSI_HA,SHT) 98 #define IPS_REGISTER_HOSTS(SHT) scsi_register_module(MODULE_SCSI_HA,SHT)
100 #define IPS_UNREGISTER_HOSTS(SHT) scsi_unregister_module(MODULE_SCSI_HA,SHT) 99 #define IPS_UNREGISTER_HOSTS(SHT) scsi_unregister_module(MODULE_SCSI_HA,SHT)
101 #define IPS_ADD_HOST(shost,device) 100 #define IPS_ADD_HOST(shost,device)
@@ -123,6 +122,10 @@
123 #ifndef min 122 #ifndef min
124 #define min(x,y) ((x) < (y) ? x : y) 123 #define min(x,y) ((x) < (y) ? x : y)
125 #endif 124 #endif
125
126 #ifndef __iomem /* For clean compiles in earlier kernels without __iomem annotations */
127 #define __iomem
128 #endif
126 129
127 #define pci_dma_hi32(a) ((a >> 16) >> 16) 130 #define pci_dma_hi32(a) ((a >> 16) >> 16)
128 #define pci_dma_lo32(a) (a & 0xffffffff) 131 #define pci_dma_lo32(a) (a & 0xffffffff)
@@ -1206,13 +1209,13 @@ typedef struct {
1206 1209
1207#define IPS_VER_MAJOR 7 1210#define IPS_VER_MAJOR 7
1208#define IPS_VER_MAJOR_STRING "7" 1211#define IPS_VER_MAJOR_STRING "7"
1209#define IPS_VER_MINOR 10 1212#define IPS_VER_MINOR 12
1210#define IPS_VER_MINOR_STRING "10" 1213#define IPS_VER_MINOR_STRING "12"
1211#define IPS_VER_BUILD 18 1214#define IPS_VER_BUILD 02
1212#define IPS_VER_BUILD_STRING "18" 1215#define IPS_VER_BUILD_STRING "02"
1213#define IPS_VER_STRING "7.10.18" 1216#define IPS_VER_STRING "7.12.02"
1214#define IPS_RELEASE_ID 0x00020000 1217#define IPS_RELEASE_ID 0x00020000
1215#define IPS_BUILD_IDENT 731 1218#define IPS_BUILD_IDENT 761
1216#define IPS_LEGALCOPYRIGHT_STRING "(C) Copyright IBM Corp. 1994, 2002. All Rights Reserved." 1219#define IPS_LEGALCOPYRIGHT_STRING "(C) Copyright IBM Corp. 1994, 2002. All Rights Reserved."
1217#define IPS_ADAPTECCOPYRIGHT_STRING "(c) Copyright Adaptec, Inc. 2002 to 2004. All Rights Reserved." 1220#define IPS_ADAPTECCOPYRIGHT_STRING "(c) Copyright Adaptec, Inc. 2002 to 2004. All Rights Reserved."
1218#define IPS_DELLCOPYRIGHT_STRING "(c) Copyright Dell 2004. All Rights Reserved." 1221#define IPS_DELLCOPYRIGHT_STRING "(c) Copyright Dell 2004. All Rights Reserved."
@@ -1223,12 +1226,12 @@ typedef struct {
1223#define IPS_VER_SERVERAID2 "2.88.13" 1226#define IPS_VER_SERVERAID2 "2.88.13"
1224#define IPS_VER_NAVAJO "2.88.13" 1227#define IPS_VER_NAVAJO "2.88.13"
1225#define IPS_VER_SERVERAID3 "6.10.24" 1228#define IPS_VER_SERVERAID3 "6.10.24"
1226#define IPS_VER_SERVERAID4H "7.10.11" 1229#define IPS_VER_SERVERAID4H "7.12.02"
1227#define IPS_VER_SERVERAID4MLx "7.10.18" 1230#define IPS_VER_SERVERAID4MLx "7.12.02"
1228#define IPS_VER_SARASOTA "7.10.18" 1231#define IPS_VER_SARASOTA "7.12.02"
1229#define IPS_VER_MARCO "7.10.18" 1232#define IPS_VER_MARCO "7.12.02"
1230#define IPS_VER_SEBRING "7.10.18" 1233#define IPS_VER_SEBRING "7.12.02"
1231#define IPS_VER_KEYWEST "7.10.18" 1234#define IPS_VER_KEYWEST "7.12.02"
1232 1235
1233/* Compatability IDs for various adapters */ 1236/* Compatability IDs for various adapters */
1234#define IPS_COMPAT_UNKNOWN "" 1237#define IPS_COMPAT_UNKNOWN ""
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index 794fb559efb0..6a75ec2187fd 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -385,6 +385,7 @@ int ata_scsi_error(struct Scsi_Host *host)
385 * appropriate place 385 * appropriate place
386 */ 386 */
387 host->host_failed--; 387 host->host_failed--;
388 INIT_LIST_HEAD(&host->eh_cmd_q);
388 389
389 DPRINTK("EXIT\n"); 390 DPRINTK("EXIT\n");
390 return 0; 391 return 0;
diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c
index 140cea05de3f..efd7d7a61135 100644
--- a/drivers/scsi/sata_sx4.c
+++ b/drivers/scsi/sata_sx4.c
@@ -468,7 +468,7 @@ static void pdc20621_dma_prep(struct ata_queued_cmd *qc)
468 for (i = 0; i < last; i++) { 468 for (i = 0; i < last; i++) {
469 buf[idx++] = cpu_to_le32(sg_dma_address(&sg[i])); 469 buf[idx++] = cpu_to_le32(sg_dma_address(&sg[i]));
470 buf[idx++] = cpu_to_le32(sg_dma_len(&sg[i])); 470 buf[idx++] = cpu_to_le32(sg_dma_len(&sg[i]));
471 total_len += sg[i].length; 471 total_len += sg_dma_len(&sg[i]);
472 } 472 }
473 buf[idx - 1] |= cpu_to_le32(ATA_PRD_EOT); 473 buf[idx - 1] |= cpu_to_le32(ATA_PRD_EOT);
474 sgt_len = idx * 4; 474 sgt_len = idx * 4;
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 2d3c4ac475f2..48edd67982a5 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -336,9 +336,23 @@ static struct scsi_target *scsi_alloc_target(struct device *parent,
336 unsigned long flags; 336 unsigned long flags;
337 const int size = sizeof(struct scsi_target) 337 const int size = sizeof(struct scsi_target)
338 + shost->transportt->target_size; 338 + shost->transportt->target_size;
339 struct scsi_target *starget = kmalloc(size, GFP_ATOMIC); 339 struct scsi_target *starget;
340 struct scsi_target *found_target; 340 struct scsi_target *found_target;
341 341
342 /*
343 * Obtain the real parent from the transport. The transport
344 * is allowed to fail (no error) if there is nothing at that
345 * target id.
346 */
347 if (shost->transportt->target_parent) {
348 spin_lock_irqsave(shost->host_lock, flags);
349 parent = shost->transportt->target_parent(shost, channel, id);
350 spin_unlock_irqrestore(shost->host_lock, flags);
351 if (!parent)
352 return NULL;
353 }
354
355 starget = kmalloc(size, GFP_KERNEL);
342 if (!starget) { 356 if (!starget) {
343 printk(KERN_ERR "%s: allocation failure\n", __FUNCTION__); 357 printk(KERN_ERR "%s: allocation failure\n", __FUNCTION__);
344 return NULL; 358 return NULL;
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 35d1c1e8e345..e6412fce423c 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -1022,6 +1022,23 @@ static int fc_rport_match(struct attribute_container *cont,
1022 return &i->rport_attr_cont.ac == cont; 1022 return &i->rport_attr_cont.ac == cont;
1023} 1023}
1024 1024
1025
1026/*
1027 * Must be called with shost->host_lock held
1028 */
1029static struct device *fc_target_parent(struct Scsi_Host *shost,
1030 int channel, uint id)
1031{
1032 struct fc_rport *rport;
1033
1034 list_for_each_entry(rport, &fc_host_rports(shost), peers)
1035 if ((rport->channel == channel) &&
1036 (rport->scsi_target_id == id))
1037 return &rport->dev;
1038
1039 return NULL;
1040}
1041
1025struct scsi_transport_template * 1042struct scsi_transport_template *
1026fc_attach_transport(struct fc_function_template *ft) 1043fc_attach_transport(struct fc_function_template *ft)
1027{ 1044{
@@ -1057,6 +1074,8 @@ fc_attach_transport(struct fc_function_template *ft)
1057 1074
1058 /* Transport uses the shost workq for scsi scanning */ 1075 /* Transport uses the shost workq for scsi scanning */
1059 i->t.create_work_queue = 1; 1076 i->t.create_work_queue = 1;
1077
1078 i->t.target_parent = fc_target_parent;
1060 1079
1061 /* 1080 /*
1062 * Setup SCSI Target Attributes. 1081 * Setup SCSI Target Attributes.
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 0291a8fb654d..0a7839db5752 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -4149,12 +4149,10 @@ static int __init init_st(void)
4149 do_create_driverfs_files(); 4149 do_create_driverfs_files();
4150 return 0; 4150 return 0;
4151 } 4151 }
4152 if (st_sysfs_class)
4153 class_destroy(st_sysfs_class);
4154 unregister_chrdev_region(MKDEV(SCSI_TAPE_MAJOR, 0), 4152 unregister_chrdev_region(MKDEV(SCSI_TAPE_MAJOR, 0),
4155
4156 ST_MAX_TAPE_ENTRIES); 4153 ST_MAX_TAPE_ENTRIES);
4157 } 4154 }
4155 class_destroy(st_sysfs_class);
4158 4156
4159 printk(KERN_ERR "Unable to get major %d for SCSI tapes\n", SCSI_TAPE_MAJOR); 4157 printk(KERN_ERR "Unable to get major %d for SCSI tapes\n", SCSI_TAPE_MAJOR);
4160 return 1; 4158 return 1;
@@ -4162,13 +4160,11 @@ static int __init init_st(void)
4162 4160
4163static void __exit exit_st(void) 4161static void __exit exit_st(void)
4164{ 4162{
4165 if (st_sysfs_class)
4166 class_destroy(st_sysfs_class);
4167 st_sysfs_class = NULL;
4168 do_remove_driverfs_files(); 4163 do_remove_driverfs_files();
4169 scsi_unregister_driver(&st_template.gendrv); 4164 scsi_unregister_driver(&st_template.gendrv);
4170 unregister_chrdev_region(MKDEV(SCSI_TAPE_MAJOR, 0), 4165 unregister_chrdev_region(MKDEV(SCSI_TAPE_MAJOR, 0),
4171 ST_MAX_TAPE_ENTRIES); 4166 ST_MAX_TAPE_ENTRIES);
4167 class_destroy(st_sysfs_class);
4172 kfree(scsi_tapes); 4168 kfree(scsi_tapes);
4173 printk(KERN_INFO "st: Unloaded.\n"); 4169 printk(KERN_INFO "st: Unloaded.\n");
4174} 4170}