Skip to content

Commit

Permalink
ide: add IDE_HFLAG_NO_ATAPI_DMA host flag
Browse files Browse the repository at this point in the history
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 <bzolnier@gmail.com>
  • Loading branch information
Bartlomiej Zolnierkiewicz committed Oct 18, 2007
1 parent 1c3dd32 commit 33c1002
Show file tree
Hide file tree
Showing 39 changed files with 40 additions and 58 deletions.
1 change: 0 additions & 1 deletion drivers/ide/arm/icside.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,6 @@ static void icside_dma_lost_irq(ide_drive_t *drive)

static void icside_dma_init(ide_hwif_t *hwif)
{
hwif->atapi_dma = 1;
hwif->mwdma_mask = 7; /* MW0..2 */
hwif->swdma_mask = 7; /* SW0..2 */

Expand Down
1 change: 1 addition & 0 deletions drivers/ide/cris/ide-cris.c
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,7 @@ init_e100_ide (void)
hwif->dma_host_on = &cris_dma_on;
hwif->dma_off_quietly = &cris_dma_off;
hwif->cbl = ATA_CBL_PATA40;
hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA;
hwif->pio_mask = ATA_PIO4,
hwif->drives[0].autotune = 1;
hwif->drives[1].autotune = 1;
Expand Down
12 changes: 8 additions & 4 deletions drivers/ide/ide-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,10 @@ static int config_drive_for_dma (ide_drive_t *drive)
ide_hwif_t *hwif = drive->hwif;
struct hd_driveid *id = drive->id;

if (drive->media != ide_disk && hwif->atapi_dma == 0)
return 0;
if (drive->media != ide_disk) {
if (hwif->host_flags & IDE_HFLAG_NO_ATAPI_DMA)
return -1;
}

/*
* Enable DMA on any drive that has
Expand Down Expand Up @@ -726,8 +728,10 @@ u8 ide_find_dma_mode(ide_drive_t *drive, u8 req_mode)
int x, i;
u8 mode = 0;

if (drive->media != ide_disk && hwif->atapi_dma == 0)
return 0;
if (drive->media != ide_disk) {
if (hwif->host_flags & IDE_HFLAG_NO_ATAPI_DMA)
return 0;
}

for (i = 0; i < ARRAY_SIZE(xfer_mode_bases); i++) {
if (req_mode < xfer_mode_bases[i])
Expand Down
3 changes: 0 additions & 3 deletions drivers/ide/ide.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,6 @@ static void init_hwif_data(ide_hwif_t *hwif, unsigned int index)

hwif->bus_state = BUSSTATE_ON;

hwif->atapi_dma = 0; /* disable all atapi dma */

init_completion(&hwif->gendev_rel_comp);

default_hwif_iops(hwif);
Expand Down Expand Up @@ -379,7 +377,6 @@ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif)

hwif->pio_mask = tmp_hwif->pio_mask;

hwif->atapi_dma = tmp_hwif->atapi_dma;
hwif->ultra_mask = tmp_hwif->ultra_mask;
hwif->mwdma_mask = tmp_hwif->mwdma_mask;
hwif->swdma_mask = tmp_hwif->swdma_mask;
Expand Down
3 changes: 0 additions & 3 deletions drivers/ide/mips/au1xxx-ide.c
Original file line number Diff line number Diff line change
Expand Up @@ -699,9 +699,6 @@ static int au_ide_probe(struct device *dev)
hwif->dma_host_on = &auide_dma_host_on;
hwif->dma_lost_irq = &auide_dma_lost_irq;
hwif->ide_dma_on = &auide_dma_on;

hwif->atapi_dma = 1;

#else /* !CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */
hwif->channel = 0;
hwif->hold = 1;
Expand Down
5 changes: 5 additions & 0 deletions drivers/ide/pci/aec62xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = {
.autodma = AUTODMA,
.enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
.bootable = OFF_BOARD,
.host_flags = IDE_HFLAG_NO_ATAPI_DMA,
.pio_mask = ATA_PIO4,
.udma_mask = 0x07, /* udma0-2 */
},{ /* 1 */
Expand All @@ -256,6 +257,7 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = {
.init_hwif = init_hwif_aec62xx,
.autodma = NOAUTODMA,
.bootable = OFF_BOARD,
.host_flags = IDE_HFLAG_NO_ATAPI_DMA,
.pio_mask = ATA_PIO4,
.udma_mask = 0x1f, /* udma0-4 */
},{ /* 2 */
Expand All @@ -266,6 +268,7 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = {
.autodma = AUTODMA,
.enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
.bootable = NEVER_BOARD,
.host_flags = IDE_HFLAG_NO_ATAPI_DMA,
.pio_mask = ATA_PIO4,
.udma_mask = 0x1f, /* udma0-4 */
},{ /* 3 */
Expand All @@ -275,6 +278,7 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = {
.init_hwif = init_hwif_aec62xx,
.autodma = AUTODMA,
.bootable = OFF_BOARD,
.host_flags = IDE_HFLAG_NO_ATAPI_DMA,
.pio_mask = ATA_PIO4,
.udma_mask = 0x3f, /* udma0-5 */
},{ /* 4 */
Expand All @@ -285,6 +289,7 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = {
.autodma = AUTODMA,
.enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
.bootable = OFF_BOARD,
.host_flags = IDE_HFLAG_NO_ATAPI_DMA,
.pio_mask = ATA_PIO4,
.udma_mask = 0x3f, /* udma0-5 */
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/ide/pci/alim15x3.c
Original file line number Diff line number Diff line change
Expand Up @@ -677,8 +677,8 @@ static void __devinit init_hwif_common_ali15x3 (ide_hwif_t *hwif)
* check in ->init_dma guarantees m5229_revision >= 0x20 here
*/

if (m5229_revision > 0x20)
hwif->atapi_dma = 1;
if (m5229_revision == 0x20)
hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA;

if (m5229_revision <= 0x20)
hwif->ultra_mask = 0x00; /* no udma */
Expand Down
2 changes: 0 additions & 2 deletions drivers/ide/pci/amd74xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,6 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif)
if (!hwif->dma_base)
return;

hwif->atapi_dma = 1;

hwif->ultra_mask = amd_config->udma_mask;
hwif->mwdma_mask = 0x07;
if ((amd_config->flags & AMD_BAD_SWDMA) == 0)
Expand Down
1 change: 0 additions & 1 deletion drivers/ide/pci/atiixp.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ static void __devinit init_hwif_atiixp(ide_hwif_t *hwif)
if (!hwif->dma_base)
return;

hwif->atapi_dma = 1;
hwif->ultra_mask = 0x3f;
hwif->mwdma_mask = 0x07;

Expand Down
1 change: 0 additions & 1 deletion drivers/ide/pci/cmd64x.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,6 @@ static void __devinit init_hwif_cmd64x(ide_hwif_t *hwif)
if (!hwif->dma_base)
return;

hwif->atapi_dma = 1;
hwif->mwdma_mask = 0x07;
hwif->ultra_mask = hwif->cds->udma_mask;

Expand Down
6 changes: 3 additions & 3 deletions drivers/ide/pci/cs5520.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ static void __devinit cs5520_init_setup_dma(struct pci_dev *dev, ide_pci_device_

static int cs5520_dma_on(ide_drive_t *drive)
{
/* ATAPI is harder so leave it for now */
drive->vdma = 1;
return 0;
}
Expand All @@ -141,8 +142,6 @@ static void __devinit init_hwif_cs5520(ide_hwif_t *hwif)

hwif->ide_dma_on = &cs5520_dma_on;

/* ATAPI is harder so leave it for now */
hwif->atapi_dma = 0;
hwif->ultra_mask = 0;
hwif->swdma_mask = 0;
hwif->mwdma_mask = 0;
Expand All @@ -156,7 +155,8 @@ static void __devinit init_hwif_cs5520(ide_hwif_t *hwif)
.autodma = AUTODMA, \
.bootable = ON_BOARD, \
.host_flags = IDE_HFLAG_ISA_PORTS | \
IDE_HFLAG_VDMA, \
IDE_HFLAG_VDMA | \
IDE_HFLAG_NO_ATAPI_DMA, \
.pio_mask = ATA_PIO4, \
}

Expand Down
1 change: 0 additions & 1 deletion drivers/ide/pci/cs5530.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ static void __devinit init_hwif_cs5530 (ide_hwif_t *hwif)
if (hwif->dma_base == 0)
return;

hwif->atapi_dma = 1;
hwif->ultra_mask = 0x07;
hwif->mwdma_mask = 0x07;

Expand Down
1 change: 0 additions & 1 deletion drivers/ide/pci/cs5535.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ static void __devinit init_hwif_cs5535(ide_hwif_t *hwif)
if (hwif->dma_base == 0)
return;

hwif->atapi_dma = 1;
hwif->ultra_mask = 0x1F;
hwif->mwdma_mask = 0x07;

Expand Down
1 change: 0 additions & 1 deletion drivers/ide/pci/cy82c693.c
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,6 @@ static void __devinit init_hwif_cy82c693(ide_hwif_t *hwif)
return;
}

hwif->atapi_dma = 1;
hwif->mwdma_mask = 0x04;
hwif->swdma_mask = 0x04;

Expand Down
1 change: 0 additions & 1 deletion drivers/ide/pci/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ static void __devinit init_hwif_generic (ide_hwif_t *hwif)
if (!(hwif->dma_base))
return;

hwif->atapi_dma = 1;
hwif->ultra_mask = 0x7f;
hwif->mwdma_mask = 0x07;
hwif->swdma_mask = 0x07;
Expand Down
1 change: 1 addition & 0 deletions drivers/ide/pci/hpt34x.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ static ide_pci_device_t hpt34x_chipset __devinitdata = {
.autodma = NOAUTODMA,
.bootable = NEVER_BOARD,
.extra = 16,
.host_flags = IDE_HFLAG_NO_ATAPI_DMA,
.pio_mask = ATA_PIO5,
};

Expand Down
6 changes: 6 additions & 0 deletions drivers/ide/pci/hpt366.c
Original file line number Diff line number Diff line change
Expand Up @@ -1555,6 +1555,7 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = {
.enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}},
.bootable = OFF_BOARD,
.extra = 240,
.host_flags = IDE_HFLAG_NO_ATAPI_DMA,
.pio_mask = ATA_PIO4,
},{ /* 1 */
.name = "HPT372A",
Expand All @@ -1567,6 +1568,7 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = {
.udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
.bootable = OFF_BOARD,
.extra = 240,
.host_flags = IDE_HFLAG_NO_ATAPI_DMA,
.pio_mask = ATA_PIO4,
},{ /* 2 */
.name = "HPT302",
Expand All @@ -1579,6 +1581,7 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = {
.udma_mask = HPT302_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
.bootable = OFF_BOARD,
.extra = 240,
.host_flags = IDE_HFLAG_NO_ATAPI_DMA,
.pio_mask = ATA_PIO4,
},{ /* 3 */
.name = "HPT371",
Expand All @@ -1591,6 +1594,7 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = {
.udma_mask = HPT371_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
.bootable = OFF_BOARD,
.extra = 240,
.host_flags = IDE_HFLAG_NO_ATAPI_DMA,
.pio_mask = ATA_PIO4,
},{ /* 4 */
.name = "HPT374",
Expand All @@ -1603,6 +1607,7 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = {
.udma_mask = ATA_UDMA5,
.bootable = OFF_BOARD,
.extra = 240,
.host_flags = IDE_HFLAG_NO_ATAPI_DMA,
.pio_mask = ATA_PIO4,
},{ /* 5 */
.name = "HPT372N",
Expand All @@ -1615,6 +1620,7 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = {
.udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
.bootable = OFF_BOARD,
.extra = 240,
.host_flags = IDE_HFLAG_NO_ATAPI_DMA,
.pio_mask = ATA_PIO4,
}
};
Expand Down
1 change: 0 additions & 1 deletion drivers/ide/pci/it8213.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ static void __devinit init_hwif_it8213(ide_hwif_t *hwif)
if (!hwif->dma_base)
return;

hwif->atapi_dma = 1;
hwif->ultra_mask = 0x7f;
hwif->mwdma_mask = 0x06;
hwif->swdma_mask = 0x04;
Expand Down
12 changes: 5 additions & 7 deletions drivers/ide/pci/it821x.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,12 +544,10 @@ static void __devinit init_hwif_it821x(ide_hwif_t *hwif)

ide_set_hwifdata(hwif, idev);

hwif->atapi_dma = 1;

pci_read_config_byte(hwif->pci_dev, 0x50, &conf);
if(conf & 1) {
if (conf & 1) {
idev->smart = 1;
hwif->atapi_dma = 0;
hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA;
/* Long I/O's although allowed in LBA48 space cause the
onboard firmware to enter the twighlight zone */
hwif->rqsize = 256;
Expand All @@ -570,10 +568,10 @@ static void __devinit init_hwif_it821x(ide_hwif_t *hwif)
*/

pci_read_config_byte(hwif->pci_dev, 0x08, &conf);
if(conf == 0x10) {
if (conf == 0x10) {
idev->timing10 = 1;
hwif->atapi_dma = 0;
if(!idev->smart)
hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA;
if (idev->smart == 0)
printk(KERN_WARNING "it821x: Revision 0x10, workarounds activated.\n");
}

Expand Down
1 change: 0 additions & 1 deletion drivers/ide/pci/jmicron.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ static void __devinit init_hwif_jmicron(ide_hwif_t *hwif)
if (hwif->dma_base == 0)
return;

hwif->atapi_dma = 1;
hwif->ultra_mask = 0x7f;
hwif->mwdma_mask = 0x07;

Expand Down
3 changes: 2 additions & 1 deletion drivers/ide/pci/ns87415.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,8 @@ static ide_pci_device_t ns87415_chipset __devinitdata = {
.init_hwif = init_hwif_ns87415,
.autodma = AUTODMA,
.bootable = ON_BOARD,
.host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
.host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA |
IDE_HFLAG_NO_ATAPI_DMA,
};

static int __devinit ns87415_init_one(struct pci_dev *dev, const struct pci_device_id *id)
Expand Down
1 change: 0 additions & 1 deletion drivers/ide/pci/opti621.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,6 @@ static void __devinit init_hwif_opti621 (ide_hwif_t *hwif)
if (!(hwif->dma_base))
return;

hwif->atapi_dma = 1;
hwif->mwdma_mask = 0x07;
hwif->swdma_mask = 0x07;
}
Expand Down
2 changes: 0 additions & 2 deletions drivers/ide/pci/pdc202xx_new.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,6 @@ static void __devinit init_hwif_pdc202new(ide_hwif_t *hwif)
if (hwif->dma_base == 0)
return;

hwif->atapi_dma = 1;

hwif->ultra_mask = hwif->cds->udma_mask;
hwif->mwdma_mask = 0x07;

Expand Down
1 change: 0 additions & 1 deletion drivers/ide/pci/pdc202xx_old.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif)
hwif->ultra_mask = hwif->cds->udma_mask;
hwif->mwdma_mask = 0x07;
hwif->swdma_mask = 0x07;
hwif->atapi_dma = 1;

hwif->dma_lost_irq = &pdc202xx_dma_lost_irq;
hwif->dma_timeout = &pdc202xx_dma_timeout;
Expand Down
2 changes: 0 additions & 2 deletions drivers/ide/pci/piix.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,6 @@ static void __devinit init_hwif_piix(ide_hwif_t *hwif)
if (piix_is_ichx(hwif->pci_dev))
hwif->ide_dma_clear_irq = &piix_dma_clear_irq;

hwif->atapi_dma = 1;

hwif->ultra_mask = hwif->cds->udma_mask;
hwif->mwdma_mask = 0x06;
hwif->swdma_mask = 0x04;
Expand Down
1 change: 0 additions & 1 deletion drivers/ide/pci/sc1200.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,6 @@ static void __devinit init_hwif_sc1200 (ide_hwif_t *hwif)
hwif->udma_filter = sc1200_udma_filter;
hwif->ide_dma_end = &sc1200_ide_dma_end;

hwif->atapi_dma = 1;
hwif->ultra_mask = 0x07;
hwif->mwdma_mask = 0x07;
}
Expand Down
1 change: 0 additions & 1 deletion drivers/ide/pci/scc_pata.c
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,6 @@ static void __devinit init_hwif_scc(ide_hwif_t *hwif)
}
hwif->mwdma_mask = 0x00;
hwif->swdma_mask = 0x00;
hwif->atapi_dma = 1;

/* we support 80c cable only. */
hwif->cbl = ATA_CBL_PATA80;
Expand Down
2 changes: 0 additions & 2 deletions drivers/ide/pci/serverworks.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,6 @@ static void __devinit init_hwif_svwks (ide_hwif_t *hwif)
hwif->set_dma_mode = &svwks_set_dma_mode;
hwif->udma_filter = &svwks_udma_filter;

hwif->atapi_dma = 1;

if (hwif->pci_dev->device != PCI_DEVICE_ID_SERVERWORKS_OSB4IDE)
hwif->ultra_mask = 0x3f;

Expand Down
1 change: 0 additions & 1 deletion drivers/ide/pci/sgiioc4.c
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,6 @@ ide_init_sgiioc4(ide_hwif_t * hwif)
if (hwif->dma_base == 0)
return;

hwif->atapi_dma = 1;
hwif->mwdma_mask = 0x04;

hwif->dma_setup = &sgiioc4_ide_dma_setup;
Expand Down
4 changes: 2 additions & 2 deletions drivers/ide/pci/siimage.c
Original file line number Diff line number Diff line change
Expand Up @@ -899,8 +899,8 @@ static void __devinit init_hwif_siimage(ide_hwif_t *hwif)
hwif->ultra_mask = 0x7f;
hwif->mwdma_mask = 0x07;

if (!is_sata(hwif))
hwif->atapi_dma = 1;
if (is_sata(hwif))
hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA;

if (hwif->cbl != ATA_CBL_PATA40_SHORT)
hwif->cbl = ata66_siimage(hwif);
Expand Down
Loading

0 comments on commit 33c1002

Please sign in to comment.