summaryrefslogtreecommitdiffstats
path: root/sys/dev/ata
diff options
context:
space:
mode:
authorsos <sos@FreeBSD.org>2004-10-01 09:04:53 +0000
committersos <sos@FreeBSD.org>2004-10-01 09:04:53 +0000
commita2615e3bda06614729f54affd6180a79275cf3c7 (patch)
tree6bb62a522dc99e1ddd66e430eb23255db9194a89 /sys/dev/ata
parent8d7277b2042fefcc39028a18038dc0e127bcd86e (diff)
downloadFreeBSD-src-a2615e3bda06614729f54affd6180a79275cf3c7.zip
FreeBSD-src-a2615e3bda06614729f54affd6180a79275cf3c7.tar.gz
Fix the serverworks modesetting code, of mask offset was wrong.
Diffstat (limited to 'sys/dev/ata')
-rw-r--r--sys/dev/ata/ata-chipset.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/sys/dev/ata/ata-chipset.c b/sys/dev/ata/ata-chipset.c
index 637f663..6a0ed25 100644
--- a/sys/dev/ata/ata-chipset.c
+++ b/sys/dev/ata/ata-chipset.c
@@ -1973,7 +1973,7 @@ ata_serverworks_setmode(struct ata_device *atadev, int mode)
device_t parent = device_get_parent(atadev->channel->dev);
struct ata_pci_controller *ctlr = device_get_softc(parent);
int devno = (atadev->channel->unit << 1) + ATA_DEV(atadev->unit);
- int offset = devno ^ 0x01;
+ int offset = (devno ^ 0x01) << 3;
int error;
u_int8_t piotimings[] = { 0x5d, 0x47, 0x34, 0x22, 0x20, 0x34, 0x22, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20 };
@@ -1995,30 +1995,32 @@ ata_serverworks_setmode(struct ata_device *atadev, int mode)
(pci_read_config(parent, 0x56, 2) &
~(0xf << (devno << 2))) |
((mode & ATA_MODE_MASK) << (devno << 2)), 2);
-
- pci_write_config(parent, 0x54, pci_read_config(parent, 0x54, 1) |
- (0x01 << devno), 1);
+ pci_write_config(parent, 0x54,
+ pci_read_config(parent, 0x54, 1) |
+ (0x01 << devno), 1);
pci_write_config(parent, 0x44,
(pci_read_config(parent, 0x44, 4) &
- ~(0xff << (offset << 8))) |
- (dmatimings[2] << (offset << 8)), 4);
+ ~(0xff << offset)) |
+ (dmatimings[2] << offset), 4);
}
else if (mode >= ATA_WDMA0) {
- pci_write_config(parent, 0x54, pci_read_config(parent, 0x54, 1) &
- ~(0x01 << devno), 1);
+ pci_write_config(parent, 0x54,
+ pci_read_config(parent, 0x54, 1) &
+ ~(0x01 << devno), 1);
pci_write_config(parent, 0x44,
(pci_read_config(parent, 0x44, 4) &
- ~(0xff << (offset << 8))) |
- (dmatimings[mode & ATA_MODE_MASK]<<(offset<<8)),4);
+ ~(0xff << offset)) |
+ (dmatimings[mode & ATA_MODE_MASK] << offset),4);
}
else
- pci_write_config(parent, 0x54, pci_read_config(parent, 0x54, 1) &
- ~(0x01 << devno), 1);
+ pci_write_config(parent, 0x54,
+ pci_read_config(parent, 0x54, 1) &
+ ~(0x01 << devno), 1);
pci_write_config(parent, 0x40,
(pci_read_config(parent, 0x40, 4) &
- ~(0xff << (offset << 8))) |
- (piotimings[ata_mode2idx(mode)] << (offset << 8)), 4);
+ ~(0xff << offset)) |
+ (piotimings[ata_mode2idx(mode)] << offset), 4);
atadev->mode = mode;
}
}
OpenPOWER on IntegriCloud