libpayload: Add raw_read_ functions

Add: raw_read_cntfrq_el0() and raw_read_cntpct_el0()

Required to support Arch64 Timer

Change-Id: I86aa97039304b9e9336d0146febfe1811c9e075a
Signed-off-by: T Michael Turney <mturney@codeaurora.org>
Reviewed-on: https://review.coreboot.org/25649
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
T Michael Turney 2018-04-26 10:14:20 -07:00 committed by Julius Werner
parent 7978b8b725
commit 1e3e02a1d2
2 changed files with 18 additions and 0 deletions

View File

@ -1043,3 +1043,19 @@ void raw_write_vbar(uint64_t vbar, uint32_t el)
{ {
SWITCH_CASE_WRITE(raw_write_vbar, vbar, el); SWITCH_CASE_WRITE(raw_write_vbar, vbar, el);
} }
uint32_t raw_read_cntfrq_el0(void)
{
uint64_t cntfrq_el0;
__asm__ __volatile__("mrs %0, CNTFRQ_EL0\n\t" : "=r" (cntfrq_el0) : : "memory");
return cntfrq_el0;
}
uint64_t raw_read_cntpct_el0(void)
{
uint64_t cntpct_el0;
__asm__ __volatile__("mrs %0, CNTPCT_EL0\n\t" : "=r" (cntpct_el0) : : "memory");
return cntpct_el0;
}

View File

@ -360,6 +360,8 @@ uint64_t raw_read_vbar_current(void);
void raw_write_vbar_current(uint64_t vbar); void raw_write_vbar_current(uint64_t vbar);
uint64_t raw_read_vbar(uint32_t el); uint64_t raw_read_vbar(uint32_t el);
void raw_write_vbar(uint64_t vbar, uint32_t el); void raw_write_vbar(uint64_t vbar, uint32_t el);
uint64_t raw_read_cntpct_el0(void);
uint32_t raw_read_cntfrq_el0(void);
/* Cache maintenance system instructions */ /* Cache maintenance system instructions */
void dccisw(uint64_t cisw); void dccisw(uint64_t cisw);