ide: switch to generic DMA-mapping API
cover ide: switch to generic DMA-mapping API
Make IDE core PCI independent by replacing hwif->pci_dev (struct pci_dev *) with hwif->dev (struct device *) and switch to using generic DMA-mapping API.
This is on top of IDE quilt tree + 3 patches posted today.
diffstat:
drivers/ide/arm/icside.c | 52 ++++++++-------------------- drivers/ide/ide-dma.c | 55 +++++++++++++++--------------- drivers/ide/ide-io.c | 2 - drivers/ide/ide-lib.c | 6 ++- drivers/ide/ide-probe.c | 4 +- drivers/ide/ide.c | 3 + drivers/ide/mips/au1xxx-ide.c | 43 ++++------------------- drivers/ide/pci/aec62xx.c | 8 ++-- drivers/ide/pci/alim15x3.c | 9 ++-- drivers/ide/pci/amd74xx.c | 7 ++- drivers/ide/pci/atiixp.c | 9 ++-- drivers/ide/pci/cmd64x.c | 14 +++---- drivers/ide/pci/cs5520.c | 2 - drivers/ide/pci/cs5535.c | 4 +- drivers/ide/pci/cy82c693.c | 5 +- drivers/ide/pci/delkin_cb.c | 2 - drivers/ide/pci/hpt34x.c | 2 - drivers/ide/pci/hpt366.c | 29 +++++++++------ drivers/ide/pci/it8213.c | 7 ++- drivers/ide/pci/it821x.c | 47 +++++++++++++++---------- drivers/ide/pci/jmicron.c | 2 - drivers/ide/pci/ns87415.c | 14 +++---- drivers/ide/pci/pdc202xx_new.c | 6 ++- drivers/ide/pci/pdc202xx_old.c | 11 +++--- drivers/ide/pci/piix.c | 53 ++-------------------------- drivers/ide/pci/rz1000.c | 2 - drivers/ide/pci/sc1200.c | 12 +++--- drivers/ide/pci/scc_pata.c | 13 +++---- drivers/ide/pci/serverworks.c | 18 ++++++--- drivers/ide/pci/sgiioc4.c | 19 ++++------ drivers/ide/pci/siimage.c | 51 ++++++++++++++++----------- drivers/ide/pci/sis5513.c | 22 ++++++------ drivers/ide/pci/sl82c105.c | 17 +++++---- drivers/ide/pci/slc90e66.c | 7 ++- drivers/ide/pci/tc86c001.c | 3 + drivers/ide/pci/triflex.c | 2 - drivers/ide/pci/trm290.c | 2 - drivers/ide/pci/via82cxxx.c | 12 +++--- drivers/ide/ppc/pmac.c | 24 ++++++------- drivers/ide/setup-pci.c | 6 +-- include/asm-mips/mach-au1x00/au1xxx_ide.h | 1 include/linux/ide.h | 10 +++-- 42 files changed, 288 insertions(+), 329 deletions(-)
Thanks,
Bart
PATCH 1/9 piix: remove stale comments
--- drivers/ide/pci/piix.c | 47 +---------------------------------------------- 1 file changed, 1 insertion(+), 46 deletions(-)
drivers/ide/pci/piix.c +1 -46
@@ -8,53 +8,8 @@* * May be copied or modified under the terms of the GNU General Public License * -* PIO mode setting function for Intel chipsets. -* For use instead of BIOS settings. +* Documentation: * -* 40-41 -* 42-43 -* -* 41 -* 43 -* -* | PIO 0 | c0 | 80 | 0 | -* | PIO 2 | SW2 | d0 | 90 | 4 | -* | PIO 3 | MW1 | e1 | a1 | 9 | -* | PIO 4 | MW2 | e3 | a3 | b | -* -* sitre = word40 & 0x4000; primary -* sitre = word42 & 0x4000; secondary -* -* 44 8421|8421 hdd|hdb -* -* 48 8421 hdd|hdc|hdb|hda udma enabled -* -* 0001 hda -* 0010 hdb -* 0100 hdc -* 1000 hdd -* -* 4a 84|21 hdb|hda -* 4b 84|21 hdd|hdc -* -* ata-33/82371AB -* ata-33/82371EB -* ata-33/82801AB ata-66/82801AA -* 00|00 udma 0 00|00 reserved -* 01|01 udma 1 01|01 udma 3 -* 10|10 udma 2 10|10 udma 4 -* 11|11 reserved 11|11 reserved -* -* 54 8421|8421 ata66 drive|ata66 enable -* -* pci_read_config_word(HWIF(drive)->pci_dev, 0x40, ®40); -* pci_read_config_word(HWIF(drive)->pci_dev, 0x42, ®42); -* pci_read_config_word(HWIF(drive)->pci_dev, 0x44, ®44); -* pci_read_config_byte(HWIF(drive)->pci_dev, 0x48, ®48); -* pci_read_config_word(HWIF(drive)->pci_dev, 0x4a, ®4a); -* pci_read_config_byte(HWIF(drive)->pci_dev, 0x54, ®54); -* -* Documentation * Publically available from Intel web site. Errata documentation * is also publically available. As an aide to anyone hacking on this * driver the list of errata that are relevant is below.going back to
Re: [PATCH 1/9] piix: remove stale comments
Hello.
Quoted 1 line · Bartlomiej Zolnierkiewicz
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
Quoted 37 lines
Index:
b/drivers/ide/pci/piix.c
===================================================================drivers/ide/pci/piix.c +1
-27@@ -8,53 +8,8 @@* * May be copied or modified under the terms of the GNU General Public License * -* PIO mode setting function for Intel chipsets. -* For use instead of BIOS settings. +* Documentation: * -* 40-41 -* 42-43 -* -* 41 -* 43 -* -* | PIO 0 | c0 | 80 | 0 | -* | PIO 2 | SW2 | d0 | 90 | 4 | -* | PIO 3 | MW1 | e1 | a1 | 9 | -* | PIO 4 | MW2 | e3 | a3 | b | -* -* sitre = word40 & 0x4000; primary -* sitre = word42 & 0x4000; secondary -* -* 44 8421|8421 hdd|hdb -* -* 48 8421 hdd|hdc|hdb|hda udma enabled -* -* 0001 hda -* 0010 hdb -* 0100 hdc -* 1000 hdd -* -* 4a 84|21 hdb|hda -* 4b 84|21 hdd|hdc
drivers/ide/pci/piix.c line 48
Quoted 10 lines
drivers/ide/pci/piix.c +0
-10-* -* ata-33/82371AB -* ata-33/82371EB -* ata-33/82801AB ata-66/82801AA -* 00|00 udma 0 00|00 reserved -* 01|01 udma 1 01|01 udma 3 -* 10|10 udma 2 10|10 udma 4 -* 11|11 reserved 11|11 reserved -* -* 54 8421|8421 ata66 drive|ata66 enable
You could have left te progarmming info intact...
WBR, Sergei
Re: [PATCH 1/9] piix: remove stale comments
Quoted 48 lines · Sergei Shtylyov
Hello.
Quoted 1 line · Bartlomiej Zolnierkiewicz
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>Acked-by Sergei Shtylyov <[email protected]>Quoted 41 lines
Index:
b/drivers/ide/pci/piix.c
===================================================================drivers/ide/pci/piix.c +1
-31@@ -8,53 +8,8 @@* * May be copied or modified under the terms of the GNU General Public License * -* PIO mode setting function for Intel chipsets. -* For use instead of BIOS settings. +* Documentation: * -* 40-41 -* 42-43 -* -* 41 -* 43 -* -* | PIO 0 | c0 | 80 | 0 | -* | PIO 2 | SW2 | d0 | 90 | 4 | -* | PIO 3 | MW1 | e1 | a1 | 9 | -* | PIO 4 | MW2 | e3 | a3 | b | -* -* sitre = word40 & 0x4000; primary -* sitre = word42 & 0x4000; secondary -* -* 44 8421|8421 hdd|hdb -* -* 48 8421 hdd|hdc|hdb|hda udma enabled -* -* 0001 hda -* 0010 hdb -* 0100 hdc -* 1000 hdd -* -* 4a 84|21 hdb|hda -* 4b 84|21 hdd|hdc -* -* ata-33/82371AB -* ata-33/82371EB -* ata-33/82801AB ata-66/82801AA
Quoted 8 lines
drivers/ide/pci/piix.c line 48
Quoted 6 lines
drivers/ide/pci/piix.c +0
-6-* 00|00 udma 0 00|00 reserved -* 01|01 udma 1 01|01 udma 3 -* 10|10 udma 2 10|10 udma 4 -* 11|11 reserved 11|11 reserved -* -* 54 8421|8421 ata66 drive|ata66 enable You could have left te progarmming info intact...
Well, I thought about that but:
* It referenced ATA devices using hd[a-d] naming which while matches with most of use cases is not 100% correct (piix driver can be modular etc).
* Right below there is a note about the official Intel documentation (which is publically available).
* The piix.c code is self-documenting nowadays (in large parts thanks to your efforts). :)
Thanks,
Bart
PATCH 2/9 ide: fix ide_intr() for non-PCI devices and CONFIG_BLK_DEV_IDEPCI=y
In reply to Bartlomiej Zolnierkiewicz'hwif->pci_dev && !hwif->pci_dev->vendor' condition is never true, check for 'hwif->chipset != ide_pci' instead.
--- drivers/ide/ide-io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ide/ide-io.c +1 -1
@@ -1487,7 +1487,7 @@ irqreturn_t ide_intr (int irq, void *dev* remove all the ifdef PCI crap */ #ifdef CONFIG_BLK_DEV_IDEPCI - if (hwif->pci_dev && !hwif->pci_dev->vendor) + if (hwif->chipset != ide_pci)#endif /* CONFIG_BLK_DEV_IDEPCI */ {/*
Re: [PATCH 2/9] ide: fix ide_intr() for non-PCI devices and CONFIG_BLK_DEV_IDEPCI=y
Quoted 4 lines · Bartlomiej Zolnierkiewicz
'
hwif->pci_dev&& !hwif->pci_dev->vendor' condition is never true, check for 'hwif->chipset!=ide_pci' instead.Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
MBR, Sergei
PATCH 3/9 ide: remove BUG_ON() from ide_build_sglist()
In reply to Bartlomiej Zolnierkiewiczdo_rw_taskfile() has been fixed to check the return value of ->dma_setup method so this BUG_ON() is no longer needed.
--- drivers/ide/ide-dma.c | 2 -- 1 file changed, 2 deletions(-)
drivers/ide/ide-dma.c +0 -2
@@ -186,8 +186,6 @@ int ide_build_sglist(ide_drive_t *drive,ide_hwif_t *hwif =HWIF (drive);struct scatterlist *sg = hwif->sg_table; -BUG_ON ((rq->cmd_type ==REQ_TYPE_ATA_TASKFILE ) && rq->nr_sectors >256 ); -ide_map_sg (drive, rq);if (rq_data_dir (rq) ==READ )
PATCH 4/9 ide: use ide_destroy_dmatable() instead of pci_unmap_sg()
In reply to Bartlomiej ZolnierkiewiczUse ide_destroy_dmatable() in:
* ide-dma.c::ide_build_dmatable()
* sgiioc4.c::sgiioc4_build_dma_table()
* pmac.c::pmac_ide_{build,destroy}_dmatable()
There should be no functionality changes caused by this patch.
--- drivers/ide/ide-dma.c | 8 ++++---- drivers/ide/pci/sgiioc4.c | 3 +-- drivers/ide/ppc/pmac.c | 14 +++++--------- 3 files changed, 10 insertions(+), 15 deletions(-)
drivers/ide/ide-dma.c +4 -4
@@ -282,12 +282,12 @@ int ide_build_dmatable (ide_drive_t *dri *--table |=cpu_to_le32 (0x80000000 );return count; } +printk (KERN_ERR "%s: empty DMA table?\n" , drive->name); + use_pio_instead: -pci_unmap_sg (hwif->pci_dev, - hwif->sg_table, - hwif->sg_nents, - hwif->sg_dma_direction); +ide_destroy_dmatable (drive); +return 0 ;/* revert to PIO for this request */ }
drivers/ide/pci/sgiioc4.c +1 -2
@@ -517,8 +517,7 @@ sgiioc4_build_dma_table(ide_drive_t * dr } use_pio_instead: -pci_unmap_sg (hwif->pci_dev, hwif->sg_table, hwif->sg_nents, - hwif->sg_dma_direction); +ide_destroy_dmatable (drive);return 0 ;/* revert to PIO for this request */ }
drivers/ide/ppc/pmac.c +5 -9
@@ -1535,11 +1535,10 @@ pmac_ide_build_dmatable(ide_drive_t *dri }printk (KERN_DEBUG "%s: empty DMA table?\n" , drive->name); - use_pio_instead: -pci_unmap_sg (hwif->pci_dev, - hwif->sg_table, - hwif->sg_nents, - hwif->sg_dma_direction); + +use_pio_instead: +ide_destroy_dmatable (drive); +return 0 ;/* revert to PIO for this request */ }
@@ -1548,12 +1547,9 @@ static void pmac_ide_destroy_dmatable (ide_drive_t *drive) {ide_hwif_t *hwif = drive->hwif; -struct pci_dev *dev =HWIF (drive)->pci_dev; -struct scatterlist *sg = hwif->sg_table; -int nents = hwif->sg_nents;if (nents) { -pci_unmap_sg (dev, sg, nents, hwif->sg_dma_direction); +ide_destroy_dmatable (drive); hwif->sg_nents =0 ; } }
Re: [PATCH 4/9] ide: use ide_destroy_dmatable() instead of pci_unmap_sg()
Quoted 8 lines · Bartlomiej Zolnierkiewicz
Use
ide_destroy_dmatable()in:
* ide-dma.c::ide_build_dmatable()
*sgiioc4.c::sgiioc4_build_dma_table()
* pmac.c::pmac_ide_{build,destroy}_dmatable()There should be no functionality changes caused by this patch.
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
MBR, Sergei
PATCH 5/9 ide: keep pointer to struct device instead of struct pci_dev in ide_hwif_t
In reply to Bartlomiej ZolnierkiewiczKeep pointer to struct device instead of struct pci_dev in ide_hwif_t.
While on it:
* Use *dev->dma_mask instead of pci_dev->dma_mask in ide_toggle_bounce().
There should be no functionality changes caused by this patch.
--- drivers/ide/ide-dma.c | 23 ++++++++++-------- drivers/ide/ide-lib.c | 6 +++- drivers/ide/ide-probe.c | 4 +-- drivers/ide/ide.c | 3 +- drivers/ide/pci/aec62xx.c | 8 +++--- drivers/ide/pci/alim15x3.c | 9 ++++--- drivers/ide/pci/amd74xx.c | 7 ++++- drivers/ide/pci/atiixp.c | 9 +++---- drivers/ide/pci/cmd64x.c | 14 +++++------ drivers/ide/pci/cs5520.c | 2 - drivers/ide/pci/cs5535.c | 4 ++- drivers/ide/pci/cy82c693.c | 5 ++-- drivers/ide/pci/delkin_cb.c | 2 - drivers/ide/pci/hpt34x.c | 2 - drivers/ide/pci/hpt366.c | 29 +++++++++++++---------- drivers/ide/pci/it8213.c | 7 +++-- drivers/ide/pci/it821x.c | 47 ++++++++++++++++++++++--------------- drivers/ide/pci/jmicron.c | 2 - drivers/ide/pci/ns87415.c | 14 +++++------ drivers/ide/pci/pdc202xx_new.c | 6 +++- drivers/ide/pci/pdc202xx_old.c | 11 +++++--- drivers/ide/pci/piix.c | 6 ++-- drivers/ide/pci/rz1000.c | 2 - drivers/ide/pci/sc1200.c | 12 ++++----- drivers/ide/pci/scc_pata.c | 13 ++++------ drivers/ide/pci/serverworks.c | 18 ++++++++------ drivers/ide/pci/sgiioc4.c | 16 ++++++------ drivers/ide/pci/siimage.c | 51 ++++++++++++++++++++++++----------------- drivers/ide/pci/sis5513.c | 22 ++++++++--------- drivers/ide/pci/sl82c105.c | 17 ++++++++----- drivers/ide/pci/slc90e66.c | 7 +++-- drivers/ide/pci/tc86c001.c | 3 +- drivers/ide/pci/triflex.c | 2 - drivers/ide/pci/trm290.c | 2 - drivers/ide/pci/via82cxxx.c | 12 +++++---- drivers/ide/ppc/pmac.c | 10 ++++---- drivers/ide/setup-pci.c | 6 ++-- include/linux/ide.h | 5 ++-- 38 files changed, 236 insertions(+), 182 deletions(-)
drivers/ide/ide-dma.c +13 -10
@@ -184,6 +184,7 @@ static int ide_dma_good_drive(ide_drive_int ide_build_sglist (ide_drive_t *drive,struct request *rq) {ide_hwif_t *hwif =HWIF (drive); +struct pci_dev *pdev =to_pci_dev (hwif->dev);struct scatterlist *sg = hwif->sg_table;ide_map_sg (drive, rq);
@@ -193,7 +194,7 @@ int ide_build_sglist(ide_drive_t *drive,else hwif->sg_dma_direction =PCI_DMA_TODEVICE ; -return pci_map_sg (hwif->pci_dev, sg, hwif->sg_nents, hwif->sg_dma_direction); +return pci_map_sg (pdev, sg, hwif->sg_nents, hwif->sg_dma_direction); }EXPORT_SYMBOL_GPL (ide_build_sglist);
@@ -306,11 +307,11 @@ EXPORT_SYMBOL_GPL(ide_build_dmatable);void ide_destroy_dmatable (ide_drive_t *drive) { -struct pci_dev *dev =HWIF (drive)->pci_dev; -struct scatterlist *sg =HWIF (drive)->sg_table; -int nents =HWIF (drive)->sg_nents; +ide_hwif_t *hwif = drive->hwif; +struct pci_dev *pdev =to_pci_dev (hwif->dev); -pci_unmap_sg (dev, sg, nents,HWIF (drive)->sg_dma_direction); +pci_unmap_sg (pdev, hwif->sg_table, hwif->sg_nents, + hwif->sg_dma_direction); }EXPORT_SYMBOL_GPL (ide_destroy_dmatable);
@@ -845,10 +846,10 @@ EXPORT_SYMBOL(ide_dma_timeout);static void ide_release_dma_engine (ide_hwif_t *hwif) {if (hwif->dmatable_cpu) { -pci_free_consistent (hwif->pci_dev, -PRD_ENTRIES *PRD_BYTES , - hwif->dmatable_cpu, - hwif->dmatable_dma); +struct pci_dev *pdev =to_pci_dev (hwif->dev); + +pci_free_consistent (pdev,PRD_ENTRIES *PRD_BYTES , + hwif->dmatable_cpu, hwif->dmatable_dma); hwif->dmatable_cpu =NULL ; } }
@@ -876,7 +877,9 @@ int ide_release_dma(ide_hwif_t *hwif)static int ide_allocate_dma_engine (ide_hwif_t *hwif) { - hwif->dmatable_cpu =pci_alloc_consistent (hwif->pci_dev, +struct pci_dev *pdev =to_pci_dev (hwif->dev); + + hwif->dmatable_cpu =pci_alloc_consistent (pdev,PRD_ENTRIES *PRD_BYTES , &hwif->dmatable_dma);
drivers/ide/ide-lib.c +4 -2
@@ -358,8 +358,10 @@ void ide_toggle_bounce(ide_drive_t *drivif (!PCI_DMA_BUS_IS_PHYS ) { addr =BLK_BOUNCE_ANY ; }else if (on && drive->media == ide_disk) { -if (HWIF (drive)->pci_dev) - addr =HWIF (drive)->pci_dev->dma_mask; +struct device *dev = drive->hwif->dev; + +if (dev && dev->dma_mask) + addr = *dev->dma_mask; }if (drive->queue)
drivers/ide/ide-probe.c +2 -2
@@ -622,8 +622,8 @@ static void hwif_register (ide_hwif_t *hstrlcpy (hwif->gendev.bus_id,hwif->name,BUS_ID_SIZE ); hwif->gendev.driver_data = hwif;if (hwif->gendev.parent ==NULL ) { -if (hwif->pci_dev) - hwif->gendev.parent = &hwif->pci_dev->dev; +if (hwif->dev) + hwif->gendev.parent = hwif->dev;else /* Would like to do = &device_legacy */ hwif->gendev.parent =NULL ;
drivers/ide/ide.c +2 -1
@@ -405,8 +405,9 @@ static void ide_hwif_restore(ide_hwif_t hwif->chipset = tmp_hwif->chipset; hwif->hold = tmp_hwif->hold; + hwif->dev = tmp_hwif->dev; +#ifdef CONFIG_BLK_DEV_IDEPCI - hwif->pci_dev = tmp_hwif->pci_dev; hwif->cds = tmp_hwif->cds;#endif
drivers/ide/pci/aec62xx.c +4 -4
@@ -90,7 +90,7 @@ static u8 pci_bus_clock_list_ultra (u8 sstatic void aec6210_set_mode (ide_drive_t *drive,const u8 speed) {ide_hwif_t *hwif =HWIF (drive); -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev);u16 d_conf =0 ;u8 ultra =0 , ultra_conf =0 ;u8 tmp0 =0 , tmp1 =0 , tmp2 =0 ;
@@ -116,7 +116,7 @@ static void aec6210_set_mode(ide_drive_tstatic void aec6260_set_mode (ide_drive_t *drive,const u8 speed) {ide_hwif_t *hwif =HWIF (drive); -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev);u8 unit = (drive->select.b.unit &0x01 );u8 tmp1 =0 , tmp2 =0 ;u8 ultra =0 , drive_conf =0 , ultra_conf =0 ;
@@ -170,7 +170,7 @@ static unsigned int __devinit init_chipsstatic void __devinit init_hwif_aec62xx (ide_hwif_t *hwif) { -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev); hwif->set_pio_mode = &aec_set_pio_mode;
@@ -188,7 +188,7 @@ static void __devinit init_hwif_aec62xx(if (hwif->cbl !=ATA_CBL_PATA40_SHORT ) {u8 ata66 =0 , mask = hwif->channel ?0x02 :0x01 ; -pci_read_config_byte (hwif->pci_dev,0x49 , &ata66); +pci_read_config_byte (dev,0x49 , &ata66); hwif->cbl = (ata66 & mask) ?ATA_CBL_PATA40 :ATA_CBL_PATA80 ; }
drivers/ide/pci/alim15x3.c +5 -4
@@ -293,7 +293,7 @@ static int ali_get_info (char *buffer, cstatic void ali_set_pio_mode (ide_drive_t *drive,const u8 pio) {ide_hwif_t *hwif =HWIF (drive); -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev);int s_time, a_time, c_time;u8 s_clc, a_clc, r_clc;unsigned long flags;
@@ -396,7 +396,7 @@ static u8 ali_udma_filter(ide_drive_t *dstatic void ali_set_dma_mode (ide_drive_t *drive,const u8 speed) {ide_hwif_t *hwif =HWIF (drive); -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev);u8 speed1 = speed;u8 unit = (drive->select.b.unit &0x01 );u8 tmpbyte =0x00 ;
@@ -625,7 +625,7 @@ static int ali_cable_override(struct pcistatic u8 __devinit ata66_ali15x3 (ide_hwif_t *hwif) { -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev);unsigned long flags;u8 cbl =ATA_CBL_PATA40 , tmpbyte;
@@ -688,12 +688,13 @@ static void __devinit init_hwif_common_astatic void __devinit init_hwif_ali15x3 (ide_hwif_t *hwif) { +struct pci_dev *dev =to_pci_dev (hwif->dev);u8 ideic, inmir;s8 irq_routing_table[] = {-1 ,9 ,3 ,10 ,4 ,5 ,7 ,6 ,1 ,11 ,0 ,12 ,0 ,14 ,0 ,15 };int irq =-1 ; -if (hwif->pci_dev->device ==PCI_DEVICE_ID_AL_M5229 ) +if (dev->device ==PCI_DEVICE_ID_AL_M5229 ) hwif->irq = hwif->channel ?15 :14 ;if (isa_dev) {
drivers/ide/pci/amd74xx.c +5 -2
@@ -86,6 +86,7 @@ static void amd_set_speed(struct pci_devstatic void amd_set_drive (ide_drive_t *drive,const u8 speed) {ide_hwif_t *hwif = drive->hwif; +struct pci_dev *dev =to_pci_dev (hwif->dev);ide_drive_t *peer = hwif->drives + (~drive->dn &1 );struct ide_timing t, p;int T ,UT ;
@@ -104,7 +105,7 @@ static void amd_set_drive(ide_drive_t *dif (speed ==XFER_UDMA_5 && amd_clock <=33333 ) t.udma =1 ;if (speed ==XFER_UDMA_6 && amd_clock <=33333 ) t.udma =15 ; -amd_set_speed (hwif->pci_dev, drive->dn, udma_mask, &t); +amd_set_speed (dev, drive->dn, udma_mask, &t); }/*
@@ -202,8 +203,10 @@ static unsigned int __devinit init_chipsstatic void __devinit init_hwif_amd74xx (ide_hwif_t *hwif) { +struct pci_dev *dev =to_pci_dev (hwif->dev); +if (hwif->irq ==0 )/* 0 is bogus but will do for now */ - hwif->irq =pci_get_legacy_ide_irq (hwif->pci_dev, hwif->channel); + hwif->irq =pci_get_legacy_ide_irq (dev, hwif->channel); hwif->set_pio_mode = &amd_set_pio_mode; hwif->set_dma_mode = &amd_set_drive;
drivers/ide/pci/atiixp.c +4 -5
@@ -55,7 +55,7 @@ static DEFINE_SPINLOCK(atiixp_lock);static void atiixp_set_pio_mode (ide_drive_t *drive,const u8 pio) { -struct pci_dev *dev = drive->hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (drive->hwif->dev);unsigned long flags;int timing_shift = (drive->dn &2 ) ?16 :0 + (drive->dn &1 ) ?0 :8 ;u32 pio_timing_data;
@@ -88,7 +88,7 @@ static void atiixp_set_pio_mode(ide_drivstatic void atiixp_set_dma_mode (ide_drive_t *drive,const u8 speed) { -struct pci_dev *dev = drive->hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (drive->hwif->dev);unsigned long flags;int timing_shift = (drive->dn &2 ) ?16 :0 + (drive->dn &1 ) ?0 :8 ;u32 tmp32;
@@ -133,9 +133,8 @@ static void atiixp_set_dma_mode(ide_drivstatic void __devinit init_hwif_atiixp (ide_hwif_t *hwif) { -u8 udma_mode =0 ; -u8 ch = hwif->channel; -struct pci_dev *pdev = hwif->pci_dev; +struct pci_dev *pdev =to_pci_dev (hwif->dev); +u8 udma_mode =0 , ch = hwif->channel; hwif->set_pio_mode = &atiixp_set_pio_mode; hwif->set_dma_mode = &atiixp_set_dma_mode;
drivers/ide/pci/cmd64x.c +7 -7
@@ -71,7 +71,7 @@ static u8 quantize_timing(int timing, in*/ static void program_cycle_times (ide_drive_t *drive,int cycle_time,int active_time) { -struct pci_dev *dev =HWIF (drive)->pci_dev; +struct pci_dev *dev =to_pci_dev (drive->hwif->dev);int clock_time =1000 /system_bus_clock ();u8 cycle_count, active_count, recovery_count, drwtim; static const u8 recovery_values[] =
@@ -118,7 +118,7 @@ static void program_cycle_times (ide_dristatic void cmd64x_tune_pio (ide_drive_t *drive,const u8 pio) {ide_hwif_t *hwif =HWIF (drive); -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev);unsigned int cycle_time;u8 setup_count, arttim =0 ;
@@ -183,7 +183,7 @@ static void cmd64x_set_pio_mode(ide_drivstatic void cmd64x_set_dma_mode (ide_drive_t *drive,const u8 speed) {ide_hwif_t *hwif =HWIF (drive); -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev);u8 unit = drive->dn &0x01 ;u8 regU =0 , pciU = hwif->channel ?UDIDETCR1 :UDIDETCR0 ;
@@ -245,7 +245,7 @@ static int cmd648_ide_dma_end (ide_drivestatic int cmd64x_ide_dma_end (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive); -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev);int irq_reg = hwif->channel ?ARTTIM23 :CFR ;u8 irq_mask = hwif->channel ?ARTTIM23_INTR_CH1 :CFR_INTR_CH0 ;
@@ -285,7 +285,7 @@ static int cmd648_ide_dma_test_irq (ide_static int cmd64x_ide_dma_test_irq (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive); -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev);int irq_reg = hwif->channel ?ARTTIM23 :CFR ;u8 irq_mask = hwif->channel ?ARTTIM23_INTR_CH1 :CFR_INTR_CH0 ;
@@ -375,7 +375,7 @@ static unsigned int __devinit init_chipsstatic u8 __devinit ata66_cmd64x (ide_hwif_t *hwif) { -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev);u8 bmidecsr =0 , mask = hwif->channel ?0x02 :0x01 ;switch (dev->device) {
@@ -390,7 +390,7 @@ static u8 __devinit ata66_cmd64x(ide_hwistatic void __devinit init_hwif_cmd64x (ide_hwif_t *hwif) { -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev); hwif->set_pio_mode = &cmd64x_set_pio_mode; hwif->set_dma_mode = &cmd64x_set_dma_mode;
drivers/ide/pci/cs5520.c +1 -1
@@ -69,7 +69,7 @@ static struct pio_clocks cs5520_pio_clocstatic void cs5520_set_pio_mode (ide_drive_t *drive,const u8 pio) {ide_hwif_t *hwif =HWIF (drive); -struct pci_dev *pdev = hwif->pci_dev; +struct pci_dev *pdev =to_pci_dev (hwif->dev);int controller = drive->dn >1 ?1 :0 ;/* FIXME: if DMA = 1 do we need to set the DMA bit here ? */
drivers/ide/pci/cs5535.c +3 -1
@@ -177,13 +177,15 @@ static u8 __devinit cs5535_cable_detect(*/ static void __devinit init_hwif_cs5535 (ide_hwif_t *hwif) { +struct pci_dev *dev =to_pci_dev (hwif->dev); + hwif->set_pio_mode = &cs5535_set_pio_mode; hwif->set_dma_mode = &cs5535_set_dma_mode;if (hwif->dma_base ==0 )return ; - hwif->cbl =cs5535_cable_detect (hwif->pci_dev); + hwif->cbl =cs5535_cable_detect (dev); }static const struct ide_port_info cs5535_chipset__devinitdata = {
drivers/ide/pci/cy82c693.c +3 -2
@@ -228,7 +228,7 @@ static void cy82c693_set_dma_mode(ide_drstatic void cy82c693_set_pio_mode (ide_drive_t *drive,const u8 pio) {ide_hwif_t *hwif =HWIF (drive); -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev);pio_clocks_t pclk;unsigned int addrCtrl;
@@ -397,8 +397,9 @@ static void __devinit init_hwif_cy82c693static void __devinit init_iops_cy82c693 (ide_hwif_t *hwif) {static ide_hwif_t *primary; +struct pci_dev *dev =to_pci_dev (hwif->dev); -if (PCI_FUNC (hwif->pci_dev->devfn) ==1 ) +if (PCI_FUNC (dev->devfn) ==1 ) primary = hwif;else { hwif->mate = primary;
drivers/ide/pci/delkin_cb.c +1 -1
@@ -87,7 +87,7 @@ delkin_cb_probe (struct pci_dev *dev, coreturn -ENODEV ; }pci_set_drvdata (dev, hwif); - hwif->pci_dev = dev; + hwif->dev = &dev->dev; drive = &hwif->drives[0 ];if (drive->present) { drive->io_32bit =1 ;
drivers/ide/pci/hpt34x.c +1 -1
@@ -45,7 +45,7 @@static void hpt34x_set_mode (ide_drive_t *drive,const u8 speed) { -struct pci_dev *dev =HWIF (drive)->pci_dev; +struct pci_dev *dev =to_pci_dev (drive->hwif->dev);u32 reg1=0 , tmp1 =0 , reg2 =0 , tmp2 =0 ;u8 hi_speed, lo_speed;
drivers/ide/pci/hpt366.c +17 -12
@@ -626,7 +626,8 @@ static int check_in_drive_list(ide_drivestatic u8 hpt3xx_udma_filter (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive); -struct hpt_info *info =pci_get_drvdata (hwif->pci_dev); +struct pci_dev *dev =to_pci_dev (hwif->dev); +struct hpt_info *info =pci_get_drvdata (dev);u8 mask = hwif->ultra_mask;switch (info->chip_type) {
@@ -665,7 +666,8 @@ static u8 hpt3xx_udma_filter(ide_drive_tstatic u8 hpt3xx_mdma_filter (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive); -struct hpt_info *info =pci_get_drvdata (hwif->pci_dev); +struct pci_dev *dev =to_pci_dev (hwif->dev); +struct hpt_info *info =pci_get_drvdata (dev);switch (info->chip_type) {case HPT372 :
@@ -699,7 +701,7 @@ static u32 get_speed_setting(u8 speed, sstatic void hpt3xx_set_mode (ide_drive_t *drive,const u8 speed) { -struct pci_dev *dev =HWIF (drive)->pci_dev; +struct pci_dev *dev =to_pci_dev (drive->hwif->dev);struct hpt_info *info =pci_get_drvdata (dev);struct hpt_timings *t = info->timings;u8 itr_addr =0x40 + (drive->dn *4 );
@@ -742,7 +744,7 @@ static void hpt3xx_quirkproc(ide_drive_tstatic void hpt3xx_maskproc (ide_drive_t *drive,int mask) {ide_hwif_t *hwif =HWIF (drive); -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev);struct hpt_info *info =pci_get_drvdata (dev);if (drive->quirk_list) {
@@ -774,7 +776,7 @@ static void hpt3xx_maskproc(ide_drive_t*/ static void hpt366_dma_lost_irq (ide_drive_t *drive) { -struct pci_dev *dev =HWIF (drive)->pci_dev; +struct pci_dev *dev =to_pci_dev (drive->hwif->dev);u8 mcr1 =0 , mcr3 =0 , scr1 =0 ;pci_read_config_byte (dev,0x50 , &mcr1);
@@ -790,18 +792,20 @@ static void hpt366_dma_lost_irq(ide_drivstatic void hpt370_clear_engine (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive); +struct pci_dev *dev =to_pci_dev (hwif->dev); -pci_write_config_byte (hwif->pci_dev, hwif->select_data,0x37 ); +pci_write_config_byte (dev, hwif->select_data,0x37 );udelay (10 ); }static void hpt370_irq_timeout (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive); +struct pci_dev *dev =to_pci_dev (hwif->dev);u16 bfifo =0 ;u8 dma_cmd; -pci_read_config_word (hwif->pci_dev, hwif->select_data +2 , &bfifo); +pci_read_config_word (dev, hwif->select_data +2 , &bfifo);printk (KERN_DEBUG "%s: %d bytes in FIFO\n" , drive->name, bfifo &0x1ff );/* get DMA command mode */
@@ -844,10 +848,11 @@ static void hpt370_dma_timeout(ide_drivestatic int hpt374_ide_dma_test_irq (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive); +struct pci_dev *dev =to_pci_dev (hwif->dev);u16 bfifo =0 ;u8 dma_stat; -pci_read_config_word (hwif->pci_dev, hwif->select_data +2 , &bfifo); +pci_read_config_word (dev, hwif->select_data +2 , &bfifo);if (bfifo &0x1FF ) {// printk("%s: %d bytes in FIFO\n", drive->name, bfifo); return 0 ;
@@ -867,7 +872,7 @@ static int hpt374_ide_dma_test_irq(ide_dstatic int hpt374_ide_dma_end (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive); -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev);u8 mcr =0 , mcr_addr = hwif->select_data;u8 bwsr =0 , mask = hwif->channel ?0x02 :0x01 ;
@@ -942,7 +947,7 @@ static void hpt3xxn_rw_disk(ide_drive_tstatic int hpt3xx_busproc (ide_drive_t *drive,int state) {ide_hwif_t *hwif =HWIF (drive); -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev);u8 mcr_addr = hwif->select_data +2 ;u8 resetmask = hwif->channel ?0x80 :0x40 ;u8 bsr2 =0 ;
@@ -1278,7 +1283,7 @@ static unsigned int __devinit init_chipsstatic void __devinit init_hwif_hpt366 (ide_hwif_t *hwif) { -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev);struct hpt_info *info =pci_get_drvdata (dev);int serialize =HPT_SERIALIZE_IO ;u8 scr1 =0 , ata66 = hwif->channel ?0x01 :0x02 ;
@@ -1393,7 +1398,7 @@ static void __devinit init_hwif_hpt366(istatic void __devinit init_dma_hpt366 (ide_hwif_t *hwif,unsigned long dmabase) { -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev);u8 masterdma =0 , slavedma =0 ;u8 dma_new =0 , dma_old =0 ;unsigned long flags;
drivers/ide/pci/it8213.c +4 -3
@@ -28,7 +28,7 @@static void it8213_set_pio_mode (ide_drive_t *drive,const u8 pio) {ide_hwif_t *hwif =HWIF (drive); -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev);int is_slave = drive->dn &1 ;int master_port =0x40 ;int slave_port =0x44 ;
@@ -85,7 +85,7 @@ static void it8213_set_pio_mode(ide_drivstatic void it8213_set_dma_mode (ide_drive_t *drive,const u8 speed) {ide_hwif_t *hwif =HWIF (drive); -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev);u8 maslave =0x40 ;int a_speed =3 << (drive->dn *4 );int u_flag =1 << drive->dn;
@@ -152,6 +152,7 @@ static void it8213_set_dma_mode(ide_drivstatic void __devinit init_hwif_it8213 (ide_hwif_t *hwif) { +struct pci_dev *dev =to_pci_dev (hwif->dev);u8 reg42h =0 ; hwif->set_dma_mode = &it8213_set_dma_mode;
@@ -160,7 +161,7 @@ static void __devinit init_hwif_it8213(iif (!hwif->dma_base)return ; -pci_read_config_byte (hwif->pci_dev,0x42 , ®42h); +pci_read_config_byte (dev,0x42 , ®42h);if (hwif->cbl !=ATA_CBL_PATA40_SHORT ) hwif->cbl = (reg42h &0x02 ) ?ATA_CBL_PATA40 :ATA_CBL_PATA80 ;
drivers/ide/pci/it821x.c +28 -19
134 lines not on this page · raw message
drivers/ide/pci/jmicron.c +1 -1
@@ -30,7 +30,7 @@ typedef enum {static u8 __devinit ata66_jmicron (ide_hwif_t *hwif) { -struct pci_dev *pdev = hwif->pci_dev; +struct pci_dev *pdev =to_pci_dev (hwif->dev);u32 control;u32 control5;
drivers/ide/pci/ns87415.c +7 -7
@@ -71,10 +71,9 @@ static u8 superio_ide_inb (unsigned longstatic void __devinit superio_ide_init_iops (struct hwif_s *hwif) { +struct pci_dev *pdev =to_pci_dev (hwif->dev);u32 base, dmabase; -u8 tmp; -struct pci_dev *pdev = hwif->pci_dev; -u8 port = hwif->channel; +u8 port = hwif->channel, tmp; base =pci_resource_start (pdev, port *2 ) & ~3 ; dmabase =pci_resource_start (pdev,4 ) & ~3 ;
@@ -93,10 +92,11 @@ static void __devinit superio_ide_init_istatic void __devinit init_iops_ns87415 (ide_hwif_t *hwif) { -if (PCI_SLOT (hwif->pci_dev->devfn) ==0xE ) { +struct pci_dev *dev =to_pci_dev (hwif->dev); + +if (PCI_SLOT (dev->devfn) ==0xE )/* Built-in - assume it's under superio. */ superio_ide_init_iops (hwif); - } }#endif
@@ -110,8 +110,8 @@ static unsigned int ns87415_count = 0, nstatic void ns87415_prepare_drive (ide_drive_t *drive,unsigned int use_dma) {ide_hwif_t *hwif =HWIF (drive); +struct pci_dev *dev =to_pci_dev (hwif->dev);unsigned int bit, other, new, *old = (unsigned int *) hwif->select_data; -struct pci_dev *dev = hwif->pci_dev;unsigned long flags;local_irq_save (flags);
@@ -189,7 +189,7 @@ static int ns87415_ide_dma_setup(ide_dristatic void __devinit init_hwif_ns87415 (ide_hwif_t *hwif) { -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev);unsigned int ctrl, using_inta;u8 progif;#ifdef __sparc_v9__
drivers/ide/pci/pdc202xx_new.c +4 -2
@@ -149,6 +149,7 @@ static struct udma_timing {static void pdcnew_set_dma_mode (ide_drive_t *drive,const u8 speed) {ide_hwif_t *hwif =HWIF (drive); +struct pci_dev *dev =to_pci_dev (hwif->dev);u8 adj = (drive->dn &1 ) ?0x08 :0x00 ;/*
@@ -159,7 +160,7 @@ static void pdcnew_set_dma_mode(ide_driv* As we set up the PLL to output 133 MHz for UltraDMA/133 capable * chips, we must override the default register settings... */ -if (max_dma_rate (hwif->pci_dev) ==4 ) { +if (max_dma_rate (dev) ==4 ) {u8 mode = speed &0x07 ;if (speed >=XFER_UDMA_0 ) {
@@ -186,9 +187,10 @@ static void pdcnew_set_dma_mode(ide_drivstatic void pdcnew_set_pio_mode (ide_drive_t *drive,const u8 pio) {ide_hwif_t *hwif = drive->hwif; +struct pci_dev *dev =to_pci_dev (hwif->dev);u8 adj = (drive->dn &1 ) ?0x08 :0x00 ; -if (max_dma_rate (hwif->pci_dev) ==4 ) { +if (max_dma_rate (dev) ==4 ) {set_indexed_reg (hwif,0x0c + adj, pio_timings[pio].reg0c);set_indexed_reg (hwif,0x0d + adj, pio_timings[pio].reg0d);set_indexed_reg (hwif,0x13 + adj, pio_timings[pio].reg13);
drivers/ide/pci/pdc202xx_old.c +7 -4
@@ -66,7 +66,7 @@ static void pdc_old_disable_66MHz_clock(static void pdc202xx_set_mode (ide_drive_t *drive,const u8 speed) {ide_hwif_t *hwif =HWIF (drive); -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev);u8 drive_pci =0x60 + (drive->dn <<2 );u8 AP =0 ,BP =0 ,CP =0 ;
@@ -144,9 +144,10 @@ static void pdc202xx_set_pio_mode(ide_drstatic u8 pdc202xx_old_cable_detect (ide_hwif_t *hwif) { +struct pci_dev *dev =to_pci_dev (hwif->dev);u16 CIS =0 , mask = (hwif->channel) ? (1 <<11 ) : (1 <<10 ); -pci_read_config_word (hwif->pci_dev,0x50 , &CIS ); +pci_read_config_word (dev,0x50 , &CIS );return (CIS & mask) ?ATA_CBL_PATA40 :ATA_CBL_PATA80 ; }
@@ -305,12 +306,14 @@ static unsigned int __devinit init_chipsstatic void __devinit init_hwif_pdc202xx (ide_hwif_t *hwif) { +struct pci_dev *dev =to_pci_dev (hwif->dev); + hwif->set_pio_mode = &pdc202xx_set_pio_mode; hwif->set_dma_mode = &pdc202xx_set_mode; hwif->quirkproc = &pdc202xx_quirkproc; -if (hwif->pci_dev->device !=PCI_DEVICE_ID_PROMISE_20246 ) +if (dev->device !=PCI_DEVICE_ID_PROMISE_20246 ) hwif->resetproc = &pdc202xx_reset;if (hwif->dma_base ==0 )
@@ -319,7 +322,7 @@ static void __devinit init_hwif_pdc202xx hwif->dma_lost_irq = &pdc202xx_dma_lost_irq; hwif->dma_timeout = &pdc202xx_dma_timeout; -if (hwif->pci_dev->device !=PCI_DEVICE_ID_PROMISE_20246 ) { +if (dev->device !=PCI_DEVICE_ID_PROMISE_20246 ) {if (hwif->cbl !=ATA_CBL_PATA40_SHORT ) hwif->cbl =pdc202xx_old_cable_detect (hwif);
drivers/ide/pci/piix.c +3 -3
@@ -71,7 +71,7 @@ static int no_piix_dma;static void piix_set_pio_mode (ide_drive_t *drive,const u8 pio) {ide_hwif_t *hwif =HWIF (drive); -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev);int is_slave = drive->dn &1 ;int master_port = hwif->channel ?0x42 :0x40 ;int slave_port =0x44 ;
@@ -140,7 +140,7 @@ static void piix_set_pio_mode(ide_drive_static void piix_set_dma_mode (ide_drive_t *drive,const u8 speed) {ide_hwif_t *hwif =HWIF (drive); -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev);u8 maslave = hwif->channel ?0x42 :0x40 ;int a_speed =3 << (drive->dn *4 );int u_flag =1 << drive->dn;
@@ -260,7 +260,7 @@ static const struct ich_laptop ich_laptostatic u8 __devinit piix_cable_detect (ide_hwif_t *hwif) { -struct pci_dev *pdev = hwif->pci_dev; +struct pci_dev *pdev =to_pci_dev (hwif->dev);const struct ich_laptop *lap = &ich_laptop[0 ];u8 reg54h =0 , mask = hwif->channel ?0xc0 :0x30 ;
drivers/ide/pci/rz1000.c +1 -1
@@ -32,8 +32,8 @@static void __devinit init_hwif_rz1000 (ide_hwif_t *hwif) { +struct pci_dev *dev =to_pci_dev (hwif->dev);u16 reg; -struct pci_dev *dev = hwif->pci_dev;if (!pci_read_config_word (dev,0x40 , ®) && !pci_write_config_word (dev,0x40 , reg &0xdfff )) {
drivers/ide/pci/sc1200.c +6 -6
@@ -87,7 +87,7 @@ static const unsigned int sc1200_pio_timstatic void sc1200_tunepio (ide_drive_t *drive,u8 pio) {ide_hwif_t *hwif = drive->hwif; -struct pci_dev *pdev = hwif->pci_dev; +struct pci_dev *pdev =to_pci_dev (hwif->dev);unsigned int basereg = hwif->channel ?0x50 :0x40 , format =0 ;pci_read_config_dword (pdev, basereg +4 , &format);
@@ -130,6 +130,7 @@ out:static void sc1200_set_dma_mode (ide_drive_t *drive,const u8 mode) {ide_hwif_t *hwif =HWIF (drive); +struct pci_dev *dev =to_pci_dev (hwif->dev);int unit = drive->select.b.unit;unsigned int reg, timings;unsigned short pci_clock;
@@ -160,12 +161,11 @@ static void sc1200_set_dma_mode(ide_driv timings = mwdma_timing[pci_clock][mode -XFER_MW_DMA_0 ];if (unit ==0 ) {/* are we configuring drive0? */ -pci_read_config_dword (hwif->pci_dev, basereg+4 , ®); +pci_read_config_dword (dev, basereg +4 , ®); timings |= reg &0x80000000 ;/* preserve PIO format bit */ -pci_write_config_dword (hwif->pci_dev, basereg+4 , timings); - }else { -pci_write_config_dword (hwif->pci_dev, basereg+12 , timings); - } +pci_write_config_dword (dev, basereg +4 , timings); + }else +pci_write_config_dword (dev, basereg +12 , timings); }/* Replacement for the standard ide_dma_end action in
drivers/ide/pci/scc_pata.c +6 -7
@@ -594,7 +594,7 @@ static int __devinit init_setup_scc(strustatic void __devinit init_mmio_iops_scc (ide_hwif_t *hwif) { -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev);struct scc_ports *ports =pci_get_drvdata (dev);unsigned long dma_base = ports->dma;
@@ -620,7 +620,7 @@ static void __devinit init_mmio_iops_scc hwif->io_ports[IDE_STATUS_OFFSET ] = dma_base +0x3c ; hwif->io_ports[IDE_CONTROL_OFFSET ] = dma_base +0x40 ; - hwif->irq = hwif->pci_dev->irq; + hwif->irq = dev->irq; hwif->dma_base = dma_base; hwif->config_data = ports->ctl; hwif->mmio =1 ;
@@ -636,7 +636,8 @@ static void __devinit init_mmio_iops_sccstatic void __devinit init_iops_scc (ide_hwif_t *hwif) { -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev); + hwif->hwif_data =NULL ;if (pci_get_drvdata (dev) ==NULL )return ;
@@ -726,10 +727,8 @@ static void __devexit scc_remove(structunsigned long dma_size =pci_resource_len (dev,1 );if (hwif->dmatable_cpu) { -pci_free_consistent (hwif->pci_dev, -PRD_ENTRIES *PRD_BYTES , - hwif->dmatable_cpu, - hwif->dmatable_dma); +pci_free_consistent (dev,PRD_ENTRIES *PRD_BYTES , + hwif->dmatable_cpu, hwif->dmatable_dma); hwif->dmatable_cpu =NULL ; }
drivers/ide/pci/serverworks.c +11 -7
@@ -67,7 +67,7 @@ static int check_in_drive_lists (ide_dristatic u8 svwks_udma_filter (ide_drive_t *drive) { -struct pci_dev *dev =HWIF (drive)->pci_dev; +struct pci_dev *dev =to_pci_dev (drive->hwif->dev);u8 mask =0 ;if (dev->device ==PCI_DEVICE_ID_SERVERWORKS_HT1000IDE )
@@ -130,7 +130,7 @@ static void svwks_set_pio_mode(ide_drivestatic const u8 pio_modes[] = {0x5d ,0x47 ,0x34 ,0x22 ,0x20 };static const u8 drive_pci[] = {0x41 ,0x40 ,0x43 ,0x42 }; -struct pci_dev *dev = drive->hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (drive->hwif->dev);pci_write_config_byte (dev, drive_pci[drive->dn], pio_modes[pio]);
@@ -153,7 +153,7 @@ static void svwks_set_dma_mode(ide_drivestatic const u8 drive_pci2[] = {0x45 ,0x44 ,0x47 ,0x46 };ide_hwif_t *hwif =HWIF (drive); -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev);u8 unit = (drive->select.b.unit &0x01 );u8 ultra_enable =0 , ultra_timing =0 , dma_timing =0 ;
@@ -287,7 +287,8 @@ static u8 __devinit ata66_svwks_svwks(id*/ static u8 __devinit ata66_svwks_dell (ide_hwif_t *hwif) { -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev); + if (dev->subsystem_vendor == PCI_VENDOR_ID_DELL && dev->vendor == PCI_VENDOR_ID_SERVERWORKS && (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE ||
@@ -305,7 +306,8 @@ static u8 __devinit ata66_svwks_dell(ide*/ static u8 __devinit ata66_svwks_cobalt (ide_hwif_t *hwif) { -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev); +if (dev->subsystem_vendor ==PCI_VENDOR_ID_SUN && dev->vendor ==PCI_VENDOR_ID_SERVERWORKS && dev->device ==PCI_DEVICE_ID_SERVERWORKS_CSB5IDE )
@@ -316,7 +318,7 @@ static u8 __devinit ata66_svwks_cobalt(istatic u8 __devinit ata66_svwks (ide_hwif_t *hwif) { -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev);/* Server Works */ if (dev->subsystem_vendor ==PCI_VENDOR_ID_SERVERWORKS )
@@ -340,6 +342,8 @@ static u8 __devinit ata66_svwks(ide_hwifstatic void __devinit init_hwif_svwks (ide_hwif_t *hwif) { +struct pci_dev *dev =to_pci_dev (hwif->dev); + hwif->set_pio_mode = &svwks_set_pio_mode; hwif->set_dma_mode = &svwks_set_dma_mode; hwif->udma_filter = &svwks_udma_filter;
@@ -347,7 +351,7 @@ static void __devinit init_hwif_svwks (iif (!hwif->dma_base)return ; -if (hwif->pci_dev->device !=PCI_DEVICE_ID_SERVERWORKS_OSB4IDE ) { +if (dev->device !=PCI_DEVICE_ID_SERVERWORKS_OSB4IDE ) {if (hwif->cbl !=ATA_CBL_PATA40_SHORT ) hwif->cbl =ata66_svwks (hwif); }
drivers/ide/pci/sgiioc4.c +8 -8
@@ -159,6 +159,7 @@ sgiioc4_clearirq(ide_drive_t * drive) }if (intr_reg &0x02 ) { +struct pci_dev *dev =to_pci_dev (hwif->dev);/* Error when transferring DMA data on PCI bus */ u32 pci_err_addr_low, pci_err_addr_high, pci_stat_cmd_reg;
@@ -167,7 +168,7 @@ sgiioc4_clearirq(ide_drive_t * drive)readl ((void __iomem *)hwif->io_ports[IDE_IRQ_OFFSET ]); pci_err_addr_high =readl ((void __iomem *)(hwif->io_ports[IDE_IRQ_OFFSET ] +4 )); -pci_read_config_dword (hwif->pci_dev,PCI_COMMAND , +pci_read_config_dword (dev,PCI_COMMAND , &pci_stat_cmd_reg);printk (KERN_ERR "%s(%s) : PCI Bus Error when doing DMA:"
@@ -178,8 +179,7 @@ sgiioc4_clearirq(ide_drive_t * drive) __FUNCTION__, drive->name, pci_err_addr_high, pci_err_addr_low);/* Clear the PCI Error indicator */ -pci_write_config_dword (hwif->pci_dev,PCI_COMMAND , -0x00000146 ); +pci_write_config_dword (dev,PCI_COMMAND ,0x00000146 ); }/* Clear the Interrupt, Error bits on the IOC4 */
@@ -334,6 +334,7 @@ sgiioc4_INB(unsigned long port)static int __devinit ide_dma_sgiioc4 (ide_hwif_t * hwif,unsigned long dma_base) { +struct pci_dev *dev =to_pci_dev (hwif->dev);void __iomem *virt_dma_base;int num_ports =sizeof (ioc4_dma_regs_t);void *pad;
@@ -359,7 +360,7 @@ ide_dma_sgiioc4(ide_hwif_t * hwif, unsig } hwif->dma_base = (unsigned long ) virt_dma_base; - hwif->dmatable_cpu =pci_alloc_consistent (hwif->pci_dev, + hwif->dmatable_cpu =pci_alloc_consistent (dev,IOC4_PRD_ENTRIES *IOC4_PRD_BYTES , &hwif->dmatable_dma);
@@ -368,7 +369,7 @@ ide_dma_sgiioc4(ide_hwif_t * hwif, unsig hwif->sg_max_nents =IOC4_PRD_ENTRIES ; - pad =pci_alloc_consistent (hwif->pci_dev,IOC4_IDE_CACHELINE_SIZE , + pad =pci_alloc_consistent (dev,IOC4_IDE_CACHELINE_SIZE , (dma_addr_t *) &(hwif->dma_status));if (pad) {
@@ -376,8 +377,7 @@ ide_dma_sgiioc4(ide_hwif_t * hwif, unsigreturn 0 ; } -pci_free_consistent (hwif->pci_dev, -IOC4_PRD_ENTRIES *IOC4_PRD_BYTES , +pci_free_consistent (dev,IOC4_PRD_ENTRIES *IOC4_PRD_BYTES , hwif->dmatable_cpu, hwif->dmatable_dma); printk(KERN_INFO "%s() -- Error! Unable to allocate DMA Maps for drive %s\n",
@@ -640,7 +640,7 @@ sgiioc4_ide_setup_pci_device(struct pci_ hw.dev = &dev->dev;ide_init_port_hw (hwif, &hw); - hwif->pci_dev = dev; + hwif->dev = &dev->dev; hwif->channel =0 ;/* Single Channel chip */ /* The IOC4 uses MMIO rather than Port IO. */
drivers/ide/pci/siimage.c +30 -21
150 lines not on this page · raw message
drivers/ide/pci/sis5513.c +11 -11
@@ -197,7 +197,7 @@ static char* chipset_capability[] = {static u8 sis_ata133_get_base (ide_drive_t *drive) { -struct pci_dev *dev = drive->hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (drive->hwif->dev);u32 reg54 =0 ;pci_read_config_dword (dev,0x54 , ®54);
@@ -207,7 +207,7 @@ static u8 sis_ata133_get_base(ide_drive_static void sis_ata16_program_timings (ide_drive_t *drive,const u8 mode) { -struct pci_dev *dev = drive->hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (drive->hwif->dev);u16 t1 =0 ;u8 drive_pci =0x40 + drive->dn *2 ;
@@ -230,7 +230,7 @@ static void sis_ata16_program_timings(idstatic void sis_ata100_program_timings (ide_drive_t *drive,const u8 mode) { -struct pci_dev *dev = drive->hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (drive->hwif->dev);u8 t1, drive_pci =0x40 + drive->dn *2 ;/* timing bits: 7:4 active 3:0 recovery */
@@ -253,7 +253,7 @@ static void sis_ata100_program_timings(istatic void sis_ata133_program_timings (ide_drive_t *drive,const u8 mode) { -struct pci_dev *dev = drive->hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (drive->hwif->dev);u32 t1 =0 ;u8 drive_pci =sis_ata133_get_base (drive), clk, idx;
@@ -286,7 +286,7 @@ static void sis_program_timings(ide_drivstatic void config_drive_art_rwp (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive); -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev);u8 reg4bh =0 ;u8 rw_prefetch =0 ;
@@ -307,7 +307,7 @@ static void sis_set_pio_mode(ide_drive_tstatic void sis_ata133_program_udma_timings (ide_drive_t *drive,const u8 mode) { -struct pci_dev *dev = drive->hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (drive->hwif->dev);u32 regdw =0 ;u8 drive_pci =sis_ata133_get_base (drive), clk, idx;
@@ -326,7 +326,7 @@ static void sis_ata133_program_udma_timistatic void sis_ata33_program_udma_timings (ide_drive_t *drive,const u8 mode) { -struct pci_dev *dev = drive->hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (drive->hwif->dev);u8 drive_pci =0x40 + drive->dn *2 , reg =0 , i = chipset_family;pci_read_config_byte (dev, drive_pci +1 , ®);
@@ -359,7 +359,7 @@ static void sis_set_dma_mode(ide_drive_tstatic u8 sis5513_ata133_udma_filter (ide_drive_t *drive) { -struct pci_dev *dev = drive->hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (drive->hwif->dev);u32 regdw =0 ;u8 drive_pci =sis_ata133_get_base (drive);
@@ -530,7 +530,7 @@ static const struct sis_laptop sis_laptostatic u8 __devinit ata66_sis5513 (ide_hwif_t *hwif) { -struct pci_dev *pdev = hwif->pci_dev; +struct pci_dev *pdev =to_pci_dev (hwif->dev);const struct sis_laptop *lap = &sis_laptop[0 ];u8 ata66 =0 ;
@@ -545,12 +545,12 @@ static u8 __devinit ata66_sis5513(ide_hwif (chipset_family >=ATA_133 ) {u16 regw =0 ;u16 reg_addr = hwif->channel ?0x52 :0x50 ; -pci_read_config_word (hwif->pci_dev, reg_addr, ®w); +pci_read_config_word (pdev, reg_addr, ®w); ata66 = (regw &0x8000 ) ?0 :1 ; }else if (chipset_family >=ATA_66 ) {u8 reg48h =0 ;u8 mask = hwif->channel ?0x20 :0x10 ; -pci_read_config_byte (hwif->pci_dev,0x48 , ®48h); +pci_read_config_byte (pdev,0x48 , ®48h); ata66 = (reg48h & mask) ?0 :1 ; }
drivers/ide/pci/sl82c105.c +10 -7
@@ -78,7 +78,7 @@ static unsigned int get_pio_timings(ide_*/ static void sl82c105_set_pio_mode (ide_drive_t *drive,const u8 pio) { -struct pci_dev *dev =HWIF (drive)->pci_dev; +struct pci_dev *dev =to_pci_dev (drive->hwif->dev);int reg =0x44 + drive->dn *4 ;u16 drv_ctrl;
@@ -147,7 +147,7 @@ static inline void sl82c105_reset_host(sstatic void sl82c105_dma_lost_irq (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive); -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev);u32 val, mask = hwif->channel ?CTRL_IDE_IRQB :CTRL_IDE_IRQA ;u8 dma_cmd;
@@ -184,7 +184,7 @@ static void sl82c105_dma_lost_irq(ide_drstatic void sl82c105_dma_start (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive); -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev);int reg =0x44 + drive->dn *4 ;DBG (("%s(drive:%s)\n" , __FUNCTION__, drive->name));
@@ -197,15 +197,17 @@ static void sl82c105_dma_start(ide_drivestatic void sl82c105_dma_timeout (ide_drive_t *drive) { +struct pci_dev *dev =to_pci_dev (drive->hwif->dev); +DBG (("sl82c105_dma_timeout(drive:%s)\n" , drive->name)); -sl82c105_reset_host (HWIF (drive)->pci_dev); +sl82c105_reset_host (dev);ide_dma_timeout (drive); }static int sl82c105_dma_end (ide_drive_t *drive) { -struct pci_dev *dev =HWIF (drive)->pci_dev; +struct pci_dev *dev =to_pci_dev (drive->hwif->dev);int reg =0x44 + drive->dn *4 ;int ret;
@@ -224,7 +226,7 @@ static int sl82c105_dma_end(ide_drive_t*/ static void sl82c105_resetproc (ide_drive_t *drive) { -struct pci_dev *dev =HWIF (drive)->pci_dev; +struct pci_dev *dev =to_pci_dev (drive->hwif->dev);u32 val;DBG (("sl82c105_resetproc(drive:%s)\n" , drive->name));
@@ -293,6 +295,7 @@ static unsigned int __devinit init_chips*/ static void __devinit init_hwif_sl82c105 (ide_hwif_t *hwif) { +struct pci_dev *dev =to_pci_dev (hwif->dev);unsigned int rev;DBG (("init_hwif_sl82c105(hwif: ide%d)\n" , hwif->index));
@@ -304,7 +307,7 @@ static void __devinit init_hwif_sl82c105if (!hwif->dma_base)return ; - rev =sl82c105_bridge_revision (hwif->pci_dev); + rev =sl82c105_bridge_revision (dev);if (rev <=5 ) {/* * Never ever EVER under any circumstances enable
drivers/ide/pci/slc90e66.c +4 -3
@@ -26,7 +26,7 @@ static DEFINE_SPINLOCK(slc90e66_lock);static void slc90e66_set_pio_mode (ide_drive_t *drive,const u8 pio) {ide_hwif_t *hwif =HWIF (drive); -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev);int is_slave = drive->dn &1 ;int master_port = hwif->channel ?0x42 :0x40 ;int slave_port =0x44 ;
@@ -79,7 +79,7 @@ static void slc90e66_set_pio_mode(ide_drstatic void slc90e66_set_dma_mode (ide_drive_t *drive,const u8 speed) {ide_hwif_t *hwif =HWIF (drive); -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev);u8 maslave = hwif->channel ?0x42 :0x40 ;int sitre =0 , a_speed =7 << (drive->dn *4 );int u_speed =0 , u_flag =1 << drive->dn;
@@ -122,13 +122,14 @@ static void slc90e66_set_dma_mode(ide_drstatic void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif) { +struct pci_dev *dev =to_pci_dev (hwif->dev);u8 reg47 =0 ;u8 mask = hwif->channel ?0x01 :0x02 ;/* bit0:Primary */ hwif->set_pio_mode = &slc90e66_set_pio_mode; hwif->set_dma_mode = &slc90e66_set_dma_mode; -pci_read_config_byte (hwif->pci_dev,0x47 , ®47); +pci_read_config_byte (dev,0x47 , ®47);if (hwif->dma_base ==0 )return ;
drivers/ide/pci/tc86c001.c +2 -1
@@ -164,7 +164,8 @@ static int tc86c001_busproc(ide_drive_tstatic void __devinit init_hwif_tc86c001 (ide_hwif_t *hwif) { -unsigned long sc_base =pci_resource_start (hwif->pci_dev,5 ); +struct pci_dev *dev =to_pci_dev (hwif->dev); +unsigned long sc_base =pci_resource_start (dev,5 );u16 scr1 =inw (sc_base +0x00 );/* System Control 1 Register bit 15 (Soft Reset) set */
drivers/ide/pci/triflex.c +1 -1
@@ -43,7 +43,7 @@static void triflex_set_mode (ide_drive_t *drive,const u8 speed) {ide_hwif_t *hwif =HWIF (drive); -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev);u8 channel_offset = hwif->channel ?0x74 :0x70 ;u16 timing =0 ;u32 triflex_timings =0 ;
drivers/ide/pci/trm290.c +1 -1
@@ -242,10 +242,10 @@ static int trm290_ide_dma_test_irq (ide_static void __devinit init_hwif_trm290 (ide_hwif_t *hwif) { +struct pci_dev *dev =to_pci_dev (hwif->dev);unsigned int cfgbase =0 ;unsigned long flags;u8 reg =0 ; -struct pci_dev *dev = hwif->pci_dev; cfgbase =pci_resource_start (dev,4 );if ((dev->class &5 ) && cfgbase) {
drivers/ide/pci/via82cxxx.c +7 -5
@@ -121,8 +121,8 @@ struct via82cxxx_devstatic void via_set_speed (ide_hwif_t *hwif,u8 dn,struct ide_timing *timing) { -struct pci_dev *dev = hwif->pci_dev; -struct via82cxxx_dev *vdev =pci_get_drvdata (hwif->pci_dev); +struct pci_dev *dev =to_pci_dev (hwif->dev); +struct via82cxxx_dev *vdev =pci_get_drvdata (dev);u8 t;if (~vdev->via_config->flags &VIA_BAD_AST ) {
@@ -159,8 +159,10 @@ static void via_set_speed(ide_hwif_t *hwstatic void via_set_drive (ide_drive_t *drive,const u8 speed) { -ide_drive_t *peer =HWIF (drive)->drives + (~drive->dn &1 ); -struct via82cxxx_dev *vdev =pci_get_drvdata (drive->hwif->pci_dev); +ide_hwif_t *hwif = drive->hwif; +ide_drive_t *peer = hwif->drives + (~drive->dn &1 ); +struct pci_dev *dev =to_pci_dev (hwif->dev); +struct via82cxxx_dev *vdev =pci_get_drvdata (dev);struct ide_timing t, p;unsigned int T ,UT ;
@@ -408,7 +410,7 @@ static int via_cable_override(struct pcistatic u8 __devinit via82cxxx_cable_detect (ide_hwif_t *hwif) { -struct pci_dev *pdev = hwif->pci_dev; +struct pci_dev *pdev =to_pci_dev (hwif->dev);struct via82cxxx_dev *vdev =pci_get_drvdata (pdev);if (via_cable_override (pdev))
drivers/ide/ppc/pmac.c +6 -4
@@ -1200,7 +1200,7 @@ pmac_ide_macio_attach(struct macio_dev * base =ioremap (macio_resource_start (mdev,0 ),0x400 ); regbase = (unsigned long ) base; - hwif->pci_dev = mdev->bus->pdev; + hwif->dev = &mdev->bus->pdev->dev; pmif->mdev = mdev; pmif->node = mdev->ofdev.node;
@@ -1315,7 +1315,7 @@ pmac_ide_pci_attach(struct pci_dev *pdevreturn -ENXIO ; } - hwif->pci_dev = pdev; + hwif->dev = &pdev->dev; pmif->mdev =NULL ; pmif->node = np;
@@ -1725,10 +1725,12 @@ pmac_ide_dma_lost_irq (ide_drive_t *drivstatic void __init pmac_ide_setup_dma (pmac_ide_hwif_t *pmif,ide_hwif_t *hwif) { +struct pci_dev *dev =to_pci_dev (hwif->dev); +/* We won't need pci_dev if we switch to generic consistent * DMA routines ... */ -if (hwif->pci_dev ==NULL ) +if (dev ==NULL )return ;/* * Allocate space for the DBDMA commands.
@@ -1736,7 +1738,7 @@ pmac_ide_setup_dma(pmac_ide_hwif_t *pmif* aligning the start address to a multiple of 16 bytes. */ pmif->dma_table_cpu = (struct dbdma_cmd *)pci_alloc_consistent ( - hwif->pci_dev, + dev, (MAX_DCMDS +2 ) *sizeof (struct dbdma_cmd ), &hwif->dmatable_dma);if (pmif->dma_table_cpu ==NULL ) {
drivers/ide/setup-pci.c +3 -3
@@ -162,8 +162,8 @@ static void ide_pci_clear_simplex(unsignstatic unsigned long ide_get_or_set_dma_base (const struct ide_port_info *d,ide_hwif_t *hwif) { -unsigned long dma_base =0 ; -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev); +unsigned long dma_base =0 ;u8 dma_stat =0 ;if (hwif->mmio)
@@ -391,7 +391,7 @@ static ide_hwif_t *ide_hwif_configure(st hwif->noprobe = oldnoprobe; - hwif->pci_dev = dev; + hwif->dev = &dev->dev; hwif->cds = d; hwif->channel = port;
include/linux/ide.h +3 -2
@@ -503,7 +503,8 @@ typedef struct hwif_s {hwif_chipset_t chipset;/* sub-module for tuning.. */ -struct pci_dev *pci_dev;/* for pci chipsets */ +struct device *dev; +const struct ide_port_info *cds;/* chipset device struct */ ide_ack_intr_t *ack_intr;
@@ -1302,7 +1303,7 @@ static inline void ide_dump_identify(u8static inline int hwif_to_node (ide_hwif_t *hwif) { -struct pci_dev *dev = hwif->pci_dev; +struct pci_dev *dev =to_pci_dev (hwif->dev);return dev ?pcibus_to_node (dev->bus) :-1 ; }
PATCH 6/9 au1xxx-ide: use hwif->dev
In reply to Bartlomiej Zolnierkiewicz* Setup hwif->dev in au_ide_probe().
* Use hwif->dev instead of ahwif->dev in auide_build_sglist(), auide_build_dmatable(), auide_dma_end() and auide_ddma_init().
* Remove no longer needed 'dev' field from _auide_hwif type.
--- drivers/ide/mips/au1xxx-ide.c | 15 ++++++--------- include/asm-mips/mach-au1x00/au1xxx_ide.h | 1 - 2 files changed, 6 insertions(+), 10 deletions(-)
drivers/ide/mips/au1xxx-ide.c +6 -9
@@ -213,7 +213,6 @@ static void auide_set_dma_mode(ide_drivestatic int auide_build_sglist (ide_drive_t *drive,struct request *rq) {ide_hwif_t *hwif = drive->hwif; -_auide_hwif *ahwif = (_auide_hwif *)hwif->hwif_data;struct scatterlist *sg = hwif->sg_table;ide_map_sg (drive, rq);
@@ -223,7 +222,7 @@ static int auide_build_sglist(ide_drive_else hwif->sg_dma_direction =DMA_TO_DEVICE ; -return dma_map_sg (ahwif->dev, sg, hwif->sg_nents, +return dma_map_sg (hwif->dev, sg, hwif->sg_nents, hwif->sg_dma_direction); }
@@ -300,7 +299,7 @@ static int auide_build_dmatable(ide_drivreturn 1 ; use_pio_instead: -dma_unmap_sg (ahwif->dev, +dma_unmap_sg (hwif->dev, hwif->sg_table, hwif->sg_nents, hwif->sg_dma_direction);
@@ -311,10 +310,9 @@ static int auide_build_dmatable(ide_drivstatic int auide_dma_end (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive); -_auide_hwif *ahwif = (_auide_hwif *)hwif->hwif_data;if (hwif->sg_nents) { -dma_unmap_sg (ahwif->dev, hwif->sg_table, hwif->sg_nents, +dma_unmap_sg (hwif->dev, hwif->sg_table, hwif->sg_nents, hwif->sg_dma_direction); hwif->sg_nents =0 ; }
@@ -504,7 +502,7 @@ static int auide_ddma_init(_auide_hwif * auide->rx_desc_head = (void *)au1xxx_dbdma_ring_alloc (auide->rx_chan,NUM_DESCRIPTORS ); - hwif->dmatable_cpu =dma_alloc_coherent (auide->dev, + hwif->dmatable_cpu =dma_alloc_coherent (hwif->dev,PRD_ENTRIES *PRD_BYTES ,/* 1 Page */ &hwif->dmatable_dma,GFP_KERNEL );
@@ -592,9 +590,6 @@ static int au_ide_probe(struct device *d#endif memset (&auide_hwif,0 ,sizeof (_auide_hwif)); - auide_hwif.dev =0 ; - - ahwif->dev = dev; ahwif->irq =platform_get_irq (pdev,0 ); res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );
@@ -633,6 +628,8 @@ static int au_ide_probe(struct device *dide_init_port_hw (hwif, &hw); + hwif->dev = dev; + hwif->ultra_mask =0x0 ;/* Disable Ultra DMA */ #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA hwif->mwdma_mask =0x07 ;/* Multimode-2 DMA */
include/asm-mips/mach-au1x00/au1xxx_ide.h +0 -1
@@ -74,7 +74,6 @@ typedef structstruct dbdma_cmd *dma_table_cpu;dma_addr_t dma_table_dma;#endif -struct device *dev;int irq;u32 regbase;#ifdef CONFIG_PM
PATCH 7/9 icside: use hwif->dev
In reply to Bartlomiej Zolnierkiewicz* Setup hwif->dev in icside_setup().
* Use hwif->dev instead of state->dev in icside_build_sglist(), icside_dma_end(), icside_dma_start() and icside_dma_setup().
* Remove no longer needed 'dev' field from struct icside_state.
--- drivers/ide/arm/icside.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-)
drivers/ide/arm/icside.c +14 -17
@@ -71,8 +71,6 @@ struct icside_state {void __iomem *irq_port;void __iomem *ioc_base;unsigned int type; -/* parent device... until the IDE core gets one of its own */ -struct device *dev;ide_hwif_t *hwif[2 ]; };
@@ -209,7 +207,6 @@ static void icside_maskproc(ide_drive_tstatic void icside_build_sglist (ide_drive_t *drive,struct request *rq) {ide_hwif_t *hwif = drive->hwif; -struct icside_state *state = hwif->hwif_data;struct scatterlist *sg = hwif->sg_table;ide_map_sg (drive, rq);
@@ -219,7 +216,7 @@ static void icside_build_sglist(ide_drivelse hwif->sg_dma_direction =DMA_TO_DEVICE ; - hwif->sg_nents =dma_map_sg (state->dev, sg, hwif->sg_nents, + hwif->sg_nents =dma_map_sg (hwif->dev, sg, hwif->sg_nents, hwif->sg_dma_direction); }
@@ -294,33 +291,33 @@ static void icside_dma_host_set(ide_drivstatic int icside_dma_end (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive); -struct icside_state *state = hwif->hwif_data; +struct expansion_card *ec =ECARD_DEV (hwif->dev); drive->waiting_for_dma =0 ; -disable_dma (ECARD_DEV (state->dev)->dma); +disable_dma (ec->dma);/* Teardown mappings after DMA has completed. */ -dma_unmap_sg (state->dev, hwif->sg_table, hwif->sg_nents, +dma_unmap_sg (hwif->dev, hwif->sg_table, hwif->sg_nents, hwif->sg_dma_direction); -return get_dma_residue (ECARD_DEV (state->dev)->dma) !=0 ; +return get_dma_residue (ec->dma) !=0 ; }static void icside_dma_start (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive); -struct icside_state *state = hwif->hwif_data; +struct expansion_card *ec =ECARD_DEV (hwif->dev);/* We can not enable DMA on both channels simultaneously. */ -BUG_ON (dma_channel_active (ECARD_DEV (state->dev)->dma)); -enable_dma (ECARD_DEV (state->dev)->dma); +BUG_ON (dma_channel_active (ec->dma)); +enable_dma (ec->dma); }static int icside_dma_setup (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive); -struct icside_state *state = hwif->hwif_data; +struct expansion_card *ec =ECARD_DEV (hwif->dev);struct request *rq = hwif->hwgroup->rq;unsigned int dma_mode;
@@ -332,7 +329,7 @@ static int icside_dma_setup(ide_drive_t/* * We can not enable DMA on both channels. */ -BUG_ON (dma_channel_active (ECARD_DEV (state->dev)->dma)); +BUG_ON (dma_channel_active (ec->dma));icside_build_sglist (drive, rq);
@@ -349,14 +346,14 @@ static int icside_dma_setup(ide_drive_t/* * Select the correct timing for this drive. */ -set_dma_speed (ECARD_DEV (state->dev)->dma, drive->drive_data); +set_dma_speed (ec->dma, drive->drive_data);/* * Tell the DMA engine about the SG table and * data direction. */ -set_dma_sg (ECARD_DEV (state->dev)->dma, hwif->sg_table, hwif->sg_nents); -set_dma_mode (ECARD_DEV (state->dev)->dma, dma_mode); +set_dma_sg (ec->dma, hwif->sg_table, hwif->sg_nents); +set_dma_mode (ec->dma, dma_mode); drive->waiting_for_dma =1 ;
@@ -444,6 +441,7 @@ icside_setup(void __iomem *base, struct hwif->noprobe =0 ; hwif->chipset = ide_acorn; hwif->gendev.parent = &ec->dev; + hwif->dev = &ec->dev; }return hwif;
@@ -591,7 +589,6 @@ icside_probe(struct expansion_card *ec, } state->type =ICS_TYPE_NOTYPE ; - state->dev = &ec->dev; idmem =ecardm_iomap (ec,ECARD_RES_IOCFAST ,0 ,0 );if (idmem) {
Re: [PATCH 7/9] icside: use hwif->dev
Quoted 9 lines · Bartlomiej Zolnierkiewicz
* Setup
hwif->devinicside_setup().* Use
hwif->devinstead ofstate->devinicside_build_sglist(),icside_dma_end(),icside_dma_start()andicside_dma_setup().* Remove no longer needed 'dev' field from struct
icside_state.Cc Russell King <[email protected]>Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
MBR, Sergei
PS: Russel, that was only an eyes check, the last word is yours. :-)
Re: [PATCH 7/9] icside: use hwif->dev
In reply to Bartlomiej ZolnierkiewiczQuoted 9 lines · Bartlomiej Zolnierkiewicz
* Setup
hwif->devinicside_setup().* Use
hwif->devinstead ofstate->devinicside_build_sglist(),icside_dma_end(),icside_dma_start()andicside_dma_setup().* Remove no longer needed 'dev' field from struct
icside_state.Cc Russell King <[email protected]>Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
MBR, Sergei
Re: [PATCH 7/9] icside: use hwif->dev
Quoted 11 lines · Sergei Shtylyov
Quoted 9 lines
* Setup
hwif->devinicside_setup().* Use
hwif->devinstead ofstate->devinicside_build_sglist(),icside_dma_end(),icside_dma_start()andicside_dma_setup().* Remove no longer needed 'dev' field from struct
icside_state.Cc Russell King <[email protected]>Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>Acked-by Sergei Shtylyov <[email protected]>
Hmm, it looks like I've already reviewed this patch... :-/
MBR, Sergei
PATCH 8/9 ide: switch to DMA-mapping API
In reply to Bartlomiej Zolnierkiewicz* pci_map_sg() -> dma_map_sg() in ide_build_sglist().
* pci_unmap_sg() -> dma_unmap_sg() in ide_destroy_dmatable().
There should be no functionality changes caused by this patch except for blackfin arch whose dma_[un]map_sg() implementation differs from pci_[un]map_sg() one (on s390 arch there is no PCI, on avr32 and h8300 archs PCI is currently unsupported, on m32r arch PCI support depends on BROKEN, on m68k arch PCI support depends on HADES which in turn depends on BROKEN, on all other archs dma_[un]map_sg() functionality matches with pci_[un]map_sg() one).
---
It seems like blackfin arch should be using <asm-generic/pci-dma-compat.h> in <asm-blackfin/pci.h> or drivers still using PCI DMA-mapping API instead of the generic one won't work but I'll leave this to blackfin gurus...
[ Bryan, could you please take a look? Thanks. ]
drivers/ide/ide-dma.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/ide/ide-dma.c +9 -9
@@ -85,6 +85,7 @@#include <linux/ide.h> #include <linux/delay.h> #include <linux/scatterlist.h> +#include <linux/dma-mapping.h> #include <asm/io.h> #include <asm/irq.h>
@@ -175,26 +176,26 @@ static int ide_dma_good_drive(ide_drive_* @drive: the drive to build the DMA table for * @rq: the request holding the sg list * -* Perform the PCI mapping magic necessary to access the source or -* target buffers of a request via PCI DMA. The lower layers of the +* Perform the DMA mapping magic necessary to access the source or +* target buffers of a request via DMA. The lower layers of the * kernel provide the necessary cache management so that we can -* operate in a portable fashion +* operate in a portable fashion. */ int ide_build_sglist (ide_drive_t *drive,struct request *rq) {ide_hwif_t *hwif =HWIF (drive); -struct pci_dev *pdev =to_pci_dev (hwif->dev);struct scatterlist *sg = hwif->sg_table;ide_map_sg (drive, rq);if (rq_data_dir (rq) ==READ ) - hwif->sg_dma_direction =PCI_DMA_FROMDEVICE ; + hwif->sg_dma_direction =DMA_FROM_DEVICE ;else - hwif->sg_dma_direction =PCI_DMA_TODEVICE ; + hwif->sg_dma_direction =DMA_TO_DEVICE ; -return pci_map_sg (pdev, sg, hwif->sg_nents, hwif->sg_dma_direction); +return dma_map_sg (hwif->dev, sg, hwif->sg_nents, + hwif->sg_dma_direction); }EXPORT_SYMBOL_GPL (ide_build_sglist);
@@ -308,9 +309,8 @@ EXPORT_SYMBOL_GPL(ide_build_dmatable);void ide_destroy_dmatable (ide_drive_t *drive) {ide_hwif_t *hwif = drive->hwif; -struct pci_dev *pdev =to_pci_dev (hwif->dev); -pci_unmap_sg (pdev, hwif->sg_table, hwif->sg_nents, +dma_unmap_sg (hwif->dev, hwif->sg_table, hwif->sg_nents, hwif->sg_dma_direction); }
Re: [PATCH 8/9] ide: switch to DMA-mapping API
Quoted 4 lines · Bartlomiej Zolnierkiewicz
*
pci_map_sg()->dma_map_sg()inide_build_sglist().*
pci_unmap_sg()->dma_unmap_sg()inide_destroy_dmatable().
Quoted 8 lines
There should be no functionality changes caused by this patch except for blackfin arch whose dma_[un]map_sg() implementation differs from pci_[un]map_sg() one (on s390 arch there is no PCI, on avr32 and h8300 archs PCI is currently unsupported, on m32r arch PCI support depends on BROKEN, on m68k arch PCI support depends on HADES which in turn depends on BROKEN, on all other archs dma_[un]map_sg() functionality matches with pci_[un]map_sg() one).
Thanks a lot for this carefully check with Blackfin. Please go ahead with this patch change, we plan to remove PCI useless header file in Blackfin like AVR32
-Bryan
Quoted 75 lines
Cc Bryan Wu <[email protected]>Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>---
It seems like blackfin arch should be using <asm-generic/pci-dma-compat.h> in <asm-blackfin/pci.h> or drivers still using PCI DMA-mapping API instead of the generic one won't work but I'll leave this to blackfin gurus...[ Bryan, could you please take a look? Thanks. ]
drivers/ide/ide-dma.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)Index:
b/drivers/ide/ide-dma.c
===================================================================drivers/ide/ide-dma.c +9
-10@@ -85,6 +85,7 @@#include <linux/ide.h> #include <linux/delay.h> #include <linux/scatterlist.h> +#include <linux/dma-mapping.h> #include <asm/io.h> #include <asm/irq.h> @@ -175,26 +176,26 @@ static int ide_dma_good_drive(ide_drive_* @drive: the drive to build the DMA table for * @rq: the request holding the sg list * -* Perform the PCI mapping magic necessary to access the source or -* target buffers of a request via PCI DMA. The lower layers of the +* Perform the DMA mapping magic necessary to access the source or +* target buffers of a request via DMA. The lower layers of the * kernel provide the necessary cache management so that we can -* operate in a portable fashion +* operate in a portable fashion. */ int ide_build_sglist (ide_drive_t *drive,struct request *rq) {ide_hwif_t *hwif =HWIF (drive); -struct pci_dev *pdev =to_pci_dev (hwif->dev);struct scatterlist *sg = hwif->sg_table;ide_map_sg (drive, rq);if (rq_data_dir (rq) ==READ ) - hwif->sg_dma_direction =PCI_DMA_FROMDEVICE ; + hwif->sg_dma_direction =DMA_FROM_DEVICE ;else - hwif->sg_dma_direction =PCI_DMA_TODEVICE ; + hwif->sg_dma_direction =DMA_TO_DEVICE ; -return pci_map_sg (pdev, sg, hwif->sg_nents, hwif->sg_dma_direction); +return dma_map_sg (hwif->dev, sg, hwif->sg_nents, + hwif->sg_dma_direction); }EXPORT_SYMBOL_GPL (ide_build_sglist);@@ -308,9 +309,8 @@ EXPORT_SYMBOL_GPL(ide_build_dmatable);void ide_destroy_dmatable (ide_drive_t *drive) {ide_hwif_t *hwif = drive->hwif; -struct pci_dev *pdev =to_pci_dev (hwif->dev); -pci_unmap_sg (pdev, hwif->sg_table, hwif->sg_nents, +dma_unmap_sg (hwif->dev, hwif->sg_table, hwif->sg_nents, hwif->sg_dma_direction); } --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
PATCH 9/9 ide: use ide_build_sglist() and ide_destroy_dmatable() in non-PCI host drivers
In reply to Bartlomiej Zolnierkiewicz* Make ide_build_sglist() and ide_destroy_dmatable() available also when CONFIG_BLK_DEV_IDEDMA_PCI=n.
* Use ide_build_sglist() and ide_destroy_dmatable() in {ics,au1xxx-}ide.c and remove no longer needed {ics,au}ide_build_sglist().
There should be no functionality changes caused by this patch.
--- drivers/ide/arm/icside.c | 21 ++------------------- drivers/ide/ide-dma.c | 4 +++- drivers/ide/mips/au1xxx-ide.c | 28 +++------------------------- include/linux/ide.h | 5 +++-- 4 files changed, 11 insertions(+), 47 deletions(-)
drivers/ide/arm/icside.c +2 -19
@@ -204,22 +204,6 @@ static void icside_maskproc(ide_drive_t* interfaces use the same IRQ, which should guarantee this. */ -static void icside_build_sglist (ide_drive_t *drive,struct request *rq) -{ -ide_hwif_t *hwif = drive->hwif; -struct scatterlist *sg = hwif->sg_table; - -ide_map_sg (drive, rq); - -if (rq_data_dir (rq) ==READ ) - hwif->sg_dma_direction =DMA_FROM_DEVICE ; -else - hwif->sg_dma_direction =DMA_TO_DEVICE ; - - hwif->sg_nents =dma_map_sg (hwif->dev, sg, hwif->sg_nents, - hwif->sg_dma_direction); -} -/* * Configure the IOMD to give the appropriate timings for the transfer * mode being requested. We take the advice of the ATA standards, and
@@ -298,8 +282,7 @@ static int icside_dma_end(ide_drive_t *ddisable_dma (ec->dma);/* Teardown mappings after DMA has completed. */ -dma_unmap_sg (hwif->dev, hwif->sg_table, hwif->sg_nents, - hwif->sg_dma_direction); +ide_destroy_dmatable (drive);return get_dma_residue (ec->dma) !=0 ; }
@@ -331,7 +314,7 @@ static int icside_dma_setup(ide_drive_t*/ BUG_ON (dma_channel_active (ec->dma)); -icside_build_sglist (drive, rq); + hwif->sg_nents =ide_build_sglist (drive, rq);/* * Ensure that we have the right interrupt routed.
drivers/ide/ide-dma.c +3 -1
@@ -170,7 +170,6 @@ static int ide_dma_good_drive(ide_drive_return ide_in_drive_list (drive->id, drive_whitelist); } -#ifdef CONFIG_BLK_DEV_IDEDMA_PCI /** * ide_build_sglist - map IDE scatter gather for DMA I/O * @drive: the drive to build the DMA table for
@@ -200,6 +199,7 @@ int ide_build_sglist(ide_drive_t *drive,EXPORT_SYMBOL_GPL (ide_build_sglist); +#ifdef CONFIG_BLK_DEV_IDEDMA_PCI /** * ide_build_dmatable - build IDE DMA table *
@@ -294,6 +294,7 @@ use_pio_instead: }EXPORT_SYMBOL_GPL (ide_build_dmatable); +#endif /** * ide_destroy_dmatable - clean up DMA mapping
@@ -316,6 +317,7 @@ void ide_destroy_dmatable (ide_drive_t *EXPORT_SYMBOL_GPL (ide_destroy_dmatable); +#ifdef CONFIG_BLK_DEV_IDEDMA_PCI /** * config_drive_for_dma - attempt to activate IDE DMA * @drive: the drive to place in DMA mode
drivers/ide/mips/au1xxx-ide.c +3 -25
@@ -209,23 +209,6 @@ static void auide_set_dma_mode(ide_drive*/ #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA - -static int auide_build_sglist (ide_drive_t *drive,struct request *rq) -{ -ide_hwif_t *hwif = drive->hwif; -struct scatterlist *sg = hwif->sg_table; - -ide_map_sg (drive, rq); - -if (rq_data_dir (rq) ==READ ) - hwif->sg_dma_direction =DMA_FROM_DEVICE ; -else - hwif->sg_dma_direction =DMA_TO_DEVICE ; - -return dma_map_sg (hwif->dev, sg, hwif->sg_nents, - hwif->sg_dma_direction); -} -static int auide_build_dmatable (ide_drive_t *drive) {int i, iswrite, count =0 ;
@@ -240,8 +223,7 @@ static int auide_build_dmatable(ide_driv/* Save for interrupt context */ ahwif->drive = drive; -/* Build sglist */ - hwif->sg_nents = i =auide_build_sglist (drive, rq); + hwif->sg_nents = i =ide_build_sglist (drive, rq);if (!i)return 0 ;
@@ -299,10 +281,7 @@ static int auide_build_dmatable(ide_drivreturn 1 ; use_pio_instead: -dma_unmap_sg (hwif->dev, - hwif->sg_table, - hwif->sg_nents, - hwif->sg_dma_direction); +ide_destroy_dmatable (drive);return 0 ;/* revert to PIO for this request */ }
@@ -312,8 +291,7 @@ static int auide_dma_end(ide_drive_t *dride_hwif_t *hwif =HWIF (drive);if (hwif->sg_nents) { -dma_unmap_sg (hwif->dev, hwif->sg_table, hwif->sg_nents, - hwif->sg_dma_direction); +ide_destroy_dmatable (drive); hwif->sg_nents =0 ; }
include/linux/ide.h +3 -2
@@ -1158,10 +1158,11 @@ void ide_dma_on(ide_drive_t *);int ide_set_dma (ide_drive_t *);ide_startstop_t ide_dma_intr (ide_drive_t *); +int ide_build_sglist (ide_drive_t *,struct request *); +void ide_destroy_dmatable (ide_drive_t *); +#ifdef CONFIG_BLK_DEV_IDEDMA_PCI -extern int ide_build_sglist (ide_drive_t *,struct request *);extern int ide_build_dmatable (ide_drive_t *,struct request *); -extern void ide_destroy_dmatable (ide_drive_t *);extern int ide_release_dma (ide_hwif_t *);extern void ide_setup_dma (ide_hwif_t *,unsigned long ,unsigned int );