summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorbouyer <bouyer@NetBSD.org>1998-12-03 13:24:11 +0000
committerbouyer <bouyer@NetBSD.org>1998-12-03 13:24:11 +0000
commit09408781c944e2ba6faf653e0987e6edf23db796 (patch)
tree32bc14b4e20faf5587d2ee1440a9200001a39f84 /sys/dev
parent2fc486ea0147ac0de476f86fb384642c1f3eff25 (diff)
Ouh ! Correct the 8-bit PCI registers reading/writing functions: need to
multiply the register offset by 8.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/pciide.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/dev/pci/pciide.c b/sys/dev/pci/pciide.c
index 8fd0b97fa6f..738b0d9ef39 100644
--- a/sys/dev/pci/pciide.c
+++ b/sys/dev/pci/pciide.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pciide.c,v 1.20 1998/12/02 10:52:25 bouyer Exp $ */
+/* $NetBSD: pciide.c,v 1.21 1998/12/03 13:24:11 bouyer Exp $ */
/*
* Copyright (c) 1996, 1998 Christopher G. Demetriou. All rights reserved.
@@ -85,7 +85,8 @@ pciide_pci_read(pc, pa, reg)
pcitag_t pa;
int reg;
{
- return ((pci_conf_read(pc, pa, (reg & ~0x03)) >> (reg & 0x03)) & 0xff);
+ return (
+ pci_conf_read(pc, pa, (reg & ~0x03)) >> ((reg & 0x03) * 8) & 0xff);
}
@@ -101,8 +102,8 @@ pciide_pci_write(pc, pa, reg, val)
pcireg_t pcival;
pcival = pci_conf_read(pc, pa, (reg & ~0x03));
- pcival &= ~(0xff << (reg & 0x03));
- pcival |= (val << (reg & 0x03));
+ pcival &= ~(0xff << ((reg & 0x03) * 8));
+ pcival |= (val << ((reg & 0x03) * 8));
pci_conf_write(pc, pa, (reg & ~0x03), pcival);
}