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.h98
1 files changed, 68 insertions, 30 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 66c3100c2b94..d6a3d4b345fc 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -37,6 +37,16 @@
37#include <scsi/scsi_host.h> 37#include <scsi/scsi_host.h>
38 38
39/* 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/*
40 * 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
41 * converted to the new debugging mechanism 51 * converted to the new debugging mechanism
42 */ 52 */
@@ -44,7 +54,7 @@
44#undef ATA_VERBOSE_DEBUG /* yet more debugging output */ 54#undef ATA_VERBOSE_DEBUG /* yet more debugging output */
45#undef ATA_IRQ_TRAP /* define to ack screaming irqs */ 55#undef ATA_IRQ_TRAP /* define to ack screaming irqs */
46#undef ATA_NDEBUG /* define to disable quick runtime checks */ 56#undef ATA_NDEBUG /* define to disable quick runtime checks */
47#undef ATA_ENABLE_PATA /* define to enable PATA support in some 57#define ATA_ENABLE_PATA /* define to enable PATA support in some
48 * low-level drivers */ 58 * low-level drivers */
49 59
50 60
@@ -112,8 +122,6 @@ enum {
112 /* tag ATA_MAX_QUEUE - 1 is reserved for internal commands */ 122 /* tag ATA_MAX_QUEUE - 1 is reserved for internal commands */
113 ATA_MAX_QUEUE = 32, 123 ATA_MAX_QUEUE = 32,
114 ATA_TAG_INTERNAL = ATA_MAX_QUEUE - 1, 124 ATA_TAG_INTERNAL = ATA_MAX_QUEUE - 1,
115 ATA_MAX_SECTORS = 200, /* FIXME */
116 ATA_MAX_SECTORS_LBA48 = 65535,
117 ATA_MAX_BUS = 2, 125 ATA_MAX_BUS = 2,
118 ATA_DEF_BUSY_WAIT = 10000, 126 ATA_DEF_BUSY_WAIT = 10000,
119 ATA_SHORT_PAUSE = (HZ >> 6) + 1, 127 ATA_SHORT_PAUSE = (HZ >> 6) + 1,
@@ -197,8 +205,8 @@ enum {
197 ATA_QCFLAG_EH_SCHEDULED = (1 << 18), /* EH scheduled (obsolete) */ 205 ATA_QCFLAG_EH_SCHEDULED = (1 << 18), /* EH scheduled (obsolete) */
198 206
199 /* host set flags */ 207 /* host set flags */
200 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 */
201 209
202 /* various lengths of time */ 210 /* various lengths of time */
203 ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */ 211 ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */
204 ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */ 212 ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */
@@ -225,8 +233,8 @@ enum {
225 /* encoding various smaller bitmaps into a single 233 /* encoding various smaller bitmaps into a single
226 * unsigned int bitmap 234 * unsigned int bitmap
227 */ 235 */
228 ATA_BITS_PIO = 5, 236 ATA_BITS_PIO = 7,
229 ATA_BITS_MWDMA = 3, 237 ATA_BITS_MWDMA = 5,
230 ATA_BITS_UDMA = 8, 238 ATA_BITS_UDMA = 8,
231 239
232 ATA_SHIFT_PIO = 0, 240 ATA_SHIFT_PIO = 0,
@@ -289,6 +297,11 @@ enum {
289 * most devices. 297 * most devices.
290 */ 298 */
291 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 */
292}; 305};
293 306
294enum hsm_task_states { 307enum hsm_task_states {
@@ -350,23 +363,32 @@ struct ata_probe_ent {
350 struct scsi_host_template *sht; 363 struct scsi_host_template *sht;
351 struct ata_ioports port[ATA_MAX_PORTS]; 364 struct ata_ioports port[ATA_MAX_PORTS];
352 unsigned int n_ports; 365 unsigned int n_ports;
353 unsigned int hard_port_no; 366 unsigned int dummy_port_mask;
354 unsigned int pio_mask; 367 unsigned int pio_mask;
355 unsigned int mwdma_mask; 368 unsigned int mwdma_mask;
356 unsigned int udma_mask; 369 unsigned int udma_mask;
357 unsigned int legacy_mode;
358 unsigned long irq; 370 unsigned long irq;
371 unsigned long irq2;
359 unsigned int irq_flags; 372 unsigned int irq_flags;
360 unsigned long host_flags; 373 unsigned long port_flags;
361 unsigned long host_set_flags; 374 unsigned long _host_flags;
362 void __iomem *mmio_base; 375 void __iomem *mmio_base;
363 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;
364}; 385};
365 386
366struct ata_host_set { 387struct ata_host {
367 spinlock_t lock; 388 spinlock_t lock;
368 struct device *dev; 389 struct device *dev;
369 unsigned long irq; 390 unsigned long irq;
391 unsigned long irq2;
370 void __iomem *mmio_base; 392 void __iomem *mmio_base;
371 unsigned int n_ports; 393 unsigned int n_ports;
372 void *private_data; 394 void *private_data;
@@ -374,7 +396,6 @@ struct ata_host_set {
374 unsigned long flags; 396 unsigned long flags;
375 int simplex_claimed; /* Keep seperate in case we 397 int simplex_claimed; /* Keep seperate in case we
376 ever need to do this locked */ 398 ever need to do this locked */
377 struct ata_host_set *next; /* for legacy mode */
378 struct ata_port *ports[0]; 399 struct ata_port *ports[0];
379}; 400};
380 401
@@ -420,7 +441,7 @@ struct ata_queued_cmd {
420 void *private_data; 441 void *private_data;
421}; 442};
422 443
423struct ata_host_stats { 444struct ata_port_stats {
424 unsigned long unhandled_irq; 445 unsigned long unhandled_irq;
425 unsigned long idle_irq; 446 unsigned long idle_irq;
426 unsigned long rw_reqbuf; 447 unsigned long rw_reqbuf;
@@ -468,6 +489,7 @@ struct ata_device {
468 489
469 /* error history */ 490 /* error history */
470 struct ata_ering ering; 491 struct ata_ering ering;
492 unsigned int horkage; /* List of broken features */
471}; 493};
472 494
473/* Offset into struct ata_device. Fields above it are maintained 495/* Offset into struct ata_device. Fields above it are maintained
@@ -498,14 +520,13 @@ struct ata_eh_context {
498}; 520};
499 521
500struct ata_port { 522struct ata_port {
501 struct Scsi_Host *host; /* our co-allocated scsi host */ 523 struct Scsi_Host *scsi_host; /* our co-allocated scsi host */
502 const struct ata_port_operations *ops; 524 const struct ata_port_operations *ops;
503 spinlock_t *lock; 525 spinlock_t *lock;
504 unsigned long flags; /* ATA_FLAG_xxx */ 526 unsigned long flags; /* ATA_FLAG_xxx */
505 unsigned int pflags; /* ATA_PFLAG_xxx */ 527 unsigned int pflags; /* ATA_PFLAG_xxx */
506 unsigned int id; /* unique id req'd by scsi midlyr */ 528 unsigned int id; /* unique id req'd by scsi midlyr */
507 unsigned int port_no; /* unique port #; from zero */ 529 unsigned int port_no; /* unique port #; from zero */
508 unsigned int hard_port_no; /* hardware port #; from zero */
509 530
510 struct ata_prd *prd; /* our SG list */ 531 struct ata_prd *prd; /* our SG list */
511 dma_addr_t prd_dma; /* and its DMA mapping */ 532 dma_addr_t prd_dma; /* and its DMA mapping */
@@ -524,7 +545,7 @@ struct ata_port {
524 unsigned int hw_sata_spd_limit; 545 unsigned int hw_sata_spd_limit;
525 unsigned int sata_spd_limit; /* SATA PHY speed limit */ 546 unsigned int sata_spd_limit; /* SATA PHY speed limit */
526 547
527 /* record runtime error info, protected by host_set lock */ 548 /* record runtime error info, protected by host lock */
528 struct ata_eh_info eh_info; 549 struct ata_eh_info eh_info;
529 /* EH context owned by EH */ 550 /* EH context owned by EH */
530 struct ata_eh_context eh_context; 551 struct ata_eh_context eh_context;
@@ -538,8 +559,8 @@ struct ata_port {
538 unsigned int active_tag; 559 unsigned int active_tag;
539 u32 sactive; 560 u32 sactive;
540 561
541 struct ata_host_stats stats; 562 struct ata_port_stats stats;
542 struct ata_host_set *host_set; 563 struct ata_host *host;
543 struct device *dev; 564 struct device *dev;
544 565
545 struct work_struct port_task; 566 struct work_struct port_task;
@@ -615,7 +636,7 @@ struct ata_port_operations {
615 int (*port_start) (struct ata_port *ap); 636 int (*port_start) (struct ata_port *ap);
616 void (*port_stop) (struct ata_port *ap); 637 void (*port_stop) (struct ata_port *ap);
617 638
618 void (*host_stop) (struct ata_host_set *host_set); 639 void (*host_stop) (struct ata_host *host);
619 640
620 void (*bmdma_stop) (struct ata_queued_cmd *qc); 641 void (*bmdma_stop) (struct ata_queued_cmd *qc);
621 u8 (*bmdma_status) (struct ata_port *ap); 642 u8 (*bmdma_status) (struct ata_port *ap);
@@ -623,7 +644,7 @@ struct ata_port_operations {
623 644
624struct ata_port_info { 645struct ata_port_info {
625 struct scsi_host_template *sht; 646 struct scsi_host_template *sht;
626 unsigned long host_flags; 647 unsigned long flags;
627 unsigned long pio_mask; 648 unsigned long pio_mask;
628 unsigned long mwdma_mask; 649 unsigned long mwdma_mask;
629 unsigned long udma_mask; 650 unsigned long udma_mask;
@@ -649,6 +670,8 @@ extern const unsigned long sata_deb_timing_normal[];
649extern const unsigned long sata_deb_timing_hotplug[]; 670extern const unsigned long sata_deb_timing_hotplug[];
650extern const unsigned long sata_deb_timing_long[]; 671extern const unsigned long sata_deb_timing_long[];
651 672
673extern const struct ata_port_operations ata_dummy_port_ops;
674
652static inline const unsigned long * 675static inline const unsigned long *
653sata_ehc_deb_timing(struct ata_eh_context *ehc) 676sata_ehc_deb_timing(struct ata_eh_context *ehc)
654{ 677{
@@ -658,6 +681,11 @@ sata_ehc_deb_timing(struct ata_eh_context *ehc)
658 return sata_deb_timing_normal; 681 return sata_deb_timing_normal;
659} 682}
660 683
684static inline int ata_port_is_dummy(struct ata_port *ap)
685{
686 return ap->ops == &ata_dummy_port_ops;
687}
688
661extern void ata_port_probe(struct ata_port *); 689extern void ata_port_probe(struct ata_port *);
662extern void __sata_phy_reset(struct ata_port *ap); 690extern void __sata_phy_reset(struct ata_port *ap);
663extern void sata_phy_reset(struct ata_port *ap); 691extern void sata_phy_reset(struct ata_port *ap);
@@ -676,19 +704,30 @@ extern void ata_std_ports(struct ata_ioports *ioaddr);
676extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, 704extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
677 unsigned int n_ports); 705 unsigned int n_ports);
678extern void ata_pci_remove_one (struct pci_dev *pdev); 706extern void ata_pci_remove_one (struct pci_dev *pdev);
679extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t state); 707extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg);
680extern void ata_pci_device_do_resume(struct pci_dev *pdev); 708extern void ata_pci_device_do_resume(struct pci_dev *pdev);
681extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t state); 709extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
682extern int ata_pci_device_resume(struct pci_dev *pdev); 710extern int ata_pci_device_resume(struct pci_dev *pdev);
683extern int ata_pci_clear_simplex(struct pci_dev *pdev); 711extern int ata_pci_clear_simplex(struct pci_dev *pdev);
684#endif /* CONFIG_PCI */ 712#endif /* CONFIG_PCI */
685extern int ata_device_add(const struct ata_probe_ent *ent); 713extern int ata_device_add(const struct ata_probe_ent *ent);
686extern void ata_port_detach(struct ata_port *ap); 714extern void ata_port_detach(struct ata_port *ap);
687extern void ata_host_set_remove(struct ata_host_set *host_set); 715extern void ata_host_init(struct ata_host *, struct device *,
716 unsigned long, const struct ata_port_operations *);
717extern void ata_host_remove(struct ata_host *host);
688extern int ata_scsi_detect(struct scsi_host_template *sht); 718extern int ata_scsi_detect(struct scsi_host_template *sht);
689extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); 719extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg);
690extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); 720extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *));
691extern int ata_scsi_release(struct Scsi_Host *host); 721extern int ata_scsi_release(struct Scsi_Host *host);
722extern void ata_sas_port_destroy(struct ata_port *);
723extern struct ata_port *ata_sas_port_alloc(struct ata_host *,
724 struct ata_port_info *, struct Scsi_Host *);
725extern int ata_sas_port_init(struct ata_port *);
726extern int ata_sas_port_start(struct ata_port *ap);
727extern void ata_sas_port_stop(struct ata_port *ap);
728extern int ata_sas_slave_configure(struct scsi_device *, struct ata_port *);
729extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *),
730 struct ata_port *ap);
692extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); 731extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc);
693extern int sata_scr_valid(struct ata_port *ap); 732extern int sata_scr_valid(struct ata_port *ap);
694extern int sata_scr_read(struct ata_port *ap, int reg, u32 *val); 733extern int sata_scr_read(struct ata_port *ap, int reg, u32 *val);
@@ -697,10 +736,9 @@ extern int sata_scr_write_flush(struct ata_port *ap, int reg, u32 val);
697extern int ata_port_online(struct ata_port *ap); 736extern int ata_port_online(struct ata_port *ap);
698extern int ata_port_offline(struct ata_port *ap); 737extern int ata_port_offline(struct ata_port *ap);
699extern int ata_scsi_device_resume(struct scsi_device *); 738extern int ata_scsi_device_resume(struct scsi_device *);
700extern int ata_scsi_device_suspend(struct scsi_device *, pm_message_t state); 739extern int ata_scsi_device_suspend(struct scsi_device *, pm_message_t mesg);
701extern int ata_host_set_suspend(struct ata_host_set *host_set, 740extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg);
702 pm_message_t mesg); 741extern void ata_host_resume(struct ata_host *host);
703extern void ata_host_set_resume(struct ata_host_set *host_set);
704extern int ata_ratelimit(void); 742extern int ata_ratelimit(void);
705extern unsigned int ata_busy_sleep(struct ata_port *ap, 743extern unsigned int ata_busy_sleep(struct ata_port *ap,
706 unsigned long timeout_pat, 744 unsigned long timeout_pat,
@@ -725,7 +763,7 @@ extern u8 ata_altstatus(struct ata_port *ap);
725extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf); 763extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf);
726extern int ata_port_start (struct ata_port *ap); 764extern int ata_port_start (struct ata_port *ap);
727extern void ata_port_stop (struct ata_port *ap); 765extern void ata_port_stop (struct ata_port *ap);
728extern void ata_host_stop (struct ata_host_set *host_set); 766extern void ata_host_stop (struct ata_host *host);
729extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs); 767extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs);
730extern void ata_mmio_data_xfer(struct ata_device *adev, unsigned char *buf, 768extern void ata_mmio_data_xfer(struct ata_device *adev, unsigned char *buf,
731 unsigned int buflen, int write_data); 769 unsigned int buflen, int write_data);
@@ -811,7 +849,7 @@ struct pci_bits {
811 unsigned long val; 849 unsigned long val;
812}; 850};
813 851
814extern void ata_pci_host_stop (struct ata_host_set *host_set); 852extern void ata_pci_host_stop (struct ata_host *host);
815extern struct ata_probe_ent * 853extern struct ata_probe_ent *
816ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int portmask); 854ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int portmask);
817extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits); 855extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits);