Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 61900
b: refs/heads/master
c: 6a824c9
h: refs/heads/master
v: v3
  • Loading branch information
Bartlomiej Zolnierkiewicz committed Jul 19, 2007
1 parent f6a4909 commit 6a7b915
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 40 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: 2134758d2a5429325cee4d4ce8959af5314eeba1
refs/heads/master: 6a824c92db4d606c324272c4eed366fb71672440
13 changes: 7 additions & 6 deletions trunk/drivers/ide/ide-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,11 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode)
struct hd_driveid* id = drive->id;
int overridden = 0;

if (mode_wanted != 255) {
pio_mode = mode_wanted;
} else if (!drive->id) {
pio_mode = 0;
} else if ((pio_mode = ide_scan_pio_blacklist(id->model)) != -1) {
if (mode_wanted != 255)
return min_t(u8, mode_wanted, max_mode);

if ((drive->hwif->host_flags & IDE_HFLAG_PIO_NO_BLACKLIST) == 0 &&
(pio_mode = ide_scan_pio_blacklist(id->model)) != -1) {
printk(KERN_INFO "%s: is on PIO blacklist\n", drive->name);
} else {
pio_mode = id->tPIO;
Expand Down Expand Up @@ -324,7 +324,8 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode)
/*
* Conservative "downgrade" for all pre-ATA2 drives
*/
if (pio_mode && pio_mode < 4) {
if ((drive->hwif->host_flags & IDE_HFLAG_PIO_NO_DOWNGRADE) == 0 &&
pio_mode && pio_mode < 4) {
pio_mode--;
printk(KERN_INFO "%s: applying conservative "
"PIO \"downgrade\"\n", drive->name);
Expand Down
18 changes: 2 additions & 16 deletions trunk/drivers/ide/ide-timing.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,21 +106,6 @@ static struct ide_timing ide_timing[] = {
#define XFER_EPIO 0x01
#define XFER_PIO 0x00

static short ide_find_best_pio_mode(ide_drive_t *drive)
{
struct hd_driveid *id = drive->id;
short best = 0;

/* EIDE PIO modes */
if ((id->field_valid & 2) && (id->capability & 8)) {
if ((best = (drive->id->eide_pio_modes & 4) ? XFER_PIO_5 :
(drive->id->eide_pio_modes & 2) ? XFER_PIO_4 :
(drive->id->eide_pio_modes & 1) ? XFER_PIO_3 : 0)) return best;
}

return XFER_PIO_0 + min_t(u8, id->tPIO, 2);
}

static void ide_timing_quantize(struct ide_timing *t, struct ide_timing *q, int T, int UT)
{
q->setup = EZ(t->setup * 1000, T);
Expand Down Expand Up @@ -210,7 +195,8 @@ static int ide_timing_compute(ide_drive_t *drive, short speed, struct ide_timing
*/

if ((speed & XFER_MODE) != XFER_PIO) {
ide_timing_compute(drive, ide_find_best_pio_mode(drive), &p, T, UT);
u8 pio = ide_get_best_pio_mode(drive, 255, 5);
ide_timing_compute(drive, XFER_PIO_0 + pio, &p, T, UT);
ide_timing_merge(&p, t, t, IDE_TIMING_ALL);
}

Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/ide/ide.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,8 @@ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif)
hwif->straight8 = tmp_hwif->straight8;
hwif->bus_state = tmp_hwif->bus_state;

hwif->host_flags = tmp_hwif->host_flags;

hwif->atapi_dma = tmp_hwif->atapi_dma;
hwif->ultra_mask = tmp_hwif->ultra_mask;
hwif->mwdma_mask = tmp_hwif->mwdma_mask;
Expand Down
20 changes: 12 additions & 8 deletions trunk/drivers/ide/pci/amd74xx.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Version 2.20
* Version 2.21
*
* AMD 755/756/766/8111 and nVidia nForce/2/2s/3/3s/CK804/MCP04
* IDE driver for Linux.
Expand Down Expand Up @@ -272,10 +272,8 @@ static int amd_set_drive(ide_drive_t *drive, u8 speed)

static void amd74xx_tune_drive(ide_drive_t *drive, u8 pio)
{
if (pio == 255) {
amd_set_drive(drive, ide_find_best_pio_mode(drive));
return;
}
if (pio == 255)
pio = ide_get_best_pio_mode(drive, 255, 5);

amd_set_drive(drive, XFER_PIO_0 + min_t(byte, pio, 5));
}
Expand All @@ -284,12 +282,14 @@ static int amd74xx_ide_dma_check(ide_drive_t *drive)
{
u8 speed = ide_max_dma_mode(drive);

if (speed == 0)
speed = ide_find_best_pio_mode(drive);
if (speed == 0) {
amd74xx_tune_drive(drive, 255);
return -1;
}

amd_set_drive(drive, speed);

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

return -1;
Expand Down Expand Up @@ -451,6 +451,8 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif)
.autodma = AUTODMA, \
.enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, \
.bootable = ON_BOARD, \
.host_flags = IDE_HFLAG_PIO_NO_BLACKLIST \
| IDE_HFLAG_PIO_NO_DOWNGRADE, \
}

#define DECLARE_NV_DEV(name_str) \
Expand All @@ -461,6 +463,8 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif)
.autodma = AUTODMA, \
.enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, \
.bootable = ON_BOARD, \
.host_flags = IDE_HFLAG_PIO_NO_BLACKLIST \
| IDE_HFLAG_PIO_NO_DOWNGRADE, \
}

static ide_pci_device_t amd74xx_chipsets[] __devinitdata = {
Expand Down
22 changes: 13 additions & 9 deletions trunk/drivers/ide/pci/via82cxxx.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Version 3.45
* Version 3.46
*
* VIA IDE driver for Linux. Supported southbridges:
*
Expand Down Expand Up @@ -203,10 +203,8 @@ static int via_set_drive(ide_drive_t *drive, u8 speed)

static void via82cxxx_tune_drive(ide_drive_t *drive, u8 pio)
{
if (pio == 255) {
via_set_drive(drive, ide_find_best_pio_mode(drive));
return;
}
if (pio == 255)
pio = ide_get_best_pio_mode(drive, 255, 5);

via_set_drive(drive, XFER_PIO_0 + min_t(u8, pio, 5));
}
Expand All @@ -223,12 +221,14 @@ static int via82cxxx_ide_dma_check (ide_drive_t *drive)
{
u8 speed = ide_max_dma_mode(drive);

if (speed == 0)
speed = ide_find_best_pio_mode(drive);
if (speed == 0) {
via82cxxx_tune_drive(drive, 255);
return -1;
}

via_set_drive(drive, speed);

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

return -1;
Expand Down Expand Up @@ -500,14 +500,18 @@ static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = {
.init_hwif = init_hwif_via82cxxx,
.autodma = NOAUTODMA,
.enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
.bootable = ON_BOARD
.bootable = ON_BOARD,
.host_flags = IDE_HFLAG_PIO_NO_BLACKLIST
| IDE_HFLAG_PIO_NO_DOWNGRADE,
},{ /* 1 */
.name = "VP_IDE",
.init_chipset = init_chipset_via82cxxx,
.init_hwif = init_hwif_via82cxxx,
.autodma = AUTODMA,
.enablebits = {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
.bootable = ON_BOARD,
.host_flags = IDE_HFLAG_PIO_NO_BLACKLIST
| IDE_HFLAG_PIO_NO_DOWNGRADE,
}
};

Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/ide/setup-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,8 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a
else
ide_hwif_setup_dma(dev, d, hwif);
bypass_legacy_dma:
hwif->host_flags = d->host_flags;

if (d->init_hwif)
/* Call chipset-specific routine
* for each enabled hwif
Expand Down
7 changes: 7 additions & 0 deletions trunk/include/linux/ide.h
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,8 @@ typedef struct hwif_s {
u8 straight8; /* Alan's straight 8 check */
u8 bus_state; /* power state of the IDE bus */

u8 host_flags;

u8 atapi_dma; /* host supports atapi_dma */
u8 ultra_mask;
u8 mwdma_mask;
Expand Down Expand Up @@ -1245,7 +1247,12 @@ typedef struct ide_pci_enablebit_s {
enum {
/* Uses ISA control ports not PCI ones. */
IDE_HFLAG_ISA_PORTS = (1 << 0),
/* single port device */
IDE_HFLAG_SINGLE = (1 << 1),
/* don't use legacy PIO blacklist */
IDE_HFLAG_PIO_NO_BLACKLIST = (1 << 2),
/* don't use conservative PIO "downgrade" */
IDE_HFLAG_PIO_NO_DOWNGRADE = (1 << 3),
};

typedef struct ide_pci_device_s {
Expand Down

0 comments on commit 6a7b915

Please sign in to comment.