aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/ahci.c3
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.c2
-rw-r--r--drivers/scsi/ata_piix.c18
-rw-r--r--drivers/scsi/libata-core.c485
-rw-r--r--drivers/scsi/libata-scsi.c2
-rw-r--r--drivers/scsi/libata.h2
-rw-r--r--drivers/scsi/sata_nv.c2
-rw-r--r--drivers/scsi/sata_promise.c1
-rw-r--r--drivers/scsi/sata_qstor.c2
-rw-r--r--drivers/scsi/sata_sil.c1
-rw-r--r--drivers/scsi/sata_sis.c1
-rw-r--r--drivers/scsi/sata_svw.c1
-rw-r--r--drivers/scsi/sata_sx4.c2
-rw-r--r--drivers/scsi/sata_uli.c1
-rw-r--r--drivers/scsi/sata_via.c1
-rw-r--r--drivers/scsi/sata_vsc.c2
16 files changed, 460 insertions, 66 deletions
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
index da5bd33d982d..fc5263c6b102 100644
--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -32,6 +32,7 @@
32#include <linux/delay.h> 32#include <linux/delay.h>
33#include <linux/interrupt.h> 33#include <linux/interrupt.h>
34#include <linux/sched.h> 34#include <linux/sched.h>
35#include <linux/dma-mapping.h>
35#include "scsi.h" 36#include "scsi.h"
36#include <scsi/scsi_host.h> 37#include <scsi/scsi_host.h>
37#include <linux/libata.h> 38#include <linux/libata.h>
@@ -289,6 +290,8 @@ static void ahci_host_stop(struct ata_host_set *host_set)
289{ 290{
290 struct ahci_host_priv *hpriv = host_set->private_data; 291 struct ahci_host_priv *hpriv = host_set->private_data;
291 kfree(hpriv); 292 kfree(hpriv);
293
294 ata_host_stop(host_set);
292} 295}
293 296
294static int ahci_port_start(struct ata_port *ap) 297static int ahci_port_start(struct ata_port *ap)
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index 550c9921691a..7c02b7dc7098 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -2488,7 +2488,7 @@ ahd_linux_dv_thread(void *data)
2488 sprintf(current->comm, "ahd_dv_%d", ahd->unit); 2488 sprintf(current->comm, "ahd_dv_%d", ahd->unit);
2489#else 2489#else
2490 daemonize("ahd_dv_%d", ahd->unit); 2490 daemonize("ahd_dv_%d", ahd->unit);
2491 current->flags |= PF_FREEZE; 2491 current->flags |= PF_NOFREEZE;
2492#endif 2492#endif
2493 unlock_kernel(); 2493 unlock_kernel();
2494 2494
diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c
index 3867f91ef8c7..3be546439252 100644
--- a/drivers/scsi/ata_piix.c
+++ b/drivers/scsi/ata_piix.c
@@ -153,6 +153,7 @@ static struct ata_port_operations piix_pata_ops = {
153 153
154 .port_start = ata_port_start, 154 .port_start = ata_port_start,
155 .port_stop = ata_port_stop, 155 .port_stop = ata_port_stop,
156 .host_stop = ata_host_stop,
156}; 157};
157 158
158static struct ata_port_operations piix_sata_ops = { 159static struct ata_port_operations piix_sata_ops = {
@@ -180,6 +181,7 @@ static struct ata_port_operations piix_sata_ops = {
180 181
181 .port_start = ata_port_start, 182 .port_start = ata_port_start,
182 .port_stop = ata_port_stop, 183 .port_stop = ata_port_stop,
184 .host_stop = ata_host_stop,
183}; 185};
184 186
185static struct ata_port_info piix_port_info[] = { 187static struct ata_port_info piix_port_info[] = {
@@ -663,15 +665,6 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
663 return ata_pci_init_one(pdev, port_info, n_ports); 665 return ata_pci_init_one(pdev, port_info, n_ports);
664} 666}
665 667
666/**
667 * piix_init -
668 *
669 * LOCKING:
670 *
671 * RETURNS:
672 *
673 */
674
675static int __init piix_init(void) 668static int __init piix_init(void)
676{ 669{
677 int rc; 670 int rc;
@@ -687,13 +680,6 @@ static int __init piix_init(void)
687 return 0; 680 return 0;
688} 681}
689 682
690/**
691 * piix_exit -
692 *
693 * LOCKING:
694 *
695 */
696
697static void __exit piix_exit(void) 683static void __exit piix_exit(void)
698{ 684{
699 pci_unregister_driver(&piix_pci_driver); 685 pci_unregister_driver(&piix_pci_driver);
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 63d3f70d06e1..21d194c6ace3 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -186,6 +186,28 @@ static void ata_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf)
186 ata_wait_idle(ap); 186 ata_wait_idle(ap);
187} 187}
188 188
189
190/**
191 * ata_tf_load - send taskfile registers to host controller
192 * @ap: Port to which output is sent
193 * @tf: ATA taskfile register set
194 *
195 * Outputs ATA taskfile to standard ATA host controller using MMIO
196 * or PIO as indicated by the ATA_FLAG_MMIO flag.
197 * Writes the control, feature, nsect, lbal, lbam, and lbah registers.
198 * Optionally (ATA_TFLAG_LBA48) writes hob_feature, hob_nsect,
199 * hob_lbal, hob_lbam, and hob_lbah.
200 *
201 * This function waits for idle (!BUSY and !DRQ) after writing
202 * registers. If the control register has a new value, this
203 * function also waits for idle after writing control and before
204 * writing the remaining registers.
205 *
206 * May be used as the tf_load() entry in ata_port_operations.
207 *
208 * LOCKING:
209 * Inherited from caller.
210 */
189void ata_tf_load(struct ata_port *ap, struct ata_taskfile *tf) 211void ata_tf_load(struct ata_port *ap, struct ata_taskfile *tf)
190{ 212{
191 if (ap->flags & ATA_FLAG_MMIO) 213 if (ap->flags & ATA_FLAG_MMIO)
@@ -195,11 +217,11 @@ void ata_tf_load(struct ata_port *ap, struct ata_taskfile *tf)
195} 217}
196 218
197/** 219/**
198 * ata_exec_command - issue ATA command to host controller 220 * ata_exec_command_pio - issue ATA command to host controller
199 * @ap: port to which command is being issued 221 * @ap: port to which command is being issued
200 * @tf: ATA taskfile register set 222 * @tf: ATA taskfile register set
201 * 223 *
202 * Issues PIO/MMIO write to ATA command register, with proper 224 * Issues PIO write to ATA command register, with proper
203 * synchronization with interrupt handler / other threads. 225 * synchronization with interrupt handler / other threads.
204 * 226 *
205 * LOCKING: 227 * LOCKING:
@@ -235,6 +257,18 @@ static void ata_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf)
235 ata_pause(ap); 257 ata_pause(ap);
236} 258}
237 259
260
261/**
262 * ata_exec_command - issue ATA command to host controller
263 * @ap: port to which command is being issued
264 * @tf: ATA taskfile register set
265 *
266 * Issues PIO/MMIO write to ATA command register, with proper
267 * synchronization with interrupt handler / other threads.
268 *
269 * LOCKING:
270 * spin_lock_irqsave(host_set lock)
271 */
238void ata_exec_command(struct ata_port *ap, struct ata_taskfile *tf) 272void ata_exec_command(struct ata_port *ap, struct ata_taskfile *tf)
239{ 273{
240 if (ap->flags & ATA_FLAG_MMIO) 274 if (ap->flags & ATA_FLAG_MMIO)
@@ -305,7 +339,7 @@ void ata_tf_to_host_nolock(struct ata_port *ap, struct ata_taskfile *tf)
305} 339}
306 340
307/** 341/**
308 * ata_tf_read - input device's ATA taskfile shadow registers 342 * ata_tf_read_pio - input device's ATA taskfile shadow registers
309 * @ap: Port from which input is read 343 * @ap: Port from which input is read
310 * @tf: ATA taskfile register set for storing input 344 * @tf: ATA taskfile register set for storing input
311 * 345 *
@@ -368,6 +402,23 @@ static void ata_tf_read_mmio(struct ata_port *ap, struct ata_taskfile *tf)
368 } 402 }
369} 403}
370 404
405
406/**
407 * ata_tf_read - input device's ATA taskfile shadow registers
408 * @ap: Port from which input is read
409 * @tf: ATA taskfile register set for storing input
410 *
411 * Reads ATA taskfile registers for currently-selected device
412 * into @tf.
413 *
414 * Reads nsect, lbal, lbam, lbah, and device. If ATA_TFLAG_LBA48
415 * is set, also reads the hob registers.
416 *
417 * May be used as the tf_read() entry in ata_port_operations.
418 *
419 * LOCKING:
420 * Inherited from caller.
421 */
371void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf) 422void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
372{ 423{
373 if (ap->flags & ATA_FLAG_MMIO) 424 if (ap->flags & ATA_FLAG_MMIO)
@@ -381,7 +432,7 @@ void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
381 * @ap: port where the device is 432 * @ap: port where the device is
382 * 433 *
383 * Reads ATA taskfile status register for currently-selected device 434 * Reads ATA taskfile status register for currently-selected device
384 * and return it's value. This also clears pending interrupts 435 * and return its value. This also clears pending interrupts
385 * from this device 436 * from this device
386 * 437 *
387 * LOCKING: 438 * LOCKING:
@@ -397,7 +448,7 @@ static u8 ata_check_status_pio(struct ata_port *ap)
397 * @ap: port where the device is 448 * @ap: port where the device is
398 * 449 *
399 * Reads ATA taskfile status register for currently-selected device 450 * Reads ATA taskfile status register for currently-selected device
400 * via MMIO and return it's value. This also clears pending interrupts 451 * via MMIO and return its value. This also clears pending interrupts
401 * from this device 452 * from this device
402 * 453 *
403 * LOCKING: 454 * LOCKING:
@@ -408,6 +459,20 @@ static u8 ata_check_status_mmio(struct ata_port *ap)
408 return readb((void __iomem *) ap->ioaddr.status_addr); 459 return readb((void __iomem *) ap->ioaddr.status_addr);
409} 460}
410 461
462
463/**
464 * ata_check_status - Read device status reg & clear interrupt
465 * @ap: port where the device is
466 *
467 * Reads ATA taskfile status register for currently-selected device
468 * and return its value. This also clears pending interrupts
469 * from this device
470 *
471 * May be used as the check_status() entry in ata_port_operations.
472 *
473 * LOCKING:
474 * Inherited from caller.
475 */
411u8 ata_check_status(struct ata_port *ap) 476u8 ata_check_status(struct ata_port *ap)
412{ 477{
413 if (ap->flags & ATA_FLAG_MMIO) 478 if (ap->flags & ATA_FLAG_MMIO)
@@ -415,6 +480,20 @@ u8 ata_check_status(struct ata_port *ap)
415 return ata_check_status_pio(ap); 480 return ata_check_status_pio(ap);
416} 481}
417 482
483
484/**
485 * ata_altstatus - Read device alternate status reg
486 * @ap: port where the device is
487 *
488 * Reads ATA taskfile alternate status register for
489 * currently-selected device and return its value.
490 *
491 * Note: may NOT be used as the check_altstatus() entry in
492 * ata_port_operations.
493 *
494 * LOCKING:
495 * Inherited from caller.
496 */
418u8 ata_altstatus(struct ata_port *ap) 497u8 ata_altstatus(struct ata_port *ap)
419{ 498{
420 if (ap->ops->check_altstatus) 499 if (ap->ops->check_altstatus)
@@ -425,6 +504,20 @@ u8 ata_altstatus(struct ata_port *ap)
425 return inb(ap->ioaddr.altstatus_addr); 504 return inb(ap->ioaddr.altstatus_addr);
426} 505}
427 506
507
508/**
509 * ata_chk_err - Read device error reg
510 * @ap: port where the device is
511 *
512 * Reads ATA taskfile error register for
513 * currently-selected device and return its value.
514 *
515 * Note: may NOT be used as the check_err() entry in
516 * ata_port_operations.
517 *
518 * LOCKING:
519 * Inherited from caller.
520 */
428u8 ata_chk_err(struct ata_port *ap) 521u8 ata_chk_err(struct ata_port *ap)
429{ 522{
430 if (ap->ops->check_err) 523 if (ap->ops->check_err)
@@ -873,10 +966,24 @@ void ata_dev_id_string(u16 *id, unsigned char *s,
873 } 966 }
874} 967}
875 968
969
970/**
971 * ata_noop_dev_select - Select device 0/1 on ATA bus
972 * @ap: ATA channel to manipulate
973 * @device: ATA device (numbered from zero) to select
974 *
975 * This function performs no actual function.
976 *
977 * May be used as the dev_select() entry in ata_port_operations.
978 *
979 * LOCKING:
980 * caller.
981 */
876void ata_noop_dev_select (struct ata_port *ap, unsigned int device) 982void ata_noop_dev_select (struct ata_port *ap, unsigned int device)
877{ 983{
878} 984}
879 985
986
880/** 987/**
881 * ata_std_dev_select - Select device 0/1 on ATA bus 988 * ata_std_dev_select - Select device 0/1 on ATA bus
882 * @ap: ATA channel to manipulate 989 * @ap: ATA channel to manipulate
@@ -884,7 +991,9 @@ void ata_noop_dev_select (struct ata_port *ap, unsigned int device)
884 * 991 *
885 * Use the method defined in the ATA specification to 992 * Use the method defined in the ATA specification to
886 * make either device 0, or device 1, active on the 993 * make either device 0, or device 1, active on the
887 * ATA channel. 994 * ATA channel. Works with both PIO and MMIO.
995 *
996 * May be used as the dev_select() entry in ata_port_operations.
888 * 997 *
889 * LOCKING: 998 * LOCKING:
890 * caller. 999 * caller.
@@ -1190,7 +1299,12 @@ err_out:
1190 * ata_bus_probe - Reset and probe ATA bus 1299 * ata_bus_probe - Reset and probe ATA bus
1191 * @ap: Bus to probe 1300 * @ap: Bus to probe
1192 * 1301 *
1302 * Master ATA bus probing function. Initiates a hardware-dependent
1303 * bus reset, then attempts to identify any devices found on
1304 * the bus.
1305 *
1193 * LOCKING: 1306 * LOCKING:
1307 * PCI/etc. bus probe sem.
1194 * 1308 *
1195 * RETURNS: 1309 * RETURNS:
1196 * Zero on success, non-zero on error. 1310 * Zero on success, non-zero on error.
@@ -1229,10 +1343,14 @@ err_out:
1229} 1343}
1230 1344
1231/** 1345/**
1232 * ata_port_probe - 1346 * ata_port_probe - Mark port as enabled
1233 * @ap: 1347 * @ap: Port for which we indicate enablement
1234 * 1348 *
1235 * LOCKING: 1349 * Modify @ap data structure such that the system
1350 * thinks that the entire port is enabled.
1351 *
1352 * LOCKING: host_set lock, or some other form of
1353 * serialization.
1236 */ 1354 */
1237 1355
1238void ata_port_probe(struct ata_port *ap) 1356void ata_port_probe(struct ata_port *ap)
@@ -1241,10 +1359,15 @@ void ata_port_probe(struct ata_port *ap)
1241} 1359}
1242 1360
1243/** 1361/**
1244 * __sata_phy_reset - 1362 * __sata_phy_reset - Wake/reset a low-level SATA PHY
1245 * @ap: 1363 * @ap: SATA port associated with target SATA PHY.
1364 *
1365 * This function issues commands to standard SATA Sxxx
1366 * PHY registers, to wake up the phy (and device), and
1367 * clear any reset condition.
1246 * 1368 *
1247 * LOCKING: 1369 * LOCKING:
1370 * PCI/etc. bus probe sem.
1248 * 1371 *
1249 */ 1372 */
1250void __sata_phy_reset(struct ata_port *ap) 1373void __sata_phy_reset(struct ata_port *ap)
@@ -1289,10 +1412,14 @@ void __sata_phy_reset(struct ata_port *ap)
1289} 1412}
1290 1413
1291/** 1414/**
1292 * __sata_phy_reset - 1415 * sata_phy_reset - Reset SATA bus.
1293 * @ap: 1416 * @ap: SATA port associated with target SATA PHY.
1417 *
1418 * This function resets the SATA bus, and then probes
1419 * the bus for devices.
1294 * 1420 *
1295 * LOCKING: 1421 * LOCKING:
1422 * PCI/etc. bus probe sem.
1296 * 1423 *
1297 */ 1424 */
1298void sata_phy_reset(struct ata_port *ap) 1425void sata_phy_reset(struct ata_port *ap)
@@ -1304,10 +1431,16 @@ void sata_phy_reset(struct ata_port *ap)
1304} 1431}
1305 1432
1306/** 1433/**
1307 * ata_port_disable - 1434 * ata_port_disable - Disable port.
1308 * @ap: 1435 * @ap: Port to be disabled.
1309 * 1436 *
1310 * LOCKING: 1437 * Modify @ap data structure such that the system
1438 * thinks that the entire port is disabled, and should
1439 * never attempt to probe or communicate with devices
1440 * on this port.
1441 *
1442 * LOCKING: host_set lock, or some other form of
1443 * serialization.
1311 */ 1444 */
1312 1445
1313void ata_port_disable(struct ata_port *ap) 1446void ata_port_disable(struct ata_port *ap)
@@ -1416,7 +1549,10 @@ static void ata_host_set_dma(struct ata_port *ap, u8 xfer_mode,
1416 * ata_set_mode - Program timings and issue SET FEATURES - XFER 1549 * ata_set_mode - Program timings and issue SET FEATURES - XFER
1417 * @ap: port on which timings will be programmed 1550 * @ap: port on which timings will be programmed
1418 * 1551 *
1552 * Set ATA device disk transfer mode (PIO3, UDMA6, etc.).
1553 *
1419 * LOCKING: 1554 * LOCKING:
1555 * PCI/etc. bus probe sem.
1420 * 1556 *
1421 */ 1557 */
1422static void ata_set_mode(struct ata_port *ap) 1558static void ata_set_mode(struct ata_port *ap)
@@ -1467,7 +1603,10 @@ err_out:
1467 * @tmout_pat: impatience timeout 1603 * @tmout_pat: impatience timeout
1468 * @tmout: overall timeout 1604 * @tmout: overall timeout
1469 * 1605 *
1470 * LOCKING: 1606 * Sleep until ATA Status register bit BSY clears,
1607 * or a timeout occurs.
1608 *
1609 * LOCKING: None.
1471 * 1610 *
1472 */ 1611 */
1473 1612
@@ -1553,10 +1692,14 @@ static void ata_bus_post_reset(struct ata_port *ap, unsigned int devmask)
1553} 1692}
1554 1693
1555/** 1694/**
1556 * ata_bus_edd - 1695 * ata_bus_edd - Issue EXECUTE DEVICE DIAGNOSTIC command.
1557 * @ap: 1696 * @ap: Port to reset and probe
1697 *
1698 * Use the EXECUTE DEVICE DIAGNOSTIC command to reset and
1699 * probe the bus. Not often used these days.
1558 * 1700 *
1559 * LOCKING: 1701 * LOCKING:
1702 * PCI/etc. bus probe sem.
1560 * 1703 *
1561 */ 1704 */
1562 1705
@@ -1633,8 +1776,8 @@ static unsigned int ata_bus_softreset(struct ata_port *ap,
1633 * the device is ATA or ATAPI. 1776 * the device is ATA or ATAPI.
1634 * 1777 *
1635 * LOCKING: 1778 * LOCKING:
1636 * Inherited from caller. Some functions called by this function 1779 * PCI/etc. bus probe sem.
1637 * obtain the host_set lock. 1780 * Obtains host_set lock.
1638 * 1781 *
1639 * SIDE EFFECTS: 1782 * SIDE EFFECTS:
1640 * Sets ATA_FLAG_PORT_DISABLED if bus reset fails. 1783 * Sets ATA_FLAG_PORT_DISABLED if bus reset fails.
@@ -1876,7 +2019,11 @@ static int fgb(u32 bitmap)
1876 * @xfer_mode_out: (output) SET FEATURES - XFER MODE code 2019 * @xfer_mode_out: (output) SET FEATURES - XFER MODE code
1877 * @xfer_shift_out: (output) bit shift that selects this mode 2020 * @xfer_shift_out: (output) bit shift that selects this mode
1878 * 2021 *
2022 * Based on host and device capabilities, determine the
2023 * maximum transfer mode that is amenable to all.
2024 *
1879 * LOCKING: 2025 * LOCKING:
2026 * PCI/etc. bus probe sem.
1880 * 2027 *
1881 * RETURNS: 2028 * RETURNS:
1882 * Zero on success, negative on error. 2029 * Zero on success, negative on error.
@@ -1909,7 +2056,11 @@ static int ata_choose_xfer_mode(struct ata_port *ap,
1909 * @ap: Port associated with device @dev 2056 * @ap: Port associated with device @dev
1910 * @dev: Device to which command will be sent 2057 * @dev: Device to which command will be sent
1911 * 2058 *
2059 * Issue SET FEATURES - XFER MODE command to device @dev
2060 * on port @ap.
2061 *
1912 * LOCKING: 2062 * LOCKING:
2063 * PCI/etc. bus probe sem.
1913 */ 2064 */
1914 2065
1915static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev) 2066static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev)
@@ -1947,10 +2098,13 @@ static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev)
1947} 2098}
1948 2099
1949/** 2100/**
1950 * ata_sg_clean - 2101 * ata_sg_clean - Unmap DMA memory associated with command
1951 * @qc: 2102 * @qc: Command containing DMA memory to be released
2103 *
2104 * Unmap all mapped DMA memory associated with this command.
1952 * 2105 *
1953 * LOCKING: 2106 * LOCKING:
2107 * spin_lock_irqsave(host_set lock)
1954 */ 2108 */
1955 2109
1956static void ata_sg_clean(struct ata_queued_cmd *qc) 2110static void ata_sg_clean(struct ata_queued_cmd *qc)
@@ -1981,7 +2135,11 @@ static void ata_sg_clean(struct ata_queued_cmd *qc)
1981 * ata_fill_sg - Fill PCI IDE PRD table 2135 * ata_fill_sg - Fill PCI IDE PRD table
1982 * @qc: Metadata associated with taskfile to be transferred 2136 * @qc: Metadata associated with taskfile to be transferred
1983 * 2137 *
2138 * Fill PCI IDE PRD (scatter-gather) table with segments
2139 * associated with the current disk command.
2140 *
1984 * LOCKING: 2141 * LOCKING:
2142 * spin_lock_irqsave(host_set lock)
1985 * 2143 *
1986 */ 2144 */
1987static void ata_fill_sg(struct ata_queued_cmd *qc) 2145static void ata_fill_sg(struct ata_queued_cmd *qc)
@@ -2028,7 +2186,13 @@ static void ata_fill_sg(struct ata_queued_cmd *qc)
2028 * ata_check_atapi_dma - Check whether ATAPI DMA can be supported 2186 * ata_check_atapi_dma - Check whether ATAPI DMA can be supported
2029 * @qc: Metadata associated with taskfile to check 2187 * @qc: Metadata associated with taskfile to check
2030 * 2188 *
2189 * Allow low-level driver to filter ATA PACKET commands, returning
2190 * a status indicating whether or not it is OK to use DMA for the
2191 * supplied PACKET command.
2192 *
2031 * LOCKING: 2193 * LOCKING:
2194 * spin_lock_irqsave(host_set lock)
2195 *
2032 * RETURNS: 0 when ATAPI DMA can be used 2196 * RETURNS: 0 when ATAPI DMA can be used
2033 * nonzero otherwise 2197 * nonzero otherwise
2034 */ 2198 */
@@ -2046,6 +2210,8 @@ int ata_check_atapi_dma(struct ata_queued_cmd *qc)
2046 * ata_qc_prep - Prepare taskfile for submission 2210 * ata_qc_prep - Prepare taskfile for submission
2047 * @qc: Metadata associated with taskfile to be prepared 2211 * @qc: Metadata associated with taskfile to be prepared
2048 * 2212 *
2213 * Prepare ATA taskfile for submission.
2214 *
2049 * LOCKING: 2215 * LOCKING:
2050 * spin_lock_irqsave(host_set lock) 2216 * spin_lock_irqsave(host_set lock)
2051 */ 2217 */
@@ -2057,6 +2223,32 @@ void ata_qc_prep(struct ata_queued_cmd *qc)
2057 ata_fill_sg(qc); 2223 ata_fill_sg(qc);
2058} 2224}
2059 2225
2226/**
2227 * ata_sg_init_one - Associate command with memory buffer
2228 * @qc: Command to be associated
2229 * @buf: Memory buffer
2230 * @buflen: Length of memory buffer, in bytes.
2231 *
2232 * Initialize the data-related elements of queued_cmd @qc
2233 * to point to a single memory buffer, @buf of byte length @buflen.
2234 *
2235 * LOCKING:
2236 * spin_lock_irqsave(host_set lock)
2237 */
2238
2239
2240
2241/**
2242 * ata_sg_init_one - Prepare a one-entry scatter-gather list.
2243 * @qc: Queued command
2244 * @buf: transfer buffer
2245 * @buflen: length of buf
2246 *
2247 * Builds a single-entry scatter-gather list to initiate a
2248 * transfer utilizing the specified buffer.
2249 *
2250 * LOCKING:
2251 */
2060void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf, unsigned int buflen) 2252void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf, unsigned int buflen)
2061{ 2253{
2062 struct scatterlist *sg; 2254 struct scatterlist *sg;
@@ -2074,6 +2266,32 @@ void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf, unsigned int buflen)
2074 sg->length = buflen; 2266 sg->length = buflen;
2075} 2267}
2076 2268
2269/**
2270 * ata_sg_init - Associate command with scatter-gather table.
2271 * @qc: Command to be associated
2272 * @sg: Scatter-gather table.
2273 * @n_elem: Number of elements in s/g table.
2274 *
2275 * Initialize the data-related elements of queued_cmd @qc
2276 * to point to a scatter-gather table @sg, containing @n_elem
2277 * elements.
2278 *
2279 * LOCKING:
2280 * spin_lock_irqsave(host_set lock)
2281 */
2282
2283
2284/**
2285 * ata_sg_init - Assign a scatter gather list to a queued command
2286 * @qc: Queued command
2287 * @sg: Scatter-gather list
2288 * @n_elem: length of sg list
2289 *
2290 * Attaches a scatter-gather list to a queued command.
2291 *
2292 * LOCKING:
2293 */
2294
2077void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, 2295void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
2078 unsigned int n_elem) 2296 unsigned int n_elem)
2079{ 2297{
@@ -2083,14 +2301,16 @@ void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
2083} 2301}
2084 2302
2085/** 2303/**
2086 * ata_sg_setup_one - 2304 * ata_sg_setup_one - DMA-map the memory buffer associated with a command.
2087 * @qc: 2305 * @qc: Command with memory buffer to be mapped.
2306 *
2307 * DMA-map the memory buffer associated with queued_cmd @qc.
2088 * 2308 *
2089 * LOCKING: 2309 * LOCKING:
2090 * spin_lock_irqsave(host_set lock) 2310 * spin_lock_irqsave(host_set lock)
2091 * 2311 *
2092 * RETURNS: 2312 * RETURNS:
2093 * 2313 * Zero on success, negative on error.
2094 */ 2314 */
2095 2315
2096static int ata_sg_setup_one(struct ata_queued_cmd *qc) 2316static int ata_sg_setup_one(struct ata_queued_cmd *qc)
@@ -2115,13 +2335,16 @@ static int ata_sg_setup_one(struct ata_queued_cmd *qc)
2115} 2335}
2116 2336
2117/** 2337/**
2118 * ata_sg_setup - 2338 * ata_sg_setup - DMA-map the scatter-gather table associated with a command.
2119 * @qc: 2339 * @qc: Command with scatter-gather table to be mapped.
2340 *
2341 * DMA-map the scatter-gather table associated with queued_cmd @qc.
2120 * 2342 *
2121 * LOCKING: 2343 * LOCKING:
2122 * spin_lock_irqsave(host_set lock) 2344 * spin_lock_irqsave(host_set lock)
2123 * 2345 *
2124 * RETURNS: 2346 * RETURNS:
2347 * Zero on success, negative on error.
2125 * 2348 *
2126 */ 2349 */
2127 2350
@@ -2151,6 +2374,7 @@ static int ata_sg_setup(struct ata_queued_cmd *qc)
2151 * @ap: 2374 * @ap:
2152 * 2375 *
2153 * LOCKING: 2376 * LOCKING:
2377 * None. (executing in kernel thread context)
2154 * 2378 *
2155 * RETURNS: 2379 * RETURNS:
2156 * 2380 *
@@ -2198,6 +2422,7 @@ static unsigned long ata_pio_poll(struct ata_port *ap)
2198 * @ap: 2422 * @ap:
2199 * 2423 *
2200 * LOCKING: 2424 * LOCKING:
2425 * None. (executing in kernel thread context)
2201 */ 2426 */
2202 2427
2203static void ata_pio_complete (struct ata_port *ap) 2428static void ata_pio_complete (struct ata_port *ap)
@@ -2240,6 +2465,18 @@ static void ata_pio_complete (struct ata_port *ap)
2240 ata_qc_complete(qc, drv_stat); 2465 ata_qc_complete(qc, drv_stat);
2241} 2466}
2242 2467
2468
2469/**
2470 * swap_buf_le16 -
2471 * @buf: Buffer to swap
2472 * @buf_words: Number of 16-bit words in buffer.
2473 *
2474 * Swap halves of 16-bit words if needed to convert from
2475 * little-endian byte order to native cpu byte order, or
2476 * vice-versa.
2477 *
2478 * LOCKING:
2479 */
2243void swap_buf_le16(u16 *buf, unsigned int buf_words) 2480void swap_buf_le16(u16 *buf, unsigned int buf_words)
2244{ 2481{
2245#ifdef __BIG_ENDIAN 2482#ifdef __BIG_ENDIAN
@@ -2415,6 +2652,7 @@ err_out:
2415 * @ap: 2652 * @ap:
2416 * 2653 *
2417 * LOCKING: 2654 * LOCKING:
2655 * None. (executing in kernel thread context)
2418 */ 2656 */
2419 2657
2420static void ata_pio_block(struct ata_port *ap) 2658static void ata_pio_block(struct ata_port *ap)
@@ -2583,6 +2821,7 @@ static void atapi_request_sense(struct ata_port *ap, struct ata_device *dev,
2583 * transaction completed successfully. 2821 * transaction completed successfully.
2584 * 2822 *
2585 * LOCKING: 2823 * LOCKING:
2824 * Inherited from SCSI layer (none, can sleep)
2586 */ 2825 */
2587 2826
2588static void ata_qc_timeout(struct ata_queued_cmd *qc) 2827static void ata_qc_timeout(struct ata_queued_cmd *qc)
@@ -2692,6 +2931,7 @@ out:
2692 * @dev: Device from whom we request an available command structure 2931 * @dev: Device from whom we request an available command structure
2693 * 2932 *
2694 * LOCKING: 2933 * LOCKING:
2934 * None.
2695 */ 2935 */
2696 2936
2697static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap) 2937static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap)
@@ -2717,6 +2957,7 @@ static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap)
2717 * @dev: Device from whom we request an available command structure 2957 * @dev: Device from whom we request an available command structure
2718 * 2958 *
2719 * LOCKING: 2959 * LOCKING:
2960 * None.
2720 */ 2961 */
2721 2962
2722struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, 2963struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap,
@@ -2781,6 +3022,7 @@ static void __ata_qc_complete(struct ata_queued_cmd *qc)
2781 * in case something prevents using it. 3022 * in case something prevents using it.
2782 * 3023 *
2783 * LOCKING: 3024 * LOCKING:
3025 * spin_lock_irqsave(host_set lock)
2784 * 3026 *
2785 */ 3027 */
2786void ata_qc_free(struct ata_queued_cmd *qc) 3028void ata_qc_free(struct ata_queued_cmd *qc)
@@ -2794,9 +3036,13 @@ void ata_qc_free(struct ata_queued_cmd *qc)
2794/** 3036/**
2795 * ata_qc_complete - Complete an active ATA command 3037 * ata_qc_complete - Complete an active ATA command
2796 * @qc: Command to complete 3038 * @qc: Command to complete
2797 * @drv_stat: ATA status register contents 3039 * @drv_stat: ATA Status register contents
3040 *
3041 * Indicate to the mid and upper layers that an ATA
3042 * command has completed, with either an ok or not-ok status.
2798 * 3043 *
2799 * LOCKING: 3044 * LOCKING:
3045 * spin_lock_irqsave(host_set lock)
2800 * 3046 *
2801 */ 3047 */
2802 3048
@@ -2892,6 +3138,7 @@ err_out:
2892 return -1; 3138 return -1;
2893} 3139}
2894 3140
3141
2895/** 3142/**
2896 * ata_qc_issue_prot - issue taskfile to device in proto-dependent manner 3143 * ata_qc_issue_prot - issue taskfile to device in proto-dependent manner
2897 * @qc: command to issue to device 3144 * @qc: command to issue to device
@@ -2901,6 +3148,8 @@ err_out:
2901 * classes called "protocols", and issuing each type of protocol 3148 * classes called "protocols", and issuing each type of protocol
2902 * is slightly different. 3149 * is slightly different.
2903 * 3150 *
3151 * May be used as the qc_issue() entry in ata_port_operations.
3152 *
2904 * LOCKING: 3153 * LOCKING:
2905 * spin_lock_irqsave(host_set lock) 3154 * spin_lock_irqsave(host_set lock)
2906 * 3155 *
@@ -2958,7 +3207,7 @@ int ata_qc_issue_prot(struct ata_queued_cmd *qc)
2958} 3207}
2959 3208
2960/** 3209/**
2961 * ata_bmdma_setup - Set up PCI IDE BMDMA transaction 3210 * ata_bmdma_setup_mmio - Set up PCI IDE BMDMA transaction
2962 * @qc: Info associated with this ATA transaction. 3211 * @qc: Info associated with this ATA transaction.
2963 * 3212 *
2964 * LOCKING: 3213 * LOCKING:
@@ -3065,6 +3314,18 @@ static void ata_bmdma_start_pio (struct ata_queued_cmd *qc)
3065 ap->ioaddr.bmdma_addr + ATA_DMA_CMD); 3314 ap->ioaddr.bmdma_addr + ATA_DMA_CMD);
3066} 3315}
3067 3316
3317
3318/**
3319 * ata_bmdma_start - Start a PCI IDE BMDMA transaction
3320 * @qc: Info associated with this ATA transaction.
3321 *
3322 * Writes the ATA_DMA_START flag to the DMA command register.
3323 *
3324 * May be used as the bmdma_start() entry in ata_port_operations.
3325 *
3326 * LOCKING:
3327 * spin_lock_irqsave(host_set lock)
3328 */
3068void ata_bmdma_start(struct ata_queued_cmd *qc) 3329void ata_bmdma_start(struct ata_queued_cmd *qc)
3069{ 3330{
3070 if (qc->ap->flags & ATA_FLAG_MMIO) 3331 if (qc->ap->flags & ATA_FLAG_MMIO)
@@ -3073,6 +3334,20 @@ void ata_bmdma_start(struct ata_queued_cmd *qc)
3073 ata_bmdma_start_pio(qc); 3334 ata_bmdma_start_pio(qc);
3074} 3335}
3075 3336
3337
3338/**
3339 * ata_bmdma_setup - Set up PCI IDE BMDMA transaction
3340 * @qc: Info associated with this ATA transaction.
3341 *
3342 * Writes address of PRD table to device's PRD Table Address
3343 * register, sets the DMA control register, and calls
3344 * ops->exec_command() to start the transfer.
3345 *
3346 * May be used as the bmdma_setup() entry in ata_port_operations.
3347 *
3348 * LOCKING:
3349 * spin_lock_irqsave(host_set lock)
3350 */
3076void ata_bmdma_setup(struct ata_queued_cmd *qc) 3351void ata_bmdma_setup(struct ata_queued_cmd *qc)
3077{ 3352{
3078 if (qc->ap->flags & ATA_FLAG_MMIO) 3353 if (qc->ap->flags & ATA_FLAG_MMIO)
@@ -3081,6 +3356,19 @@ void ata_bmdma_setup(struct ata_queued_cmd *qc)
3081 ata_bmdma_setup_pio(qc); 3356 ata_bmdma_setup_pio(qc);
3082} 3357}
3083 3358
3359
3360/**
3361 * ata_bmdma_irq_clear - Clear PCI IDE BMDMA interrupt.
3362 * @ap: Port associated with this ATA transaction.
3363 *
3364 * Clear interrupt and error flags in DMA status register.
3365 *
3366 * May be used as the irq_clear() entry in ata_port_operations.
3367 *
3368 * LOCKING:
3369 * spin_lock_irqsave(host_set lock)
3370 */
3371
3084void ata_bmdma_irq_clear(struct ata_port *ap) 3372void ata_bmdma_irq_clear(struct ata_port *ap)
3085{ 3373{
3086 if (ap->flags & ATA_FLAG_MMIO) { 3374 if (ap->flags & ATA_FLAG_MMIO) {
@@ -3093,6 +3381,19 @@ void ata_bmdma_irq_clear(struct ata_port *ap)
3093 3381
3094} 3382}
3095 3383
3384
3385/**
3386 * ata_bmdma_status - Read PCI IDE BMDMA status
3387 * @ap: Port associated with this ATA transaction.
3388 *
3389 * Read and return BMDMA status register.
3390 *
3391 * May be used as the bmdma_status() entry in ata_port_operations.
3392 *
3393 * LOCKING:
3394 * spin_lock_irqsave(host_set lock)
3395 */
3396
3096u8 ata_bmdma_status(struct ata_port *ap) 3397u8 ata_bmdma_status(struct ata_port *ap)
3097{ 3398{
3098 u8 host_stat; 3399 u8 host_stat;
@@ -3104,6 +3405,19 @@ u8 ata_bmdma_status(struct ata_port *ap)
3104 return host_stat; 3405 return host_stat;
3105} 3406}
3106 3407
3408
3409/**
3410 * ata_bmdma_stop - Stop PCI IDE BMDMA transfer
3411 * @ap: Port associated with this ATA transaction.
3412 *
3413 * Clears the ATA_DMA_START flag in the dma control register
3414 *
3415 * May be used as the bmdma_stop() entry in ata_port_operations.
3416 *
3417 * LOCKING:
3418 * spin_lock_irqsave(host_set lock)
3419 */
3420
3107void ata_bmdma_stop(struct ata_port *ap) 3421void ata_bmdma_stop(struct ata_port *ap)
3108{ 3422{
3109 if (ap->flags & ATA_FLAG_MMIO) { 3423 if (ap->flags & ATA_FLAG_MMIO) {
@@ -3203,13 +3517,18 @@ idle_irq:
3203 3517
3204/** 3518/**
3205 * ata_interrupt - Default ATA host interrupt handler 3519 * ata_interrupt - Default ATA host interrupt handler
3206 * @irq: irq line 3520 * @irq: irq line (unused)
3207 * @dev_instance: pointer to our host information structure 3521 * @dev_instance: pointer to our ata_host_set information structure
3208 * @regs: unused 3522 * @regs: unused
3209 * 3523 *
3524 * Default interrupt handler for PCI IDE devices. Calls
3525 * ata_host_intr() for each port that is not disabled.
3526 *
3210 * LOCKING: 3527 * LOCKING:
3528 * Obtains host_set lock during operation.
3211 * 3529 *
3212 * RETURNS: 3530 * RETURNS:
3531 * IRQ_NONE or IRQ_HANDLED.
3213 * 3532 *
3214 */ 3533 */
3215 3534
@@ -3302,6 +3621,19 @@ err_out:
3302 ata_qc_complete(qc, ATA_ERR); 3621 ata_qc_complete(qc, ATA_ERR);
3303} 3622}
3304 3623
3624
3625/**
3626 * ata_port_start - Set port up for dma.
3627 * @ap: Port to initialize
3628 *
3629 * Called just after data structures for each port are
3630 * initialized. Allocates space for PRD table.
3631 *
3632 * May be used as the port_start() entry in ata_port_operations.
3633 *
3634 * LOCKING:
3635 */
3636
3305int ata_port_start (struct ata_port *ap) 3637int ata_port_start (struct ata_port *ap)
3306{ 3638{
3307 struct device *dev = ap->host_set->dev; 3639 struct device *dev = ap->host_set->dev;
@@ -3315,6 +3647,18 @@ int ata_port_start (struct ata_port *ap)
3315 return 0; 3647 return 0;
3316} 3648}
3317 3649
3650
3651/**
3652 * ata_port_stop - Undo ata_port_start()
3653 * @ap: Port to shut down
3654 *
3655 * Frees the PRD table.
3656 *
3657 * May be used as the port_stop() entry in ata_port_operations.
3658 *
3659 * LOCKING:
3660 */
3661
3318void ata_port_stop (struct ata_port *ap) 3662void ata_port_stop (struct ata_port *ap)
3319{ 3663{
3320 struct device *dev = ap->host_set->dev; 3664 struct device *dev = ap->host_set->dev;
@@ -3322,6 +3666,13 @@ void ata_port_stop (struct ata_port *ap)
3322 dma_free_coherent(dev, ATA_PRD_TBL_SZ, ap->prd, ap->prd_dma); 3666 dma_free_coherent(dev, ATA_PRD_TBL_SZ, ap->prd, ap->prd_dma);
3323} 3667}
3324 3668
3669void ata_host_stop (struct ata_host_set *host_set)
3670{
3671 if (host_set->mmio_base)
3672 iounmap(host_set->mmio_base);
3673}
3674
3675
3325/** 3676/**
3326 * ata_host_remove - Unregister SCSI host structure with upper layers 3677 * ata_host_remove - Unregister SCSI host structure with upper layers
3327 * @ap: Port to unregister 3678 * @ap: Port to unregister
@@ -3350,7 +3701,11 @@ static void ata_host_remove(struct ata_port *ap, unsigned int do_unregister)
3350 * @ent: Probe information provided by low-level driver 3701 * @ent: Probe information provided by low-level driver
3351 * @port_no: Port number associated with this ata_port 3702 * @port_no: Port number associated with this ata_port
3352 * 3703 *
3704 * Initialize a new ata_port structure, and its associated
3705 * scsi_host.
3706 *
3353 * LOCKING: 3707 * LOCKING:
3708 * Inherited from caller.
3354 * 3709 *
3355 */ 3710 */
3356 3711
@@ -3405,9 +3760,13 @@ static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host,
3405 * @host_set: Collections of ports to which we add 3760 * @host_set: Collections of ports to which we add
3406 * @port_no: Port number associated with this host 3761 * @port_no: Port number associated with this host
3407 * 3762 *
3763 * Attach low-level ATA driver to system.
3764 *
3408 * LOCKING: 3765 * LOCKING:
3766 * PCI/etc. bus probe sem.
3409 * 3767 *
3410 * RETURNS: 3768 * RETURNS:
3769 * New ata_port on success, for NULL on error.
3411 * 3770 *
3412 */ 3771 */
3413 3772
@@ -3440,12 +3799,22 @@ err_out:
3440} 3799}
3441 3800
3442/** 3801/**
3443 * ata_device_add - 3802 * ata_device_add - Register hardware device with ATA and SCSI layers
3444 * @ent: 3803 * @ent: Probe information describing hardware device to be registered
3804 *
3805 * This function processes the information provided in the probe
3806 * information struct @ent, allocates the necessary ATA and SCSI
3807 * host information structures, initializes them, and registers
3808 * everything with requisite kernel subsystems.
3809 *
3810 * This function requests irqs, probes the ATA bus, and probes
3811 * the SCSI bus.
3445 * 3812 *
3446 * LOCKING: 3813 * LOCKING:
3814 * PCI/etc. bus probe sem.
3447 * 3815 *
3448 * RETURNS: 3816 * RETURNS:
3817 * Number of ports registered. Zero on error (no ports registered).
3449 * 3818 *
3450 */ 3819 */
3451 3820
@@ -3597,7 +3966,15 @@ int ata_scsi_release(struct Scsi_Host *host)
3597/** 3966/**
3598 * ata_std_ports - initialize ioaddr with standard port offsets. 3967 * ata_std_ports - initialize ioaddr with standard port offsets.
3599 * @ioaddr: IO address structure to be initialized 3968 * @ioaddr: IO address structure to be initialized
3969 *
3970 * Utility function which initializes data_addr, error_addr,
3971 * feature_addr, nsect_addr, lbal_addr, lbam_addr, lbah_addr,
3972 * device_addr, status_addr, and command_addr to standard offsets
3973 * relative to cmd_addr.
3974 *
3975 * Does not set ctl_addr, altstatus_addr, bmdma_addr, or scr_addr.
3600 */ 3976 */
3977
3601void ata_std_ports(struct ata_ioports *ioaddr) 3978void ata_std_ports(struct ata_ioports *ioaddr)
3602{ 3979{
3603 ioaddr->data_addr = ioaddr->cmd_addr + ATA_REG_DATA; 3980 ioaddr->data_addr = ioaddr->cmd_addr + ATA_REG_DATA;
@@ -3639,6 +4016,20 @@ ata_probe_ent_alloc(struct device *dev, struct ata_port_info *port)
3639 return probe_ent; 4016 return probe_ent;
3640} 4017}
3641 4018
4019
4020
4021/**
4022 * ata_pci_init_native_mode - Initialize native-mode driver
4023 * @pdev: pci device to be initialized
4024 * @port: array[2] of pointers to port info structures.
4025 *
4026 * Utility function which allocates and initializes an
4027 * ata_probe_ent structure for a standard dual-port
4028 * PIO-based IDE controller. The returned ata_probe_ent
4029 * structure can be passed to ata_device_add(). The returned
4030 * ata_probe_ent structure should then be freed with kfree().
4031 */
4032
3642#ifdef CONFIG_PCI 4033#ifdef CONFIG_PCI
3643struct ata_probe_ent * 4034struct ata_probe_ent *
3644ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port) 4035ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port)
@@ -3720,10 +4111,19 @@ ata_pci_init_legacy_mode(struct pci_dev *pdev, struct ata_port_info **port,
3720 * @port_info: Information from low-level host driver 4111 * @port_info: Information from low-level host driver
3721 * @n_ports: Number of ports attached to host controller 4112 * @n_ports: Number of ports attached to host controller
3722 * 4113 *
4114 * This is a helper function which can be called from a driver's
4115 * xxx_init_one() probe function if the hardware uses traditional
4116 * IDE taskfile registers.
4117 *
4118 * This function calls pci_enable_device(), reserves its register
4119 * regions, sets the dma mask, enables bus master mode, and calls
4120 * ata_device_add()
4121 *
3723 * LOCKING: 4122 * LOCKING:
3724 * Inherited from PCI layer (may sleep). 4123 * Inherited from PCI layer (may sleep).
3725 * 4124 *
3726 * RETURNS: 4125 * RETURNS:
4126 * Zero on success, negative on errno-based value on error.
3727 * 4127 *
3728 */ 4128 */
3729 4129
@@ -3878,10 +4278,6 @@ void ata_pci_remove_one (struct pci_dev *pdev)
3878 } 4278 }
3879 4279
3880 free_irq(host_set->irq, host_set); 4280 free_irq(host_set->irq, host_set);
3881 if (host_set->ops->host_stop)
3882 host_set->ops->host_stop(host_set);
3883 if (host_set->mmio_base)
3884 iounmap(host_set->mmio_base);
3885 4281
3886 for (i = 0; i < host_set->n_ports; i++) { 4282 for (i = 0; i < host_set->n_ports; i++) {
3887 ap = host_set->ports[i]; 4283 ap = host_set->ports[i];
@@ -3900,6 +4296,9 @@ void ata_pci_remove_one (struct pci_dev *pdev)
3900 scsi_host_put(ap->host); 4296 scsi_host_put(ap->host);
3901 } 4297 }
3902 4298
4299 if (host_set->ops->host_stop)
4300 host_set->ops->host_stop(host_set);
4301
3903 kfree(host_set); 4302 kfree(host_set);
3904 4303
3905 pci_release_regions(pdev); 4304 pci_release_regions(pdev);
@@ -3943,15 +4342,6 @@ int pci_test_config_bits(struct pci_dev *pdev, struct pci_bits *bits)
3943#endif /* CONFIG_PCI */ 4342#endif /* CONFIG_PCI */
3944 4343
3945 4344
3946/**
3947 * ata_init -
3948 *
3949 * LOCKING:
3950 *
3951 * RETURNS:
3952 *
3953 */
3954
3955static int __init ata_init(void) 4345static int __init ata_init(void)
3956{ 4346{
3957 ata_wq = create_workqueue("ata"); 4347 ata_wq = create_workqueue("ata");
@@ -3997,6 +4387,7 @@ EXPORT_SYMBOL_GPL(ata_chk_err);
3997EXPORT_SYMBOL_GPL(ata_exec_command); 4387EXPORT_SYMBOL_GPL(ata_exec_command);
3998EXPORT_SYMBOL_GPL(ata_port_start); 4388EXPORT_SYMBOL_GPL(ata_port_start);
3999EXPORT_SYMBOL_GPL(ata_port_stop); 4389EXPORT_SYMBOL_GPL(ata_port_stop);
4390EXPORT_SYMBOL_GPL(ata_host_stop);
4000EXPORT_SYMBOL_GPL(ata_interrupt); 4391EXPORT_SYMBOL_GPL(ata_interrupt);
4001EXPORT_SYMBOL_GPL(ata_qc_prep); 4392EXPORT_SYMBOL_GPL(ata_qc_prep);
4002EXPORT_SYMBOL_GPL(ata_bmdma_setup); 4393EXPORT_SYMBOL_GPL(ata_bmdma_setup);
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index 416ba67ba9ee..7a4adc4c8f09 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -947,7 +947,7 @@ unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf,
947} 947}
948 948
949/** 949/**
950 * ata_scsiop_noop - 950 * ata_scsiop_noop - Command handler that simply returns success.
951 * @args: device IDENTIFY data / SCSI command of interest. 951 * @args: device IDENTIFY data / SCSI command of interest.
952 * @rbuf: Response buffer, to which simulated SCSI cmd output is sent. 952 * @rbuf: Response buffer, to which simulated SCSI cmd output is sent.
953 * @buflen: Response buffer length. 953 * @buflen: Response buffer length.
diff --git a/drivers/scsi/libata.h b/drivers/scsi/libata.h
index 6518226b8f87..d90430bbb0de 100644
--- a/drivers/scsi/libata.h
+++ b/drivers/scsi/libata.h
@@ -26,7 +26,7 @@
26#define __LIBATA_H__ 26#define __LIBATA_H__
27 27
28#define DRV_NAME "libata" 28#define DRV_NAME "libata"
29#define DRV_VERSION "1.10" /* must be exactly four chars */ 29#define DRV_VERSION "1.11" /* must be exactly four chars */
30 30
31struct ata_scsi_args { 31struct ata_scsi_args {
32 u16 *id; 32 u16 *id;
diff --git a/drivers/scsi/sata_nv.c b/drivers/scsi/sata_nv.c
index 69009f853a49..b0403ccd8a25 100644
--- a/drivers/scsi/sata_nv.c
+++ b/drivers/scsi/sata_nv.c
@@ -329,6 +329,8 @@ static void nv_host_stop (struct ata_host_set *host_set)
329 host->host_desc->disable_hotplug(host_set); 329 host->host_desc->disable_hotplug(host_set);
330 330
331 kfree(host); 331 kfree(host);
332
333 ata_host_stop(host_set);
332} 334}
333 335
334static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) 336static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c
index c4e9e0298122..b18c90582e67 100644
--- a/drivers/scsi/sata_promise.c
+++ b/drivers/scsi/sata_promise.c
@@ -122,6 +122,7 @@ static struct ata_port_operations pdc_ata_ops = {
122 .scr_write = pdc_sata_scr_write, 122 .scr_write = pdc_sata_scr_write,
123 .port_start = pdc_port_start, 123 .port_start = pdc_port_start,
124 .port_stop = pdc_port_stop, 124 .port_stop = pdc_port_stop,
125 .host_stop = ata_host_stop,
125}; 126};
126 127
127static struct ata_port_info pdc_port_info[] = { 128static struct ata_port_info pdc_port_info[] = {
diff --git a/drivers/scsi/sata_qstor.c b/drivers/scsi/sata_qstor.c
index dfd362104717..1383e8a28d72 100644
--- a/drivers/scsi/sata_qstor.c
+++ b/drivers/scsi/sata_qstor.c
@@ -536,6 +536,8 @@ static void qs_host_stop(struct ata_host_set *host_set)
536 536
537 writeb(0, mmio_base + QS_HCT_CTRL); /* disable host interrupts */ 537 writeb(0, mmio_base + QS_HCT_CTRL); /* disable host interrupts */
538 writeb(QS_CNFG3_GSRST, mmio_base + QS_HCF_CNFG3); /* global reset */ 538 writeb(QS_CNFG3_GSRST, mmio_base + QS_HCF_CNFG3); /* global reset */
539
540 ata_host_stop(host_set);
539} 541}
540 542
541static void qs_host_init(unsigned int chip_id, struct ata_probe_ent *pe) 543static void qs_host_init(unsigned int chip_id, struct ata_probe_ent *pe)
diff --git a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c
index 2b2ff48be396..238580d244e6 100644
--- a/drivers/scsi/sata_sil.c
+++ b/drivers/scsi/sata_sil.c
@@ -161,6 +161,7 @@ static struct ata_port_operations sil_ops = {
161 .scr_write = sil_scr_write, 161 .scr_write = sil_scr_write,
162 .port_start = ata_port_start, 162 .port_start = ata_port_start,
163 .port_stop = ata_port_stop, 163 .port_stop = ata_port_stop,
164 .host_stop = ata_host_stop,
164}; 165};
165 166
166static struct ata_port_info sil_port_info[] = { 167static struct ata_port_info sil_port_info[] = {
diff --git a/drivers/scsi/sata_sis.c b/drivers/scsi/sata_sis.c
index 5105ddd08447..e418b89c6b9d 100644
--- a/drivers/scsi/sata_sis.c
+++ b/drivers/scsi/sata_sis.c
@@ -114,6 +114,7 @@ static struct ata_port_operations sis_ops = {
114 .scr_write = sis_scr_write, 114 .scr_write = sis_scr_write,
115 .port_start = ata_port_start, 115 .port_start = ata_port_start,
116 .port_stop = ata_port_stop, 116 .port_stop = ata_port_stop,
117 .host_stop = ata_host_stop,
117}; 118};
118 119
119static struct ata_port_info sis_port_info = { 120static struct ata_port_info sis_port_info = {
diff --git a/drivers/scsi/sata_svw.c b/drivers/scsi/sata_svw.c
index 05075bd3a893..edef1fa969fc 100644
--- a/drivers/scsi/sata_svw.c
+++ b/drivers/scsi/sata_svw.c
@@ -313,6 +313,7 @@ static struct ata_port_operations k2_sata_ops = {
313 .scr_write = k2_sata_scr_write, 313 .scr_write = k2_sata_scr_write,
314 .port_start = ata_port_start, 314 .port_start = ata_port_start,
315 .port_stop = ata_port_stop, 315 .port_stop = ata_port_stop,
316 .host_stop = ata_host_stop,
316}; 317};
317 318
318static void k2_sata_setup_port(struct ata_ioports *port, unsigned long base) 319static void k2_sata_setup_port(struct ata_ioports *port, unsigned long base)
diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c
index 70118650c461..140cea05de3f 100644
--- a/drivers/scsi/sata_sx4.c
+++ b/drivers/scsi/sata_sx4.c
@@ -245,6 +245,8 @@ static void pdc20621_host_stop(struct ata_host_set *host_set)
245 245
246 iounmap(dimm_mmio); 246 iounmap(dimm_mmio);
247 kfree(hpriv); 247 kfree(hpriv);
248
249 ata_host_stop(host_set);
248} 250}
249 251
250static int pdc_port_start(struct ata_port *ap) 252static int pdc_port_start(struct ata_port *ap)
diff --git a/drivers/scsi/sata_uli.c b/drivers/scsi/sata_uli.c
index 0bff4f475f26..a71fb54eebd3 100644
--- a/drivers/scsi/sata_uli.c
+++ b/drivers/scsi/sata_uli.c
@@ -113,6 +113,7 @@ static struct ata_port_operations uli_ops = {
113 113
114 .port_start = ata_port_start, 114 .port_start = ata_port_start,
115 .port_stop = ata_port_stop, 115 .port_stop = ata_port_stop,
116 .host_stop = ata_host_stop,
116}; 117};
117 118
118static struct ata_port_info uli_port_info = { 119static struct ata_port_info uli_port_info = {
diff --git a/drivers/scsi/sata_via.c b/drivers/scsi/sata_via.c
index 3a7830667277..f43183c19a12 100644
--- a/drivers/scsi/sata_via.c
+++ b/drivers/scsi/sata_via.c
@@ -134,6 +134,7 @@ static struct ata_port_operations svia_sata_ops = {
134 134
135 .port_start = ata_port_start, 135 .port_start = ata_port_start,
136 .port_stop = ata_port_stop, 136 .port_stop = ata_port_stop,
137 .host_stop = ata_host_stop,
137}; 138};
138 139
139static struct ata_port_info svia_port_info = { 140static struct ata_port_info svia_port_info = {
diff --git a/drivers/scsi/sata_vsc.c b/drivers/scsi/sata_vsc.c
index 2c28f0ad73c2..c5e09dc6f3de 100644
--- a/drivers/scsi/sata_vsc.c
+++ b/drivers/scsi/sata_vsc.c
@@ -21,6 +21,7 @@
21#include <linux/blkdev.h> 21#include <linux/blkdev.h>
22#include <linux/delay.h> 22#include <linux/delay.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/dma-mapping.h>
24#include "scsi.h" 25#include "scsi.h"
25#include <scsi/scsi_host.h> 26#include <scsi/scsi_host.h>
26#include <linux/libata.h> 27#include <linux/libata.h>
@@ -230,6 +231,7 @@ static struct ata_port_operations vsc_sata_ops = {
230 .scr_write = vsc_sata_scr_write, 231 .scr_write = vsc_sata_scr_write,
231 .port_start = ata_port_start, 232 .port_start = ata_port_start,
232 .port_stop = ata_port_stop, 233 .port_stop = ata_port_stop,
234 .host_stop = ata_host_stop,
233}; 235};
234 236
235static void __devinit vsc_sata_setup_port(struct ata_ioports *port, unsigned long base) 237static void __devinit vsc_sata_setup_port(struct ata_ioports *port, unsigned long base)