summaryrefslogtreecommitdiff
path: root/sys/arch/i386/pci
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2011-10-13 18:09:34 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2011-10-13 18:09:34 +0000
commit35252f0dafa4ccce1148cc18897ba319f6c982cd (patch)
tree11bf0a0c8ddc1aa40bbca08dff0c261ad1d0b487 /sys/arch/i386/pci
parent6c6f2d19008ddad564db525921331ee0e982bdc7 (diff)
I'm sick and tired of people doing misalgned reads and writes to PCI config
space and not noticing because they only test on amd64. So enforce alignment there as well, at least for a little while such that we find those bugs and force people to fix them.
Diffstat (limited to 'sys/arch/i386/pci')
-rw-r--r--sys/arch/i386/pci/pci_machdep.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/arch/i386/pci/pci_machdep.c b/sys/arch/i386/pci/pci_machdep.c
index 0b39b27c92d..0cbf206f5d7 100644
--- a/sys/arch/i386/pci/pci_machdep.c
+++ b/sys/arch/i386/pci/pci_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pci_machdep.c,v 1.63 2011/06/08 22:57:59 kettenis Exp $ */
+/* $OpenBSD: pci_machdep.c,v 1.64 2011/10/13 18:09:33 kettenis Exp $ */
/* $NetBSD: pci_machdep.c,v 1.28 1997/06/06 23:29:17 thorpej Exp $ */
/*-
@@ -411,6 +411,8 @@ pci_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg)
pcireg_t data;
int bus;
+ KASSERT((reg & 0x3) == 0);
+
if (pci_mcfg_addr && reg >= PCI_CONFIG_SPACE_SIZE) {
pci_decompose_tag(pc, tag, &bus, NULL, NULL);
if (bus >= pci_mcfg_min_bus && bus <= pci_mcfg_max_bus) {
@@ -447,6 +449,8 @@ pci_conf_write(pci_chipset_tag_t pc, pcitag_t tag, int reg, pcireg_t data)
{
int bus;
+ KASSERT((reg & 0x3) == 0);
+
if (pci_mcfg_addr && reg >= PCI_CONFIG_SPACE_SIZE) {
pci_decompose_tag(pc, tag, &bus, NULL, NULL);
if (bus >= pci_mcfg_min_bus && bus <= pci_mcfg_max_bus) {