diff options
author | 2011-07-06 23:42:38 +0000 | |
---|---|---|
committer | 2011-07-06 23:42:38 +0000 | |
commit | 0ca661808624ef202bbdecfceaaddef4c276bbf2 (patch) | |
tree | ce96841195a30dc1a093df98b6e59493d2680f61 | |
parent | "Tweak previous", aka (diff) | |
download | wireguard-openbsd-0ca661808624ef202bbdecfceaaddef4c276bbf2.tar.xz wireguard-openbsd-0ca661808624ef202bbdecfceaaddef4c276bbf2.zip |
Handle pci_conf_read() faults on reading non-existent registers that result
in master aborts. Return 0xffffffff to emulate what happens on non-perfect
architectures in that case.
ok deraadt@
-rw-r--r-- | sys/arch/sparc64/dev/psycho.c | 20 | ||||
-rw-r--r-- | sys/arch/sparc64/dev/schizo.c | 20 |
2 files changed, 34 insertions, 6 deletions
diff --git a/sys/arch/sparc64/dev/psycho.c b/sys/arch/sparc64/dev/psycho.c index 97da3a46080..16410083d06 100644 --- a/sys/arch/sparc64/dev/psycho.c +++ b/sys/arch/sparc64/dev/psycho.c @@ -1,4 +1,4 @@ -/* $OpenBSD: psycho.c,v 1.68 2011/06/26 20:32:36 kettenis Exp $ */ +/* $OpenBSD: psycho.c,v 1.69 2011/07/06 23:43:14 kettenis Exp $ */ /* $NetBSD: psycho.c,v 1.39 2001/10/07 20:30:41 eeh Exp $ */ /* @@ -1116,8 +1116,22 @@ psycho_conf_size(pci_chipset_tag_t pc, pcitag_t tag) pcireg_t psycho_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg) { - return (bus_space_read_4(pc->bustag, pc->bushandle, - PCITAG_OFFSET(tag) + reg)); + struct cpu_info *ci = curcpu(); + pcireg_t val; + int s; + + s = splhigh(); + membar(Sync); + ci->ci_pci_probe = 1; + val = bus_space_read_4(pc->bustag, pc->bushandle, + PCITAG_OFFSET(tag) + reg); + membar(Sync); + if (ci->ci_pci_fault) + val = 0xffffffff; + ci->ci_pci_probe = ci->ci_pci_fault = 0; + splx(s); + + return (val); } void diff --git a/sys/arch/sparc64/dev/schizo.c b/sys/arch/sparc64/dev/schizo.c index 1ed9e1b525d..79602501388 100644 --- a/sys/arch/sparc64/dev/schizo.c +++ b/sys/arch/sparc64/dev/schizo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: schizo.c,v 1.62 2011/06/26 20:32:36 kettenis Exp $ */ +/* $OpenBSD: schizo.c,v 1.63 2011/07/06 23:42:38 kettenis Exp $ */ /* * Copyright (c) 2002 Jason L. Wright (jason@thought.net) @@ -471,8 +471,22 @@ schizo_conf_size(pci_chipset_tag_t pc, pcitag_t tag) pcireg_t schizo_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg) { - return (bus_space_read_4(pc->bustag, pc->bushandle, - PCITAG_OFFSET(tag) + reg)); + struct cpu_info *ci = curcpu(); + pcireg_t val; + int s; + + s = splhigh(); + membar(Sync); + ci->ci_pci_probe = 1; + val = bus_space_read_4(pc->bustag, pc->bushandle, + PCITAG_OFFSET(tag) + reg); + membar(Sync); + if (ci->ci_pci_fault) + val = 0xffffffff; + ci->ci_pci_probe = ci->ci_pci_fault = 0; + splx(s); + + return (val); } void |