Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 76892
b: refs/heads/master
c: 5df91a2
h: refs/heads/master
v: v3
  • Loading branch information
Tejun Heo authored and Jeff Garzik committed Jan 23, 2008
1 parent 587ca31 commit aa3e882
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 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: 7c77fa4d51b1480bcec2e898c94d6912fe063c16
refs/heads/master: 5df91a25df08d85700fef5fd59bb1873273e5ef5
42 changes: 21 additions & 21 deletions trunk/drivers/ata/libata-acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,49 +473,49 @@ EXPORT_SYMBOL_GPL(ata_acpi_udma_cycle);
unsigned long ata_acpi_gtm_xfermask(struct ata_device *dev,
const struct ata_acpi_gtm *gtm)
{
unsigned long pio_mask = 0, mwdma_mask = 0, udma_mask = 0;
int unit, i;
u32 t;
unsigned long mask = (0x7f << ATA_SHIFT_UDMA) | (0x7 << ATA_SHIFT_MWDMA) | (0x1F << ATA_SHIFT_PIO);

/* we always use the 0 slot for crap hardware */
unit = dev->devno;
if (!(gtm->flags & 0x10))
unit = 0;

/* Values larger than the longest cycle results in 0 mask
* while values equal to smaller than the shortest cycle
* results in mask which includes all supported modes.
* Disabled transfer method has the value of 0xffffffff which
* will always result in 0 mask.
*/

/* start by scanning for PIO modes */
for (i = 0; i < 7; i++) {
t = gtm->drive[unit].pio;
if (t <= ata_acpi_pio_cycle[i]) {
mask |= (2 << (ATA_SHIFT_PIO + i)) - 1;
t = gtm->drive[unit].pio;
for (i = 0; i < ARRAY_SIZE(ata_acpi_pio_cycle); i++)
if (t > ata_acpi_pio_cycle[i])
break;
}
}
pio_mask = (1 << i) - 1;

/* See if we have MWDMA or UDMA data. We don't bother with
* MWDMA if UDMA is available as this means the BIOS set UDMA
* and our error changedown if it works is UDMA to PIO anyway.
*/
if (gtm->flags & (1 << (2 * unit))) {
t = gtm->drive[unit].dma;
if (!(gtm->flags & (1 << (2 * unit)))) {
/* MWDMA */
for (i = 0; i < 5; i++) {
t = gtm->drive[unit].dma;
if (t <= ata_acpi_mwdma_cycle[i]) {
mask |= (2 << (ATA_SHIFT_MWDMA + i)) - 1;
for (i = 0; i < ARRAY_SIZE(ata_acpi_mwdma_cycle); i++)
if (t > ata_acpi_mwdma_cycle[i])
break;
}
}
mwdma_mask = (1 << i) - 1;
} else {
/* UDMA */
for (i = 0; i < 7; i++) {
t = gtm->drive[unit].dma;
if (t <= ata_acpi_udma_cycle[i]) {
mask |= (2 << (ATA_SHIFT_UDMA + i)) - 1;
for (i = 0; i < ARRAY_SIZE(ata_acpi_udma_cycle); i++)
if (t > ata_acpi_udma_cycle[i])
break;
}
}
udma_mask = (1 << i) - 1;
}

return mask;
return ata_pack_xfermask(pio_mask, mwdma_mask, udma_mask);
}
EXPORT_SYMBOL_GPL(ata_acpi_gtm_xfermask);

Expand Down

0 comments on commit aa3e882

Please sign in to comment.