Page MenuHomeFreeBSD

D39074.diff
No OneTemporary

D39074.diff

diff --git a/sys/arm/arm/generic_timer.c b/sys/arm/arm/generic_timer.c
--- a/sys/arm/arm/generic_timer.c
+++ b/sys/arm/arm/generic_timer.c
@@ -108,45 +108,40 @@
static struct arm_tmr_softc *arm_tmr_sc = NULL;
-#ifdef DEV_ACPI
-static struct resource_spec timer_acpi_spec[] = {
+static struct resource_spec timer_spec[] = {
+ /* Keep in order of rid ascending. */
{ SYS_RES_IRQ, GT_PHYS_SECURE, RF_ACTIVE | RF_OPTIONAL },
{ SYS_RES_IRQ, GT_PHYS_NONSECURE, RF_ACTIVE },
{ SYS_RES_IRQ, GT_VIRT, RF_ACTIVE },
+ /* Not currently assigned from GTDT information. */
{ SYS_RES_IRQ, GT_HYP_PHYS, RF_ACTIVE | RF_OPTIONAL },
+ { SYS_RES_IRQ, GT_HYP_VIRT, RF_ACTIVE | RF_OPTIONAL },
{ -1, 0 }
};
-#endif
static const struct arm_tmr_irq_defs {
- int idx;
- const char *name;
- int flags;
+ const char *name;
+ const struct resource_spec *spec;
} arm_tmr_irq_defs[] = {
{
- .idx = GT_PHYS_SECURE,
.name = "sec-phys",
- .flags = RF_ACTIVE | RF_OPTIONAL,
+ .spec = &timer_spec[GT_PHYS_SECURE],
},
{
- .idx = GT_PHYS_NONSECURE,
.name = "phys",
- .flags = RF_ACTIVE,
+ .spec = &timer_spec[GT_PHYS_NONSECURE],
},
{
- .idx = GT_VIRT,
.name = "virt",
- .flags = RF_ACTIVE,
+ .spec = &timer_spec[GT_VIRT],
},
{
- .idx = GT_HYP_PHYS,
.name = "hyp-phys",
- .flags = RF_ACTIVE | RF_OPTIONAL,
+ .spec = &timer_spec[GT_HYP_PHYS],
},
{
- .idx = GT_HYP_VIRT,
.name = "hyp-virt",
- .flags = RF_ACTIVE | RF_OPTIONAL,
+ .spec = &timer_spec[GT_HYP_VIRT],
},
};
@@ -429,7 +424,7 @@
const struct arm_tmr_irq_defs *irq_def;
size_t i;
phandle_t node;
- int error, rid;
+ int error, idx, rid;
bool has_names;
sc = device_get_softc(dev);
@@ -444,8 +439,8 @@
* in the "usual" order with sec-phys first and allocate by idx.
*/
irq_def = &arm_tmr_irq_defs[i];
- rid = irq_def->idx;
- flags = irq_def->flags;
+ idx = rid = irq_def->spec->rid;
+ flags = irq_def->spec->flags;
if (has_names) {
error = ofw_bus_find_string_index(node,
"interrupt-names", irq_def->name, &rid);
@@ -480,10 +475,10 @@
flags &= ~RF_OPTIONAL;
}
- sc->res[irq_def->idx] = bus_alloc_resource_any(dev,
- SYS_RES_IRQ, &rid, flags);
+ sc->res[idx] = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
+ flags);
- if (sc->res[irq_def->idx] == NULL) {
+ if (sc->res[idx] == NULL) {
device_printf(dev,
"could not allocate irq for %s interrupt '%s'\n",
(flags & RF_OPTIONAL) != 0 ? "optional" :
@@ -583,14 +578,14 @@
int error;
sc = device_get_softc(dev);
- if (bus_alloc_resources(dev, timer_acpi_spec, sc->res)) {
+ if (bus_alloc_resources(dev, timer_spec, sc->res)) {
device_printf(dev, "could not allocate resources\n");
return (ENXIO);
}
error = arm_tmr_attach(dev);
if (error != 0)
- bus_release_resources(dev, timer_acpi_spec, sc->res);
+ bus_release_resources(dev, timer_spec, sc->res);
return (error);
}
#endif
@@ -644,8 +639,8 @@
for (i = 0; i < nitems(arm_tmr_irq_defs); i++) {
irq_def = &arm_tmr_irq_defs[i];
- MPASS(sc->res[irq_def->idx] != NULL ||
- (irq_def->flags & RF_OPTIONAL) != 0);
+ MPASS(sc->res[irq_def->spec->rid] != NULL ||
+ (irq_def->spec->flags & RF_OPTIONAL) != 0);
}
#ifdef __aarch64__

File Metadata

Mime Type
text/plain
Expires
Thu, May 28, 3:31 PM (5 m, 23 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33588638
Default Alt Text
D39074.diff (3 KB)

Event Timeline