diff options
Diffstat (limited to 'include/linux/libata.h')
| -rw-r--r-- | include/linux/libata.h | 192 |
1 files changed, 145 insertions, 47 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h index 20b1cf527c60..d6a3d4b345fc 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
| @@ -30,12 +30,23 @@ | |||
| 30 | #include <linux/interrupt.h> | 30 | #include <linux/interrupt.h> |
| 31 | #include <linux/pci.h> | 31 | #include <linux/pci.h> |
| 32 | #include <linux/dma-mapping.h> | 32 | #include <linux/dma-mapping.h> |
| 33 | #include <asm/scatterlist.h> | ||
| 33 | #include <asm/io.h> | 34 | #include <asm/io.h> |
| 34 | #include <linux/ata.h> | 35 | #include <linux/ata.h> |
| 35 | #include <linux/workqueue.h> | 36 | #include <linux/workqueue.h> |
| 36 | #include <scsi/scsi_host.h> | 37 | #include <scsi/scsi_host.h> |
| 37 | 38 | ||
| 38 | /* | 39 | /* |
| 40 | * Define if arch has non-standard setup. This is a _PCI_ standard | ||
| 41 | * not a legacy or ISA standard. | ||
| 42 | */ | ||
| 43 | #ifdef CONFIG_ATA_NONSTANDARD | ||
| 44 | #include <asm/libata-portmap.h> | ||
| 45 | #else | ||
| 46 | #include <asm-generic/libata-portmap.h> | ||
| 47 | #endif | ||
| 48 | |||
| 49 | /* | ||
| 39 | * compile-time options: to be removed as soon as all the drivers are | 50 | * compile-time options: to be removed as soon as all the drivers are |
| 40 | * converted to the new debugging mechanism | 51 | * converted to the new debugging mechanism |
| 41 | */ | 52 | */ |
| @@ -43,7 +54,7 @@ | |||
| 43 | #undef ATA_VERBOSE_DEBUG /* yet more debugging output */ | 54 | #undef ATA_VERBOSE_DEBUG /* yet more debugging output */ |
| 44 | #undef ATA_IRQ_TRAP /* define to ack screaming irqs */ | 55 | #undef ATA_IRQ_TRAP /* define to ack screaming irqs */ |
| 45 | #undef ATA_NDEBUG /* define to disable quick runtime checks */ | 56 | #undef ATA_NDEBUG /* define to disable quick runtime checks */ |
| 46 | #undef ATA_ENABLE_PATA /* define to enable PATA support in some | 57 | #define ATA_ENABLE_PATA /* define to enable PATA support in some |
| 47 | * low-level drivers */ | 58 | * low-level drivers */ |
| 48 | 59 | ||
| 49 | 60 | ||
| @@ -111,8 +122,6 @@ enum { | |||
| 111 | /* tag ATA_MAX_QUEUE - 1 is reserved for internal commands */ | 122 | /* tag ATA_MAX_QUEUE - 1 is reserved for internal commands */ |
| 112 | ATA_MAX_QUEUE = 32, | 123 | ATA_MAX_QUEUE = 32, |
| 113 | ATA_TAG_INTERNAL = ATA_MAX_QUEUE - 1, | 124 | ATA_TAG_INTERNAL = ATA_MAX_QUEUE - 1, |
| 114 | ATA_MAX_SECTORS = 200, /* FIXME */ | ||
| 115 | ATA_MAX_SECTORS_LBA48 = 65535, | ||
| 116 | ATA_MAX_BUS = 2, | 125 | ATA_MAX_BUS = 2, |
| 117 | ATA_DEF_BUSY_WAIT = 10000, | 126 | ATA_DEF_BUSY_WAIT = 10000, |
| 118 | ATA_SHORT_PAUSE = (HZ >> 6) + 1, | 127 | ATA_SHORT_PAUSE = (HZ >> 6) + 1, |
| @@ -130,6 +139,7 @@ enum { | |||
| 130 | ATA_DFLAG_CFG_MASK = (1 << 8) - 1, | 139 | ATA_DFLAG_CFG_MASK = (1 << 8) - 1, |
| 131 | 140 | ||
| 132 | ATA_DFLAG_PIO = (1 << 8), /* device currently in PIO mode */ | 141 | ATA_DFLAG_PIO = (1 << 8), /* device currently in PIO mode */ |
| 142 | ATA_DFLAG_SUSPENDED = (1 << 9), /* device suspended */ | ||
| 133 | ATA_DFLAG_INIT_MASK = (1 << 16) - 1, | 143 | ATA_DFLAG_INIT_MASK = (1 << 16) - 1, |
| 134 | 144 | ||
| 135 | ATA_DFLAG_DETACH = (1 << 16), | 145 | ATA_DFLAG_DETACH = (1 << 16), |
| @@ -159,22 +169,28 @@ enum { | |||
| 159 | ATA_FLAG_HRST_TO_RESUME = (1 << 11), /* hardreset to resume phy */ | 169 | ATA_FLAG_HRST_TO_RESUME = (1 << 11), /* hardreset to resume phy */ |
| 160 | ATA_FLAG_SKIP_D2H_BSY = (1 << 12), /* can't wait for the first D2H | 170 | ATA_FLAG_SKIP_D2H_BSY = (1 << 12), /* can't wait for the first D2H |
| 161 | * Register FIS clearing BSY */ | 171 | * Register FIS clearing BSY */ |
| 162 | |||
| 163 | ATA_FLAG_DEBUGMSG = (1 << 13), | 172 | ATA_FLAG_DEBUGMSG = (1 << 13), |
| 164 | ATA_FLAG_FLUSH_PORT_TASK = (1 << 14), /* flush port task */ | ||
| 165 | 173 | ||
| 166 | ATA_FLAG_EH_PENDING = (1 << 15), /* EH pending */ | 174 | /* The following flag belongs to ap->pflags but is kept in |
| 167 | ATA_FLAG_EH_IN_PROGRESS = (1 << 16), /* EH in progress */ | 175 | * ap->flags because it's referenced in many LLDs and will be |
| 168 | ATA_FLAG_FROZEN = (1 << 17), /* port is frozen */ | 176 | * removed in not-too-distant future. |
| 169 | ATA_FLAG_RECOVERED = (1 << 18), /* recovery action performed */ | 177 | */ |
| 170 | ATA_FLAG_LOADING = (1 << 19), /* boot/loading probe */ | 178 | ATA_FLAG_DISABLED = (1 << 23), /* port is disabled, ignore it */ |
| 171 | ATA_FLAG_UNLOADING = (1 << 20), /* module is unloading */ | ||
| 172 | ATA_FLAG_SCSI_HOTPLUG = (1 << 21), /* SCSI hotplug scheduled */ | ||
| 173 | 179 | ||
| 174 | ATA_FLAG_DISABLED = (1 << 22), /* port is disabled, ignore it */ | 180 | /* bits 24:31 of ap->flags are reserved for LLD specific flags */ |
| 175 | ATA_FLAG_SUSPENDED = (1 << 23), /* port is suspended (power) */ | ||
| 176 | 181 | ||
| 177 | /* bits 24:31 of ap->flags are reserved for LLDD specific flags */ | 182 | /* struct ata_port pflags */ |
| 183 | ATA_PFLAG_EH_PENDING = (1 << 0), /* EH pending */ | ||
| 184 | ATA_PFLAG_EH_IN_PROGRESS = (1 << 1), /* EH in progress */ | ||
| 185 | ATA_PFLAG_FROZEN = (1 << 2), /* port is frozen */ | ||
| 186 | ATA_PFLAG_RECOVERED = (1 << 3), /* recovery action performed */ | ||
| 187 | ATA_PFLAG_LOADING = (1 << 4), /* boot/loading probe */ | ||
| 188 | ATA_PFLAG_UNLOADING = (1 << 5), /* module is unloading */ | ||
| 189 | ATA_PFLAG_SCSI_HOTPLUG = (1 << 6), /* SCSI hotplug scheduled */ | ||
| 190 | |||
| 191 | ATA_PFLAG_FLUSH_PORT_TASK = (1 << 16), /* flush port task */ | ||
| 192 | ATA_PFLAG_SUSPENDED = (1 << 17), /* port is suspended (power) */ | ||
| 193 | ATA_PFLAG_PM_PENDING = (1 << 18), /* PM operation pending */ | ||
| 178 | 194 | ||
| 179 | /* struct ata_queued_cmd flags */ | 195 | /* struct ata_queued_cmd flags */ |
| 180 | ATA_QCFLAG_ACTIVE = (1 << 0), /* cmd not yet ack'd to scsi lyer */ | 196 | ATA_QCFLAG_ACTIVE = (1 << 0), /* cmd not yet ack'd to scsi lyer */ |
| @@ -189,8 +205,8 @@ enum { | |||
| 189 | ATA_QCFLAG_EH_SCHEDULED = (1 << 18), /* EH scheduled (obsolete) */ | 205 | ATA_QCFLAG_EH_SCHEDULED = (1 << 18), /* EH scheduled (obsolete) */ |
| 190 | 206 | ||
| 191 | /* host set flags */ | 207 | /* host set flags */ |
| 192 | ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host_set only */ | 208 | ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host only */ |
| 193 | 209 | ||
| 194 | /* various lengths of time */ | 210 | /* various lengths of time */ |
| 195 | ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */ | 211 | ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */ |
| 196 | ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */ | 212 | ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */ |
| @@ -217,8 +233,8 @@ enum { | |||
| 217 | /* encoding various smaller bitmaps into a single | 233 | /* encoding various smaller bitmaps into a single |
| 218 | * unsigned int bitmap | 234 | * unsigned int bitmap |
| 219 | */ | 235 | */ |
| 220 | ATA_BITS_PIO = 5, | 236 | ATA_BITS_PIO = 7, |
| 221 | ATA_BITS_MWDMA = 3, | 237 | ATA_BITS_MWDMA = 5, |
| 222 | ATA_BITS_UDMA = 8, | 238 | ATA_BITS_UDMA = 8, |
| 223 | 239 | ||
| 224 | ATA_SHIFT_PIO = 0, | 240 | ATA_SHIFT_PIO = 0, |
| @@ -247,15 +263,24 @@ enum { | |||
| 247 | ATA_EH_REVALIDATE = (1 << 0), | 263 | ATA_EH_REVALIDATE = (1 << 0), |
| 248 | ATA_EH_SOFTRESET = (1 << 1), | 264 | ATA_EH_SOFTRESET = (1 << 1), |
| 249 | ATA_EH_HARDRESET = (1 << 2), | 265 | ATA_EH_HARDRESET = (1 << 2), |
| 266 | ATA_EH_SUSPEND = (1 << 3), | ||
| 267 | ATA_EH_RESUME = (1 << 4), | ||
| 268 | ATA_EH_PM_FREEZE = (1 << 5), | ||
| 250 | 269 | ||
| 251 | ATA_EH_RESET_MASK = ATA_EH_SOFTRESET | ATA_EH_HARDRESET, | 270 | ATA_EH_RESET_MASK = ATA_EH_SOFTRESET | ATA_EH_HARDRESET, |
| 252 | ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE, | 271 | ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE | ATA_EH_SUSPEND | |
| 272 | ATA_EH_RESUME | ATA_EH_PM_FREEZE, | ||
| 253 | 273 | ||
| 254 | /* ata_eh_info->flags */ | 274 | /* ata_eh_info->flags */ |
| 255 | ATA_EHI_HOTPLUGGED = (1 << 0), /* could have been hotplugged */ | 275 | ATA_EHI_HOTPLUGGED = (1 << 0), /* could have been hotplugged */ |
| 276 | ATA_EHI_RESUME_LINK = (1 << 1), /* resume link (reset modifier) */ | ||
| 277 | ATA_EHI_NO_AUTOPSY = (1 << 2), /* no autopsy */ | ||
| 278 | ATA_EHI_QUIET = (1 << 3), /* be quiet */ | ||
| 256 | 279 | ||
| 257 | ATA_EHI_DID_RESET = (1 << 16), /* already reset this port */ | 280 | ATA_EHI_DID_RESET = (1 << 16), /* already reset this port */ |
| 258 | 281 | ||
| 282 | ATA_EHI_RESET_MODIFIER_MASK = ATA_EHI_RESUME_LINK, | ||
| 283 | |||
| 259 | /* max repeat if error condition is still set after ->error_handler */ | 284 | /* max repeat if error condition is still set after ->error_handler */ |
| 260 | ATA_EH_MAX_REPEAT = 5, | 285 | ATA_EH_MAX_REPEAT = 5, |
| 261 | 286 | ||
| @@ -272,6 +297,11 @@ enum { | |||
| 272 | * most devices. | 297 | * most devices. |
| 273 | */ | 298 | */ |
| 274 | ATA_SPINUP_WAIT = 8000, | 299 | ATA_SPINUP_WAIT = 8000, |
| 300 | |||
| 301 | /* Horkage types. May be set by libata or controller on drives | ||
| 302 | (some horkage may be drive/controller pair dependant */ | ||
| 303 | |||
| 304 | ATA_HORKAGE_DIAGNOSTIC = (1 << 0), /* Failed boot diag */ | ||
| 275 | }; | 305 | }; |
| 276 | 306 | ||
| 277 | enum hsm_task_states { | 307 | enum hsm_task_states { |
| @@ -333,23 +363,32 @@ struct ata_probe_ent { | |||
| 333 | struct scsi_host_template *sht; | 363 | struct scsi_host_template *sht; |
| 334 | struct ata_ioports port[ATA_MAX_PORTS]; | 364 | struct ata_ioports port[ATA_MAX_PORTS]; |
| 335 | unsigned int n_ports; | 365 | unsigned int n_ports; |
| 336 | unsigned int hard_port_no; | 366 | unsigned int dummy_port_mask; |
| 337 | unsigned int pio_mask; | 367 | unsigned int pio_mask; |
| 338 | unsigned int mwdma_mask; | 368 | unsigned int mwdma_mask; |
| 339 | unsigned int udma_mask; | 369 | unsigned int udma_mask; |
| 340 | unsigned int legacy_mode; | ||
| 341 | unsigned long irq; | 370 | unsigned long irq; |
| 371 | unsigned long irq2; | ||
| 342 | unsigned int irq_flags; | 372 | unsigned int irq_flags; |
| 343 | unsigned long host_flags; | 373 | unsigned long port_flags; |
| 344 | unsigned long host_set_flags; | 374 | unsigned long _host_flags; |
| 345 | void __iomem *mmio_base; | 375 | void __iomem *mmio_base; |
| 346 | void *private_data; | 376 | void *private_data; |
| 377 | |||
| 378 | /* port_info for the secondary port. Together with irq2, it's | ||
| 379 | * used to implement non-uniform secondary port. Currently, | ||
| 380 | * the only user is ata_piix combined mode. This workaround | ||
| 381 | * will be removed together with ata_probe_ent when init model | ||
| 382 | * is updated. | ||
| 383 | */ | ||
| 384 | const struct ata_port_info *pinfo2; | ||
| 347 | }; | 385 | }; |
| 348 | 386 | ||
| 349 | struct ata_host_set { | 387 | struct ata_host { |
| 350 | spinlock_t lock; | 388 | spinlock_t lock; |
| 351 | struct device *dev; | 389 | struct device *dev; |
| 352 | unsigned long irq; | 390 | unsigned long irq; |
| 391 | unsigned long irq2; | ||
| 353 | void __iomem *mmio_base; | 392 | void __iomem *mmio_base; |
| 354 | unsigned int n_ports; | 393 | unsigned int n_ports; |
| 355 | void *private_data; | 394 | void *private_data; |
| @@ -357,7 +396,6 @@ struct ata_host_set { | |||
| 357 | unsigned long flags; | 396 | unsigned long flags; |
| 358 | int simplex_claimed; /* Keep seperate in case we | 397 | int simplex_claimed; /* Keep seperate in case we |
| 359 | ever need to do this locked */ | 398 | ever need to do this locked */ |
| 360 | struct ata_host_set *next; /* for legacy mode */ | ||
| 361 | struct ata_port *ports[0]; | 399 | struct ata_port *ports[0]; |
| 362 | }; | 400 | }; |
| 363 | 401 | ||
| @@ -403,7 +441,7 @@ struct ata_queued_cmd { | |||
| 403 | void *private_data; | 441 | void *private_data; |
| 404 | }; | 442 | }; |
| 405 | 443 | ||
| 406 | struct ata_host_stats { | 444 | struct ata_port_stats { |
| 407 | unsigned long unhandled_irq; | 445 | unsigned long unhandled_irq; |
| 408 | unsigned long idle_irq; | 446 | unsigned long idle_irq; |
| 409 | unsigned long rw_reqbuf; | 447 | unsigned long rw_reqbuf; |
| @@ -451,6 +489,7 @@ struct ata_device { | |||
| 451 | 489 | ||
| 452 | /* error history */ | 490 | /* error history */ |
| 453 | struct ata_ering ering; | 491 | struct ata_ering ering; |
| 492 | unsigned int horkage; /* List of broken features */ | ||
| 454 | }; | 493 | }; |
| 455 | 494 | ||
| 456 | /* Offset into struct ata_device. Fields above it are maintained | 495 | /* Offset into struct ata_device. Fields above it are maintained |
| @@ -481,13 +520,13 @@ struct ata_eh_context { | |||
| 481 | }; | 520 | }; |
| 482 | 521 | ||
| 483 | struct ata_port { | 522 | struct ata_port { |
| 484 | struct Scsi_Host *host; /* our co-allocated scsi host */ | 523 | struct Scsi_Host *scsi_host; /* our co-allocated scsi host */ |
| 485 | const struct ata_port_operations *ops; | 524 | const struct ata_port_operations *ops; |
| 486 | spinlock_t *lock; | 525 | spinlock_t *lock; |
| 487 | unsigned long flags; /* ATA_FLAG_xxx */ | 526 | unsigned long flags; /* ATA_FLAG_xxx */ |
| 527 | unsigned int pflags; /* ATA_PFLAG_xxx */ | ||
| 488 | unsigned int id; /* unique id req'd by scsi midlyr */ | 528 | unsigned int id; /* unique id req'd by scsi midlyr */ |
| 489 | unsigned int port_no; /* unique port #; from zero */ | 529 | unsigned int port_no; /* unique port #; from zero */ |
| 490 | unsigned int hard_port_no; /* hardware port #; from zero */ | ||
| 491 | 530 | ||
| 492 | struct ata_prd *prd; /* our SG list */ | 531 | struct ata_prd *prd; /* our SG list */ |
| 493 | dma_addr_t prd_dma; /* and its DMA mapping */ | 532 | dma_addr_t prd_dma; /* and its DMA mapping */ |
| @@ -506,7 +545,7 @@ struct ata_port { | |||
| 506 | unsigned int hw_sata_spd_limit; | 545 | unsigned int hw_sata_spd_limit; |
| 507 | unsigned int sata_spd_limit; /* SATA PHY speed limit */ | 546 | unsigned int sata_spd_limit; /* SATA PHY speed limit */ |
| 508 | 547 | ||
| 509 | /* record runtime error info, protected by host_set lock */ | 548 | /* record runtime error info, protected by host lock */ |
| 510 | struct ata_eh_info eh_info; | 549 | struct ata_eh_info eh_info; |
| 511 | /* EH context owned by EH */ | 550 | /* EH context owned by EH */ |
| 512 | struct ata_eh_context eh_context; | 551 | struct ata_eh_context eh_context; |
| @@ -520,8 +559,8 @@ struct ata_port { | |||
| 520 | unsigned int active_tag; | 559 | unsigned int active_tag; |
| 521 | u32 sactive; | 560 | u32 sactive; |
| 522 | 561 | ||
| 523 | struct ata_host_stats stats; | 562 | struct ata_port_stats stats; |
| 524 | struct ata_host_set *host_set; | 563 | struct ata_host *host; |
| 525 | struct device *dev; | 564 | struct device *dev; |
| 526 | 565 | ||
| 527 | struct work_struct port_task; | 566 | struct work_struct port_task; |
| @@ -534,6 +573,9 @@ struct ata_port { | |||
| 534 | struct list_head eh_done_q; | 573 | struct list_head eh_done_q; |
| 535 | wait_queue_head_t eh_wait_q; | 574 | wait_queue_head_t eh_wait_q; |
| 536 | 575 | ||
| 576 | pm_message_t pm_mesg; | ||
| 577 | int *pm_result; | ||
| 578 | |||
| 537 | void *private_data; | 579 | void *private_data; |
| 538 | 580 | ||
| 539 | u8 sector_buf[ATA_SECT_SIZE]; /* owned by EH */ | 581 | u8 sector_buf[ATA_SECT_SIZE]; /* owned by EH */ |
| @@ -588,10 +630,13 @@ struct ata_port_operations { | |||
| 588 | void (*scr_write) (struct ata_port *ap, unsigned int sc_reg, | 630 | void (*scr_write) (struct ata_port *ap, unsigned int sc_reg, |
| 589 | u32 val); | 631 | u32 val); |
| 590 | 632 | ||
| 633 | int (*port_suspend) (struct ata_port *ap, pm_message_t mesg); | ||
| 634 | int (*port_resume) (struct ata_port *ap); | ||
| 635 | |||
| 591 | int (*port_start) (struct ata_port *ap); | 636 | int (*port_start) (struct ata_port *ap); |
| 592 | void (*port_stop) (struct ata_port *ap); | 637 | void (*port_stop) (struct ata_port *ap); |
| 593 | 638 | ||
| 594 | void (*host_stop) (struct ata_host_set *host_set); | 639 | void (*host_stop) (struct ata_host *host); |
| 595 | 640 | ||
| 596 | void (*bmdma_stop) (struct ata_queued_cmd *qc); | 641 | void (*bmdma_stop) (struct ata_queued_cmd *qc); |
| 597 | u8 (*bmdma_status) (struct ata_port *ap); | 642 | u8 (*bmdma_status) (struct ata_port *ap); |
| @@ -599,7 +644,7 @@ struct ata_port_operations { | |||
| 599 | 644 | ||
| 600 | struct ata_port_info { | 645 | struct ata_port_info { |
| 601 | struct scsi_host_template *sht; | 646 | struct scsi_host_template *sht; |
| 602 | unsigned long host_flags; | 647 | unsigned long flags; |
| 603 | unsigned long pio_mask; | 648 | unsigned long pio_mask; |
| 604 | unsigned long mwdma_mask; | 649 | unsigned long mwdma_mask; |
| 605 | unsigned long udma_mask; | 650 | unsigned long udma_mask; |
| @@ -621,9 +666,25 @@ struct ata_timing { | |||
| 621 | 666 | ||
| 622 | #define FIT(v,vmin,vmax) max_t(short,min_t(short,v,vmax),vmin) | 667 | #define FIT(v,vmin,vmax) max_t(short,min_t(short,v,vmax),vmin) |
| 623 | 668 | ||
| 624 | extern const unsigned long sata_deb_timing_boot[]; | 669 | extern const unsigned long sata_deb_timing_normal[]; |
| 625 | extern const unsigned long sata_deb_timing_eh[]; | 670 | extern const unsigned long sata_deb_timing_hotplug[]; |
| 626 | extern const unsigned long sata_deb_timing_before_fsrst[]; | 671 | extern const unsigned long sata_deb_timing_long[]; |
| 672 | |||
| 673 | extern const struct ata_port_operations ata_dummy_port_ops; | ||
| 674 | |||
| 675 | static inline const unsigned long * | ||
| 676 | sata_ehc_deb_timing(struct ata_eh_context *ehc) | ||
| 677 | { | ||
| 678 | if (ehc->i.flags & ATA_EHI_HOTPLUGGED) | ||
| 679 | return sata_deb_timing_hotplug; | ||
| 680 | else | ||
| 681 | return sata_deb_timing_normal; | ||
| 682 | } | ||
| 683 | |||
| 684 | static inline int ata_port_is_dummy(struct ata_port *ap) | ||
| 685 | { | ||
| 686 | return ap->ops == &ata_dummy_port_ops; | ||
| 687 | } | ||
| 627 | 688 | ||
| 628 | extern void ata_port_probe(struct ata_port *); | 689 | extern void ata_port_probe(struct ata_port *); |
| 629 | extern void __sata_phy_reset(struct ata_port *ap); | 690 | extern void __sata_phy_reset(struct ata_port *ap); |
| @@ -643,17 +704,30 @@ extern void ata_std_ports(struct ata_ioports *ioaddr); | |||
| 643 | extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, | 704 | extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, |
| 644 | unsigned int n_ports); | 705 | unsigned int n_ports); |
| 645 | extern void ata_pci_remove_one (struct pci_dev *pdev); | 706 | extern void ata_pci_remove_one (struct pci_dev *pdev); |
| 646 | extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t state); | 707 | extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg); |
| 708 | extern void ata_pci_device_do_resume(struct pci_dev *pdev); | ||
| 709 | extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); | ||
| 647 | extern int ata_pci_device_resume(struct pci_dev *pdev); | 710 | extern int ata_pci_device_resume(struct pci_dev *pdev); |
| 648 | extern int ata_pci_clear_simplex(struct pci_dev *pdev); | 711 | extern int ata_pci_clear_simplex(struct pci_dev *pdev); |
| 649 | #endif /* CONFIG_PCI */ | 712 | #endif /* CONFIG_PCI */ |
| 650 | extern int ata_device_add(const struct ata_probe_ent *ent); | 713 | extern int ata_device_add(const struct ata_probe_ent *ent); |
| 651 | extern void ata_port_detach(struct ata_port *ap); | 714 | extern void ata_port_detach(struct ata_port *ap); |
| 652 | extern void ata_host_set_remove(struct ata_host_set *host_set); | 715 | extern void ata_host_init(struct ata_host *, struct device *, |
| 716 | unsigned long, const struct ata_port_operations *); | ||
| 717 | extern void ata_host_remove(struct ata_host *host); | ||
| 653 | extern int ata_scsi_detect(struct scsi_host_template *sht); | 718 | extern int ata_scsi_detect(struct scsi_host_template *sht); |
| 654 | extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); | 719 | extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); |
| 655 | extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); | 720 | extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); |
| 656 | extern int ata_scsi_release(struct Scsi_Host *host); | 721 | extern int ata_scsi_release(struct Scsi_Host *host); |
| 722 | extern void ata_sas_port_destroy(struct ata_port *); | ||
| 723 | extern struct ata_port *ata_sas_port_alloc(struct ata_host *, | ||
| 724 | struct ata_port_info *, struct Scsi_Host *); | ||
| 725 | extern int ata_sas_port_init(struct ata_port *); | ||
| 726 | extern int ata_sas_port_start(struct ata_port *ap); | ||
| 727 | extern void ata_sas_port_stop(struct ata_port *ap); | ||
| 728 | extern int ata_sas_slave_configure(struct scsi_device *, struct ata_port *); | ||
| 729 | extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), | ||
| 730 | struct ata_port *ap); | ||
| 657 | extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); | 731 | extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); |
| 658 | extern int sata_scr_valid(struct ata_port *ap); | 732 | extern int sata_scr_valid(struct ata_port *ap); |
| 659 | extern int sata_scr_read(struct ata_port *ap, int reg, u32 *val); | 733 | extern int sata_scr_read(struct ata_port *ap, int reg, u32 *val); |
| @@ -662,9 +736,9 @@ extern int sata_scr_write_flush(struct ata_port *ap, int reg, u32 val); | |||
| 662 | extern int ata_port_online(struct ata_port *ap); | 736 | extern int ata_port_online(struct ata_port *ap); |
| 663 | extern int ata_port_offline(struct ata_port *ap); | 737 | extern int ata_port_offline(struct ata_port *ap); |
| 664 | extern int ata_scsi_device_resume(struct scsi_device *); | 738 | extern int ata_scsi_device_resume(struct scsi_device *); |
| 665 | extern int ata_scsi_device_suspend(struct scsi_device *, pm_message_t state); | 739 | extern int ata_scsi_device_suspend(struct scsi_device *, pm_message_t mesg); |
| 666 | extern int ata_device_resume(struct ata_device *); | 740 | extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg); |
| 667 | extern int ata_device_suspend(struct ata_device *, pm_message_t state); | 741 | extern void ata_host_resume(struct ata_host *host); |
| 668 | extern int ata_ratelimit(void); | 742 | extern int ata_ratelimit(void); |
| 669 | extern unsigned int ata_busy_sleep(struct ata_port *ap, | 743 | extern unsigned int ata_busy_sleep(struct ata_port *ap, |
| 670 | unsigned long timeout_pat, | 744 | unsigned long timeout_pat, |
| @@ -689,7 +763,7 @@ extern u8 ata_altstatus(struct ata_port *ap); | |||
| 689 | extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf); | 763 | extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf); |
| 690 | extern int ata_port_start (struct ata_port *ap); | 764 | extern int ata_port_start (struct ata_port *ap); |
| 691 | extern void ata_port_stop (struct ata_port *ap); | 765 | extern void ata_port_stop (struct ata_port *ap); |
| 692 | extern void ata_host_stop (struct ata_host_set *host_set); | 766 | extern void ata_host_stop (struct ata_host *host); |
| 693 | extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs); | 767 | extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs); |
| 694 | extern void ata_mmio_data_xfer(struct ata_device *adev, unsigned char *buf, | 768 | extern void ata_mmio_data_xfer(struct ata_device *adev, unsigned char *buf, |
| 695 | unsigned int buflen, int write_data); | 769 | unsigned int buflen, int write_data); |
| @@ -775,7 +849,7 @@ struct pci_bits { | |||
| 775 | unsigned long val; | 849 | unsigned long val; |
| 776 | }; | 850 | }; |
| 777 | 851 | ||
| 778 | extern void ata_pci_host_stop (struct ata_host_set *host_set); | 852 | extern void ata_pci_host_stop (struct ata_host *host); |
| 779 | extern struct ata_probe_ent * | 853 | extern struct ata_probe_ent * |
| 780 | ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int portmask); | 854 | ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int portmask); |
| 781 | extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits); | 855 | extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits); |
| @@ -824,19 +898,24 @@ extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
| 824 | (ehi)->desc_len = 0; \ | 898 | (ehi)->desc_len = 0; \ |
| 825 | } while (0) | 899 | } while (0) |
| 826 | 900 | ||
| 827 | static inline void ata_ehi_hotplugged(struct ata_eh_info *ehi) | 901 | static inline void __ata_ehi_hotplugged(struct ata_eh_info *ehi) |
| 828 | { | 902 | { |
| 829 | if (ehi->flags & ATA_EHI_HOTPLUGGED) | 903 | if (ehi->flags & ATA_EHI_HOTPLUGGED) |
| 830 | return; | 904 | return; |
| 831 | 905 | ||
| 832 | ehi->flags |= ATA_EHI_HOTPLUGGED; | 906 | ehi->flags |= ATA_EHI_HOTPLUGGED | ATA_EHI_RESUME_LINK; |
| 833 | ehi->hotplug_timestamp = jiffies; | 907 | ehi->hotplug_timestamp = jiffies; |
| 834 | 908 | ||
| 835 | ehi->err_mask |= AC_ERR_ATA_BUS; | ||
| 836 | ehi->action |= ATA_EH_SOFTRESET; | 909 | ehi->action |= ATA_EH_SOFTRESET; |
| 837 | ehi->probe_mask |= (1 << ATA_MAX_DEVICES) - 1; | 910 | ehi->probe_mask |= (1 << ATA_MAX_DEVICES) - 1; |
| 838 | } | 911 | } |
| 839 | 912 | ||
| 913 | static inline void ata_ehi_hotplugged(struct ata_eh_info *ehi) | ||
| 914 | { | ||
| 915 | __ata_ehi_hotplugged(ehi); | ||
| 916 | ehi->err_mask |= AC_ERR_ATA_BUS; | ||
| 917 | } | ||
| 918 | |||
| 840 | /* | 919 | /* |
| 841 | * qc helpers | 920 | * qc helpers |
| 842 | */ | 921 | */ |
| @@ -887,6 +966,9 @@ static inline unsigned int ata_tag_internal(unsigned int tag) | |||
| 887 | return tag == ATA_MAX_QUEUE - 1; | 966 | return tag == ATA_MAX_QUEUE - 1; |
| 888 | } | 967 | } |
| 889 | 968 | ||
| 969 | /* | ||
| 970 | * device helpers | ||
| 971 | */ | ||
| 890 | static inline unsigned int ata_class_enabled(unsigned int class) | 972 | static inline unsigned int ata_class_enabled(unsigned int class) |
| 891 | { | 973 | { |
| 892 | return class == ATA_DEV_ATA || class == ATA_DEV_ATAPI; | 974 | return class == ATA_DEV_ATA || class == ATA_DEV_ATAPI; |
| @@ -917,6 +999,22 @@ static inline unsigned int ata_dev_absent(const struct ata_device *dev) | |||
| 917 | return ata_class_absent(dev->class); | 999 | return ata_class_absent(dev->class); |
| 918 | } | 1000 | } |
| 919 | 1001 | ||
| 1002 | static inline unsigned int ata_dev_ready(const struct ata_device *dev) | ||
| 1003 | { | ||
| 1004 | return ata_dev_enabled(dev) && !(dev->flags & ATA_DFLAG_SUSPENDED); | ||
| 1005 | } | ||
| 1006 | |||
| 1007 | /* | ||
| 1008 | * port helpers | ||
| 1009 | */ | ||
| 1010 | static inline int ata_port_max_devices(const struct ata_port *ap) | ||
| 1011 | { | ||
| 1012 | if (ap->flags & ATA_FLAG_SLAVE_POSS) | ||
| 1013 | return 2; | ||
| 1014 | return 1; | ||
| 1015 | } | ||
| 1016 | |||
| 1017 | |||
| 920 | static inline u8 ata_chk_status(struct ata_port *ap) | 1018 | static inline u8 ata_chk_status(struct ata_port *ap) |
| 921 | { | 1019 | { |
| 922 | return ap->ops->check_status(ap); | 1020 | return ap->ops->check_status(ap); |
