summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2005-12-14 20:06:58 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2005-12-14 20:06:58 +0000
commit1d43f882c71e49ebbe1a2304883c1a3190ffa9cd (patch)
tree06961a9d4655f2abc3af4fadad4742dec5b71b97 /sys/arch
parentb4dd2134f7764ae61583b89d15009b76214c5ac8 (diff)
Prevent access to PCI config space for function >0 on bus 0.
Fixes Xorg PCI scan. ok drahn@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/macppc/pci/ht.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/arch/macppc/pci/ht.c b/sys/arch/macppc/pci/ht.c
index 73d671aa208..657c41cac8b 100644
--- a/sys/arch/macppc/pci/ht.c
+++ b/sys/arch/macppc/pci/ht.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ht.c,v 1.7 2005/11/13 21:48:16 drahn Exp $ */
+/* $OpenBSD: ht.c,v 1.8 2005/12/14 20:06:57 kettenis Exp $ */
/*
* Copyright (c) 2005 Mark Kettenis
@@ -263,8 +263,8 @@ ht_conf_read(void *cpv, pcitag_t tag, int offset)
reg = bus_space_read_4(sc->sc_iot, sc->sc_config0_ioh, tag);
reg = letoh32(reg);
} else if (bus == 0) {
- /* XXX Needed on some PowerMac G5's. Why? */
- if (fcn > 1)
+ /* XXX Why can we only access function 0? */
+ if (fcn > 0)
return ~0;
tag |= offset;
reg = bus_space_read_4(sc->sc_memt, sc->sc_config0_memh, tag);
@@ -282,19 +282,22 @@ void
ht_conf_write(void *cpv, pcitag_t tag, int offset, pcireg_t data)
{
struct ht_softc *sc = cpv;
- int bus, dev;
+ int bus, dev, fcn;
#ifdef DEBUG
printf("ht_conf_write: tag=%x, offset=%x, data = %x\n",
tag, offset, data);
#endif
- ht_decompose_tag(NULL, tag, &bus, &dev, NULL);
+ ht_decompose_tag(NULL, tag, &bus, &dev, &fcn);
if (bus == 0 && dev == 0) {
tag |= (offset << 2);
data = htole32(data);
bus_space_write_4(sc->sc_iot, sc->sc_config0_ioh, tag, data);
bus_space_read_4(sc->sc_iot, sc->sc_config0_ioh, tag);
} else if (bus == 0) {
+ /* XXX Why can we only access function 0? */
+ if (fcn > 0)
+ return;
tag |= offset;
bus_space_write_4(sc->sc_memt, sc->sc_config0_memh, tag, data);
bus_space_read_4(sc->sc_memt, sc->sc_config0_memh, tag);