From 1b678347121001c3c230c6eccfdf9f65c3ec1a4e Mon Sep 17 00:00:00 2001 From: Benjamin Herrenschmidt Date: Fri, 19 Oct 2007 00:30:05 +0200 Subject: ide: Add ide_get_paired_drive() helper This adds a helper to get to the "other" drive on a pair connected to a given hwif. Signed-off-by: Benjamin Herrenschmidt Cc: Andrew Morton Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- include/linux/ide.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include') diff --git a/include/linux/ide.h b/include/linux/ide.h index e39ee2f..69dbe7d 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -1454,4 +1454,11 @@ static inline int hwif_to_node(ide_hwif_t *hwif) return dev ? pcibus_to_node(dev->bus) : -1; } +static inline ide_drive_t *ide_get_paired_drive(ide_drive_t *drive) +{ + ide_hwif_t *hwif = HWIF(drive); + + return &hwif->drives[(drive->dn ^ 1) & 1]; +} + #endif /* _IDE_H */ -- cgit v1.1 From 33c1002ed912ac9dacedd5d5b166da3b72d18460 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 19 Oct 2007 00:30:06 +0200 Subject: ide: add IDE_HFLAG_NO_ATAPI_DMA host flag Add IDE_HFLAG_NO_ATAPI_DMA host flag and set it in host drivers which don't support ATAPI DMA. Then remove no longer needed hwif->atapi_dma. Signed-off-by: Bartlomiej Zolnierkiewicz --- include/linux/ide.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/ide.h b/include/linux/ide.h index 69dbe7d..e44ecc9 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -685,7 +685,6 @@ typedef struct hwif_s { u8 pio_mask; - u8 atapi_dma; /* host supports atapi_dma */ u8 ultra_mask; u8 mwdma_mask; u8 swdma_mask; @@ -1258,6 +1257,8 @@ enum { IDE_HFLAG_TRUST_BIOS_FOR_DMA = (1 << 10), /* host uses VDMA */ IDE_HFLAG_VDMA = (1 << 11), + /* ATAPI DMA is unsupported */ + IDE_HFLAG_NO_ATAPI_DMA = (1 << 12), }; typedef struct ide_pci_device_s { -- cgit v1.1 From 7cab14a79973893392111b8f887856a54621f759 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 19 Oct 2007 00:30:06 +0200 Subject: ide: add IDE_HFLAG_BOOTABLE host flag Add IDE_HFLAG_BOOTABLE host flag and IDE_HFLAG_OFF_BOARD define. Convert all host drivers using ide_pci_device_t to use IDE_HFLAG_{BOOTABLE,OFF_BOARD} instead of d->bootable and then remove no longer needed d->bootable. Signed-off-by: Bartlomiej Zolnierkiewicz --- include/linux/ide.h | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/linux/ide.h b/include/linux/ide.h index e44ecc9..575bf81 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -1210,15 +1210,6 @@ extern void default_hwif_iops(ide_hwif_t *); extern void default_hwif_mmiops(ide_hwif_t *); extern void default_hwif_transport(ide_hwif_t *); -#define ON_BOARD 1 -#define NEVER_BOARD 0 - -#ifdef CONFIG_BLK_DEV_OFFBOARD -# define OFF_BOARD ON_BOARD -#else /* CONFIG_BLK_DEV_OFFBOARD */ -# define OFF_BOARD NEVER_BOARD -#endif /* CONFIG_BLK_DEV_OFFBOARD */ - #define NODMA 0 #define NOAUTODMA 1 #define AUTODMA 2 @@ -1259,8 +1250,16 @@ enum { IDE_HFLAG_VDMA = (1 << 11), /* ATAPI DMA is unsupported */ IDE_HFLAG_NO_ATAPI_DMA = (1 << 12), + /* set if host is a "bootable" controller */ + IDE_HFLAG_BOOTABLE = (1 << 13), }; +#ifdef CONFIG_BLK_DEV_OFFBOARD +# define IDE_HFLAG_OFF_BOARD IDE_HFLAG_BOOTABLE +#else +# define IDE_HFLAG_OFF_BOARD 0 +#endif + typedef struct ide_pci_device_s { char *name; int (*init_setup)(struct pci_dev *, struct ide_pci_device_s *); @@ -1272,7 +1271,6 @@ typedef struct ide_pci_device_s { void (*fixup)(ide_hwif_t *); u8 autodma; ide_pci_enablebit_t enablebits[2]; - u8 bootable; unsigned int extra; struct ide_pci_device_s *next; u16 host_flags; -- cgit v1.1 From 47b687882c02f802dd5bbe1227effe006820246e Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 19 Oct 2007 00:30:06 +0200 Subject: ide: add IDE_HFLAG_NO_{DMA,AUTODMA} host flags Add IDE_HFLAG_NO_{DMA,AUTODMA} host flags. Convert all host drivers using ide_pci_device_t to use these flags instead of d->autodma and then remove no longer needed d->autodma. Signed-off-by: Bartlomiej Zolnierkiewicz --- include/linux/ide.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/linux/ide.h b/include/linux/ide.h index 575bf81..6f375e0 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -1210,10 +1210,6 @@ extern void default_hwif_iops(ide_hwif_t *); extern void default_hwif_mmiops(ide_hwif_t *); extern void default_hwif_transport(ide_hwif_t *); -#define NODMA 0 -#define NOAUTODMA 1 -#define AUTODMA 2 - typedef struct ide_pci_enablebit_s { u8 reg; /* byte pci reg holding the enable-bit */ u8 mask; /* mask to isolate the enable-bit */ @@ -1252,6 +1248,10 @@ enum { IDE_HFLAG_NO_ATAPI_DMA = (1 << 12), /* set if host is a "bootable" controller */ IDE_HFLAG_BOOTABLE = (1 << 13), + /* host doesn't support DMA */ + IDE_HFLAG_NO_DMA = (1 << 14), + /* check if host is PCI IDE device before allowing DMA */ + IDE_HFLAG_NO_AUTODMA = (1 << 15), }; #ifdef CONFIG_BLK_DEV_OFFBOARD @@ -1269,7 +1269,6 @@ typedef struct ide_pci_device_s { void (*init_hwif)(ide_hwif_t *); void (*init_dma)(ide_hwif_t *, unsigned long); void (*fixup)(ide_hwif_t *); - u8 autodma; ide_pci_enablebit_t enablebits[2]; unsigned int extra; struct ide_pci_device_s *next; -- cgit v1.1 From 9ffcf364f9d0aca3ea79e9987c368eb75925460e Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 19 Oct 2007 00:30:07 +0200 Subject: ide: remove ->init_setup_dma from ide_pci_device_t (take 2) * Make ide_pci_device_t.host_flags u32 and add IDE_HFLAG_CS5520 host flag. * Pass ide_pci_device_t *d to setup-pci.c::ide_get_or_set_dma_base() and use d->name instead of hwif->cds->name. * Set IDE_HFLAG_CS5520 host flag in cs5520 host driver and use it in ide_get_or_set_dma_base() to find out which PCI BAR to use, remove no longer needed cs5520.c::cs5520_init_setup_dma() and ide_pci_device_t.init_setup_dma. This fixes PCI bus-mastering not being checked for CS5510/CS5520 hosts. v2: * It is wrong to check simplex bits on CS5510/CS5520 as v1 did. (Noticed by Alan). Cc: Alan Cox Cc: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- include/linux/ide.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/linux/ide.h b/include/linux/ide.h index 6f375e0..b721f0b 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -1252,6 +1252,8 @@ enum { IDE_HFLAG_NO_DMA = (1 << 14), /* check if host is PCI IDE device before allowing DMA */ IDE_HFLAG_NO_AUTODMA = (1 << 15), + /* host is CS5510/CS5520 */ + IDE_HFLAG_CS5520 = (1 << 16), }; #ifdef CONFIG_BLK_DEV_OFFBOARD @@ -1263,7 +1265,6 @@ enum { typedef struct ide_pci_device_s { char *name; int (*init_setup)(struct pci_dev *, struct ide_pci_device_s *); - void (*init_setup_dma)(struct pci_dev *, struct ide_pci_device_s *, ide_hwif_t *); unsigned int (*init_chipset)(struct pci_dev *, const char *); void (*init_iops)(ide_hwif_t *); void (*init_hwif)(ide_hwif_t *); @@ -1272,7 +1273,7 @@ typedef struct ide_pci_device_s { ide_pci_enablebit_t enablebits[2]; unsigned int extra; struct ide_pci_device_s *next; - u16 host_flags; + u32 host_flags; u8 pio_mask; u8 udma_mask; } ide_pci_device_t; -- cgit v1.1 From 238e4f142c33bb34440cc64029dde7b9fbc4e65f Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 19 Oct 2007 00:30:07 +0200 Subject: ide: add IDE_HFLAG_NO_LBA48 and IDE_HFLAG_NO_LBA48_DMA host flags Add IDE_HFLAG_NO_LBA48[_DMA] host flags, use it instead of hwif->no_lba48[_dma] and then remove no longer needed hwif->no_lba48[_dma]. As a side-effect this change fixes hwif->no_lba48_dma not being restored by ide_hwif_restore(). Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- include/linux/ide.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/linux/ide.h b/include/linux/ide.h index b721f0b..dced2e1 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -796,8 +796,6 @@ typedef struct hwif_s { unsigned serialized : 1; /* serialized all channel operation */ unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ unsigned reset : 1; /* reset after probe */ - unsigned no_lba48 : 1; /* 1 = cannot do LBA48 */ - unsigned no_lba48_dma : 1; /* 1 = cannot do LBA48 DMA */ unsigned auto_poll : 1; /* supports nop auto-poll */ unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ unsigned no_io_32bit : 1; /* 1 = can not do 32-bit IO ops */ @@ -1254,6 +1252,10 @@ enum { IDE_HFLAG_NO_AUTODMA = (1 << 15), /* host is CS5510/CS5520 */ IDE_HFLAG_CS5520 = (1 << 16), + /* no LBA48 */ + IDE_HFLAG_NO_LBA48 = (1 << 17), + /* no LBA48 DMA */ + IDE_HFLAG_NO_LBA48_DMA = (1 << 18), }; #ifdef CONFIG_BLK_DEV_OFFBOARD -- cgit v1.1 From 5f8b6c34854a966fe5eb7241fde0419d47d5d408 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 19 Oct 2007 00:30:07 +0200 Subject: ide: add ->mwdma_mask and ->swdma_mask to ide_pci_device_t (take 2) * Add ->mwdma_mask and ->swdma_mask to ide_pci_device_t. * Set ide_hwif_t DMA masks using DMA masks from ide_pci_device_t in setup-pci.c::ide_pci_setup_ports() (iff DMA base is valid and ->init_hwif method may still override them). * Convert IDE PCI host drivers to use ide_pci_device_t DMA masks. While at it: * Use ATA_{UDMA,MWDMA,SWDMA}* defines. * hpt34x.c: add separate ide_pci_device_t instances for HPT343 and HPT345. * serverworks.c: fix DMA masks being set before checking DMA base. v2: * Add missing masks to DECLARE_GENERIC_PCI_DEV() macro. Signed-off-by: Bartlomiej Zolnierkiewicz --- include/linux/ide.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/linux/ide.h b/include/linux/ide.h index dced2e1..8766265 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -1277,6 +1277,8 @@ typedef struct ide_pci_device_s { struct ide_pci_device_s *next; u32 host_flags; u8 pio_mask; + u8 swdma_mask; + u8 mwdma_mask; u8 udma_mask; } ide_pci_device_t; -- cgit v1.1 From 942278ef6424c5d661ad0a8202ef60dc0f268a95 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 19 Oct 2007 00:30:09 +0200 Subject: ide: remove .init_setup from ide_pci_device_t Now that all users were fixed we can safely remove it. Signed-off-by: Bartlomiej Zolnierkiewicz --- include/linux/ide.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/linux/ide.h b/include/linux/ide.h index 8766265..eced442 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -1266,7 +1266,6 @@ enum { typedef struct ide_pci_device_s { char *name; - int (*init_setup)(struct pci_dev *, struct ide_pci_device_s *); unsigned int (*init_chipset)(struct pci_dev *, const char *); void (*init_iops)(ide_hwif_t *); void (*init_hwif)(ide_hwif_t *); -- cgit v1.1 From ed67b92385a5afddc98d5ff0894b2854c4a54dac Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 19 Oct 2007 00:30:10 +0200 Subject: ide: add IDE_HFLAG_ERROR_STOPS_FIFO host flag Add IDE_HFLAG_ERROR_STOPS_FIFO host flag and use it instead of hwif->err_stops_fifo. As a side-effect this change fixes hwif->err_stops_fifo not being restored by ide_hwif_restore(). Signed-off-by: Bartlomiej Zolnierkiewicz --- include/linux/ide.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/ide.h b/include/linux/ide.h index eced442..b12510d 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -799,7 +799,6 @@ typedef struct hwif_s { unsigned auto_poll : 1; /* supports nop auto-poll */ unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ unsigned no_io_32bit : 1; /* 1 = can not do 32-bit IO ops */ - unsigned err_stops_fifo : 1; /* 1=data FIFO is cleared by an error */ unsigned mmio : 1; /* host uses MMIO */ struct device gendev; @@ -1256,6 +1255,8 @@ enum { IDE_HFLAG_NO_LBA48 = (1 << 17), /* no LBA48 DMA */ IDE_HFLAG_NO_LBA48_DMA = (1 << 18), + /* data FIFO is cleared by an error */ + IDE_HFLAG_ERROR_STOPS_FIFO = (1 << 19), }; #ifdef CONFIG_BLK_DEV_OFFBOARD -- cgit v1.1 From 1c51361a9867021dd7444b56d87834003d4ca67d Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 19 Oct 2007 00:30:10 +0200 Subject: ide: add IDE_HFLAG_SERIALIZE host flag Add IDE_HFLAG_SERIALIZE host flag to tell ide_pci_setup_ports() to set hwif/mate->serialized and convert aec62xx, cs5530 and sc1200 host drivers to use it. Signed-off-by: Bartlomiej Zolnierkiewicz --- include/linux/ide.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/linux/ide.h b/include/linux/ide.h index b12510d..659b60a 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -1257,6 +1257,8 @@ enum { IDE_HFLAG_NO_LBA48_DMA = (1 << 18), /* data FIFO is cleared by an error */ IDE_HFLAG_ERROR_STOPS_FIFO = (1 << 19), + /* serialize ports */ + IDE_HFLAG_SERIALIZE = (1 << 20), }; #ifdef CONFIG_BLK_DEV_OFFBOARD -- cgit v1.1 From 3985ee3b4c5f9e1d73623b92715375b089c54353 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 19 Oct 2007 00:30:11 +0200 Subject: ide: add IDE_HFLAG_LEGACY_IRQS host flag Add IDE_HFLAG_LEGACY_IRQS host flag to tell ide_pci_setup_ports() to set hwif->irq to legacy IRQ 14/15 (iff hwif->irq is not already set) and convert atiixp, piix, serverworks, sis5513 and slc90e66 host drivers to use it. While at it: * In piix.c add IDE_HFLAGS_PIIX define and don't use ->init_hwif for MPIIX. Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- include/linux/ide.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/linux/ide.h b/include/linux/ide.h index 659b60a..19db0a4 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -1259,6 +1259,8 @@ enum { IDE_HFLAG_ERROR_STOPS_FIFO = (1 << 19), /* serialize ports */ IDE_HFLAG_SERIALIZE = (1 << 20), + /* use legacy IRQs */ + IDE_HFLAG_LEGACY_IRQS = (1 << 21), }; #ifdef CONFIG_BLK_DEV_OFFBOARD -- cgit v1.1