Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F148415453
D8606.1786731587.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D8606.1786731587.diff
View Options
Index: sys/arm/arm/gic.h
===================================================================
--- sys/arm/arm/gic.h
+++ sys/arm/arm/gic.h
@@ -75,9 +75,6 @@
#endif
#ifdef INTRNG
- /* FDT child data */
- pcell_t addr_cells;
- pcell_t size_cells;
int nranges;
struct arm_gic_range * ranges;
#endif
Index: sys/arm/arm/gic.c
===================================================================
--- sys/arm/arm/gic.c
+++ sys/arm/arm/gic.c
@@ -61,8 +61,10 @@
#include <machine/intr.h>
#include <machine/smp.h>
+#ifdef FDT
#include <dev/fdt/fdt_intr.h>
#include <dev/ofw/ofw_bus_subr.h>
+#endif
#include <arm/arm/gic.h>
Index: sys/arm/arm/gic_fdt.c
===================================================================
--- sys/arm/arm/gic_fdt.c
+++ sys/arm/arm/gic_fdt.c
@@ -60,6 +60,16 @@
};
#endif
+struct arm_gic_fdt_softc {
+ struct arm_gic_softc sc_gic;
+
+#ifdef INTRNG
+ /* FDT child data */
+ pcell_t addr_cells;
+ pcell_t size_cells;
+#endif
+};
+
static device_probe_t gic_fdt_probe;
static device_attach_t gic_fdt_attach;
static ofw_bus_get_devinfo_t gic_ofw_get_devinfo;
@@ -102,7 +112,7 @@
};
DEFINE_CLASS_1(gic, gic_fdt_driver, gic_fdt_methods,
- sizeof(struct arm_gic_softc), arm_gic_driver);
+ sizeof(struct arm_gic_fdt_softc), arm_gic_driver);
static devclass_t gic_fdt_devclass;
@@ -128,7 +138,7 @@
gic_fdt_attach(device_t dev)
{
#ifdef INTRNG
- struct arm_gic_softc *sc = device_get_softc(dev);
+ struct arm_gic_fdt_softc *sc = device_get_softc(dev);
phandle_t pxref;
intptr_t xref;
#endif
@@ -164,14 +174,14 @@
goto cleanup;
}
} else {
- if (sc->gic_res[2] == NULL) {
+ if (sc->sc_gic.gic_res[2] == NULL) {
device_printf(dev,
"not root PIC must have defined interrupt\n");
intr_pic_deregister(dev, xref);
goto cleanup;
}
- if (bus_setup_intr(dev, sc->gic_res[2], INTR_TYPE_CLK,
- arm_gic_intr, NULL, sc, &sc->gic_intrhand)) {
+ if (bus_setup_intr(dev, sc->sc_gic.gic_res[2], INTR_TYPE_CLK,
+ arm_gic_intr, NULL, sc, &sc->sc_gic.gic_intrhand)) {
device_printf(dev, "could not setup irq handler\n");
intr_pic_deregister(dev, xref);
goto cleanup;
@@ -209,7 +219,7 @@
}
static int
-arm_gic_fill_ranges(phandle_t node, struct arm_gic_softc *sc)
+arm_gic_fill_ranges(phandle_t node, struct arm_gic_fdt_softc *sc)
{
pcell_t host_cells;
cell_t *base_ranges;
@@ -229,42 +239,43 @@
nbase_ranges = OF_getproplen(node, "ranges");
if (nbase_ranges < 0)
return (-1);
- sc->nranges = nbase_ranges / sizeof(cell_t) /
+ sc->sc_gic.nranges = nbase_ranges / sizeof(cell_t) /
(sc->addr_cells + host_cells + sc->size_cells);
- if (sc->nranges == 0)
+ if (sc->sc_gic.nranges == 0)
return (0);
- sc->ranges = malloc(sc->nranges * sizeof(sc->ranges[0]),
- M_DEVBUF, M_WAITOK);
+ sc->sc_gic.ranges = malloc(
+ sc->sc_gic.nranges * sizeof(sc->sc_gic.ranges[0]), M_DEVBUF,
+ M_WAITOK);
base_ranges = malloc(nbase_ranges, M_DEVBUF, M_WAITOK);
OF_getencprop(node, "ranges", base_ranges, nbase_ranges);
- for (i = 0, j = 0; i < sc->nranges; i++) {
- sc->ranges[i].bus = 0;
+ for (i = 0, j = 0; i < sc->sc_gic.nranges; i++) {
+ sc->sc_gic.ranges[i].bus = 0;
for (k = 0; k < sc->addr_cells; k++) {
- sc->ranges[i].bus <<= 32;
- sc->ranges[i].bus |= base_ranges[j++];
+ sc->sc_gic.ranges[i].bus <<= 32;
+ sc->sc_gic.ranges[i].bus |= base_ranges[j++];
}
- sc->ranges[i].host = 0;
+ sc->sc_gic.ranges[i].host = 0;
for (k = 0; k < host_cells; k++) {
- sc->ranges[i].host <<= 32;
- sc->ranges[i].host |= base_ranges[j++];
+ sc->sc_gic.ranges[i].host <<= 32;
+ sc->sc_gic.ranges[i].host |= base_ranges[j++];
}
- sc->ranges[i].size = 0;
+ sc->sc_gic.ranges[i].size = 0;
for (k = 0; k < sc->size_cells; k++) {
- sc->ranges[i].size <<= 32;
- sc->ranges[i].size |= base_ranges[j++];
+ sc->sc_gic.ranges[i].size <<= 32;
+ sc->sc_gic.ranges[i].size |= base_ranges[j++];
}
}
free(base_ranges, M_DEVBUF);
- return (sc->nranges);
+ return (sc->sc_gic.nranges);
}
static bool
arm_gic_add_children(device_t dev)
{
- struct arm_gic_softc *sc;
+ struct arm_gic_fdt_softc *sc;
struct arm_gic_devinfo *dinfo;
phandle_t child, node;
device_t cdev;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Aug 14, 6:19 PM (13 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29407942
Default Alt Text
D8606.1786731587.diff (4 KB)
Attached To
Mode
D8606: Split out the FDT parts of the GIC softc
Attached
Detach File
Event Timeline
Log In to Comment