aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/libata.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/libata.h')
-rw-r--r--include/linux/libata.h75
1 files changed, 58 insertions, 17 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h
index ed3f26eb5df1..b6b8a7f3ec66 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -213,10 +213,11 @@ enum {
213 ATA_PFLAG_FROZEN = (1 << 2), /* port is frozen */ 213 ATA_PFLAG_FROZEN = (1 << 2), /* port is frozen */
214 ATA_PFLAG_RECOVERED = (1 << 3), /* recovery action performed */ 214 ATA_PFLAG_RECOVERED = (1 << 3), /* recovery action performed */
215 ATA_PFLAG_LOADING = (1 << 4), /* boot/loading probe */ 215 ATA_PFLAG_LOADING = (1 << 4), /* boot/loading probe */
216 ATA_PFLAG_UNLOADING = (1 << 5), /* module is unloading */
217 ATA_PFLAG_SCSI_HOTPLUG = (1 << 6), /* SCSI hotplug scheduled */ 216 ATA_PFLAG_SCSI_HOTPLUG = (1 << 6), /* SCSI hotplug scheduled */
218 ATA_PFLAG_INITIALIZING = (1 << 7), /* being initialized, don't touch */ 217 ATA_PFLAG_INITIALIZING = (1 << 7), /* being initialized, don't touch */
219 ATA_PFLAG_RESETTING = (1 << 8), /* reset in progress */ 218 ATA_PFLAG_RESETTING = (1 << 8), /* reset in progress */
219 ATA_PFLAG_UNLOADING = (1 << 9), /* driver is being unloaded */
220 ATA_PFLAG_UNLOADED = (1 << 10), /* driver is unloaded */
220 221
221 ATA_PFLAG_SUSPENDED = (1 << 17), /* port is suspended (power) */ 222 ATA_PFLAG_SUSPENDED = (1 << 17), /* port is suspended (power) */
222 ATA_PFLAG_PM_PENDING = (1 << 18), /* PM operation pending */ 223 ATA_PFLAG_PM_PENDING = (1 << 18), /* PM operation pending */
@@ -238,6 +239,7 @@ enum {
238 /* host set flags */ 239 /* host set flags */
239 ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host only */ 240 ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host only */
240 ATA_HOST_STARTED = (1 << 1), /* Host started */ 241 ATA_HOST_STARTED = (1 << 1), /* Host started */
242 ATA_HOST_PARALLEL_SCAN = (1 << 2), /* Ports on this host can be scanned in parallel */
241 243
242 /* bits 24:31 of host->flags are reserved for LLD specific flags */ 244 /* bits 24:31 of host->flags are reserved for LLD specific flags */
243 245
@@ -1285,26 +1287,62 @@ static inline int ata_link_active(struct ata_link *link)
1285 return ata_tag_valid(link->active_tag) || link->sactive; 1287 return ata_tag_valid(link->active_tag) || link->sactive;
1286} 1288}
1287 1289
1288extern struct ata_link *__ata_port_next_link(struct ata_port *ap, 1290/*
1289 struct ata_link *link, 1291 * Iterators
1290 bool dev_only); 1292 *
1293 * ATA_LITER_* constants are used to select link iteration mode and
1294 * ATA_DITER_* device iteration mode.
1295 *
1296 * For a custom iteration directly using ata_{link|dev}_next(), if
1297 * @link or @dev, respectively, is NULL, the first element is
1298 * returned. @dev and @link can be any valid device or link and the
1299 * next element according to the iteration mode will be returned.
1300 * After the last element, NULL is returned.
1301 */
1302enum ata_link_iter_mode {
1303 ATA_LITER_EDGE, /* if present, PMP links only; otherwise,
1304 * host link. no slave link */
1305 ATA_LITER_HOST_FIRST, /* host link followed by PMP or slave links */
1306 ATA_LITER_PMP_FIRST, /* PMP links followed by host link,
1307 * slave link still comes after host link */
1308};
1309
1310enum ata_dev_iter_mode {
1311 ATA_DITER_ENABLED,
1312 ATA_DITER_ENABLED_REVERSE,
1313 ATA_DITER_ALL,
1314 ATA_DITER_ALL_REVERSE,
1315};
1291 1316
1292#define __ata_port_for_each_link(link, ap) \ 1317extern struct ata_link *ata_link_next(struct ata_link *link,
1293 for ((link) = __ata_port_next_link((ap), NULL, false); (link); \ 1318 struct ata_port *ap,
1294 (link) = __ata_port_next_link((ap), (link), false)) 1319 enum ata_link_iter_mode mode);
1295 1320
1296#define ata_port_for_each_link(link, ap) \ 1321extern struct ata_device *ata_dev_next(struct ata_device *dev,
1297 for ((link) = __ata_port_next_link((ap), NULL, true); (link); \ 1322 struct ata_link *link,
1298 (link) = __ata_port_next_link((ap), (link), true)) 1323 enum ata_dev_iter_mode mode);
1299 1324
1300#define ata_link_for_each_dev(dev, link) \ 1325/*
1301 for ((dev) = (link)->device; \ 1326 * Shortcut notation for iterations
1302 (dev) < (link)->device + ata_link_max_devices(link) || ((dev) = NULL); \ 1327 *
1303 (dev)++) 1328 * ata_for_each_link() iterates over each link of @ap according to
1329 * @mode. @link points to the current link in the loop. @link is
1330 * NULL after loop termination. ata_for_each_dev() works the same way
1331 * except that it iterates over each device of @link.
1332 *
1333 * Note that the mode prefixes ATA_{L|D}ITER_ shouldn't need to be
1334 * specified when using the following shorthand notations. Only the
1335 * mode itself (EDGE, HOST_FIRST, ENABLED, etc...) should be
1336 * specified. This not only increases brevity but also makes it
1337 * impossible to use ATA_LITER_* for device iteration or vice-versa.
1338 */
1339#define ata_for_each_link(link, ap, mode) \
1340 for ((link) = ata_link_next(NULL, (ap), ATA_LITER_##mode); (link); \
1341 (link) = ata_link_next((link), (ap), ATA_LITER_##mode))
1304 1342
1305#define ata_link_for_each_dev_reverse(dev, link) \ 1343#define ata_for_each_dev(dev, link, mode) \
1306 for ((dev) = (link)->device + ata_link_max_devices(link) - 1; \ 1344 for ((dev) = ata_dev_next(NULL, (link), ATA_DITER_##mode); (dev); \
1307 (dev) >= (link)->device || ((dev) = NULL); (dev)--) 1345 (dev) = ata_dev_next((dev), (link), ATA_DITER_##mode))
1308 1346
1309/** 1347/**
1310 * ata_ncq_enabled - Test whether NCQ is enabled 1348 * ata_ncq_enabled - Test whether NCQ is enabled
@@ -1481,6 +1519,7 @@ extern void sata_pmp_error_handler(struct ata_port *ap);
1481 1519
1482extern const struct ata_port_operations ata_sff_port_ops; 1520extern const struct ata_port_operations ata_sff_port_ops;
1483extern const struct ata_port_operations ata_bmdma_port_ops; 1521extern const struct ata_port_operations ata_bmdma_port_ops;
1522extern const struct ata_port_operations ata_bmdma32_port_ops;
1484 1523
1485/* PIO only, sg_tablesize and dma_boundary limits can be removed */ 1524/* PIO only, sg_tablesize and dma_boundary limits can be removed */
1486#define ATA_PIO_SHT(drv_name) \ 1525#define ATA_PIO_SHT(drv_name) \
@@ -1508,6 +1547,8 @@ extern void ata_sff_exec_command(struct ata_port *ap,
1508 const struct ata_taskfile *tf); 1547 const struct ata_taskfile *tf);
1509extern unsigned int ata_sff_data_xfer(struct ata_device *dev, 1548extern unsigned int ata_sff_data_xfer(struct ata_device *dev,
1510 unsigned char *buf, unsigned int buflen, int rw); 1549 unsigned char *buf, unsigned int buflen, int rw);
1550extern unsigned int ata_sff_data_xfer32(struct ata_device *dev,
1551 unsigned char *buf, unsigned int buflen, int rw);
1511extern unsigned int ata_sff_data_xfer_noirq(struct ata_device *dev, 1552extern unsigned int ata_sff_data_xfer_noirq(struct ata_device *dev,
1512 unsigned char *buf, unsigned int buflen, int rw); 1553 unsigned char *buf, unsigned int buflen, int rw);
1513extern u8 ata_sff_irq_on(struct ata_port *ap); 1554extern u8 ata_sff_irq_on(struct ata_port *ap);