diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2011-10-13 09:44:41 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2011-10-13 09:44:41 +0000 |
commit | 7231fd77a76af504b64032b9e3fa1f3ada887c3e (patch) | |
tree | d18f2e8459062d2c3fcd6173cdc07122a1caeb76 | |
parent | 8e4b1391b57ca5078c5c1816992b30fba67c95f7 (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.
-rw-r--r-- | sys/arch/amd64/pci/pci_machdep.c | 6 |
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) { |