Decrypt magic numbers - define names for fields of Generic Timer's CNTKCTL reg.
Submitted by: Ruslan Bukin <br@bsdpad.com>
This commit is contained in:
parent
247602e3ea
commit
8f1bc52dfb
@ -66,7 +66,22 @@ __FBSDID("$FreeBSD$");
|
|||||||
#define GENERIC_TIMER_REG_CTRL 0
|
#define GENERIC_TIMER_REG_CTRL 0
|
||||||
#define GENERIC_TIMER_REG_TVAL 1
|
#define GENERIC_TIMER_REG_TVAL 1
|
||||||
|
|
||||||
#define CNTPSIRQ 29
|
#define GENERIC_TIMER_CNTKCTL_PL0PTEN (1 << 9) /* Physical timer registers
|
||||||
|
access from PL0 */
|
||||||
|
#define GENERIC_TIMER_CNTKCTL_PL0VTEN (1 << 8) /* Virtual timer registers
|
||||||
|
access from PL0 */
|
||||||
|
#define GENERIC_TIMER_CNTKCTL_EVNTI (1 << 4) /* Virtual counter
|
||||||
|
event bits */
|
||||||
|
#define GENERIC_TIMER_CNTKCTL_EVNTDIR (1 << 3) /* Virtual counter
|
||||||
|
event transition */
|
||||||
|
#define GENERIC_TIMER_CNTKCTL_EVNTEN (1 << 2) /* Enables events from
|
||||||
|
the virtual counter */
|
||||||
|
#define GENERIC_TIMER_CNTKCTL_PL0VCTEN (1 << 1) /* CNTVCT and CNTFRQ
|
||||||
|
access from PL0 */
|
||||||
|
#define GENERIC_TIMER_CNTKCTL_PL0PCTEN (1 << 0) /* CNTPCT and CNTFRQ
|
||||||
|
access from PL0 */
|
||||||
|
|
||||||
|
#define GENERIC_TIMER_CNTPSIRQ 29
|
||||||
|
|
||||||
struct arm_tmr_softc {
|
struct arm_tmr_softc {
|
||||||
struct resource *irq_res;
|
struct resource *irq_res;
|
||||||
@ -167,7 +182,11 @@ disable_user_access(void)
|
|||||||
uint32_t cntkctl;
|
uint32_t cntkctl;
|
||||||
|
|
||||||
__asm volatile("mrc p15, 0, %0, c14, c1, 0" : "=r" (cntkctl));
|
__asm volatile("mrc p15, 0, %0, c14, c1, 0" : "=r" (cntkctl));
|
||||||
cntkctl &= ~((3 << 8) | (7 << 0));
|
cntkctl &= ~(GENERIC_TIMER_CNTKCTL_PL0PTEN |
|
||||||
|
GENERIC_TIMER_CNTKCTL_PL0VTEN |
|
||||||
|
GENERIC_TIMER_CNTKCTL_EVNTEN |
|
||||||
|
GENERIC_TIMER_CNTKCTL_PL0VCTEN |
|
||||||
|
GENERIC_TIMER_CNTKCTL_PL0PCTEN);
|
||||||
__asm volatile("mcr p15, 0, %0, c14, c1, 0" : : "r" (cntkctl));
|
__asm volatile("mcr p15, 0, %0, c14, c1, 0" : : "r" (cntkctl));
|
||||||
isb();
|
isb();
|
||||||
}
|
}
|
||||||
@ -270,7 +289,8 @@ arm_tmr_attach(device_t dev)
|
|||||||
|
|
||||||
rid = 0;
|
rid = 0;
|
||||||
sc->irq_res = bus_alloc_resource(dev, SYS_RES_IRQ, &rid,
|
sc->irq_res = bus_alloc_resource(dev, SYS_RES_IRQ, &rid,
|
||||||
CNTPSIRQ, CNTPSIRQ, 1, RF_SHAREABLE | RF_ACTIVE);
|
GENERIC_TIMER_CNTPSIRQ, GENERIC_TIMER_CNTPSIRQ,
|
||||||
|
1, RF_SHAREABLE | RF_ACTIVE);
|
||||||
|
|
||||||
arm_tmr_sc = sc;
|
arm_tmr_sc = sc;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user