PERFORCE change 94711 for review
John-Mark Gurney
jmg at FreeBSD.org
Thu Apr 6 01:29:48 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=94711
Change 94711 by jmg at jmg_carbon-60 on 2006/04/06 01:29:40
push first pass of interrupt code to machine for compile testing..
Affected files ...
.. //depot/projects/kmacy_sun4v/src/sys/sun4v/include/hv_pcivar.h#4 edit
.. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/hv_pci.c#22 edit
Differences ...
==== //depot/projects/kmacy_sun4v/src/sys/sun4v/include/hv_pcivar.h#4 (text+ko) ====
@@ -34,6 +34,9 @@
devhandle_t hs_devhandle;
uint8_t hs_busnum;
+ struct resource *hs_intr;
+ void *hs_intrcookie;
+
struct rman hs_pci_mem_rman;
bus_space_tag_t hs_pci_memt;
bus_space_handle_t hs_pci_memh;
==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/hv_pci.c#22 (text+ko) ====
@@ -123,6 +123,16 @@
DRIVER_MODULE(hvpci, nexus, hvpci_driver, hvpci_devclass, 0, 0);
+static void
+hvpci_intr(void *v)
+{
+ struct hvpci_softc *sc;
+
+ sc = (struct hvpci_softc *)v;
+
+ printf("%s: intr, sc: %p\n", __func__, sc);
+}
+
static int
hvpci_probe(device_t dev)
{
@@ -147,7 +157,7 @@
#endif
uint64_t reg, nreg;
int br[2];
- int n, type;
+ int n, type, error;
int i, nrange;
sc = device_get_softc(dev);
@@ -174,6 +184,30 @@
sc->hs_devhandle = SUN4V_REG_SPEC2CFG_HDL(reg);
#endif
+ rid = 0;
+ if ((sc->hs_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
+ RF_SHAREABLE | RF_ACTIVE)) = NULL) {
+ device_printf(dev, "couldn't map interrupt\n");
+ return ENXIO;
+ }
+
+ error = bus_setup_intr(dev, hvpci_intr, INTR_MPSAFE, hvpci_intr, sc,
+ &sc->hs_intrcookie);
+ if (error) {
+ bus_release_resource(dev, SYS_RES_IRQ,
+ rman_get_rid(sc->hs_irq), sc->hs_irq);
+ device_printf(dev, "bus_setup_intr: %d\n", error);
+ return error;
+ }
+
+ /* initalize intr resources */
+ sc->hs_intr_rman.rm_type = RMAN_ARRAY;
+ sc->hs_intr_rman.rm_type = "HyperVisor PCI Interrupts";
+ if (rman_init(&sc->hs_intr_rman) != 0 || rman_manage_region(rmanp, 0,
+ /* XXX - no clue where this should start or end */
+ 10) != 0)
+ panic("%s: failed to set up intr rman", __func__);
+
/* Pull in the ra addresses out of OFW */
nrange = OF_getprop_alloc(node, "ranges", sizeof *range,
(void **)&range);
@@ -363,6 +397,8 @@
int flags, driver_intr_t *intr, void *arg, void **cookiep)
{
+ device_printf(dev, "attempted setup_intr: child: %p, ires: %p, flags: %#x, intr: %p, arg: %p, cookiep: %p\n",
+ child, ireq, flags, intr, arg, cookiep);
return (0);
}
@@ -391,16 +427,25 @@
flags &= ~RF_ACTIVE;
switch (type) {
+ case SYS_RES_IRQ:
+ if (end - start != 0)
+ return NULL;
+ rm = &sc->sc_pci_intr_rman;
+ bt = bh = NULL;
+ break;
+
case SYS_RES_MEMORY:
rm = &sc->hs_pci_mem_rman;
bt = sc->hs_pci_memt;
bh = sc->hs_pci_memh;
break;
+
case SYS_RES_IOPORT:
rm = &sc->hs_pci_io_rman;
bt = sc->hs_pci_iot;
bh = sc->hs_pci_ioh;
break;
+
default:
return (NULL);
}
More information about the p4-projects
mailing list