aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-10-28 12:29:23 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-10-28 12:29:23 -0400
commit7a9f8f93d2dad38f30fbc79d8a1e6517373aa4b6 (patch)
tree9116e5bde860d00685c5b6eee7be5ba9899aabb9 /drivers/scsi
parent972c26bdd6b58e7534473c4f7928584578cf43f4 (diff)
parent5fadd053d9bb4345ec6f405d24db4e7eb49cf81e (diff)
Merge branch 'master'
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/NCR5380.c2
-rw-r--r--drivers/scsi/aacraid/aacraid.h2
-rw-r--r--drivers/scsi/ahci.c10
-rw-r--r--drivers/scsi/ata_piix.c4
-rw-r--r--drivers/scsi/eata.c2
-rw-r--r--drivers/scsi/hosts.c3
-rw-r--r--drivers/scsi/libata-core.c282
-rw-r--r--drivers/scsi/libata-scsi.c24
-rw-r--r--drivers/scsi/libata.h2
-rw-r--r--drivers/scsi/lpfc/lpfc_mem.c2
-rw-r--r--drivers/scsi/osst.c6
-rw-r--r--drivers/scsi/pdc_adma.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_gbl.h4
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c3
-rw-r--r--drivers/scsi/qla2xxx/qla_rscn.c2
-rw-r--r--drivers/scsi/sata_mv.c4
-rw-r--r--drivers/scsi/sata_nv.c6
-rw-r--r--drivers/scsi/sata_promise.c20
-rw-r--r--drivers/scsi/sata_qstor.c8
-rw-r--r--drivers/scsi/sata_sil.c6
-rw-r--r--drivers/scsi/sata_sil24.c2
-rw-r--r--drivers/scsi/sata_sis.c2
-rw-r--r--drivers/scsi/sata_svw.c4
-rw-r--r--drivers/scsi/sata_sx4.c29
-rw-r--r--drivers/scsi/sata_uli.c2
-rw-r--r--drivers/scsi/sata_via.c2
-rw-r--r--drivers/scsi/sata_vsc.c14
-rw-r--r--drivers/scsi/scsi.c8
-rw-r--r--drivers/scsi/scsi_devinfo.c1
-rw-r--r--drivers/scsi/scsi_error.c2
-rw-r--r--drivers/scsi/scsi_ioctl.c3
-rw-r--r--drivers/scsi/scsi_lib.c9
-rw-r--r--drivers/scsi/scsi_transport_fc.c13
-rw-r--r--drivers/scsi/sg.c2
-rw-r--r--drivers/scsi/st.c6
36 files changed, 339 insertions, 156 deletions
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index d40ba0bd68a..23392ae7df8 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -91,7 +91,7 @@
91#ifndef NDEBUG 91#ifndef NDEBUG
92#define NDEBUG 0 92#define NDEBUG 0
93#endif 93#endif
94#ifndef NDEBUG 94#ifndef NDEBUG_ABORT
95#define NDEBUG_ABORT 0 95#define NDEBUG_ABORT 0
96#endif 96#endif
97 97
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 4a99d2f000f..d54b1cc88d0 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -19,7 +19,7 @@
19#define AAC_MAX_LUN (8) 19#define AAC_MAX_LUN (8)
20 20
21#define AAC_MAX_HOSTPHYSMEMPAGES (0xfffff) 21#define AAC_MAX_HOSTPHYSMEMPAGES (0xfffff)
22#define AAC_MAX_32BIT_SGBCOUNT ((unsigned short)512) 22#define AAC_MAX_32BIT_SGBCOUNT ((unsigned short)256)
23 23
24/* 24/*
25 * These macros convert from physical channels to virtual channels 25 * These macros convert from physical channels to virtual channels
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
index f0d8f89b5d4..cbab5868ffd 100644
--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -216,7 +216,7 @@ static Scsi_Host_Template ahci_sht = {
216 .ordered_flush = 1, 216 .ordered_flush = 1,
217}; 217};
218 218
219static struct ata_port_operations ahci_ops = { 219static const struct ata_port_operations ahci_ops = {
220 .port_disable = ata_port_disable, 220 .port_disable = ata_port_disable,
221 221
222 .check_status = ahci_check_status, 222 .check_status = ahci_check_status,
@@ -415,7 +415,7 @@ static u32 ahci_scr_read (struct ata_port *ap, unsigned int sc_reg_in)
415 return 0xffffffffU; 415 return 0xffffffffU;
416 } 416 }
417 417
418 return readl((void *) ap->ioaddr.scr_addr + (sc_reg * 4)); 418 return readl((void __iomem *) ap->ioaddr.scr_addr + (sc_reg * 4));
419} 419}
420 420
421 421
@@ -433,7 +433,7 @@ static void ahci_scr_write (struct ata_port *ap, unsigned int sc_reg_in,
433 return; 433 return;
434 } 434 }
435 435
436 writel(val, (void *) ap->ioaddr.scr_addr + (sc_reg * 4)); 436 writel(val, (void __iomem *) ap->ioaddr.scr_addr + (sc_reg * 4));
437} 437}
438 438
439static void ahci_phy_reset(struct ata_port *ap) 439static void ahci_phy_reset(struct ata_port *ap)
@@ -461,14 +461,14 @@ static void ahci_phy_reset(struct ata_port *ap)
461 461
462static u8 ahci_check_status(struct ata_port *ap) 462static u8 ahci_check_status(struct ata_port *ap)
463{ 463{
464 void *mmio = (void *) ap->ioaddr.cmd_addr; 464 void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr;
465 465
466 return readl(mmio + PORT_TFDATA) & 0xFF; 466 return readl(mmio + PORT_TFDATA) & 0xFF;
467} 467}
468 468
469static u8 ahci_check_err(struct ata_port *ap) 469static u8 ahci_check_err(struct ata_port *ap)
470{ 470{
471 void *mmio = (void *) ap->ioaddr.cmd_addr; 471 void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr;
472 472
473 return (readl(mmio + PORT_TFDATA) >> 8) & 0xFF; 473 return (readl(mmio + PORT_TFDATA) >> 8) & 0xFF;
474} 474}
diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c
index d71cef767ce..be021478f41 100644
--- a/drivers/scsi/ata_piix.c
+++ b/drivers/scsi/ata_piix.c
@@ -147,7 +147,7 @@ static Scsi_Host_Template piix_sht = {
147 .ordered_flush = 1, 147 .ordered_flush = 1,
148}; 148};
149 149
150static struct ata_port_operations piix_pata_ops = { 150static const struct ata_port_operations piix_pata_ops = {
151 .port_disable = ata_port_disable, 151 .port_disable = ata_port_disable,
152 .set_piomode = piix_set_piomode, 152 .set_piomode = piix_set_piomode,
153 .set_dmamode = piix_set_dmamode, 153 .set_dmamode = piix_set_dmamode,
@@ -177,7 +177,7 @@ static struct ata_port_operations piix_pata_ops = {
177 .host_stop = ata_host_stop, 177 .host_stop = ata_host_stop,
178}; 178};
179 179
180static struct ata_port_operations piix_sata_ops = { 180static const struct ata_port_operations piix_sata_ops = {
181 .port_disable = ata_port_disable, 181 .port_disable = ata_port_disable,
182 182
183 .tf_load = ata_tf_load, 183 .tf_load = ata_tf_load,
diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c
index c10e45b94b6..3d13fdee4fc 100644
--- a/drivers/scsi/eata.c
+++ b/drivers/scsi/eata.c
@@ -1357,7 +1357,7 @@ static int port_detect(unsigned long port_base, unsigned int j,
1357 1357
1358 for (i = 0; i < shost->can_queue; i++) { 1358 for (i = 0; i < shost->can_queue; i++) {
1359 size_t sz = shost->sg_tablesize *sizeof(struct sg_list); 1359 size_t sz = shost->sg_tablesize *sizeof(struct sg_list);
1360 unsigned int gfp_mask = (shost->unchecked_isa_dma ? GFP_DMA : 0) | GFP_ATOMIC; 1360 gfp_t gfp_mask = (shost->unchecked_isa_dma ? GFP_DMA : 0) | GFP_ATOMIC;
1361 ha->cp[i].sglist = kmalloc(sz, gfp_mask); 1361 ha->cp[i].sglist = kmalloc(sz, gfp_mask);
1362 if (!ha->cp[i].sglist) { 1362 if (!ha->cp[i].sglist) {
1363 printk 1363 printk
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index 02fe371b0ab..f24d84538fd 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -287,7 +287,8 @@ static void scsi_host_dev_release(struct device *dev)
287struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) 287struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
288{ 288{
289 struct Scsi_Host *shost; 289 struct Scsi_Host *shost;
290 int gfp_mask = GFP_KERNEL, rval; 290 gfp_t gfp_mask = GFP_KERNEL;
291 int rval;
291 292
292 if (sht->unchecked_isa_dma && privsize) 293 if (sht->unchecked_isa_dma && privsize)
293 gfp_mask |= __GFP_DMA; 294 gfp_mask |= __GFP_DMA;
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index c5e663fefdf..64f30bf5931 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -67,9 +67,9 @@ static void ata_dev_reread_id(struct ata_port *ap, struct ata_device *dev);
67static void ata_dev_init_params(struct ata_port *ap, struct ata_device *dev); 67static void ata_dev_init_params(struct ata_port *ap, struct ata_device *dev);
68static void ata_set_mode(struct ata_port *ap); 68static void ata_set_mode(struct ata_port *ap);
69static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev); 69static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev);
70static unsigned int ata_get_mode_mask(struct ata_port *ap, int shift); 70static unsigned int ata_get_mode_mask(const struct ata_port *ap, int shift);
71static int fgb(u32 bitmap); 71static int fgb(u32 bitmap);
72static int ata_choose_xfer_mode(struct ata_port *ap, 72static int ata_choose_xfer_mode(const struct ata_port *ap,
73 u8 *xfer_mode_out, 73 u8 *xfer_mode_out,
74 unsigned int *xfer_shift_out); 74 unsigned int *xfer_shift_out);
75static void __ata_qc_complete(struct ata_queued_cmd *qc); 75static void __ata_qc_complete(struct ata_queued_cmd *qc);
@@ -87,7 +87,7 @@ MODULE_LICENSE("GPL");
87MODULE_VERSION(DRV_VERSION); 87MODULE_VERSION(DRV_VERSION);
88 88
89/** 89/**
90 * ata_tf_load - send taskfile registers to host controller 90 * ata_tf_load_pio - send taskfile registers to host controller
91 * @ap: Port to which output is sent 91 * @ap: Port to which output is sent
92 * @tf: ATA taskfile register set 92 * @tf: ATA taskfile register set
93 * 93 *
@@ -97,7 +97,7 @@ MODULE_VERSION(DRV_VERSION);
97 * Inherited from caller. 97 * Inherited from caller.
98 */ 98 */
99 99
100static void ata_tf_load_pio(struct ata_port *ap, struct ata_taskfile *tf) 100static void ata_tf_load_pio(struct ata_port *ap, const struct ata_taskfile *tf)
101{ 101{
102 struct ata_ioports *ioaddr = &ap->ioaddr; 102 struct ata_ioports *ioaddr = &ap->ioaddr;
103 unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; 103 unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR;
@@ -155,7 +155,7 @@ static void ata_tf_load_pio(struct ata_port *ap, struct ata_taskfile *tf)
155 * Inherited from caller. 155 * Inherited from caller.
156 */ 156 */
157 157
158static void ata_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf) 158static void ata_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
159{ 159{
160 struct ata_ioports *ioaddr = &ap->ioaddr; 160 struct ata_ioports *ioaddr = &ap->ioaddr;
161 unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; 161 unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR;
@@ -224,7 +224,7 @@ static void ata_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf)
224 * LOCKING: 224 * LOCKING:
225 * Inherited from caller. 225 * Inherited from caller.
226 */ 226 */
227void ata_tf_load(struct ata_port *ap, struct ata_taskfile *tf) 227void ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf)
228{ 228{
229 if (ap->flags & ATA_FLAG_MMIO) 229 if (ap->flags & ATA_FLAG_MMIO)
230 ata_tf_load_mmio(ap, tf); 230 ata_tf_load_mmio(ap, tf);
@@ -244,7 +244,7 @@ void ata_tf_load(struct ata_port *ap, struct ata_taskfile *tf)
244 * spin_lock_irqsave(host_set lock) 244 * spin_lock_irqsave(host_set lock)
245 */ 245 */
246 246
247static void ata_exec_command_pio(struct ata_port *ap, struct ata_taskfile *tf) 247static void ata_exec_command_pio(struct ata_port *ap, const struct ata_taskfile *tf)
248{ 248{
249 DPRINTK("ata%u: cmd 0x%X\n", ap->id, tf->command); 249 DPRINTK("ata%u: cmd 0x%X\n", ap->id, tf->command);
250 250
@@ -265,7 +265,7 @@ static void ata_exec_command_pio(struct ata_port *ap, struct ata_taskfile *tf)
265 * spin_lock_irqsave(host_set lock) 265 * spin_lock_irqsave(host_set lock)
266 */ 266 */
267 267
268static void ata_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf) 268static void ata_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
269{ 269{
270 DPRINTK("ata%u: cmd 0x%X\n", ap->id, tf->command); 270 DPRINTK("ata%u: cmd 0x%X\n", ap->id, tf->command);
271 271
@@ -285,7 +285,7 @@ static void ata_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf)
285 * LOCKING: 285 * LOCKING:
286 * spin_lock_irqsave(host_set lock) 286 * spin_lock_irqsave(host_set lock)
287 */ 287 */
288void ata_exec_command(struct ata_port *ap, struct ata_taskfile *tf) 288void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf)
289{ 289{
290 if (ap->flags & ATA_FLAG_MMIO) 290 if (ap->flags & ATA_FLAG_MMIO)
291 ata_exec_command_mmio(ap, tf); 291 ata_exec_command_mmio(ap, tf);
@@ -305,7 +305,7 @@ void ata_exec_command(struct ata_port *ap, struct ata_taskfile *tf)
305 * Obtains host_set lock. 305 * Obtains host_set lock.
306 */ 306 */
307 307
308static inline void ata_exec(struct ata_port *ap, struct ata_taskfile *tf) 308static inline void ata_exec(struct ata_port *ap, const struct ata_taskfile *tf)
309{ 309{
310 unsigned long flags; 310 unsigned long flags;
311 311
@@ -328,7 +328,7 @@ static inline void ata_exec(struct ata_port *ap, struct ata_taskfile *tf)
328 * Obtains host_set lock. 328 * Obtains host_set lock.
329 */ 329 */
330 330
331static void ata_tf_to_host(struct ata_port *ap, struct ata_taskfile *tf) 331static void ata_tf_to_host(struct ata_port *ap, const struct ata_taskfile *tf)
332{ 332{
333 ap->ops->tf_load(ap, tf); 333 ap->ops->tf_load(ap, tf);
334 334
@@ -348,7 +348,7 @@ static void ata_tf_to_host(struct ata_port *ap, struct ata_taskfile *tf)
348 * spin_lock_irqsave(host_set lock) 348 * spin_lock_irqsave(host_set lock)
349 */ 349 */
350 350
351void ata_tf_to_host_nolock(struct ata_port *ap, struct ata_taskfile *tf) 351void ata_tf_to_host_nolock(struct ata_port *ap, const struct ata_taskfile *tf)
352{ 352{
353 ap->ops->tf_load(ap, tf); 353 ap->ops->tf_load(ap, tf);
354 ap->ops->exec_command(ap, tf); 354 ap->ops->exec_command(ap, tf);
@@ -558,7 +558,7 @@ u8 ata_chk_err(struct ata_port *ap)
558 * Inherited from caller. 558 * Inherited from caller.
559 */ 559 */
560 560
561void ata_tf_to_fis(struct ata_taskfile *tf, u8 *fis, u8 pmp) 561void ata_tf_to_fis(const struct ata_taskfile *tf, u8 *fis, u8 pmp)
562{ 562{
563 fis[0] = 0x27; /* Register - Host to Device FIS */ 563 fis[0] = 0x27; /* Register - Host to Device FIS */
564 fis[1] = (pmp & 0xf) | (1 << 7); /* Port multiplier number, 564 fis[1] = (pmp & 0xf) | (1 << 7); /* Port multiplier number,
@@ -599,7 +599,7 @@ void ata_tf_to_fis(struct ata_taskfile *tf, u8 *fis, u8 pmp)
599 * Inherited from caller. 599 * Inherited from caller.
600 */ 600 */
601 601
602void ata_tf_from_fis(u8 *fis, struct ata_taskfile *tf) 602void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf)
603{ 603{
604 tf->command = fis[2]; /* status */ 604 tf->command = fis[2]; /* status */
605 tf->feature = fis[3]; /* error */ 605 tf->feature = fis[3]; /* error */
@@ -845,7 +845,7 @@ static unsigned int ata_devchk(struct ata_port *ap,
845 * the event of failure. 845 * the event of failure.
846 */ 846 */
847 847
848unsigned int ata_dev_classify(struct ata_taskfile *tf) 848unsigned int ata_dev_classify(const struct ata_taskfile *tf)
849{ 849{
850 /* Apple's open source Darwin code hints that some devices only 850 /* Apple's open source Darwin code hints that some devices only
851 * put a proper signature into the LBA mid/high registers, 851 * put a proper signature into the LBA mid/high registers,
@@ -937,7 +937,7 @@ static u8 ata_dev_try_classify(struct ata_port *ap, unsigned int device)
937 * caller. 937 * caller.
938 */ 938 */
939 939
940void ata_dev_id_string(u16 *id, unsigned char *s, 940void ata_dev_id_string(const u16 *id, unsigned char *s,
941 unsigned int ofs, unsigned int len) 941 unsigned int ofs, unsigned int len)
942{ 942{
943 unsigned int c; 943 unsigned int c;
@@ -1054,7 +1054,7 @@ void ata_dev_select(struct ata_port *ap, unsigned int device,
1054 * caller. 1054 * caller.
1055 */ 1055 */
1056 1056
1057static inline void ata_dump_id(struct ata_device *dev) 1057static inline void ata_dump_id(const struct ata_device *dev)
1058{ 1058{
1059 DPRINTK("49==0x%04x " 1059 DPRINTK("49==0x%04x "
1060 "53==0x%04x " 1060 "53==0x%04x "
@@ -1082,6 +1082,31 @@ static inline void ata_dump_id(struct ata_device *dev)
1082 dev->id[93]); 1082 dev->id[93]);
1083} 1083}
1084 1084
1085/*
1086 * Compute the PIO modes available for this device. This is not as
1087 * trivial as it seems if we must consider early devices correctly.
1088 *
1089 * FIXME: pre IDE drive timing (do we care ?).
1090 */
1091
1092static unsigned int ata_pio_modes(const struct ata_device *adev)
1093{
1094 u16 modes;
1095
1096 /* Usual case. Word 53 indicates word 88 is valid */
1097 if (adev->id[ATA_ID_FIELD_VALID] & (1 << 2)) {
1098 modes = adev->id[ATA_ID_PIO_MODES] & 0x03;
1099 modes <<= 3;
1100 modes |= 0x7;
1101 return modes;
1102 }
1103
1104 /* If word 88 isn't valid then Word 51 holds the PIO timing number
1105 for the maximum. Turn it into a mask and return it */
1106 modes = (2 << (adev->id[ATA_ID_OLD_PIO_MODES] & 0xFF)) - 1 ;
1107 return modes;
1108}
1109
1085/** 1110/**
1086 * ata_dev_identify - obtain IDENTIFY x DEVICE page 1111 * ata_dev_identify - obtain IDENTIFY x DEVICE page
1087 * @ap: port on which device we wish to probe resides 1112 * @ap: port on which device we wish to probe resides
@@ -1215,10 +1240,8 @@ retry:
1215 xfer_modes = dev->id[ATA_ID_UDMA_MODES]; 1240 xfer_modes = dev->id[ATA_ID_UDMA_MODES];
1216 if (!xfer_modes) 1241 if (!xfer_modes)
1217 xfer_modes = (dev->id[ATA_ID_MWDMA_MODES]) << ATA_SHIFT_MWDMA; 1242 xfer_modes = (dev->id[ATA_ID_MWDMA_MODES]) << ATA_SHIFT_MWDMA;
1218 if (!xfer_modes) { 1243 if (!xfer_modes)
1219 xfer_modes = (dev->id[ATA_ID_PIO_MODES]) << (ATA_SHIFT_PIO + 3); 1244 xfer_modes = ata_pio_modes(dev);
1220 xfer_modes |= (0x7 << ATA_SHIFT_PIO);
1221 }
1222 1245
1223 ata_dump_id(dev); 1246 ata_dump_id(dev);
1224 1247
@@ -1329,7 +1352,7 @@ err_out:
1329} 1352}
1330 1353
1331 1354
1332static inline u8 ata_dev_knobble(struct ata_port *ap) 1355static inline u8 ata_dev_knobble(const struct ata_port *ap)
1333{ 1356{
1334 return ((ap->cbl == ATA_CBL_SATA) && (!ata_id_is_sata(ap->device->id))); 1357 return ((ap->cbl == ATA_CBL_SATA) && (!ata_id_is_sata(ap->device->id)));
1335} 1358}
@@ -1515,7 +1538,153 @@ void ata_port_disable(struct ata_port *ap)
1515 ap->flags |= ATA_FLAG_PORT_DISABLED; 1538 ap->flags |= ATA_FLAG_PORT_DISABLED;
1516} 1539}
1517 1540
1518static struct { 1541/*
1542 * This mode timing computation functionality is ported over from
1543 * drivers/ide/ide-timing.h and was originally written by Vojtech Pavlik
1544 */
1545/*
1546 * PIO 0-5, MWDMA 0-2 and UDMA 0-6 timings (in nanoseconds).
1547 * These were taken from ATA/ATAPI-6 standard, rev 0a, except
1548 * for PIO 5, which is a nonstandard extension and UDMA6, which
1549 * is currently supported only by Maxtor drives.
1550 */
1551
1552static const struct ata_timing ata_timing[] = {
1553
1554 { XFER_UDMA_6, 0, 0, 0, 0, 0, 0, 0, 15 },
1555 { XFER_UDMA_5, 0, 0, 0, 0, 0, 0, 0, 20 },
1556 { XFER_UDMA_4, 0, 0, 0, 0, 0, 0, 0, 30 },
1557 { XFER_UDMA_3, 0, 0, 0, 0, 0, 0, 0, 45 },
1558
1559 { XFER_UDMA_2, 0, 0, 0, 0, 0, 0, 0, 60 },
1560 { XFER_UDMA_1, 0, 0, 0, 0, 0, 0, 0, 80 },
1561 { XFER_UDMA_0, 0, 0, 0, 0, 0, 0, 0, 120 },
1562
1563/* { XFER_UDMA_SLOW, 0, 0, 0, 0, 0, 0, 0, 150 }, */
1564
1565 { XFER_MW_DMA_2, 25, 0, 0, 0, 70, 25, 120, 0 },
1566 { XFER_MW_DMA_1, 45, 0, 0, 0, 80, 50, 150, 0 },
1567 { XFER_MW_DMA_0, 60, 0, 0, 0, 215, 215, 480, 0 },
1568
1569 { XFER_SW_DMA_2, 60, 0, 0, 0, 120, 120, 240, 0 },
1570 { XFER_SW_DMA_1, 90, 0, 0, 0, 240, 240, 480, 0 },
1571 { XFER_SW_DMA_0, 120, 0, 0, 0, 480, 480, 960, 0 },
1572
1573/* { XFER_PIO_5, 20, 50, 30, 100, 50, 30, 100, 0 }, */
1574 { XFER_PIO_4, 25, 70, 25, 120, 70, 25, 120, 0 },
1575 { XFER_PIO_3, 30, 80, 70, 180, 80, 70, 180, 0 },
1576
1577 { XFER_PIO_2, 30, 290, 40, 330, 100, 90, 240, 0 },
1578 { XFER_PIO_1, 50, 290, 93, 383, 125, 100, 383, 0 },
1579 { XFER_PIO_0, 70, 290, 240, 600, 165, 150, 600, 0 },
1580
1581/* { XFER_PIO_SLOW, 120, 290, 240, 960, 290, 240, 960, 0 }, */
1582
1583 { 0xFF }
1584};
1585
1586#define ENOUGH(v,unit) (((v)-1)/(unit)+1)
1587#define EZ(v,unit) ((v)?ENOUGH(v,unit):0)
1588
1589static void ata_timing_quantize(const struct ata_timing *t, struct ata_timing *q, int T, int UT)
1590{
1591 q->setup = EZ(t->setup * 1000, T);
1592 q->act8b = EZ(t->act8b * 1000, T);
1593 q->rec8b = EZ(t->rec8b * 1000, T);
1594 q->cyc8b = EZ(t->cyc8b * 1000, T);
1595 q->active = EZ(t->active * 1000, T);
1596 q->recover = EZ(t->recover * 1000, T);
1597 q->cycle = EZ(t->cycle * 1000, T);
1598 q->udma = EZ(t->udma * 1000, UT);
1599}
1600
1601void ata_timing_merge(const struct ata_timing *a, const struct ata_timing *b,
1602 struct ata_timing *m, unsigned int what)
1603{
1604 if (what & ATA_TIMING_SETUP ) m->setup = max(a->setup, b->setup);
1605 if (what & ATA_TIMING_ACT8B ) m->act8b = max(a->act8b, b->act8b);
1606 if (what & ATA_TIMING_REC8B ) m->rec8b = max(a->rec8b, b->rec8b);
1607 if (what & ATA_TIMING_CYC8B ) m->cyc8b = max(a->cyc8b, b->cyc8b);
1608 if (what & ATA_TIMING_ACTIVE ) m->active = max(a->active, b->active);
1609 if (what & ATA_TIMING_RECOVER) m->recover = max(a->recover, b->recover);
1610 if (what & ATA_TIMING_CYCLE ) m->cycle = max(a->cycle, b->cycle);
1611 if (what & ATA_TIMING_UDMA ) m->udma = max(a->udma, b->udma);
1612}
1613
1614static const struct ata_timing* ata_timing_find_mode(unsigned short speed)
1615{
1616 const struct ata_timing *t;
1617
1618 for (t = ata_timing; t->mode != speed; t++)
1619 if (t->mode == 0xFF)
1620 return NULL;
1621 return t;
1622}
1623
1624int ata_timing_compute(struct ata_device *adev, unsigned short speed,
1625 struct ata_timing *t, int T, int UT)
1626{
1627 const struct ata_timing *s;
1628 struct ata_timing p;
1629
1630 /*
1631 * Find the mode.
1632 */
1633
1634 if (!(s = ata_timing_find_mode(speed)))
1635 return -EINVAL;
1636
1637 /*
1638 * If the drive is an EIDE drive, it can tell us it needs extended
1639 * PIO/MW_DMA cycle timing.
1640 */
1641
1642 if (adev->id[ATA_ID_FIELD_VALID] & 2) { /* EIDE drive */
1643 memset(&p, 0, sizeof(p));
1644 if(speed >= XFER_PIO_0 && speed <= XFER_SW_DMA_0) {
1645 if (speed <= XFER_PIO_2) p.cycle = p.cyc8b = adev->id[ATA_ID_EIDE_PIO];
1646 else p.cycle = p.cyc8b = adev->id[ATA_ID_EIDE_PIO_IORDY];
1647 } else if(speed >= XFER_MW_DMA_0 && speed <= XFER_MW_DMA_2) {
1648 p.cycle = adev->id[ATA_ID_EIDE_DMA_MIN];
1649 }
1650 ata_timing_merge(&p, t, t, ATA_TIMING_CYCLE | ATA_TIMING_CYC8B);
1651 }
1652
1653 /*
1654 * Convert the timing to bus clock counts.
1655 */
1656
1657 ata_timing_quantize(s, t, T, UT);
1658
1659 /*
1660 * Even in DMA/UDMA modes we still use PIO access for IDENTIFY, S.M.A.R.T
1661 * and some other commands. We have to ensure that the DMA cycle timing is
1662 * slower/equal than the fastest PIO timing.
1663 */
1664
1665 if (speed > XFER_PIO_4) {
1666 ata_timing_compute(adev, adev->pio_mode, &p, T, UT);
1667 ata_timing_merge(&p, t, t, ATA_TIMING_ALL);
1668 }
1669
1670 /*
1671 * Lenghten active & recovery time so that cycle time is correct.
1672 */
1673
1674 if (t->act8b + t->rec8b < t->cyc8b) {
1675 t->act8b += (t->cyc8b - (t->act8b + t->rec8b)) / 2;
1676 t->rec8b = t->cyc8b - t->act8b;
1677 }
1678
1679 if (t->active + t->recover < t->cycle) {
1680 t->active += (t->cycle - (t->active + t->recover)) / 2;
1681 t->recover = t->cycle - t->active;
1682 }
1683
1684 return 0;
1685}
1686
1687static const struct {
1519 unsigned int shift; 1688 unsigned int shift;
1520 u8 base; 1689 u8 base;
1521} xfer_mode_classes[] = { 1690} xfer_mode_classes[] = {
@@ -1924,7 +2093,8 @@ err_out:
1924 DPRINTK("EXIT\n"); 2093 DPRINTK("EXIT\n");
1925} 2094}
1926 2095
1927static void ata_pr_blacklisted(struct ata_port *ap, struct ata_device *dev) 2096static void ata_pr_blacklisted(const struct ata_port *ap,
2097 const struct ata_device *dev)
1928{ 2098{
1929 printk(KERN_WARNING "ata%u: dev %u is on DMA blacklist, disabling DMA\n", 2099 printk(KERN_WARNING "ata%u: dev %u is on DMA blacklist, disabling DMA\n",
1930 ap->id, dev->devno); 2100 ap->id, dev->devno);
@@ -1962,7 +2132,7 @@ static const char * ata_dma_blacklist [] = {
1962 "_NEC DV5800A", 2132 "_NEC DV5800A",
1963}; 2133};
1964 2134
1965static int ata_dma_blacklisted(struct ata_port *ap, struct ata_device *dev) 2135static int ata_dma_blacklisted(const struct ata_device *dev)
1966{ 2136{
1967 unsigned char model_num[40]; 2137 unsigned char model_num[40];
1968 char *s; 2138 char *s;
@@ -1987,9 +2157,9 @@ static int ata_dma_blacklisted(struct ata_port *ap, struct ata_device *dev)
1987 return 0; 2157 return 0;
1988} 2158}
1989 2159
1990static unsigned int ata_get_mode_mask(struct ata_port *ap, int shift) 2160static unsigned int ata_get_mode_mask(const struct ata_port *ap, int shift)
1991{ 2161{
1992 struct ata_device *master, *slave; 2162 const struct ata_device *master, *slave;
1993 unsigned int mask; 2163 unsigned int mask;
1994 2164
1995 master = &ap->device[0]; 2165 master = &ap->device[0];
@@ -2001,14 +2171,14 @@ static unsigned int ata_get_mode_mask(struct ata_port *ap, int shift)
2001 mask = ap->udma_mask; 2171 mask = ap->udma_mask;
2002 if (ata_dev_present(master)) { 2172 if (ata_dev_present(master)) {
2003 mask &= (master->id[ATA_ID_UDMA_MODES] & 0xff); 2173 mask &= (master->id[ATA_ID_UDMA_MODES] & 0xff);
2004 if (ata_dma_blacklisted(ap, master)) { 2174 if (ata_dma_blacklisted(master)) {
2005 mask = 0; 2175 mask = 0;
2006 ata_pr_blacklisted(ap, master); 2176 ata_pr_blacklisted(ap, master);
2007 } 2177 }
2008 } 2178 }
2009 if (ata_dev_present(slave)) { 2179 if (ata_dev_present(slave)) {
2010 mask &= (slave->id[ATA_ID_UDMA_MODES] & 0xff); 2180 mask &= (slave->id[ATA_ID_UDMA_MODES] & 0xff);
2011 if (ata_dma_blacklisted(ap, slave)) { 2181 if (ata_dma_blacklisted(slave)) {
2012 mask = 0; 2182 mask = 0;
2013 ata_pr_blacklisted(ap, slave); 2183 ata_pr_blacklisted(ap, slave);
2014 } 2184 }
@@ -2018,14 +2188,14 @@ static unsigned int ata_get_mode_mask(struct ata_port *ap, int shift)
2018 mask = ap->mwdma_mask; 2188 mask = ap->mwdma_mask;
2019 if (ata_dev_present(master)) { 2189 if (ata_dev_present(master)) {
2020 mask &= (master->id[ATA_ID_MWDMA_MODES] & 0x07); 2190 mask &= (master->id[ATA_ID_MWDMA_MODES] & 0x07);
2021 if (ata_dma_blacklisted(ap, master)) { 2191 if (ata_dma_blacklisted(master)) {
2022 mask = 0; 2192 mask = 0;
2023 ata_pr_blacklisted(ap, master); 2193 ata_pr_blacklisted(ap, master);
2024 } 2194 }
2025 } 2195 }
2026 if (ata_dev_present(slave)) { 2196 if (ata_dev_present(slave)) {
2027 mask &= (slave->id[ATA_ID_MWDMA_MODES] & 0x07); 2197 mask &= (slave->id[ATA_ID_MWDMA_MODES] & 0x07);
2028 if (ata_dma_blacklisted(ap, slave)) { 2198 if (ata_dma_blacklisted(slave)) {
2029 mask = 0; 2199 mask = 0;
2030 ata_pr_blacklisted(ap, slave); 2200 ata_pr_blacklisted(ap, slave);
2031 } 2201 }
@@ -2089,7 +2259,7 @@ static int fgb(u32 bitmap)
2089 * Zero on success, negative on error. 2259 * Zero on success, negative on error.
2090 */ 2260 */
2091 2261
2092static int ata_choose_xfer_mode(struct ata_port *ap, 2262static int ata_choose_xfer_mode(const struct ata_port *ap,
2093 u8 *xfer_mode_out, 2263 u8 *xfer_mode_out,
2094 unsigned int *xfer_shift_out) 2264 unsigned int *xfer_shift_out)
2095{ 2265{
@@ -2613,13 +2783,13 @@ void ata_poll_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat)
2613 2783
2614/** 2784/**
2615 * ata_pio_poll - 2785 * ata_pio_poll -
2616 * @ap: 2786 * @ap: the target ata_port
2617 * 2787 *
2618 * LOCKING: 2788 * LOCKING:
2619 * None. (executing in kernel thread context) 2789 * None. (executing in kernel thread context)
2620 * 2790 *
2621 * RETURNS: 2791 * RETURNS:
2622 * 2792 * timeout value to use
2623 */ 2793 */
2624 2794
2625static unsigned long ata_pio_poll(struct ata_port *ap) 2795static unsigned long ata_pio_poll(struct ata_port *ap)
@@ -2660,8 +2830,8 @@ static unsigned long ata_pio_poll(struct ata_port *ap)
2660} 2830}
2661 2831
2662/** 2832/**
2663 * ata_pio_complete - 2833 * ata_pio_complete - check if drive is busy or idle
2664 * @ap: 2834 * @ap: the target ata_port
2665 * 2835 *
2666 * LOCKING: 2836 * LOCKING:
2667 * None. (executing in kernel thread context) 2837 * None. (executing in kernel thread context)
@@ -2713,7 +2883,7 @@ static int ata_pio_complete (struct ata_port *ap)
2713 2883
2714 2884
2715/** 2885/**
2716 * swap_buf_le16 - 2886 * swap_buf_le16 - swap halves of 16-words in place
2717 * @buf: Buffer to swap 2887 * @buf: Buffer to swap
2718 * @buf_words: Number of 16-bit words in buffer. 2888 * @buf_words: Number of 16-bit words in buffer.
2719 * 2889 *
@@ -2722,6 +2892,7 @@ static int ata_pio_complete (struct ata_port *ap)
2722 * vice-versa. 2892 * vice-versa.
2723 * 2893 *
2724 * LOCKING: 2894 * LOCKING:
2895 * Inherited from caller.
2725 */ 2896 */
2726void swap_buf_le16(u16 *buf, unsigned int buf_words) 2897void swap_buf_le16(u16 *buf, unsigned int buf_words)
2727{ 2898{
@@ -2744,7 +2915,6 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words)
2744 * 2915 *
2745 * LOCKING: 2916 * LOCKING:
2746 * Inherited from caller. 2917 * Inherited from caller.
2747 *
2748 */ 2918 */
2749 2919
2750static void ata_mmio_data_xfer(struct ata_port *ap, unsigned char *buf, 2920static void ata_mmio_data_xfer(struct ata_port *ap, unsigned char *buf,
@@ -2790,7 +2960,6 @@ static void ata_mmio_data_xfer(struct ata_port *ap, unsigned char *buf,
2790 * 2960 *
2791 * LOCKING: 2961 * LOCKING:
2792 * Inherited from caller. 2962 * Inherited from caller.
2793 *
2794 */ 2963 */
2795 2964
2796static void ata_pio_data_xfer(struct ata_port *ap, unsigned char *buf, 2965static void ata_pio_data_xfer(struct ata_port *ap, unsigned char *buf,
@@ -2830,7 +2999,6 @@ static void ata_pio_data_xfer(struct ata_port *ap, unsigned char *buf,
2830 * 2999 *
2831 * LOCKING: 3000 * LOCKING:
2832 * Inherited from caller. 3001 * Inherited from caller.
2833 *
2834 */ 3002 */
2835 3003
2836static void ata_data_xfer(struct ata_port *ap, unsigned char *buf, 3004static void ata_data_xfer(struct ata_port *ap, unsigned char *buf,
@@ -2983,7 +3151,6 @@ next_sg:
2983 * 3151 *
2984 * LOCKING: 3152 * LOCKING:
2985 * Inherited from caller. 3153 * Inherited from caller.
2986 *
2987 */ 3154 */
2988 3155
2989static void atapi_pio_bytes(struct ata_queued_cmd *qc) 3156static void atapi_pio_bytes(struct ata_queued_cmd *qc)
@@ -3019,8 +3186,8 @@ err_out:
3019} 3186}
3020 3187
3021/** 3188/**
3022 * ata_pio_sector - 3189 * ata_pio_block - start PIO on a block
3023 * @ap: 3190 * @ap: the target ata_port
3024 * 3191 *
3025 * LOCKING: 3192 * LOCKING:
3026 * None. (executing in kernel thread context) 3193 * None. (executing in kernel thread context)
@@ -3032,7 +3199,7 @@ static void ata_pio_block(struct ata_port *ap)
3032 u8 status; 3199 u8 status;
3033 3200
3034 /* 3201 /*
3035 * This is purely hueristic. This is a fast path. 3202 * This is purely heuristic. This is a fast path.
3036 * Sometimes when we enter, BSY will be cleared in 3203 * Sometimes when we enter, BSY will be cleared in
3037 * a chk-status or two. If not, the drive is probably seeking 3204 * a chk-status or two. If not, the drive is probably seeking
3038 * or something. Snooze for a couple msecs, then 3205 * or something. Snooze for a couple msecs, then
@@ -3352,7 +3519,6 @@ static void __ata_qc_complete(struct ata_queued_cmd *qc)
3352 * 3519 *
3353 * LOCKING: 3520 * LOCKING:
3354 * spin_lock_irqsave(host_set lock) 3521 * spin_lock_irqsave(host_set lock)
3355 *
3356 */ 3522 */
3357void ata_qc_free(struct ata_queued_cmd *qc) 3523void ata_qc_free(struct ata_queued_cmd *qc)
3358{ 3524{
@@ -3372,7 +3538,6 @@ void ata_qc_free(struct ata_queued_cmd *qc)
3372 * 3538 *
3373 * LOCKING: 3539 * LOCKING:
3374 * spin_lock_irqsave(host_set lock) 3540 * spin_lock_irqsave(host_set lock)
3375 *
3376 */ 3541 */
3377 3542
3378void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat) 3543void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat)
@@ -3866,7 +4031,6 @@ idle_irq:
3866 * 4031 *
3867 * RETURNS: 4032 * RETURNS:
3868 * IRQ_NONE or IRQ_HANDLED. 4033 * IRQ_NONE or IRQ_HANDLED.
3869 *
3870 */ 4034 */
3871 4035
3872irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs) 4036irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs)
@@ -3978,6 +4142,7 @@ err_out:
3978 * May be used as the port_start() entry in ata_port_operations. 4142 * May be used as the port_start() entry in ata_port_operations.
3979 * 4143 *
3980 * LOCKING: 4144 * LOCKING:
4145 * Inherited from caller.
3981 */ 4146 */
3982 4147
3983int ata_port_start (struct ata_port *ap) 4148int ata_port_start (struct ata_port *ap)
@@ -4009,6 +4174,7 @@ int ata_port_start (struct ata_port *ap)
4009 * May be used as the port_stop() entry in ata_port_operations. 4174 * May be used as the port_stop() entry in ata_port_operations.
4010 * 4175 *
4011 * LOCKING: 4176 * LOCKING:
4177 * Inherited from caller.
4012 */ 4178 */
4013 4179
4014void ata_port_stop (struct ata_port *ap) 4180void ata_port_stop (struct ata_port *ap)
@@ -4032,6 +4198,7 @@ void ata_host_stop (struct ata_host_set *host_set)
4032 * @do_unregister: 1 if we fully unregister, 0 to just stop the port 4198 * @do_unregister: 1 if we fully unregister, 0 to just stop the port
4033 * 4199 *
4034 * LOCKING: 4200 * LOCKING:
4201 * Inherited from caller.
4035 */ 4202 */
4036 4203
4037static void ata_host_remove(struct ata_port *ap, unsigned int do_unregister) 4204static void ata_host_remove(struct ata_port *ap, unsigned int do_unregister)
@@ -4059,12 +4226,11 @@ static void ata_host_remove(struct ata_port *ap, unsigned int do_unregister)
4059 * 4226 *
4060 * LOCKING: 4227 * LOCKING:
4061 * Inherited from caller. 4228 * Inherited from caller.
4062 *
4063 */ 4229 */
4064 4230
4065static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host, 4231static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host,
4066 struct ata_host_set *host_set, 4232 struct ata_host_set *host_set,
4067 struct ata_probe_ent *ent, unsigned int port_no) 4233 const struct ata_probe_ent *ent, unsigned int port_no)
4068{ 4234{
4069 unsigned int i; 4235 unsigned int i;
4070 4236
@@ -4120,10 +4286,9 @@ static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host,
4120 * 4286 *
4121 * RETURNS: 4287 * RETURNS:
4122 * New ata_port on success, for NULL on error. 4288 * New ata_port on success, for NULL on error.
4123 *
4124 */ 4289 */
4125 4290
4126static struct ata_port * ata_host_add(struct ata_probe_ent *ent, 4291static struct ata_port * ata_host_add(const struct ata_probe_ent *ent,
4127 struct ata_host_set *host_set, 4292 struct ata_host_set *host_set,
4128 unsigned int port_no) 4293 unsigned int port_no)
4129{ 4294{
@@ -4168,10 +4333,9 @@ err_out:
4168 * 4333 *
4169 * RETURNS: 4334 * RETURNS:
4170 * Number of ports registered. Zero on error (no ports registered). 4335 * Number of ports registered. Zero on error (no ports registered).
4171 *
4172 */ 4336 */
4173 4337
4174int ata_device_add(struct ata_probe_ent *ent) 4338int ata_device_add(const struct ata_probe_ent *ent)
4175{ 4339{
4176 unsigned int count = 0, i; 4340 unsigned int count = 0, i;
4177 struct device *dev = ent->dev; 4341 struct device *dev = ent->dev;
@@ -4300,7 +4464,6 @@ err_out:
4300 * Inherited from calling layer (may sleep). 4464 * Inherited from calling layer (may sleep).
4301 */ 4465 */
4302 4466
4303
4304void ata_host_set_remove(struct ata_host_set *host_set) 4467void ata_host_set_remove(struct ata_host_set *host_set)
4305{ 4468{
4306 struct ata_port *ap; 4469 struct ata_port *ap;
@@ -4390,7 +4553,7 @@ void ata_std_ports(struct ata_ioports *ioaddr)
4390} 4553}
4391 4554
4392static struct ata_probe_ent * 4555static struct ata_probe_ent *
4393ata_probe_ent_alloc(struct device *dev, struct ata_port_info *port) 4556ata_probe_ent_alloc(struct device *dev, const struct ata_port_info *port)
4394{ 4557{
4395 struct ata_probe_ent *probe_ent; 4558 struct ata_probe_ent *probe_ent;
4396 4559
@@ -4490,7 +4653,6 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev, stru
4490 if (!probe_ent) 4653 if (!probe_ent)
4491 return NULL; 4654 return NULL;
4492 4655
4493
4494 probe_ent->legacy_mode = 1; 4656 probe_ent->legacy_mode = 1;
4495 probe_ent->n_ports = 1; 4657 probe_ent->n_ports = 1;
4496 probe_ent->hard_port_no = port_num; 4658 probe_ent->hard_port_no = port_num;
@@ -4534,7 +4696,6 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev, stru
4534 * 4696 *
4535 * RETURNS: 4697 * RETURNS:
4536 * Zero on success, negative on errno-based value on error. 4698 * Zero on success, negative on errno-based value on error.
4537 *
4538 */ 4699 */
4539 4700
4540int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, 4701int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
@@ -4682,7 +4843,7 @@ err_out:
4682 * @pdev: PCI device that was removed 4843 * @pdev: PCI device that was removed
4683 * 4844 *
4684 * PCI layer indicates to libata via this hook that 4845 * PCI layer indicates to libata via this hook that
4685 * hot-unplug or module unload event has occured. 4846 * hot-unplug or module unload event has occurred.
4686 * Handle this by unregistering all objects associated 4847 * Handle this by unregistering all objects associated
4687 * with this PCI device. Free those objects. Then finally 4848 * with this PCI device. Free those objects. Then finally
4688 * release PCI resources and disable device. 4849 * release PCI resources and disable device.
@@ -4703,7 +4864,7 @@ void ata_pci_remove_one (struct pci_dev *pdev)
4703} 4864}
4704 4865
4705/* move to PCI subsystem */ 4866/* move to PCI subsystem */
4706int pci_test_config_bits(struct pci_dev *pdev, struct pci_bits *bits) 4867int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits)
4707{ 4868{
4708 unsigned long tmp = 0; 4869 unsigned long tmp = 0;
4709 4870
@@ -4830,6 +4991,9 @@ EXPORT_SYMBOL_GPL(ata_dev_id_string);
4830EXPORT_SYMBOL_GPL(ata_dev_config); 4991EXPORT_SYMBOL_GPL(ata_dev_config);
4831EXPORT_SYMBOL_GPL(ata_scsi_simulate); 4992EXPORT_SYMBOL_GPL(ata_scsi_simulate);
4832 4993
4994EXPORT_SYMBOL_GPL(ata_timing_compute);
4995EXPORT_SYMBOL_GPL(ata_timing_merge);
4996
4833#ifdef CONFIG_PCI 4997#ifdef CONFIG_PCI
4834EXPORT_SYMBOL_GPL(pci_test_config_bits); 4998EXPORT_SYMBOL_GPL(pci_test_config_bits);
4835EXPORT_SYMBOL_GPL(ata_pci_host_stop); 4999EXPORT_SYMBOL_GPL(ata_pci_host_stop);
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index 9944adbe5a1..a68c0341dc8 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -44,9 +44,9 @@
44 44
45#include "libata.h" 45#include "libata.h"
46 46
47typedef unsigned int (*ata_xlat_func_t)(struct ata_queued_cmd *qc, u8 *scsicmd); 47typedef unsigned int (*ata_xlat_func_t)(struct ata_queued_cmd *qc, const u8 *scsicmd);
48static struct ata_device * 48static struct ata_device *
49ata_scsi_find_dev(struct ata_port *ap, struct scsi_device *scsidev); 49ata_scsi_find_dev(struct ata_port *ap, const struct scsi_device *scsidev);
50 50
51 51
52static void ata_scsi_invalid_field(struct scsi_cmnd *cmd, 52static void ata_scsi_invalid_field(struct scsi_cmnd *cmd,
@@ -428,7 +428,7 @@ int ata_scsi_error(struct Scsi_Host *host)
428 */ 428 */
429 429
430static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc, 430static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc,
431 u8 *scsicmd) 431 const u8 *scsicmd)
432{ 432{
433 struct ata_taskfile *tf = &qc->tf; 433 struct ata_taskfile *tf = &qc->tf;
434 434
@@ -495,7 +495,7 @@ invalid_fld:
495 * Zero on success, non-zero on error. 495 * Zero on success, non-zero on error.
496 */ 496 */
497 497
498static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc, u8 *scsicmd) 498static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc, const u8 *scsicmd)
499{ 499{
500 struct ata_taskfile *tf = &qc->tf; 500 struct ata_taskfile *tf = &qc->tf;
501 501
@@ -522,7 +522,7 @@ static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc, u8 *scsicmd)
522 * @plen: the transfer length 522 * @plen: the transfer length
523 */ 523 */
524 524
525static void scsi_6_lba_len(u8 *scsicmd, u64 *plba, u32 *plen) 525static void scsi_6_lba_len(const u8 *scsicmd, u64 *plba, u32 *plen)
526{ 526{
527 u64 lba = 0; 527 u64 lba = 0;
528 u32 len = 0; 528 u32 len = 0;
@@ -549,7 +549,7 @@ static void scsi_6_lba_len(u8 *scsicmd, u64 *plba, u32 *plen)
549 * @plen: the transfer length 549 * @plen: the transfer length
550 */ 550 */
551 551
552static void scsi_10_lba_len(u8 *scsicmd, u64 *plba, u32 *plen) 552static void scsi_10_lba_len(const u8 *scsicmd, u64 *plba, u32 *plen)
553{ 553{
554 u64 lba = 0; 554 u64 lba = 0;
555 u32 len = 0; 555 u32 len = 0;
@@ -579,7 +579,7 @@ static void scsi_10_lba_len(u8 *scsicmd, u64 *plba, u32 *plen)
579 * @plen: the transfer length 579 * @plen: the transfer length
580 */ 580 */
581 581
582static void scsi_16_lba_len(u8 *scsicmd, u64 *plba, u32 *plen) 582static void scsi_16_lba_len(const u8 *scsicmd, u64 *plba, u32 *plen)
583{ 583{
584 u64 lba = 0; 584 u64 lba = 0;
585 u32 len = 0; 585 u32 len = 0;
@@ -618,7 +618,7 @@ static void scsi_16_lba_len(u8 *scsicmd, u64 *plba, u32 *plen)
618 * Zero on success, non-zero on error. 618 * Zero on success, non-zero on error.
619 */ 619 */
620 620
621static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc, u8 *scsicmd) 621static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc, const u8 *scsicmd)
622{ 622{
623 struct ata_taskfile *tf = &qc->tf; 623 struct ata_taskfile *tf = &qc->tf;
624 struct ata_device *dev = qc->dev; 624 struct ata_device *dev = qc->dev;
@@ -744,7 +744,7 @@ nothing_to_do:
744 * Zero on success, non-zero on error. 744 * Zero on success, non-zero on error.
745 */ 745 */
746 746
747static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, u8 *scsicmd) 747static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, const u8 *scsicmd)
748{ 748{
749 struct ata_taskfile *tf = &qc->tf; 749 struct ata_taskfile *tf = &qc->tf;
750 struct ata_device *dev = qc->dev; 750 struct ata_device *dev = qc->dev;
@@ -1698,7 +1698,7 @@ static int atapi_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat)
1698 * Zero on success, non-zero on failure. 1698 * Zero on success, non-zero on failure.
1699 */ 1699 */
1700 1700
1701static unsigned int atapi_xlat(struct ata_queued_cmd *qc, u8 *scsicmd) 1701static unsigned int atapi_xlat(struct ata_queued_cmd *qc, const u8 *scsicmd)
1702{ 1702{
1703 struct scsi_cmnd *cmd = qc->scsicmd; 1703 struct scsi_cmnd *cmd = qc->scsicmd;
1704 struct ata_device *dev = qc->dev; 1704 struct ata_device *dev = qc->dev;
@@ -1767,7 +1767,7 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc, u8 *scsicmd)
1767 */ 1767 */
1768 1768
1769static struct ata_device * 1769static struct ata_device *
1770ata_scsi_find_dev(struct ata_port *ap, struct scsi_device *scsidev) 1770ata_scsi_find_dev(struct ata_port *ap, const struct scsi_device *scsidev)
1771{ 1771{
1772 struct ata_device *dev; 1772 struct ata_device *dev;
1773 1773
@@ -1924,7 +1924,7 @@ void ata_scsi_simulate(u16 *id,
1924 void (*done)(struct scsi_cmnd *)) 1924 void (*done)(struct scsi_cmnd *))
1925{ 1925{
1926 struct ata_scsi_args args; 1926 struct ata_scsi_args args;
1927 u8 *scsicmd = cmd->cmnd; 1927 const u8 *scsicmd = cmd->cmnd;
1928 1928
1929 args.id = id; 1929 args.id = id;
1930 args.cmd = cmd; 1930 args.cmd = cmd;
diff --git a/drivers/scsi/libata.h b/drivers/scsi/libata.h
index 67d752ca8ae..3d60190584b 100644
--- a/drivers/scsi/libata.h
+++ b/drivers/scsi/libata.h
@@ -48,7 +48,7 @@ extern int ata_qc_issue(struct ata_queued_cmd *qc);
48extern int ata_check_atapi_dma(struct ata_queued_cmd *qc); 48extern int ata_check_atapi_dma(struct ata_queued_cmd *qc);
49extern void ata_dev_select(struct ata_port *ap, unsigned int device, 49extern void ata_dev_select(struct ata_port *ap, unsigned int device,
50 unsigned int wait, unsigned int can_sleep); 50 unsigned int wait, unsigned int can_sleep);
51extern void ata_tf_to_host_nolock(struct ata_port *ap, struct ata_taskfile *tf); 51extern void ata_tf_to_host_nolock(struct ata_port *ap, const struct ata_taskfile *tf);
52extern void swap_buf_le16(u16 *buf, unsigned int buf_words); 52extern void swap_buf_le16(u16 *buf, unsigned int buf_words);
53 53
54 54
diff --git a/drivers/scsi/lpfc/lpfc_mem.c b/drivers/scsi/lpfc/lpfc_mem.c
index 0aba13ceaac..352df47bcac 100644
--- a/drivers/scsi/lpfc/lpfc_mem.c
+++ b/drivers/scsi/lpfc/lpfc_mem.c
@@ -39,7 +39,7 @@
39#define LPFC_MEM_POOL_SIZE 64 /* max elem in non-DMA safety pool */ 39#define LPFC_MEM_POOL_SIZE 64 /* max elem in non-DMA safety pool */
40 40
41static void * 41static void *
42lpfc_pool_kmalloc(unsigned int gfp_flags, void *data) 42lpfc_pool_kmalloc(gfp_t gfp_flags, void *data)
43{ 43{
44 return kmalloc((unsigned long)data, gfp_flags); 44 return kmalloc((unsigned long)data, gfp_flags);
45} 45}
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c
index 3f2f2464fa6..af1133104b3 100644
--- a/drivers/scsi/osst.c
+++ b/drivers/scsi/osst.c
@@ -5146,7 +5146,8 @@ static long osst_compat_ioctl(struct file * file, unsigned int cmd_in, unsigned
5146/* Try to allocate a new tape buffer skeleton. Caller must not hold os_scsi_tapes_lock */ 5146/* Try to allocate a new tape buffer skeleton. Caller must not hold os_scsi_tapes_lock */
5147static struct osst_buffer * new_tape_buffer( int from_initialization, int need_dma, int max_sg ) 5147static struct osst_buffer * new_tape_buffer( int from_initialization, int need_dma, int max_sg )
5148{ 5148{
5149 int i, priority; 5149 int i;
5150 gfp_t priority;
5150 struct osst_buffer *tb; 5151 struct osst_buffer *tb;
5151 5152
5152 if (from_initialization) 5153 if (from_initialization)
@@ -5178,7 +5179,8 @@ static struct osst_buffer * new_tape_buffer( int from_initialization, int need_d
5178/* Try to allocate a temporary (while a user has the device open) enlarged tape buffer */ 5179/* Try to allocate a temporary (while a user has the device open) enlarged tape buffer */
5179static int enlarge_buffer(struct osst_buffer *STbuffer, int need_dma) 5180static int enlarge_buffer(struct osst_buffer *STbuffer, int need_dma)
5180{ 5181{
5181 int segs, nbr, max_segs, b_size, priority, order, got; 5182 int segs, nbr, max_segs, b_size, order, got;
5183 gfp_t priority;
5182 5184
5183 if (STbuffer->buffer_size >= OS_FRAME_SIZE) 5185 if (STbuffer->buffer_size >= OS_FRAME_SIZE)
5184 return 1; 5186 return 1;
diff --git a/drivers/scsi/pdc_adma.c b/drivers/scsi/pdc_adma.c
index c6825da6ae2..85ec5b1d7aa 100644
--- a/drivers/scsi/pdc_adma.c
+++ b/drivers/scsi/pdc_adma.c
@@ -158,7 +158,7 @@ static Scsi_Host_Template adma_ata_sht = {
158 .bios_param = ata_std_bios_param, 158 .bios_param = ata_std_bios_param,
159}; 159};
160 160
161static struct ata_port_operations adma_ata_ops = { 161static const struct ata_port_operations adma_ata_ops = {
162 .port_disable = ata_port_disable, 162 .port_disable = ata_port_disable,
163 .tf_load = ata_tf_load, 163 .tf_load = ata_tf_load,
164 .tf_read = ata_tf_read, 164 .tf_read = ata_tf_read,
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index 1ed32e7b547..e451941ad81 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -52,7 +52,7 @@ extern int qla2x00_load_risc(struct scsi_qla_host *, uint32_t *);
52extern int qla24xx_load_risc_flash(scsi_qla_host_t *, uint32_t *); 52extern int qla24xx_load_risc_flash(scsi_qla_host_t *, uint32_t *);
53extern int qla24xx_load_risc_hotplug(scsi_qla_host_t *, uint32_t *); 53extern int qla24xx_load_risc_hotplug(scsi_qla_host_t *, uint32_t *);
54 54
55extern fc_port_t *qla2x00_alloc_fcport(scsi_qla_host_t *, int); 55extern fc_port_t *qla2x00_alloc_fcport(scsi_qla_host_t *, gfp_t);
56 56
57extern int qla2x00_loop_resync(scsi_qla_host_t *); 57extern int qla2x00_loop_resync(scsi_qla_host_t *);
58 58
@@ -277,7 +277,7 @@ extern int qla2x00_fdmi_register(scsi_qla_host_t *);
277/* 277/*
278 * Global Function Prototypes in qla_rscn.c source file. 278 * Global Function Prototypes in qla_rscn.c source file.
279 */ 279 */
280extern fc_port_t *qla2x00_alloc_rscn_fcport(scsi_qla_host_t *, int); 280extern fc_port_t *qla2x00_alloc_rscn_fcport(scsi_qla_host_t *, gfp_t);
281extern int qla2x00_handle_port_rscn(scsi_qla_host_t *, uint32_t, fc_port_t *, 281extern int qla2x00_handle_port_rscn(scsi_qla_host_t *, uint32_t, fc_port_t *,
282 int); 282 int);
283extern void qla2x00_process_iodesc(scsi_qla_host_t *, struct mbx_entry *); 283extern void qla2x00_process_iodesc(scsi_qla_host_t *, struct mbx_entry *);
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 23d095d3817..fbb6feee40c 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -1685,7 +1685,7 @@ qla2x00_nvram_config(scsi_qla_host_t *ha)
1685 * Returns a pointer to the allocated fcport, or NULL, if none available. 1685 * Returns a pointer to the allocated fcport, or NULL, if none available.
1686 */ 1686 */
1687fc_port_t * 1687fc_port_t *
1688qla2x00_alloc_fcport(scsi_qla_host_t *ha, int flags) 1688qla2x00_alloc_fcport(scsi_qla_host_t *ha, gfp_t flags)
1689{ 1689{
1690 fc_port_t *fcport; 1690 fc_port_t *fcport;
1691 1691
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 8982978c42f..7aec93f9d42 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1325,6 +1325,8 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info)
1325 ha->brd_info = brd_info; 1325 ha->brd_info = brd_info;
1326 sprintf(ha->host_str, "%s_%ld", ha->brd_info->drv_name, ha->host_no); 1326 sprintf(ha->host_str, "%s_%ld", ha->brd_info->drv_name, ha->host_no);
1327 1327
1328 ha->dpc_pid = -1;
1329
1328 /* Configure PCI I/O space */ 1330 /* Configure PCI I/O space */
1329 ret = qla2x00_iospace_config(ha); 1331 ret = qla2x00_iospace_config(ha);
1330 if (ret) 1332 if (ret)
@@ -1448,7 +1450,6 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info)
1448 */ 1450 */
1449 spin_lock_init(&ha->mbx_reg_lock); 1451 spin_lock_init(&ha->mbx_reg_lock);
1450 1452
1451 ha->dpc_pid = -1;
1452 init_completion(&ha->dpc_inited); 1453 init_completion(&ha->dpc_inited);
1453 init_completion(&ha->dpc_exited); 1454 init_completion(&ha->dpc_exited);
1454 1455
diff --git a/drivers/scsi/qla2xxx/qla_rscn.c b/drivers/scsi/qla2xxx/qla_rscn.c
index 1eba9882863..7534efcc891 100644
--- a/drivers/scsi/qla2xxx/qla_rscn.c
+++ b/drivers/scsi/qla2xxx/qla_rscn.c
@@ -1066,7 +1066,7 @@ qla2x00_send_login_iocb_cb(scsi_qla_host_t *ha, struct io_descriptor *iodesc,
1066 * Returns a pointer to the allocated RSCN fcport, or NULL, if none available. 1066 * Returns a pointer to the allocated RSCN fcport, or NULL, if none available.
1067 */ 1067 */
1068fc_port_t * 1068fc_port_t *
1069qla2x00_alloc_rscn_fcport(scsi_qla_host_t *ha, int flags) 1069qla2x00_alloc_rscn_fcport(scsi_qla_host_t *ha, gfp_t flags)
1070{ 1070{
1071 fc_port_t *fcport; 1071 fc_port_t *fcport;
1072 1072
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c
index be7c378dcd3..1d6d0c9e76f 100644
--- a/drivers/scsi/sata_mv.c
+++ b/drivers/scsi/sata_mv.c
@@ -35,7 +35,7 @@
35#include <asm/io.h> 35#include <asm/io.h>
36 36
37#define DRV_NAME "sata_mv" 37#define DRV_NAME "sata_mv"
38#define DRV_VERSION "0.24" 38#define DRV_VERSION "0.25"
39 39
40enum { 40enum {
41 /* BAR's are enumerated in terms of pci_resource_start() terms */ 41 /* BAR's are enumerated in terms of pci_resource_start() terms */
@@ -290,7 +290,7 @@ static Scsi_Host_Template mv_sht = {
290 .ordered_flush = 1, 290 .ordered_flush = 1,
291}; 291};
292 292
293static struct ata_port_operations mv_ops = { 293static const struct ata_port_operations mv_ops = {
294 .port_disable = ata_port_disable, 294 .port_disable = ata_port_disable,
295 295
296 .tf_load = ata_tf_load, 296 .tf_load = ata_tf_load,
diff --git a/drivers/scsi/sata_nv.c b/drivers/scsi/sata_nv.c
index 9fa2535dd93..1a56d6c79dd 100644
--- a/drivers/scsi/sata_nv.c
+++ b/drivers/scsi/sata_nv.c
@@ -238,7 +238,7 @@ static Scsi_Host_Template nv_sht = {
238 .ordered_flush = 1, 238 .ordered_flush = 1,
239}; 239};
240 240
241static struct ata_port_operations nv_ops = { 241static const struct ata_port_operations nv_ops = {
242 .port_disable = ata_port_disable, 242 .port_disable = ata_port_disable,
243 .tf_load = ata_tf_load, 243 .tf_load = ata_tf_load,
244 .tf_read = ata_tf_read, 244 .tf_read = ata_tf_read,
@@ -331,7 +331,7 @@ static u32 nv_scr_read (struct ata_port *ap, unsigned int sc_reg)
331 return 0xffffffffU; 331 return 0xffffffffU;
332 332
333 if (host->host_flags & NV_HOST_FLAGS_SCR_MMIO) 333 if (host->host_flags & NV_HOST_FLAGS_SCR_MMIO)
334 return readl((void*)ap->ioaddr.scr_addr + (sc_reg * 4)); 334 return readl((void __iomem *)ap->ioaddr.scr_addr + (sc_reg * 4));
335 else 335 else
336 return inl(ap->ioaddr.scr_addr + (sc_reg * 4)); 336 return inl(ap->ioaddr.scr_addr + (sc_reg * 4));
337} 337}
@@ -345,7 +345,7 @@ static void nv_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val)
345 return; 345 return;
346 346
347 if (host->host_flags & NV_HOST_FLAGS_SCR_MMIO) 347 if (host->host_flags & NV_HOST_FLAGS_SCR_MMIO)
348 writel(val, (void*)ap->ioaddr.scr_addr + (sc_reg * 4)); 348 writel(val, (void __iomem *)ap->ioaddr.scr_addr + (sc_reg * 4));
349 else 349 else
350 outl(val, ap->ioaddr.scr_addr + (sc_reg * 4)); 350 outl(val, ap->ioaddr.scr_addr + (sc_reg * 4));
351} 351}
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c
index def7e0d9dac..eee93b0016d 100644
--- a/drivers/scsi/sata_promise.c
+++ b/drivers/scsi/sata_promise.c
@@ -87,8 +87,8 @@ static void pdc_port_stop(struct ata_port *ap);
87static void pdc_pata_phy_reset(struct ata_port *ap); 87static void pdc_pata_phy_reset(struct ata_port *ap);
88static void pdc_sata_phy_reset(struct ata_port *ap); 88static void pdc_sata_phy_reset(struct ata_port *ap);
89static void pdc_qc_prep(struct ata_queued_cmd *qc); 89static void pdc_qc_prep(struct ata_queued_cmd *qc);
90static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf); 90static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf);
91static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf); 91static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf);
92static void pdc_irq_clear(struct ata_port *ap); 92static void pdc_irq_clear(struct ata_port *ap);
93static int pdc_qc_issue_prot(struct ata_queued_cmd *qc); 93static int pdc_qc_issue_prot(struct ata_queued_cmd *qc);
94 94
@@ -113,7 +113,7 @@ static Scsi_Host_Template pdc_ata_sht = {
113 .ordered_flush = 1, 113 .ordered_flush = 1,
114}; 114};
115 115
116static struct ata_port_operations pdc_sata_ops = { 116static const struct ata_port_operations pdc_sata_ops = {
117 .port_disable = ata_port_disable, 117 .port_disable = ata_port_disable,
118 .tf_load = pdc_tf_load_mmio, 118 .tf_load = pdc_tf_load_mmio,
119 .tf_read = ata_tf_read, 119 .tf_read = ata_tf_read,
@@ -136,7 +136,7 @@ static struct ata_port_operations pdc_sata_ops = {
136 .host_stop = ata_pci_host_stop, 136 .host_stop = ata_pci_host_stop,
137}; 137};
138 138
139static struct ata_port_operations pdc_pata_ops = { 139static const struct ata_port_operations pdc_pata_ops = {
140 .port_disable = ata_port_disable, 140 .port_disable = ata_port_disable,
141 .tf_load = pdc_tf_load_mmio, 141 .tf_load = pdc_tf_load_mmio,
142 .tf_read = ata_tf_read, 142 .tf_read = ata_tf_read,
@@ -324,7 +324,7 @@ static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg)
324{ 324{
325 if (sc_reg > SCR_CONTROL) 325 if (sc_reg > SCR_CONTROL)
326 return 0xffffffffU; 326 return 0xffffffffU;
327 return readl((void *) ap->ioaddr.scr_addr + (sc_reg * 4)); 327 return readl((void __iomem *) ap->ioaddr.scr_addr + (sc_reg * 4));
328} 328}
329 329
330 330
@@ -333,7 +333,7 @@ static void pdc_sata_scr_write (struct ata_port *ap, unsigned int sc_reg,
333{ 333{
334 if (sc_reg > SCR_CONTROL) 334 if (sc_reg > SCR_CONTROL)
335 return; 335 return;
336 writel(val, (void *) ap->ioaddr.scr_addr + (sc_reg * 4)); 336 writel(val, (void __iomem *) ap->ioaddr.scr_addr + (sc_reg * 4));
337} 337}
338 338
339static void pdc_qc_prep(struct ata_queued_cmd *qc) 339static void pdc_qc_prep(struct ata_queued_cmd *qc)
@@ -523,8 +523,8 @@ static inline void pdc_packet_start(struct ata_queued_cmd *qc)
523 523
524 pp->pkt[2] = seq; 524 pp->pkt[2] = seq;
525 wmb(); /* flush PRD, pkt writes */ 525 wmb(); /* flush PRD, pkt writes */
526 writel(pp->pkt_dma, (void *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); 526 writel(pp->pkt_dma, (void __iomem *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT);
527 readl((void *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); /* flush */ 527 readl((void __iomem *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); /* flush */
528} 528}
529 529
530static int pdc_qc_issue_prot(struct ata_queued_cmd *qc) 530static int pdc_qc_issue_prot(struct ata_queued_cmd *qc)
@@ -546,7 +546,7 @@ static int pdc_qc_issue_prot(struct ata_queued_cmd *qc)
546 return ata_qc_issue_prot(qc); 546 return ata_qc_issue_prot(qc);
547} 547}
548 548
549static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf) 549static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
550{ 550{
551 WARN_ON (tf->protocol == ATA_PROT_DMA || 551 WARN_ON (tf->protocol == ATA_PROT_DMA ||
552 tf->protocol == ATA_PROT_NODATA); 552 tf->protocol == ATA_PROT_NODATA);
@@ -554,7 +554,7 @@ static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf)
554} 554}
555 555
556 556
557static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf) 557static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
558{ 558{
559 WARN_ON (tf->protocol == ATA_PROT_DMA || 559 WARN_ON (tf->protocol == ATA_PROT_DMA ||
560 tf->protocol == ATA_PROT_NODATA); 560 tf->protocol == ATA_PROT_NODATA);
diff --git a/drivers/scsi/sata_qstor.c b/drivers/scsi/sata_qstor.c
index 69a9b1cf6f9..de3f266d67b 100644
--- a/drivers/scsi/sata_qstor.c
+++ b/drivers/scsi/sata_qstor.c
@@ -51,8 +51,6 @@ enum {
51 QS_PRD_BYTES = QS_MAX_PRD * 16, 51 QS_PRD_BYTES = QS_MAX_PRD * 16,
52 QS_PKT_BYTES = QS_CPB_BYTES + QS_PRD_BYTES, 52 QS_PKT_BYTES = QS_CPB_BYTES + QS_PRD_BYTES,
53 53
54 QS_DMA_BOUNDARY = ~0UL,
55
56 /* global register offsets */ 54 /* global register offsets */
57 QS_HCF_CNFG3 = 0x0003, /* host configuration offset */ 55 QS_HCF_CNFG3 = 0x0003, /* host configuration offset */
58 QS_HID_HPHY = 0x0004, /* host physical interface info */ 56 QS_HID_HPHY = 0x0004, /* host physical interface info */
@@ -101,6 +99,10 @@ enum {
101 board_2068_idx = 0, /* QStor 4-port SATA/RAID */ 99 board_2068_idx = 0, /* QStor 4-port SATA/RAID */
102}; 100};
103 101
102enum {
103 QS_DMA_BOUNDARY = ~0UL
104};
105
104typedef enum { qs_state_idle, qs_state_pkt, qs_state_mmio } qs_state_t; 106typedef enum { qs_state_idle, qs_state_pkt, qs_state_mmio } qs_state_t;
105 107
106struct qs_port_priv { 108struct qs_port_priv {
@@ -145,7 +147,7 @@ static Scsi_Host_Template qs_ata_sht = {
145 .bios_param = ata_std_bios_param, 147 .bios_param = ata_std_bios_param,
146}; 148};
147 149
148static struct ata_port_operations qs_ata_ops = { 150static const struct ata_port_operations qs_ata_ops = {
149 .port_disable = ata_port_disable, 151 .port_disable = ata_port_disable,
150 .tf_load = ata_tf_load, 152 .tf_load = ata_tf_load,
151 .tf_read = ata_tf_read, 153 .tf_read = ata_tf_read,
diff --git a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c
index ba98a175ee3..3a056173fb9 100644
--- a/drivers/scsi/sata_sil.c
+++ b/drivers/scsi/sata_sil.c
@@ -150,7 +150,7 @@ static Scsi_Host_Template sil_sht = {
150 .ordered_flush = 1, 150 .ordered_flush = 1,
151}; 151};
152 152
153static struct ata_port_operations sil_ops = { 153static const struct ata_port_operations sil_ops = {
154 .port_disable = ata_port_disable, 154 .port_disable = ata_port_disable,
155 .dev_config = sil_dev_config, 155 .dev_config = sil_dev_config,
156 .tf_load = ata_tf_load, 156 .tf_load = ata_tf_load,
@@ -289,7 +289,7 @@ static inline unsigned long sil_scr_addr(struct ata_port *ap, unsigned int sc_re
289 289
290static u32 sil_scr_read (struct ata_port *ap, unsigned int sc_reg) 290static u32 sil_scr_read (struct ata_port *ap, unsigned int sc_reg)
291{ 291{
292 void *mmio = (void *) sil_scr_addr(ap, sc_reg); 292 void __iomem *mmio = (void __iomem *) sil_scr_addr(ap, sc_reg);
293 if (mmio) 293 if (mmio)
294 return readl(mmio); 294 return readl(mmio);
295 return 0xffffffffU; 295 return 0xffffffffU;
@@ -297,7 +297,7 @@ static u32 sil_scr_read (struct ata_port *ap, unsigned int sc_reg)
297 297
298static void sil_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val) 298static void sil_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val)
299{ 299{
300 void *mmio = (void *) sil_scr_addr(ap, sc_reg); 300 void *mmio = (void __iomem *) sil_scr_addr(ap, sc_reg);
301 if (mmio) 301 if (mmio)
302 writel(val, mmio); 302 writel(val, mmio);
303} 303}
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c
index e16d1815cda..e0d27a0fbad 100644
--- a/drivers/scsi/sata_sil24.c
+++ b/drivers/scsi/sata_sil24.c
@@ -275,7 +275,7 @@ static Scsi_Host_Template sil24_sht = {
275 .ordered_flush = 1, /* NCQ not supported yet */ 275 .ordered_flush = 1, /* NCQ not supported yet */
276}; 276};
277 277
278static struct ata_port_operations sil24_ops = { 278static const struct ata_port_operations sil24_ops = {
279 .port_disable = ata_port_disable, 279 .port_disable = ata_port_disable,
280 280
281 .check_status = sil24_check_status, 281 .check_status = sil24_check_status,
diff --git a/drivers/scsi/sata_sis.c b/drivers/scsi/sata_sis.c
index 0761a3234fc..057f7b98b6c 100644
--- a/drivers/scsi/sata_sis.c
+++ b/drivers/scsi/sata_sis.c
@@ -102,7 +102,7 @@ static Scsi_Host_Template sis_sht = {
102 .ordered_flush = 1, 102 .ordered_flush = 1,
103}; 103};
104 104
105static struct ata_port_operations sis_ops = { 105static const struct ata_port_operations sis_ops = {
106 .port_disable = ata_port_disable, 106 .port_disable = ata_port_disable,
107 .tf_load = ata_tf_load, 107 .tf_load = ata_tf_load,
108 .tf_read = ata_tf_read, 108 .tf_read = ata_tf_read,
diff --git a/drivers/scsi/sata_svw.c b/drivers/scsi/sata_svw.c
index d89d968beda..e0f9570bc6d 100644
--- a/drivers/scsi/sata_svw.c
+++ b/drivers/scsi/sata_svw.c
@@ -102,7 +102,7 @@ static void k2_sata_scr_write (struct ata_port *ap, unsigned int sc_reg,
102} 102}
103 103
104 104
105static void k2_sata_tf_load(struct ata_port *ap, struct ata_taskfile *tf) 105static void k2_sata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf)
106{ 106{
107 struct ata_ioports *ioaddr = &ap->ioaddr; 107 struct ata_ioports *ioaddr = &ap->ioaddr;
108 unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; 108 unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR;
@@ -297,7 +297,7 @@ static Scsi_Host_Template k2_sata_sht = {
297}; 297};
298 298
299 299
300static struct ata_port_operations k2_sata_ops = { 300static const struct ata_port_operations k2_sata_ops = {
301 .port_disable = ata_port_disable, 301 .port_disable = ata_port_disable,
302 .tf_load = k2_sata_tf_load, 302 .tf_load = k2_sata_tf_load,
303 .tf_read = k2_sata_tf_read, 303 .tf_read = k2_sata_tf_read,
diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c
index 79fdbbab513..8710d0f14f9 100644
--- a/drivers/scsi/sata_sx4.c
+++ b/drivers/scsi/sata_sx4.c
@@ -137,7 +137,7 @@ struct pdc_port_priv {
137}; 137};
138 138
139struct pdc_host_priv { 139struct pdc_host_priv {
140 void *dimm_mmio; 140 void __iomem *dimm_mmio;
141 141
142 unsigned int doing_hdma; 142 unsigned int doing_hdma;
143 unsigned int hdma_prod; 143 unsigned int hdma_prod;
@@ -157,8 +157,8 @@ static void pdc_20621_phy_reset (struct ata_port *ap);
157static int pdc_port_start(struct ata_port *ap); 157static int pdc_port_start(struct ata_port *ap);
158static void pdc_port_stop(struct ata_port *ap); 158static void pdc_port_stop(struct ata_port *ap);
159static void pdc20621_qc_prep(struct ata_queued_cmd *qc); 159static void pdc20621_qc_prep(struct ata_queued_cmd *qc);
160static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf); 160static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf);
161static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf); 161static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf);
162static void pdc20621_host_stop(struct ata_host_set *host_set); 162static void pdc20621_host_stop(struct ata_host_set *host_set);
163static unsigned int pdc20621_dimm_init(struct ata_probe_ent *pe); 163static unsigned int pdc20621_dimm_init(struct ata_probe_ent *pe);
164static int pdc20621_detect_dimm(struct ata_probe_ent *pe); 164static int pdc20621_detect_dimm(struct ata_probe_ent *pe);
@@ -196,7 +196,7 @@ static Scsi_Host_Template pdc_sata_sht = {
196 .ordered_flush = 1, 196 .ordered_flush = 1,
197}; 197};
198 198
199static struct ata_port_operations pdc_20621_ops = { 199static const struct ata_port_operations pdc_20621_ops = {
200 .port_disable = ata_port_disable, 200 .port_disable = ata_port_disable,
201 .tf_load = pdc_tf_load_mmio, 201 .tf_load = pdc_tf_load_mmio,
202 .tf_read = ata_tf_read, 202 .tf_read = ata_tf_read,
@@ -247,7 +247,7 @@ static void pdc20621_host_stop(struct ata_host_set *host_set)
247{ 247{
248 struct pci_dev *pdev = to_pci_dev(host_set->dev); 248 struct pci_dev *pdev = to_pci_dev(host_set->dev);
249 struct pdc_host_priv *hpriv = host_set->private_data; 249 struct pdc_host_priv *hpriv = host_set->private_data;
250 void *dimm_mmio = hpriv->dimm_mmio; 250 void __iomem *dimm_mmio = hpriv->dimm_mmio;
251 251
252 pci_iounmap(pdev, dimm_mmio); 252 pci_iounmap(pdev, dimm_mmio);
253 kfree(hpriv); 253 kfree(hpriv);
@@ -668,8 +668,8 @@ static void pdc20621_packet_start(struct ata_queued_cmd *qc)
668 readl(mmio + PDC_20621_SEQCTL + (seq * 4)); /* flush */ 668 readl(mmio + PDC_20621_SEQCTL + (seq * 4)); /* flush */
669 669
670 writel(port_ofs + PDC_DIMM_ATA_PKT, 670 writel(port_ofs + PDC_DIMM_ATA_PKT,
671 (void *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); 671 (void __iomem *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT);
672 readl((void *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); 672 readl((void __iomem *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT);
673 VPRINTK("submitted ofs 0x%x (%u), seq %u\n", 673 VPRINTK("submitted ofs 0x%x (%u), seq %u\n",
674 port_ofs + PDC_DIMM_ATA_PKT, 674 port_ofs + PDC_DIMM_ATA_PKT,
675 port_ofs + PDC_DIMM_ATA_PKT, 675 port_ofs + PDC_DIMM_ATA_PKT,
@@ -746,8 +746,8 @@ static inline unsigned int pdc20621_host_intr( struct ata_port *ap,
746 writel(0x00000001, mmio + PDC_20621_SEQCTL + (seq * 4)); 746 writel(0x00000001, mmio + PDC_20621_SEQCTL + (seq * 4));
747 readl(mmio + PDC_20621_SEQCTL + (seq * 4)); 747 readl(mmio + PDC_20621_SEQCTL + (seq * 4));
748 writel(port_ofs + PDC_DIMM_ATA_PKT, 748 writel(port_ofs + PDC_DIMM_ATA_PKT,
749 (void *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); 749 (void __iomem *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT);
750 readl((void *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); 750 readl((void __iomem *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT);
751 } 751 }
752 752
753 /* step two - execute ATA command */ 753 /* step two - execute ATA command */
@@ -898,7 +898,7 @@ out:
898 DPRINTK("EXIT\n"); 898 DPRINTK("EXIT\n");
899} 899}
900 900
901static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf) 901static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
902{ 902{
903 WARN_ON (tf->protocol == ATA_PROT_DMA || 903 WARN_ON (tf->protocol == ATA_PROT_DMA ||
904 tf->protocol == ATA_PROT_NODATA); 904 tf->protocol == ATA_PROT_NODATA);
@@ -906,7 +906,7 @@ static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf)
906} 906}
907 907
908 908
909static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf) 909static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
910{ 910{
911 WARN_ON (tf->protocol == ATA_PROT_DMA || 911 WARN_ON (tf->protocol == ATA_PROT_DMA ||
912 tf->protocol == ATA_PROT_NODATA); 912 tf->protocol == ATA_PROT_NODATA);
@@ -1013,7 +1013,7 @@ static void pdc20621_put_to_dimm(struct ata_probe_ent *pe, void *psource,
1013 idx++; 1013 idx++;
1014 dist = ((long)(s32)(window_size - (offset + size))) >= 0 ? size : 1014 dist = ((long)(s32)(window_size - (offset + size))) >= 0 ? size :
1015 (long) (window_size - offset); 1015 (long) (window_size - offset);
1016 memcpy_toio((char *) (dimm_mmio + offset / 4), (char *) psource, dist); 1016 memcpy_toio(dimm_mmio + offset / 4, psource, dist);
1017 writel(0x01, mmio + PDC_GENERAL_CTLR); 1017 writel(0x01, mmio + PDC_GENERAL_CTLR);
1018 readl(mmio + PDC_GENERAL_CTLR); 1018 readl(mmio + PDC_GENERAL_CTLR);
1019 1019
@@ -1022,8 +1022,7 @@ static void pdc20621_put_to_dimm(struct ata_probe_ent *pe, void *psource,
1022 for (; (long) size >= (long) window_size ;) { 1022 for (; (long) size >= (long) window_size ;) {
1023 writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR); 1023 writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR);
1024 readl(mmio + PDC_DIMM_WINDOW_CTLR); 1024 readl(mmio + PDC_DIMM_WINDOW_CTLR);
1025 memcpy_toio((char *) (dimm_mmio), (char *) psource, 1025 memcpy_toio(dimm_mmio, psource, window_size / 4);
1026 window_size / 4);
1027 writel(0x01, mmio + PDC_GENERAL_CTLR); 1026 writel(0x01, mmio + PDC_GENERAL_CTLR);
1028 readl(mmio + PDC_GENERAL_CTLR); 1027 readl(mmio + PDC_GENERAL_CTLR);
1029 psource += window_size; 1028 psource += window_size;
@@ -1034,7 +1033,7 @@ static void pdc20621_put_to_dimm(struct ata_probe_ent *pe, void *psource,
1034 if (size) { 1033 if (size) {
1035 writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR); 1034 writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR);
1036 readl(mmio + PDC_DIMM_WINDOW_CTLR); 1035 readl(mmio + PDC_DIMM_WINDOW_CTLR);
1037 memcpy_toio((char *) (dimm_mmio), (char *) psource, size / 4); 1036 memcpy_toio(dimm_mmio, psource, size / 4);
1038 writel(0x01, mmio + PDC_GENERAL_CTLR); 1037 writel(0x01, mmio + PDC_GENERAL_CTLR);
1039 readl(mmio + PDC_GENERAL_CTLR); 1038 readl(mmio + PDC_GENERAL_CTLR);
1040 } 1039 }
diff --git a/drivers/scsi/sata_uli.c b/drivers/scsi/sata_uli.c
index 9c06f2abe7f..d68dc7d3422 100644
--- a/drivers/scsi/sata_uli.c
+++ b/drivers/scsi/sata_uli.c
@@ -90,7 +90,7 @@ static Scsi_Host_Template uli_sht = {
90 .ordered_flush = 1, 90 .ordered_flush = 1,
91}; 91};
92 92
93static struct ata_port_operations uli_ops = { 93static const struct ata_port_operations uli_ops = {
94 .port_disable = ata_port_disable, 94 .port_disable = ata_port_disable,
95 95
96 .tf_load = ata_tf_load, 96 .tf_load = ata_tf_load,
diff --git a/drivers/scsi/sata_via.c b/drivers/scsi/sata_via.c
index 565872479b9..80e291a909a 100644
--- a/drivers/scsi/sata_via.c
+++ b/drivers/scsi/sata_via.c
@@ -109,7 +109,7 @@ static Scsi_Host_Template svia_sht = {
109 .ordered_flush = 1, 109 .ordered_flush = 1,
110}; 110};
111 111
112static struct ata_port_operations svia_sata_ops = { 112static const struct ata_port_operations svia_sata_ops = {
113 .port_disable = ata_port_disable, 113 .port_disable = ata_port_disable,
114 114
115 .tf_load = ata_tf_load, 115 .tf_load = ata_tf_load,
diff --git a/drivers/scsi/sata_vsc.c b/drivers/scsi/sata_vsc.c
index cf94e0158a8..5af05fdf854 100644
--- a/drivers/scsi/sata_vsc.c
+++ b/drivers/scsi/sata_vsc.c
@@ -86,7 +86,7 @@ static u32 vsc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg)
86{ 86{
87 if (sc_reg > SCR_CONTROL) 87 if (sc_reg > SCR_CONTROL)
88 return 0xffffffffU; 88 return 0xffffffffU;
89 return readl((void *) ap->ioaddr.scr_addr + (sc_reg * 4)); 89 return readl((void __iomem *) ap->ioaddr.scr_addr + (sc_reg * 4));
90} 90}
91 91
92 92
@@ -95,16 +95,16 @@ static void vsc_sata_scr_write (struct ata_port *ap, unsigned int sc_reg,
95{ 95{
96 if (sc_reg > SCR_CONTROL) 96 if (sc_reg > SCR_CONTROL)
97 return; 97 return;
98 writel(val, (void *) ap->ioaddr.scr_addr + (sc_reg * 4)); 98 writel(val, (void __iomem *) ap->ioaddr.scr_addr + (sc_reg * 4));
99} 99}
100 100
101 101
102static void vsc_intr_mask_update(struct ata_port *ap, u8 ctl) 102static void vsc_intr_mask_update(struct ata_port *ap, u8 ctl)
103{ 103{
104 unsigned long mask_addr; 104 void __iomem *mask_addr;
105 u8 mask; 105 u8 mask;
106 106
107 mask_addr = (unsigned long) ap->host_set->mmio_base + 107 mask_addr = ap->host_set->mmio_base +
108 VSC_SATA_INT_MASK_OFFSET + ap->port_no; 108 VSC_SATA_INT_MASK_OFFSET + ap->port_no;
109 mask = readb(mask_addr); 109 mask = readb(mask_addr);
110 if (ctl & ATA_NIEN) 110 if (ctl & ATA_NIEN)
@@ -115,7 +115,7 @@ static void vsc_intr_mask_update(struct ata_port *ap, u8 ctl)
115} 115}
116 116
117 117
118static void vsc_sata_tf_load(struct ata_port *ap, struct ata_taskfile *tf) 118static void vsc_sata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf)
119{ 119{
120 struct ata_ioports *ioaddr = &ap->ioaddr; 120 struct ata_ioports *ioaddr = &ap->ioaddr;
121 unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; 121 unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR;
@@ -231,7 +231,7 @@ static Scsi_Host_Template vsc_sata_sht = {
231}; 231};
232 232
233 233
234static struct ata_port_operations vsc_sata_ops = { 234static const struct ata_port_operations vsc_sata_ops = {
235 .port_disable = ata_port_disable, 235 .port_disable = ata_port_disable,
236 .tf_load = vsc_sata_tf_load, 236 .tf_load = vsc_sata_tf_load,
237 .tf_read = vsc_sata_tf_read, 237 .tf_read = vsc_sata_tf_read,
@@ -283,7 +283,7 @@ static int __devinit vsc_sata_init_one (struct pci_dev *pdev, const struct pci_d
283 struct ata_probe_ent *probe_ent = NULL; 283 struct ata_probe_ent *probe_ent = NULL;
284 unsigned long base; 284 unsigned long base;
285 int pci_dev_busy = 0; 285 int pci_dev_busy = 0;
286 void *mmio_base; 286 void __iomem *mmio_base;
287 int rc; 287 int rc;
288 288
289 if (!printed_version++) 289 if (!printed_version++)
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 1f0ebabf6d4..a5711d545d7 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -130,7 +130,7 @@ EXPORT_SYMBOL(scsi_device_types);
130 * Returns: Pointer to request block. 130 * Returns: Pointer to request block.
131 */ 131 */
132struct scsi_request *scsi_allocate_request(struct scsi_device *sdev, 132struct scsi_request *scsi_allocate_request(struct scsi_device *sdev,
133 int gfp_mask) 133 gfp_t gfp_mask)
134{ 134{
135 const int offset = ALIGN(sizeof(struct scsi_request), 4); 135 const int offset = ALIGN(sizeof(struct scsi_request), 4);
136 const int size = offset + sizeof(struct request); 136 const int size = offset + sizeof(struct request);
@@ -196,7 +196,7 @@ struct scsi_host_cmd_pool {
196 unsigned int users; 196 unsigned int users;
197 char *name; 197 char *name;
198 unsigned int slab_flags; 198 unsigned int slab_flags;
199 unsigned int gfp_mask; 199 gfp_t gfp_mask;
200}; 200};
201 201
202static struct scsi_host_cmd_pool scsi_cmd_pool = { 202static struct scsi_host_cmd_pool scsi_cmd_pool = {
@@ -213,7 +213,7 @@ static struct scsi_host_cmd_pool scsi_cmd_dma_pool = {
213static DECLARE_MUTEX(host_cmd_pool_mutex); 213static DECLARE_MUTEX(host_cmd_pool_mutex);
214 214
215static struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *shost, 215static struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *shost,
216 int gfp_mask) 216 gfp_t gfp_mask)
217{ 217{
218 struct scsi_cmnd *cmd; 218 struct scsi_cmnd *cmd;
219 219
@@ -245,7 +245,7 @@ static struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *shost,
245 * 245 *
246 * Returns: The allocated scsi command structure. 246 * Returns: The allocated scsi command structure.
247 */ 247 */
248struct scsi_cmnd *scsi_get_command(struct scsi_device *dev, int gfp_mask) 248struct scsi_cmnd *scsi_get_command(struct scsi_device *dev, gfp_t gfp_mask)
249{ 249{
250 struct scsi_cmnd *cmd; 250 struct scsi_cmnd *cmd;
251 251
diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
index 64fc9e21f35..e69477d1889 100644
--- a/drivers/scsi/scsi_devinfo.c
+++ b/drivers/scsi/scsi_devinfo.c
@@ -185,6 +185,7 @@ static struct {
185 {"PIONEER", "CD-ROM DRM-600", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, 185 {"PIONEER", "CD-ROM DRM-600", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
186 {"PIONEER", "CD-ROM DRM-602X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, 186 {"PIONEER", "CD-ROM DRM-602X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
187 {"PIONEER", "CD-ROM DRM-604X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, 187 {"PIONEER", "CD-ROM DRM-604X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
188 {"PIONEER", "CD-ROM DRM-624X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
188 {"REGAL", "CDC-4X", NULL, BLIST_MAX5LUN | BLIST_SINGLELUN}, 189 {"REGAL", "CDC-4X", NULL, BLIST_MAX5LUN | BLIST_SINGLELUN},
189 {"SanDisk", "ImageMate CF-SD1", NULL, BLIST_FORCELUN}, 190 {"SanDisk", "ImageMate CF-SD1", NULL, BLIST_FORCELUN},
190 {"SEAGATE", "ST34555N", "0930", BLIST_NOTQ}, /* Chokes on tagged INQUIRY */ 191 {"SEAGATE", "ST34555N", "0930", BLIST_NOTQ}, /* Chokes on tagged INQUIRY */
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index ad534216507..52b348c36d5 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -1645,6 +1645,8 @@ int scsi_error_handler(void *data)
1645 set_current_state(TASK_INTERRUPTIBLE); 1645 set_current_state(TASK_INTERRUPTIBLE);
1646 } 1646 }
1647 1647
1648 __set_current_state(TASK_RUNNING);
1649
1648 SCSI_LOG_ERROR_RECOVERY(1, printk("Error handler scsi_eh_%d" 1650 SCSI_LOG_ERROR_RECOVERY(1, printk("Error handler scsi_eh_%d"
1649 " exiting\n",shost->host_no)); 1651 " exiting\n",shost->host_no));
1650 1652
diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c
index de7f98cc38f..6a3f6aae8a9 100644
--- a/drivers/scsi/scsi_ioctl.c
+++ b/drivers/scsi/scsi_ioctl.c
@@ -205,7 +205,8 @@ int scsi_ioctl_send_command(struct scsi_device *sdev,
205 unsigned int inlen, outlen, cmdlen; 205 unsigned int inlen, outlen, cmdlen;
206 unsigned int needed, buf_needed; 206 unsigned int needed, buf_needed;
207 int timeout, retries, result; 207 int timeout, retries, result;
208 int data_direction, gfp_mask = GFP_KERNEL; 208 int data_direction;
209 gfp_t gfp_mask = GFP_KERNEL;
209 210
210 if (!sic) 211 if (!sic)
211 return -EINVAL; 212 return -EINVAL;
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index dc9c772bc87..3ff53880978 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -97,7 +97,6 @@ int scsi_insert_special_req(struct scsi_request *sreq, int at_head)
97} 97}
98 98
99static void scsi_run_queue(struct request_queue *q); 99static void scsi_run_queue(struct request_queue *q);
100static void scsi_release_buffers(struct scsi_cmnd *cmd);
101 100
102/* 101/*
103 * Function: scsi_unprep_request() 102 * Function: scsi_unprep_request()
@@ -678,7 +677,7 @@ static struct scsi_cmnd *scsi_end_request(struct scsi_cmnd *cmd, int uptodate,
678 return NULL; 677 return NULL;
679} 678}
680 679
681static struct scatterlist *scsi_alloc_sgtable(struct scsi_cmnd *cmd, int gfp_mask) 680static struct scatterlist *scsi_alloc_sgtable(struct scsi_cmnd *cmd, gfp_t gfp_mask)
682{ 681{
683 struct scsi_host_sg_pool *sgp; 682 struct scsi_host_sg_pool *sgp;
684 struct scatterlist *sgl; 683 struct scatterlist *sgl;
@@ -1040,8 +1039,10 @@ static int scsi_init_io(struct scsi_cmnd *cmd)
1040 * if sg table allocation fails, requeue request later. 1039 * if sg table allocation fails, requeue request later.
1041 */ 1040 */
1042 sgpnt = scsi_alloc_sgtable(cmd, GFP_ATOMIC); 1041 sgpnt = scsi_alloc_sgtable(cmd, GFP_ATOMIC);
1043 if (unlikely(!sgpnt)) 1042 if (unlikely(!sgpnt)) {
1043 scsi_unprep_request(req);
1044 return BLKPREP_DEFER; 1044 return BLKPREP_DEFER;
1045 }
1045 1046
1046 cmd->request_buffer = (char *) sgpnt; 1047 cmd->request_buffer = (char *) sgpnt;
1047 cmd->request_bufflen = req->nr_sectors << 9; 1048 cmd->request_bufflen = req->nr_sectors << 9;
@@ -1245,8 +1246,8 @@ static int scsi_prep_fn(struct request_queue *q, struct request *req)
1245 */ 1246 */
1246 ret = scsi_init_io(cmd); 1247 ret = scsi_init_io(cmd);
1247 switch(ret) { 1248 switch(ret) {
1249 /* For BLKPREP_KILL/DEFER the cmd was released */
1248 case BLKPREP_KILL: 1250 case BLKPREP_KILL:
1249 /* BLKPREP_KILL return also releases the command */
1250 goto kill; 1251 goto kill;
1251 case BLKPREP_DEFER: 1252 case BLKPREP_DEFER:
1252 goto defer; 1253 goto defer;
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 2cab556b6e8..771e97ef136 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -819,12 +819,15 @@ show_fc_private_host_tgtid_bind_type(struct class_device *cdev, char *buf)
819 return snprintf(buf, FC_BINDTYPE_MAX_NAMELEN, "%s\n", name); 819 return snprintf(buf, FC_BINDTYPE_MAX_NAMELEN, "%s\n", name);
820} 820}
821 821
822#define get_list_head_entry(pos, head, member) \
823 pos = list_entry((head)->next, typeof(*pos), member)
824
822static ssize_t 825static ssize_t
823store_fc_private_host_tgtid_bind_type(struct class_device *cdev, 826store_fc_private_host_tgtid_bind_type(struct class_device *cdev,
824 const char *buf, size_t count) 827 const char *buf, size_t count)
825{ 828{
826 struct Scsi_Host *shost = transport_class_to_shost(cdev); 829 struct Scsi_Host *shost = transport_class_to_shost(cdev);
827 struct fc_rport *rport, *next_rport; 830 struct fc_rport *rport;
828 enum fc_tgtid_binding_type val; 831 enum fc_tgtid_binding_type val;
829 unsigned long flags; 832 unsigned long flags;
830 833
@@ -834,9 +837,13 @@ store_fc_private_host_tgtid_bind_type(struct class_device *cdev,
834 /* if changing bind type, purge all unused consistent bindings */ 837 /* if changing bind type, purge all unused consistent bindings */
835 if (val != fc_host_tgtid_bind_type(shost)) { 838 if (val != fc_host_tgtid_bind_type(shost)) {
836 spin_lock_irqsave(shost->host_lock, flags); 839 spin_lock_irqsave(shost->host_lock, flags);
837 list_for_each_entry_safe(rport, next_rport, 840 while (!list_empty(&fc_host_rport_bindings(shost))) {
838 &fc_host_rport_bindings(shost), peers) 841 get_list_head_entry(rport,
842 &fc_host_rport_bindings(shost), peers);
843 spin_unlock_irqrestore(shost->host_lock, flags);
839 fc_rport_terminate(rport); 844 fc_rport_terminate(rport);
845 spin_lock_irqsave(shost->host_lock, flags);
846 }
840 spin_unlock_irqrestore(shost->host_lock, flags); 847 spin_unlock_irqrestore(shost->host_lock, flags);
841 } 848 }
842 849
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index ad94367df43..fd56b7ec88b 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -2644,7 +2644,7 @@ static char *
2644sg_page_malloc(int rqSz, int lowDma, int *retSzp) 2644sg_page_malloc(int rqSz, int lowDma, int *retSzp)
2645{ 2645{
2646 char *resp = NULL; 2646 char *resp = NULL;
2647 int page_mask; 2647 gfp_t page_mask;
2648 int order, a_size; 2648 int order, a_size;
2649 int resSz = rqSz; 2649 int resSz = rqSz;
2650 2650
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index d001c046551..927d700f007 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -3577,7 +3577,8 @@ static long st_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a
3577static struct st_buffer * 3577static struct st_buffer *
3578 new_tape_buffer(int from_initialization, int need_dma, int max_sg) 3578 new_tape_buffer(int from_initialization, int need_dma, int max_sg)
3579{ 3579{
3580 int i, priority, got = 0, segs = 0; 3580 int i, got = 0, segs = 0;
3581 gfp_t priority;
3581 struct st_buffer *tb; 3582 struct st_buffer *tb;
3582 3583
3583 if (from_initialization) 3584 if (from_initialization)
@@ -3610,7 +3611,8 @@ static struct st_buffer *
3610/* Try to allocate enough space in the tape buffer */ 3611/* Try to allocate enough space in the tape buffer */
3611static int enlarge_buffer(struct st_buffer * STbuffer, int new_size, int need_dma) 3612static int enlarge_buffer(struct st_buffer * STbuffer, int new_size, int need_dma)
3612{ 3613{
3613 int segs, nbr, max_segs, b_size, priority, order, got; 3614 int segs, nbr, max_segs, b_size, order, got;
3615 gfp_t priority;
3614 3616
3615 if (new_size <= STbuffer->buffer_size) 3617 if (new_size <= STbuffer->buffer_size)
3616 return 1; 3618 return 1;