summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2020-03-02 19:45:42 +0000
committerpatrick <patrick@openbsd.org>2020-03-02 19:45:42 +0000
commitaa509601a1aab4eb78913aeb6c56dc9493192170 (patch)
treea2f6d2bf09aa58955d0e3d40cda90cba3435e9bf
parentFix use of WITNESS_UNLOCK() in rw_exit_read() and rw_exit_write(). (diff)
downloadwireguard-openbsd-aa509601a1aab4eb78913aeb6c56dc9493192170.tar.xz
wireguard-openbsd-aa509601a1aab4eb78913aeb6c56dc9493192170.zip
Allow puc(4) to cope with 64-bit BARs. puc(4) iterates over the BARs
assuming each BAR is four byte-wide. For 64-bit BARs this is not true, so we need to skip the next entry if we encounter one. Otherwise we corrupt the 64-bit BAR we just mapped. ok kettenis@ "quite a hack" deraadt@
-rw-r--r--sys/dev/pci/puc.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/dev/pci/puc.c b/sys/dev/pci/puc.c
index 2c5f3065177..2123750945a 100644
--- a/sys/dev/pci/puc.c
+++ b/sys/dev/pci/puc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: puc.c,v 1.28 2018/12/02 21:30:21 kettenis Exp $ */
+/* $OpenBSD: puc.c,v 1.29 2020/03/02 19:45:42 patrick Exp $ */
/* $NetBSD: puc.c,v 1.3 1999/02/06 06:29:54 cgd Exp $ */
/*
@@ -163,8 +163,11 @@ puc_pci_attach(struct device *parent, struct device *self, void *aux)
0, &sc->sc_bar_mappings[i].t, &sc->sc_bar_mappings[i].h,
&sc->sc_bar_mappings[i].a, &sc->sc_bar_mappings[i].s, 0)
== 0);
- if (sc->sc_bar_mappings[i].mapped)
+ if (sc->sc_bar_mappings[i].mapped) {
+ if (type == PCI_MAPREG_MEM_TYPE_64BIT)
+ i++;
continue;
+ }
#if NCOM > 0
/*
@@ -184,6 +187,8 @@ puc_pci_attach(struct device *parent, struct device *self, void *aux)
sc->sc_bar_mappings[i].h = comconsioh;
sc->sc_bar_mappings[i].s = COM_NPORTS;
sc->sc_bar_mappings[i].mapped = 1;
+ if (type == PCI_MAPREG_MEM_TYPE_64BIT)
+ i++;
continue;
}
#endif