Index: conf/kmod.mk =================================================================== RCS file: /home/ncvs/src/sys/conf/kmod.mk,v retrieving revision 1.137 diff -u -r1.137 kmod.mk --- conf/kmod.mk 2003/03/03 22:51:22 1.137 +++ conf/kmod.mk 2003/06/12 21:32:05 @@ -104,7 +104,7 @@ CFLAGS+= -fno-common LDFLAGS+= -d -warn-common -CFLAGS+= ${DEBUG_FLAGS} +CFLAGS+= ${DEBUG} OBJS+= ${SRCS:N*.h:R:S/$/.o/g} Index: dev/pci/pci.c =================================================================== RCS file: /home/ncvs/src/sys/dev/pci/pci.c,v retrieving revision 1.214 diff -u -r1.214 pci.c --- dev/pci/pci.c 2003/04/16 03:15:08 1.214 +++ dev/pci/pci.c 2003/06/12 21:32:07 @@ -323,9 +323,10 @@ /* read configuration header into pcicfgregs structure */ struct pci_devinfo * -pci_read_device(device_t pcib, int b, int s, int f, size_t size) +pci_read_device(device_t pcib, int b, int s, int f, size_t size, int *hifunc) { #define REG(n, w) PCIB_READ_CONFIG(pcib, b, s, f, n, w) + u_int32_t devvend; pcicfgregs *cfg = NULL; struct pci_devinfo *devlist_entry; struct devlist *devlist_head; @@ -334,7 +335,7 @@ devlist_entry = NULL; - if (PCIB_READ_CONFIG(pcib, b, s, f, PCIR_DEVVENDOR, 4) != -1) { + if ((devvend = REG(PCIR_DEVVENDOR, 4)) != -1 && devvend != 0) { devlist_entry = malloc(size, M_DEVBUF, M_WAITOK | M_ZERO); if (devlist_entry == NULL) return (NULL); @@ -389,7 +390,9 @@ pci_numdevs++; pci_generation++; - } + } else if (devvend == 0) + *hifunc = 0; + return (devlist_entry); #undef REG } @@ -825,12 +828,12 @@ ("dinfo_size too small")); maxslots = PCIB_MAXSLOTS(pcib); for (s = 0; s <= maxslots; s++) { - pcifunchigh = 0; + pcifunchigh = PCI_FUNCMAX; + f = 0; for (f = 0; f <= pcifunchigh; f++) { - dinfo = pci_read_device(pcib, busno, s, f, dinfo_size); + dinfo = pci_read_device(pcib, busno, s, f, dinfo_size, + &pcifunchigh); if (dinfo != NULL) { - if (dinfo->cfg.mfdev) - pcifunchigh = PCI_FUNCMAX; pci_add_child(dev, dinfo); } } Index: dev/pci/pci_private.h =================================================================== RCS file: /home/ncvs/src/sys/dev/pci/pci_private.h,v retrieving revision 1.8 diff -u -r1.8 pci_private.h --- dev/pci/pci_private.h 2003/04/16 03:15:08 1.8 +++ dev/pci/pci_private.h 2003/06/12 21:32:08 @@ -65,7 +65,7 @@ int type, int rid); struct resource_list *pci_get_resource_list (device_t dev, device_t child); struct pci_devinfo *pci_read_device(device_t pcib, int b, int s, int f, - size_t size); + size_t size, int *hifunc); void pci_print_verbose(struct pci_devinfo *dinfo); int pci_freecfg(struct pci_devinfo *dinfo); int pci_child_location_str_method(device_t cbdev, device_t child, Index: dev/pci/pci_user.c =================================================================== RCS file: /home/ncvs/src/sys/dev/pci/pci_user.c,v retrieving revision 1.9 diff -u -r1.9 pci_user.c --- dev/pci/pci_user.c 2003/03/03 12:15:44 1.9 +++ dev/pci/pci_user.c 2003/06/12 21:32:08 @@ -176,9 +176,8 @@ const char *name; int error; - if (!(flag & FWRITE)) + if (!(flag & FWRITE) && cmd == PCIOCWRITE) return EPERM; - switch(cmd) { case PCIOCGETCONF: Index: sparc64/include/bus.h =================================================================== RCS file: /home/ncvs/src/sys/sparc64/include/bus.h,v retrieving revision 1.26 diff -u -r1.26 bus.h --- sparc64/include/bus.h 2003/05/30 20:40:33 1.26 +++ sparc64/include/bus.h 2003/06/12 21:32:47 @@ -820,6 +820,38 @@ bus_space_write_stream_8(t, h1, o1, bus_space_read_8(t, h2, o2)); } +static __inline uint8_t +bus_space_readms_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) +{ + + __BUS_DEBUG_ACCESS(h, o, "read", 1); + return (lduba_ms((caddr_t)(h + o), bus_type_asi[t->bst_type])); +} + +static __inline uint16_t +bus_space_readms_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) +{ + + __BUS_DEBUG_ACCESS(h, o, "readms", 2); + return (lduha_ms((caddr_t)(h + o), bus_type_asi[t->bst_type])); +} + +static __inline uint32_t +bus_space_readms_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) +{ + + __BUS_DEBUG_ACCESS(h, o, "readms", 4); + return (lduwa_ms((caddr_t)(h + o), bus_type_asi[t->bst_type])); +} + +static __inline uint64_t +bus_space_readms_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) +{ + + __BUS_DEBUG_ACCESS(h, o, "readms", 8); + return (ldxa_ms((caddr_t)(h + o), bus_type_asi[t->bst_type])); +} + /* Back-compat functions for old ISA drivers */ extern bus_space_tag_t isa_io_bt; extern bus_space_handle_t isa_io_hdl; Index: sparc64/include/cpu.h =================================================================== RCS file: /home/ncvs/src/sys/sparc64/include/cpu.h,v retrieving revision 1.10 diff -u -r1.10 cpu.h --- sparc64/include/cpu.h 2002/07/28 01:01:14 1.10 +++ sparc64/include/cpu.h 2003/06/12 21:32:47 @@ -77,6 +77,8 @@ extern char btext[]; extern char etext[]; +extern volatile int de_expected, de_received; + void fork_trampoline(void); static __inline u_int64_t Index: sparc64/include/cpufunc.h =================================================================== RCS file: /home/ncvs/src/sys/sparc64/include/cpufunc.h,v retrieving revision 1.16 diff -u -r1.16 cpufunc.h --- sparc64/include/cpufunc.h 2003/04/06 17:05:26 1.16 +++ sparc64/include/cpufunc.h 2003/06/12 21:32:47 @@ -102,6 +102,24 @@ LDNC_GEN(u_int, lduwa); LDNC_GEN(u_long, ldxa); +#define LDMS_GEN(tp, o) \ + static __inline tp \ + o ## _ms(caddr_t va, int asi) \ + { \ + tp r; \ + __asm __volatile("wr %2, 0, %%asi\n" \ + " membar #Sync\n" \ + #o " [%1] %%asi, %0\n" \ + " membar #Sync\n" \ + : "=r" (r) : "r" (va), "r" (asi)); \ + return (r); \ + } + +LDMS_GEN(u_char, lduba); +LDMS_GEN(u_short, lduha); +LDMS_GEN(u_int, lduwa); +LDMS_GEN(u_long, ldxa); + #define LD_GENERIC(va, asi, op, type) ({ \ type __r; \ __asm __volatile(#op " [%1] %2, %0" \ Index: sparc64/isa/isa.c =================================================================== RCS file: /home/ncvs/src/sys/sparc64/isa/isa.c,v retrieving revision 1.6 diff -u -r1.6 isa.c --- sparc64/isa/isa.c 2003/05/30 20:48:05 1.6 +++ sparc64/isa/isa.c 2003/06/12 21:32:47 @@ -170,7 +170,7 @@ if (start > 7) panic("isa_route_intr_res: start out of isa range"); res = isa_ino[start]; - if (res == 255) + if (res == ORIR_NOTFOUND) device_printf(bus, "could not map interrupt %d\n", res); return (res); } Index: sparc64/pci/apb.c =================================================================== RCS file: /home/ncvs/src/sys/sparc64/pci/apb.c,v retrieving revision 1.4 diff -u -r1.4 apb.c --- sparc64/pci/apb.c 2002/03/24 02:10:56 1.4 +++ sparc64/pci/apb.c 2003/06/12 21:32:47 @@ -203,13 +203,10 @@ } /* - * XXX If the subordinate bus number is less than the secondary bus - * number, we should pick a better value. One sensible alternative - * would be to pick 255; the only tradeoff here is that configuration - * transactions would be more widely routed than absolutely necessary. + * If we don't hardwire the bus down, pciconf gets confused. */ if (sc->secbus != 0) { - child = device_add_child(dev, "pci", -1); + child = device_add_child(dev, "pci", sc->secbus); if (child != NULL) return (bus_generic_attach(dev)); } else Index: sparc64/pci/psycho.c =================================================================== RCS file: /home/ncvs/src/sys/sparc64/pci/psycho.c,v retrieving revision 1.35 diff -u -r1.35 psycho.c --- sparc64/pci/psycho.c 2003/05/30 20:48:05 1.35 +++ sparc64/pci/psycho.c 2003/06/12 21:32:48 @@ -56,6 +56,7 @@ #include #include #include +#include #include @@ -929,8 +930,9 @@ bus_space_handle_t bh; u_long offset = 0; u_int32_t r, devid; - int i; + int i, der; +#if 0 /* * The psycho bridge does not tolerate accesses to unconfigured PCI * devices' or function's config space, so look up the device in the @@ -938,24 +940,37 @@ * that will make the detection code think that there is no device here. * This is ugly... */ - if (reg == 0 && ofw_pci_find_node(bus, slot, func) == 0) + if (ofw_pci_find_node(bus, slot, func) == 0) return (0xffffffff); +#endif sc = (struct psycho_softc *)device_get_softc(dev); offset = PSYCHO_CONF_OFF(bus, slot, func, reg); bh = sc->sc_bh[PCI_CS_CONFIG]; + printf("psycho_read_config expecting data error: %d.%d.%d: 0x%x\n", + bus, slot, func, reg); + de_expected = 1; + de_received = 0; switch (width) { case 1: - r = bus_space_read_1(sc->sc_cfgt, bh, offset); + r = bus_space_readms_1(sc->sc_cfgt, bh, offset); break; case 2: - r = bus_space_read_2(sc->sc_cfgt, bh, offset); + r = bus_space_readms_2(sc->sc_cfgt, bh, offset); break; case 4: - r = bus_space_read_4(sc->sc_cfgt, bh, offset); + r = bus_space_readms_4(sc->sc_cfgt, bh, offset); break; default: panic("psycho_read_config: bad width"); } + der = de_received; + de_received = de_expected = 0; + if (der) + r = -1; + + printf("psycho_read_config after data error: received: %d, r: 0x%x\n", + der, r); + if (reg == PCIR_INTPIN && r == 0) { /* Check for DQT_BAD_INTPIN quirk. */ devid = psycho_read_config(dev, bus, slot, func, Index: sparc64/sparc64/nexus.c =================================================================== RCS file: /home/ncvs/src/sys/sparc64/sparc64/nexus.c,v retrieving revision 1.6 diff -u -r1.6 nexus.c --- sparc64/sparc64/nexus.c 2003/02/19 05:47:45 1.6 +++ sparc64/sparc64/nexus.c 2003/06/12 21:32:48 @@ -248,8 +248,10 @@ dinfo->ndi_bustag = &nexus_bustag; dinfo->ndi_dmatag = &nexus_dmatag; device_set_ivars(cdev, dinfo); - } else + } else { free(name, M_OFWPROP); + free(type, M_OFWPROP); + } } device_set_desc(dev, "OpenFirmware Nexus device"); Index: sparc64/sparc64/trap.c =================================================================== RCS file: /home/ncvs/src/sys/sparc64/sparc64/trap.c,v retrieving revision 1.62 diff -u -r1.62 trap.c --- sparc64/sparc64/trap.c 2003/05/04 07:21:04 1.62 +++ sparc64/sparc64/trap.c 2003/06/12 21:32:49 @@ -219,6 +219,8 @@ SYSCTL_INT(_debug, OID_AUTO, debugger_on_signal, CTLFLAG_RW, &debugger_on_signal, 0, ""); +volatile int de_expected, de_received; + void trap(struct trapframe *tf) { @@ -328,6 +330,22 @@ } } error = 1; + break; + case T_DATA_ERROR: + printf("trap data error received.\n"); +#define MEMBARSYNC_INST ((u_int32_t)0x8143e040) + if (de_expected) { + de_received = 1; + /* + * XXX - we need to check that tf->tpc is + * pointing to MEMBARSYNC_INST + */ + tf->tf_tnpc = tf->tf_tpc + 4; + error = 0; + break; + } +#undef MEMBARSYNC_INST + error = 1; break; default: error = 1;