summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2011-10-13 18:09:33 +0000
committerkettenis <kettenis@openbsd.org>2011-10-13 18:09:33 +0000
commit10b5e66d069f0a34387475b82c563a6d4af2d35c (patch)
tree0e581073d0a947c8a20f2975584834be919d50de /sys
parentMake WOL support do something that actually makes sense; effectively (diff)
downloadwireguard-openbsd-10b5e66d069f0a34387475b82c563a6d4af2d35c.tar.xz
wireguard-openbsd-10b5e66d069f0a34387475b82c563a6d4af2d35c.zip
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')
-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) {