summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2008-04-07 18:45:26 +0000
committerkettenis <kettenis@openbsd.org>2008-04-07 18:45:26 +0000
commitccf31ed441473cc86f90eb895208e390535ebfa6 (patch)
tree456eecf3b63fe2adac728aeb7f1e92f9c2c30177 /sys
parenttypo, fix fragments (diff)
downloadwireguard-openbsd-ccf31ed441473cc86f90eb895208e390535ebfa6.tar.xz
wireguard-openbsd-ccf31ed441473cc86f90eb895208e390535ebfa6.zip
Hardware monitor address should be 8-byte aligned.
ok deraadt@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/isa/wbsio.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/dev/isa/wbsio.c b/sys/dev/isa/wbsio.c
index a987d0c9f1c..8e4b7110f4b 100644
--- a/sys/dev/isa/wbsio.c
+++ b/sys/dev/isa/wbsio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wbsio.c,v 1.2 2008/03/31 17:56:41 deraadt Exp $ */
+/* $OpenBSD: wbsio.c,v 1.3 2008/04/07 18:45:26 kettenis Exp $ */
/*
* Copyright (c) 2008 Mark Kettenis <kettenis@openbsd.org>
*
@@ -198,9 +198,15 @@ wbsio_attach(struct device *parent, struct device *self, void *aux)
/* Select HM logical device */
wbsio_conf_write(sc->sc_iot, sc->sc_ioh, WBSIO_LDN, WBSIO_LDN_HM);
+ /*
+ * The address should be 8-byte aligned, but it seems some
+ * BIOSes ignore this. They get away with it, because
+ * Apparently the hardware simply ignores the lower three
+ * bits. We do the same here.
+ */
reg0 = wbsio_conf_read(sc->sc_iot, sc->sc_ioh, WBSIO_HM_ADDR_LSB);
reg1 = wbsio_conf_read(sc->sc_iot, sc->sc_ioh, WBSIO_HM_ADDR_MSB);
- iobase = (reg1 << 8) | reg0;
+ iobase = (reg1 << 8) | (reg0 & ~0x7);
printf("\n");