PERFORCE change 97524 for review
Kip Macy
kmacy at FreeBSD.org
Sat May 20 18:59:02 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=97524
Change 97524 by kmacy at kmacy_storage:sun4v_rwbuf on 2006/05/20 18:58:01
add debug output
interrupt assignment
Affected files ...
.. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/hv_pci.c#40 edit
Differences ...
==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/hv_pci.c#40 (text+ko) ====
@@ -200,6 +200,9 @@
sc->hs_pci_ioh = OFW_PCI_RANGE_PHYS(&range[i]) &
PHYS_MASK;
type = PCI_IO_BUS_SPACE;
+#ifdef DEBUG
+ printf("io handle: %#lx\n", sc->hs_pci_ioh);
+#endif
break;
case OFW_PCI_CS_MEM32:
@@ -277,31 +280,19 @@
r = hvio_config_get(sc->hs_devhandle, HVPCI_BDF(bus, slot, func),
reg, width, (pci_cfg_data_t *)&data);
+
if (r == H_EOK) {
switch (width) {
case 1:
ret = data & 0xff;
if (ret == 0 && reg == PCIR_INTLINE)
ret = PCI_INVALID_IRQ;
-#if 0
- printf("%ld = read_config(%#lx, %#x, %d, %d) = %#x\n", r,
- sc->hs_devhandle, HVPCI_BDF(bus, slot, func), reg, width, ret);
-#endif
break;
case 2:
ret = data & 0xffff;
-#if 0
- printf("%ld = read_config(%#lx, %#x, %d, %d) = %#x\n", r,
- sc->hs_devhandle, HVPCI_BDF(bus, slot, func), reg, width, ret);
-#endif
-
break;
case 4:
ret = data;
-#if 0
- printf("%ld = read_config(%#lx, %#x, %d, %d) = %#x\n", r,
- sc->hs_devhandle, HVPCI_BDF(bus, slot, func), reg, width, ret);
-#endif
break;
default:
ret = -1;
@@ -381,6 +372,9 @@
switch (type) {
case SYS_RES_IOPORT:
*tag = sc->hs_pci_iot;
+#ifdef DEBUG
+ printf("io handle: %#lx\n", sc->hs_pci_ioh + childhdl);
+#endif
return (sc->hs_pci_ioh + childhdl);
break;
@@ -432,14 +426,15 @@
struct hvpci_softc *sc;
int pciintr, rid;
int error;
+ int i;
sc = device_get_softc(dev);
pciintr = rman_get_start(ires);
/* sun4v uses 1 through 4 interrupts */
- KASSERT(pciintr >= 1 && pciintr <= 4,
- ("interrupt out of range"));
- rid = pciintr;
+ KASSERT(pciintr >= 1 && pciintr <= 4, ("interrupt out of range"));
+ for (i = 1; i <= 4; i++) {
+ rid = pciintr = i;
pciintr--;
if (sc->hs_intr[pciintr] == NULL) {
if ((sc->hs_intr[pciintr] = bus_alloc_resource_any(dev,
@@ -464,6 +459,7 @@
device_printf(dev, "bus_setup_intr: %d\n", error);
return (error);
}
+ }
return (0);
}
@@ -478,6 +474,7 @@
sc = device_get_softc(dev);
pciintr = rman_get_start(vec);
+ KASSERT(pciintr >= 1 && pciintr <= 4, ("interrupt out of range"));
pciintr--;
error = bus_teardown_intr(dev, sc->hs_intr[pciintr], cookie);
@@ -526,6 +523,9 @@
break;
case SYS_RES_IOPORT:
+#ifdef DEBUG
+ printf("alloc: start: %#lx, end: %#lx, count: %#lx\n", start, end, count);
+#endif
rm = &sc->hs_pci_io_rman;
bt = sc->hs_pci_iot;
bh = sc->hs_pci_ioh;
@@ -536,6 +536,12 @@
}
rv = rman_reserve_resource(rm, start, end, count, flags, child);
+#ifdef DEBUG
+ if (type == SYS_RES_IRQ) {
+ printf("%s: reserve_resource: start: %ld, end: %ld, flags: %#x, rv: %p\n",
+ __func__, start, end, flags, rv);
+ }
+#endif
if (rv == NULL)
return (NULL);
More information about the p4-projects
mailing list