summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2011-10-13 09:44:40 +0000
committerkettenis <kettenis@openbsd.org>2011-10-13 09:44:40 +0000
commit35fc78ae2d606a0e82e655a3606f4037f0788772 (patch)
treee4296d512a37274089fc012ed10745f457f2a7f0 /sys
parentStart ldapd(8) earlier so that ypldap(8) can properly run (an LDAP (diff)
downloadwireguard-openbsd-35fc78ae2d606a0e82e655a3606f4037f0788772.tar.xz
wireguard-openbsd-35fc78ae2d606a0e82e655a3606f4037f0788772.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/amd64/pci/pci_machdep.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/arch/amd64/pci/pci_machdep.c b/sys/arch/amd64/pci/pci_machdep.c
index b5452961351..13a3aa85e3c 100644
--- a/sys/arch/amd64/pci/pci_machdep.c
+++ b/sys/arch/amd64/pci/pci_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pci_machdep.c,v 1.51 2011/06/18 17:28:18 kettenis Exp $ */
+/* $OpenBSD: pci_machdep.c,v 1.52 2011/10/13 09:44:40 kettenis Exp $ */
/* $NetBSD: pci_machdep.c,v 1.3 2003/05/07 21:33:58 fvdl Exp $ */
/*-
@@ -269,6 +269,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) {
@@ -293,6 +295,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) {