Page MenuHomeFreeBSD

D37424.id113248.diff
No OneTemporary

D37424.id113248.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
@@ -98,9 +98,16 @@
#define GT_CNTKCTL_PL0VCTEN (1 << 1) /* PL0 CNTVCT and CNTFRQ access */
#define GT_CNTKCTL_PL0PCTEN (1 << 0) /* PL0 CNTPCT and CNTFRQ access */
+struct arm_tmr_softc;
+
+struct arm_tmr_irq {
+ struct resource *res;
+ void *ihl;
+ struct arm_tmr_softc *sc;
+};
+
struct arm_tmr_softc {
- struct resource *res[GT_IRQ_COUNT];
- void *ihl[GT_IRQ_COUNT];
+ struct arm_tmr_irq irqs[GT_IRQ_COUNT];
uint64_t (*get_cntxct)(bool);
uint32_t clkfreq;
struct eventtimer et;
@@ -351,9 +358,11 @@
arm_tmr_intr(void *arg)
{
struct arm_tmr_softc *sc;
+ struct arm_tmr_irq *irq;
int ctrl;
- sc = (struct arm_tmr_softc *)arg;
+ irq = (struct arm_tmr_irq *)arg;
+ sc = irq->sc;
ctrl = get_ctrl(sc->physical);
if (ctrl & GT_CTRL_INT_STAT) {
ctrl |= GT_CTRL_INT_MASK;
@@ -442,6 +451,7 @@
arm_tmr_attach(device_t dev)
{
struct arm_tmr_softc *sc;
+ struct resource *res[GT_IRQ_COUNT];
#ifdef FDT
phandle_t node;
pcell_t clock;
@@ -482,14 +492,18 @@
return (ENXIO);
}
- if (bus_alloc_resources(dev, timer_spec, sc->res)) {
+ if (bus_alloc_resources(dev, timer_spec, res)) {
device_printf(dev, "could not allocate resources\n");
return (ENXIO);
}
+ for (i = 0; i < GT_IRQ_COUNT; i++) {
+ sc->irqs[i].res = res[i];
+ sc->irqs[i].sc = sc;
+ }
#ifdef __aarch64__
/* Use the virtual timer if we have one. */
- if (sc->res[GT_VIRT] != NULL) {
+ if (sc->irqs[GT_VIRT].res != NULL) {
sc->physical = false;
first_timer = GT_VIRT;
last_timer = GT_VIRT;
@@ -507,10 +521,10 @@
/* Setup secure, non-secure and virtual IRQs handler */
for (i = first_timer; i <= last_timer; i++) {
/* If we do not have the interrupt, skip it. */
- if (sc->res[i] == NULL)
+ if (sc->irqs[i].res == NULL)
continue;
- error = bus_setup_intr(dev, sc->res[i], INTR_TYPE_CLK,
- arm_tmr_intr, NULL, sc, &sc->ihl[i]);
+ error = bus_setup_intr(dev, sc->irqs[i].res, INTR_TYPE_CLK,
+ arm_tmr_intr, NULL, &sc->irqs[i], &sc->irqs[i].ihl);
if (error) {
device_printf(dev, "Unable to alloc int resource.\n");
return (ENXIO);
@@ -518,7 +532,7 @@
}
/* Disable the virtual timer until we are ready */
- if (sc->res[GT_VIRT] != NULL)
+ if (sc->irqs[GT_VIRT].res != NULL)
arm_tmr_disable(false);
/* And the physical */
if (sc->physical)

File Metadata

Mime Type
text/plain
Expires
Thu, Mar 6, 1:19 AM (7 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17005289
Default Alt Text
D37424.id113248.diff (2 KB)

Event Timeline