NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: port-sparc64/42545: pcictl(8) can cause sb2500 to reset
Hello,
Could the attached patch fix the problem?
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 (see
pci_make_tag() in pci_machdep.c, psycho_pci_conf_read() and
psycho_pci_conf_write() in psycho.c).
-- Takeshi Nakayama
Index: schizo.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc64/dev/schizo.c,v
retrieving revision 1.10
diff -u -d -r1.10 schizo.c
--- schizo.c 30 Nov 2009 05:00:58 -0000 1.10
+++ schizo.c 30 Dec 2009 16:16:16 -0000
@@ -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"));
Home |
Main Index |
Thread Index |
Old Index