Module Name: src
Committed By: nakayama
Date: Wed Dec 30 20:20:56 UTC 2009
Modified Files:
src/sys/arch/sparc64/dev: schizo.c
Log Message:
It seems that accessing to a PCI configration space where devices
are unavailable causes data_access_error trap. We need to check a
validity of OF node embeded in pcitag to avoid the trap.
Fixes PR port-sparc64/42545.
To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/sparc64/dev/schizo.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/sparc64/dev/schizo.c
diff -u src/sys/arch/sparc64/dev/schizo.c:1.10 src/sys/arch/sparc64/dev/schizo.c:1.11
--- src/sys/arch/sparc64/dev/schizo.c:1.10 Mon Nov 30 05:00:58 2009
+++ src/sys/arch/sparc64/dev/schizo.c Wed Dec 30 20:20:56 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: schizo.c,v 1.10 2009/11/30 05:00:58 mrg Exp $ */
+/* $NetBSD: schizo.c,v 1.11 2009/12/30 20:20:56 nakayama Exp $ */
/* $OpenBSD: schizo.c,v 1.55 2008/08/18 20:29:37 brad Exp $ */
/*
@@ -448,11 +448,12 @@
schizo_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg)
{
struct schizo_pbm *sp = pc->cookie;
- pcireg_t val;
+ pcireg_t val = (pcireg_t)~0;
DPRINTF(SDB_CONF, ("%s: tag %lx reg %x ", __func__, (long)tag, reg));
- val = bus_space_read_4(sp->sp_cfgt, sp->sp_cfgh,
- PCITAG_OFFSET(tag) + reg);
+ if (PCITAG_NODE(tag) != -1)
+ val = bus_space_read_4(sp->sp_cfgt, sp->sp_cfgh,
+ PCITAG_OFFSET(tag) + reg);
DPRINTF(SDB_CONF, (" returning %08x\n", (u_int)val));
return (val);
}
@@ -464,6 +465,13 @@
DPRINTF(SDB_CONF, ("%s: tag %lx; reg %x; data %x", __func__,
(long)tag, reg, (int)data));
+
+ /* If we don't know it, just punt it. */
+ if (PCITAG_NODE(tag) == -1) {
+ DPRINTF(SDB_CONF, (" .. bad addr\n"));
+ return;
+ }
+
bus_space_write_4(sp->sp_cfgt, sp->sp_cfgh,
PCITAG_OFFSET(tag) + reg, data);
DPRINTF(SDB_CONF, (" .. done\n"));