summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorsos <sos@FreeBSD.org>2003-02-23 16:36:21 +0000
committersos <sos@FreeBSD.org>2003-02-23 16:36:21 +0000
commit4134863978d8653c83d8403a8b0f9e130dde3ffa (patch)
treeb66c79a0c2a30fdb4768a21a85d887eaedf1d89c /sys
parent5cbd92e9a822ec1b12c59e2fce65060ca8e86822 (diff)
downloadFreeBSD-src-4134863978d8653c83d8403a8b0f9e130dde3ffa.zip
FreeBSD-src-4134863978d8653c83d8403a8b0f9e130dde3ffa.tar.gz
Fix chipset setup problem on older ALI chips.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ata/ata-chipset.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/sys/dev/ata/ata-chipset.c b/sys/dev/ata/ata-chipset.c
index f3273a7..7456bf3 100644
--- a/sys/dev/ata/ata-chipset.c
+++ b/sys/dev/ata/ata-chipset.c
@@ -376,7 +376,7 @@ ata_ali_setmode(struct ata_device *atadev, int mode)
atadev->channel->devices & ATA_ATAPI_SLAVE) {
/* doesn't support ATAPI DMA on two ATAPI devices */
ata_prtdev(atadev, "two atapi devices on this channel, no DMA\n");
- ata_limit_mode(atadev, mode, ATA_PIO_MAX);
+ mode = ata_limit_mode(atadev, mode, ATA_PIO_MAX);
}
}
@@ -387,20 +387,25 @@ ata_ali_setmode(struct ata_device *atadev, int mode)
(error) ? "failed" : "success",
ata_mode2str(mode), ctlr->chip->text);
if (!error) {
+ if (ctlr->chip->cfg2 & ALICABLE) {
+ if (mode > ATA_UDMA2)
+ pci_write_config(parent, 0x4b,
+ pci_read_config(parent, 0x4b, 1) | 0x01, 1);
+ else
+ pci_write_config(parent, 0x4b,
+ pci_read_config(parent, 0x4b, 1) & ~0x01, 1);
+ }
if (mode >= ATA_UDMA0) {
u_int8_t udma[] = {0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x0f};
u_int32_t word54 = pci_read_config(parent, 0x54, 4);
pci_write_config(parent, 0x58 + (atadev->channel->unit << 2),
0x00310001, 4);
-
- pci_write_config(parent, 0x4b,
- pci_read_config(parent, 0x4b, 1) | 0x01, 1);
- word54 &= ~(0x000f000f << (devno << 2));
- word54 |= (((udma[mode&ATA_MODE_MASK]<<16)|0x05)<<(devno<<2));
- pci_write_config(parent, 0x54, word54, 4);
- pci_write_config(parent, 0x53,
- pci_read_config(parent, 0x53, 1) | 0x03, 1);
+ word54 &= ~(0x000f000f << (devno << 2));
+ word54 |= (((udma[mode&ATA_MODE_MASK]<<16)|0x05)<<(devno<<2));
+ pci_write_config(parent, 0x54, word54, 4);
+ pci_write_config(parent, 0x53,
+ pci_read_config(parent, 0x53, 1) | 0x03, 1);
}
else {
u_int32_t piotimings[] =
OpenPOWER on IntegriCloud