Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 48829
b: refs/heads/master
c: 3608b5d
h: refs/heads/master
i:
  48827: 1718eee
v: v3
  • Loading branch information
Bartlomiej Zolnierkiewicz committed Feb 17, 2007
1 parent 7148bc3 commit a42e3e2
Show file tree
Hide file tree
Showing 37 changed files with 121 additions and 140 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9ef5791e1be91007951477b8ed1530ac1166a8e7
refs/heads/master: 3608b5d71a52c053787dbad6af20c25f7e0b75a9
5 changes: 1 addition & 4 deletions trunk/drivers/ide/arm/icside.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,10 +365,7 @@ static int icside_dma_check(ide_drive_t *drive)
out:
on = icside_set_speed(drive, xfer_mode);

if (on)
return icside_dma_on(drive);
else
return icside_dma_off_quietly(drive);
return on ? 0 : -1;
}

static int icside_dma_end(ide_drive_t *drive)
Expand Down
6 changes: 2 additions & 4 deletions trunk/drivers/ide/cris/ide-cris.c
Original file line number Diff line number Diff line change
Expand Up @@ -1048,12 +1048,10 @@ static ide_startstop_t cris_dma_intr (ide_drive_t *drive)

static int cris_dma_check(ide_drive_t *drive)
{
ide_hwif_t *hwif = drive->hwif;

if (ide_use_dma(drive) && cris_config_drive_for_dma(drive))
return hwif->ide_dma_on(drive);
return 0;

return hwif->ide_dma_off_quietly(drive);
return -1;
}

static int cris_dma_end(ide_drive_t *drive)
Expand Down
37 changes: 30 additions & 7 deletions trunk/drivers/ide/ide-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,30 +348,29 @@ EXPORT_SYMBOL_GPL(ide_destroy_dmatable);
static int config_drive_for_dma (ide_drive_t *drive)
{
struct hd_driveid *id = drive->id;
ide_hwif_t *hwif = HWIF(drive);

if ((id->capability & 1) && hwif->autodma) {
if ((id->capability & 1) && drive->hwif->autodma) {
/*
* Enable DMA on any drive that has
* UltraDMA (mode 0/1/2/3/4/5/6) enabled
*/
if ((id->field_valid & 4) && ((id->dma_ultra >> 8) & 0x7f))
return hwif->ide_dma_on(drive);
return 0;
/*
* Enable DMA on any drive that has mode2 DMA
* (multi or single) enabled
*/
if (id->field_valid & 2) /* regular DMA */
if ((id->dma_mword & 0x404) == 0x404 ||
(id->dma_1word & 0x404) == 0x404)
return hwif->ide_dma_on(drive);
return 0;

/* Consult the list of known "good" drives */
if (__ide_dma_good_drive(drive))
return hwif->ide_dma_on(drive);
return 0;
}
// if (hwif->tuneproc != NULL) hwif->tuneproc(drive, 255);
return hwif->ide_dma_off_quietly(drive);

return -1;
}

/**
Expand Down Expand Up @@ -765,6 +764,30 @@ void ide_dma_verbose(ide_drive_t *drive)

EXPORT_SYMBOL(ide_dma_verbose);

int ide_set_dma(ide_drive_t *drive)
{
ide_hwif_t *hwif = drive->hwif;
int rc;

rc = hwif->ide_dma_check(drive);

switch(rc) {
case -1: /* DMA needs to be disabled */
return hwif->ide_dma_off_quietly(drive);
case 0: /* DMA needs to be enabled */
return hwif->ide_dma_on(drive);
case 1: /* DMA setting cannot be changed */
break;
default:
BUG();
break;
}

return rc;
}

EXPORT_SYMBOL_GPL(ide_set_dma);

#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
int __ide_dma_lostirq (ide_drive_t *drive)
{
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/ide/ide-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *
break;
if (drive->hwif->ide_dma_check == NULL)
break;
drive->hwif->ide_dma_check(drive);
ide_set_dma(drive);
break;
}
pm->pm_step = ide_pm_state_completed;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/ide/ide-probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ static void probe_hwif(ide_hwif_t *hwif)
#ifdef CONFIG_IDEDMA_ONLYDISK
if (drive->media == ide_disk)
#endif
hwif->ide_dma_check(drive);
ide_set_dma(drive);
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion trunk/drivers/ide/ide.c
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,8 @@ static int set_using_dma (ide_drive_t *drive, int arg)
if (HWIF(drive)->ide_dma_check == NULL)
return -EPERM;
if (arg) {
if (HWIF(drive)->ide_dma_check(drive)) return -EIO;
if (ide_set_dma(drive))
return -EIO;
if (HWIF(drive)->ide_dma_on(drive)) return -EIO;
} else {
if (__ide_dma_off(drive))
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/ide/mips/au1xxx-ide.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,9 @@ static int auide_dma_check(ide_drive_t *drive)
speed = ide_find_best_mode(drive, XFER_PIO | XFER_MWDMA);

if (drive->autodma && (speed & XFER_MODE) != XFER_PIO)
return HWIF(drive)->ide_dma_on(drive);
return 0;

return HWIF(drive)->ide_dma_off_quietly(drive);
return -1;
}

static int auide_dma_test_irq(ide_drive_t *drive)
Expand Down
6 changes: 2 additions & 4 deletions trunk/drivers/ide/pci/aec62xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,13 @@ static void aec62xx_tune_drive (ide_drive_t *drive, u8 pio)

static int aec62xx_config_drive_xfer_rate (ide_drive_t *drive)
{
ide_hwif_t *hwif = HWIF(drive);

if (ide_use_dma(drive) && config_chipset_for_dma(drive))
return hwif->ide_dma_on(drive);
return 0;

if (ide_use_fast_pio(drive))
aec62xx_tune_drive(drive, 5);

return hwif->ide_dma_off_quietly(drive);
return -1;
}

static int aec62xx_irq_timeout (ide_drive_t *drive)
Expand Down
11 changes: 5 additions & 6 deletions trunk/drivers/ide/pci/alim15x3.c
Original file line number Diff line number Diff line change
Expand Up @@ -507,17 +507,15 @@ static int config_chipset_for_dma (ide_drive_t *drive)
*
* Configure a drive for DMA operation. If DMA is not possible we
* drop the drive into PIO mode instead.
*
* FIXME: exactly what are we trying to return here
*/

static int ali15x3_config_drive_for_dma(ide_drive_t *drive)
{
ide_hwif_t *hwif = HWIF(drive);
struct hd_driveid *id = drive->id;

if ((m5229_revision<=0x20) && (drive->media!=ide_disk))
return hwif->ide_dma_off_quietly(drive);
goto no_dma_set;

drive->init_speed = 0;

Expand Down Expand Up @@ -552,9 +550,10 @@ static int ali15x3_config_drive_for_dma(ide_drive_t *drive)
ata_pio:
hwif->tuneproc(drive, 255);
no_dma_set:
return hwif->ide_dma_off_quietly(drive);
return -1;
}
return hwif->ide_dma_on(drive);

return 0;
}

/**
Expand Down
5 changes: 3 additions & 2 deletions trunk/drivers/ide/pci/amd74xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,9 @@ static int amd74xx_ide_dma_check(ide_drive_t *drive)
amd_set_drive(drive, speed);

if (drive->autodma && (speed & XFER_MODE) != XFER_PIO)
return HWIF(drive)->ide_dma_on(drive);
return HWIF(drive)->ide_dma_off_quietly(drive);
return 0;

return -1;
}

/*
Expand Down
7 changes: 3 additions & 4 deletions trunk/drivers/ide/pci/atiixp.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,21 +252,20 @@ static int atiixp_config_drive_for_dma(ide_drive_t *drive)

static int atiixp_dma_check(ide_drive_t *drive)
{
ide_hwif_t *hwif = HWIF(drive);
u8 tspeed, speed;

drive->init_speed = 0;

if (ide_use_dma(drive) && atiixp_config_drive_for_dma(drive))
return hwif->ide_dma_on(drive);
return 0;

if (ide_use_fast_pio(drive)) {
tspeed = ide_get_best_pio_mode(drive, 255, 5, NULL);
speed = atiixp_dma_2_pio(XFER_PIO_0 + tspeed) + XFER_PIO_0;
hwif->speedproc(drive, speed);
atiixp_speedproc(drive, speed);
}

return hwif->ide_dma_off_quietly(drive);
return -1;
}

/**
Expand Down
6 changes: 2 additions & 4 deletions trunk/drivers/ide/pci/cmd64x.c
Original file line number Diff line number Diff line change
Expand Up @@ -474,15 +474,13 @@ static int config_chipset_for_dma (ide_drive_t *drive)

static int cmd64x_config_drive_for_dma (ide_drive_t *drive)
{
ide_hwif_t *hwif = HWIF(drive);

if (ide_use_dma(drive) && config_chipset_for_dma(drive))
return hwif->ide_dma_on(drive);
return 0;

if (ide_use_fast_pio(drive))
config_chipset_for_pio(drive, 1);

return hwif->ide_dma_off_quietly(drive);
return -1;
}

static int cmd64x_alt_dma_status (struct pci_dev *dev)
Expand Down
5 changes: 2 additions & 3 deletions trunk/drivers/ide/pci/cs5520.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,11 @@ static void cs5520_tune_drive(ide_drive_t *drive, u8 pio)

static int cs5520_config_drive_xfer_rate(ide_drive_t *drive)
{
ide_hwif_t *hwif = HWIF(drive);

/* Tune the drive for PIO modes up to PIO 4 */
cs5520_tune_drive(drive, 4);

/* Then tell the core to use DMA operations */
return hwif->ide_dma_on(drive);
return 0;
}

/*
Expand Down
5 changes: 1 addition & 4 deletions trunk/drivers/ide/pci/cs5530.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,7 @@ static int cs5530_config_dma (ide_drive_t *drive)
outl(timings, basereg + 12); /* write drive1 config register */
}

/*
* Finally, turn DMA on in software, and exit.
*/
return hwif->ide_dma_on(drive); /* success */
return 0; /* success */
}

/**
Expand Down
5 changes: 2 additions & 3 deletions trunk/drivers/ide/pci/cs5535.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,20 +195,19 @@ static int cs5535_config_drive_for_dma(ide_drive_t *drive)

static int cs5535_dma_check(ide_drive_t *drive)
{
ide_hwif_t *hwif = drive->hwif;
u8 speed;

drive->init_speed = 0;

if (ide_use_dma(drive) && cs5535_config_drive_for_dma(drive))
return hwif->ide_dma_on(drive);
return 0;

if (ide_use_fast_pio(drive)) {
speed = ide_get_best_pio_mode(drive, 255, 4, NULL);
cs5535_set_drive(drive, speed);
}

return hwif->ide_dma_off_quietly(drive);
return -1;
}

static u8 __devinit cs5535_cable_detect(struct pci_dev *dev)
Expand Down
8 changes: 3 additions & 5 deletions trunk/drivers/ide/pci/hpt34x.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,21 +109,19 @@ static int config_chipset_for_dma (ide_drive_t *drive)

static int hpt34x_config_drive_xfer_rate (ide_drive_t *drive)
{
ide_hwif_t *hwif = HWIF(drive);

drive->init_speed = 0;

if (ide_use_dma(drive) && config_chipset_for_dma(drive))
#ifndef CONFIG_HPT34X_AUTODMA
return hwif->ide_dma_off_quietly(drive);
return -1;
#else
return hwif->ide_dma_on(drive);
return 0;
#endif

if (ide_use_fast_pio(drive))
hpt34x_tune_drive(drive, 255);

return hwif->ide_dma_off_quietly(drive);
return -1;
}

/*
Expand Down
6 changes: 2 additions & 4 deletions trunk/drivers/ide/pci/hpt366.c
Original file line number Diff line number Diff line change
Expand Up @@ -736,17 +736,15 @@ static void hpt3xx_maskproc(ide_drive_t *drive, int mask)

static int hpt366_config_drive_xfer_rate(ide_drive_t *drive)
{
ide_hwif_t *hwif = HWIF(drive);

drive->init_speed = 0;

if (ide_use_dma(drive) && config_chipset_for_dma(drive))
return hwif->ide_dma_on(drive);
return 0;

if (ide_use_fast_pio(drive))
hpt3xx_tune_drive(drive, 255);

return hwif->ide_dma_off_quietly(drive);
return -1;
}

/*
Expand Down
14 changes: 6 additions & 8 deletions trunk/drivers/ide/pci/it8213.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,17 +244,15 @@ static int config_chipset_for_dma (ide_drive_t *drive)

static int it8213_config_drive_for_dma (ide_drive_t *drive)
{
ide_hwif_t *hwif = drive->hwif;
u8 pio;

if (ide_use_dma(drive)) {
if (config_chipset_for_dma(drive))
return hwif->ide_dma_on(drive);
}
if (ide_use_dma(drive) && config_chipset_for_dma(drive))
return 0;

hwif->speedproc(drive, XFER_PIO_0
+ ide_get_best_pio_mode(drive, 255, 4, NULL));
pio = ide_get_best_pio_mode(drive, 255, 4, NULL);
it8213_tune_chipset(drive, XFER_PIO_0 + pio);

return hwif->ide_dma_off_quietly(drive);
return -1;
}

/**
Expand Down
12 changes: 5 additions & 7 deletions trunk/drivers/ide/pci/it821x.c
Original file line number Diff line number Diff line change
Expand Up @@ -520,14 +520,12 @@ static int config_chipset_for_dma (ide_drive_t *drive)

static int it821x_config_drive_for_dma (ide_drive_t *drive)
{
ide_hwif_t *hwif = drive->hwif;
if (ide_use_dma(drive) && config_chipset_for_dma(drive))
return 0;

if (ide_use_dma(drive)) {
if (config_chipset_for_dma(drive))
return hwif->ide_dma_on(drive);
}
config_it821x_chipset_for_pio(drive, 1);
return hwif->ide_dma_off_quietly(drive);

return -1;
}

/**
Expand Down Expand Up @@ -612,7 +610,7 @@ static void __devinit it821x_fixups(ide_hwif_t *hwif)
#ifdef CONFIG_IDEDMA_ONLYDISK
if (drive->media == ide_disk)
#endif
hwif->ide_dma_check(drive);
ide_set_dma(drive);
} else {
/* Non RAID volume. Fixups to stop the core code
doing unsupported things */
Expand Down
Loading

0 comments on commit a42e3e2

Please sign in to comment.