From d66bf08586df78535a88a36b5e6ca468ab1834ee Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Wed, 23 Feb 2005 04:47:10 -0500 Subject: [libata] Add missing hooks, to avoid oops in advanced SATA drivers Advanced SATA drivers should not (and cannot) use the basic PCI IDE hooks for checking the Status and Error registers, as these registers are either in non-standard locations, or simply don't exist. In the error handling path, libata was unconditionally calling some PCI IDE hardware bitbanging functions, which would cause an oops in the AHCI driver and any other advanced libata driver. --- include/linux/libata.h | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'include/linux') diff --git a/include/linux/libata.h b/include/linux/libata.h index 10207ce48f04..505160ab472b 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -334,6 +334,8 @@ struct ata_port_operations { void (*exec_command)(struct ata_port *ap, struct ata_taskfile *tf); u8 (*check_status)(struct ata_port *ap); + u8 (*check_altstatus)(struct ata_port *ap); + u8 (*check_err)(struct ata_port *ap); void (*dev_select)(struct ata_port *ap, unsigned int device); void (*phy_reset) (struct ata_port *ap); @@ -403,6 +405,8 @@ extern void ata_tf_from_fis(u8 *fis, struct ata_taskfile *tf); extern void ata_noop_dev_select (struct ata_port *ap, unsigned int device); extern void ata_std_dev_select (struct ata_port *ap, unsigned int device); extern u8 ata_check_status(struct ata_port *ap); +extern u8 ata_altstatus(struct ata_port *ap); +extern u8 ata_chk_err(struct ata_port *ap); extern void ata_exec_command(struct ata_port *ap, struct ata_taskfile *tf); extern int ata_port_start (struct ata_port *ap); extern void ata_port_stop (struct ata_port *ap); @@ -457,26 +461,11 @@ static inline unsigned int ata_dev_present(struct ata_device *dev) (dev->class == ATA_DEV_ATAPI)); } -static inline u8 ata_chk_err(struct ata_port *ap) -{ - if (ap->flags & ATA_FLAG_MMIO) { - return readb((void __iomem *) ap->ioaddr.error_addr); - } - return inb(ap->ioaddr.error_addr); -} - static inline u8 ata_chk_status(struct ata_port *ap) { return ap->ops->check_status(ap); } -static inline u8 ata_altstatus(struct ata_port *ap) -{ - if (ap->flags & ATA_FLAG_MMIO) - return readb((void __iomem *)ap->ioaddr.altstatus_addr); - return inb(ap->ioaddr.altstatus_addr); -} - static inline void ata_pause(struct ata_port *ap) { ata_altstatus(ap); -- cgit v1.2.3