Page MenuHomeFreeBSD

D36600.diff
No OneTemporary

D36600.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
@@ -78,6 +78,12 @@
#include <dev/acpica/acpivar.h>
#endif
+#define GT_PHYS_SECURE 0
+#define GT_PHYS_NONSECURE 1
+#define GT_VIRT 2
+#define GT_HYP 3
+#define GT_IRQ_COUNT 4
+
#define GT_CTRL_ENABLE (1 << 0)
#define GT_CTRL_INT_MASK (1 << 1)
#define GT_CTRL_INT_STAT (1 << 2)
@@ -93,8 +99,8 @@
#define GT_CNTKCTL_PL0PCTEN (1 << 0) /* PL0 CNTPCT and CNTFRQ access */
struct arm_tmr_softc {
- struct resource *res[4];
- void *ihl[4];
+ struct resource *res[GT_IRQ_COUNT];
+ void *ihl[GT_IRQ_COUNT];
uint64_t (*get_cntxct)(bool);
uint32_t clkfreq;
struct eventtimer et;
@@ -104,10 +110,10 @@
static struct arm_tmr_softc *arm_tmr_sc = NULL;
static struct resource_spec timer_spec[] = {
- { SYS_RES_IRQ, 0, RF_ACTIVE }, /* Secure */
- { SYS_RES_IRQ, 1, RF_ACTIVE }, /* Non-secure */
- { SYS_RES_IRQ, 2, RF_ACTIVE | RF_OPTIONAL }, /* Virt */
- { SYS_RES_IRQ, 3, RF_ACTIVE | RF_OPTIONAL }, /* Hyp */
+ { SYS_RES_IRQ, GT_PHYS_SECURE, RF_ACTIVE },
+ { SYS_RES_IRQ, GT_PHYS_NONSECURE, RF_ACTIVE },
+ { SYS_RES_IRQ, GT_VIRT, RF_ACTIVE | RF_OPTIONAL },
+ { SYS_RES_IRQ, GT_HYP, RF_ACTIVE | RF_OPTIONAL },
{ -1, 0 }
};
@@ -412,9 +418,12 @@
goto out;
}
- arm_tmr_acpi_add_irq(parent, dev, 0, gtdt->SecureEl1Interrupt);
- arm_tmr_acpi_add_irq(parent, dev, 1, gtdt->NonSecureEl1Interrupt);
- arm_tmr_acpi_add_irq(parent, dev, 2, gtdt->VirtualTimerInterrupt);
+ arm_tmr_acpi_add_irq(parent, dev, GT_PHYS_SECURE,
+ gtdt->SecureEl1Interrupt);
+ arm_tmr_acpi_add_irq(parent, dev, GT_PHYS_NONSECURE,
+ gtdt->NonSecureEl1Interrupt);
+ arm_tmr_acpi_add_irq(parent, dev, GT_VIRT,
+ gtdt->VirtualTimerInterrupt);
out:
acpi_unmap_table(gtdt);
@@ -480,17 +489,17 @@
#ifdef __aarch64__
/* Use the virtual timer if we have one. */
- if (sc->res[2] != NULL) {
+ if (sc->res[GT_VIRT] != NULL) {
sc->physical = false;
- first_timer = 2;
- last_timer = 2;
+ first_timer = GT_VIRT;
+ last_timer = GT_VIRT;
} else
#endif
/* Otherwise set up the secure and non-secure physical timers. */
{
sc->physical = true;
- first_timer = 0;
- last_timer = 1;
+ first_timer = GT_PHYS_SECURE;
+ last_timer = GT_PHYS_NONSECURE;
}
arm_tmr_sc = sc;
@@ -509,7 +518,7 @@
}
/* Disable the virtual timer until we are ready */
- if (sc->res[2] != NULL)
+ if (sc->res[GT_VIRT] != NULL)
arm_tmr_disable(false);
/* And the physical */
if (sc->physical)

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 19, 9:23 AM (21 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14714056
Default Alt Text
D36600.diff (2 KB)

Event Timeline