libpayload arm64: Add helper functions with el argument
Allow read/write to registers at a given el. Also, make read/write registers at current el call this newly added function. BRANCH=none BUG=none TEST=build and boot on mt8173-evb Change-Id: Id69f0fdc07193c5c7e997712f0cd99de6f41510b Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: c091917babc39d9ab997f51f81b486c9aa900c24 Original-Change-Id: I0944946642066b88331e497a92388e74e86902d0 Original-Signed-off-by: HC Yen <hc.yen@mediatek.com> Original-Reviewed-on: https://chromium-review.googlesource.com/240322 Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/8798 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
parent
584e048185
commit
11e743ce26
|
@ -179,12 +179,24 @@ void raw_write_elr_el3(uint64_t elr_el3)
|
||||||
|
|
||||||
uint64_t raw_read_elr_current(void)
|
uint64_t raw_read_elr_current(void)
|
||||||
{
|
{
|
||||||
SWITCH_CASE_READ(raw_read_elr,elr,uint64_t);
|
uint32_t el = get_current_el();
|
||||||
|
return raw_read_elr(el);
|
||||||
}
|
}
|
||||||
|
|
||||||
void raw_write_elr_current(uint64_t elr)
|
void raw_write_elr_current(uint64_t elr)
|
||||||
{
|
{
|
||||||
SWITCH_CASE_WRITE(raw_write_elr,elr);
|
uint32_t el = get_current_el();
|
||||||
|
raw_write_elr(elr, el);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t raw_read_elr(uint32_t el)
|
||||||
|
{
|
||||||
|
SWITCH_CASE_READ(raw_read_elr, elr, uint64_t, el);
|
||||||
|
}
|
||||||
|
|
||||||
|
void raw_write_elr(uint64_t elr, uint32_t el)
|
||||||
|
{
|
||||||
|
SWITCH_CASE_WRITE(raw_write_elr, elr, el);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FPCR */
|
/* FPCR */
|
||||||
|
@ -380,12 +392,24 @@ void raw_write_spsr_el3(uint32_t spsr_el3)
|
||||||
|
|
||||||
uint32_t raw_read_spsr_current(void)
|
uint32_t raw_read_spsr_current(void)
|
||||||
{
|
{
|
||||||
SWITCH_CASE_READ(raw_read_spsr,spsr,uint32_t);
|
uint32_t el = get_current_el();
|
||||||
|
return raw_read_spsr(el);
|
||||||
}
|
}
|
||||||
|
|
||||||
void raw_write_spsr_current(uint32_t spsr)
|
void raw_write_spsr_current(uint32_t spsr)
|
||||||
{
|
{
|
||||||
SWITCH_CASE_WRITE(raw_write_spsr,spsr);
|
uint32_t el = get_current_el();
|
||||||
|
raw_write_spsr(spsr, el);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t raw_read_spsr(uint32_t el)
|
||||||
|
{
|
||||||
|
SWITCH_CASE_READ(raw_read_spsr, spsr, uint32_t, el);
|
||||||
|
}
|
||||||
|
|
||||||
|
void raw_write_spsr(uint32_t spsr, uint32_t el)
|
||||||
|
{
|
||||||
|
SWITCH_CASE_WRITE(raw_write_spsr, spsr, el);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t raw_read_spsr_fiq(void)
|
uint32_t raw_read_spsr_fiq(void)
|
||||||
|
|
|
@ -80,12 +80,24 @@ void raw_write_actlr_el3(uint32_t actlr_el3)
|
||||||
|
|
||||||
uint32_t raw_read_actlr_current(void)
|
uint32_t raw_read_actlr_current(void)
|
||||||
{
|
{
|
||||||
SWITCH_CASE_READ(raw_read_actlr,actlr,uint32_t);
|
uint32_t el = get_current_el();
|
||||||
|
return raw_read_actlr(el);
|
||||||
}
|
}
|
||||||
|
|
||||||
void raw_write_actlr_current(uint32_t actlr)
|
void raw_write_actlr_current(uint32_t actlr)
|
||||||
{
|
{
|
||||||
SWITCH_CASE_WRITE(raw_write_actlr,actlr);
|
uint32_t el = get_current_el();
|
||||||
|
raw_write_actlr(actlr, el);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t raw_read_actlr(uint32_t el)
|
||||||
|
{
|
||||||
|
SWITCH_CASE_READ(raw_read_actlr, actlr, uint32_t, el);
|
||||||
|
}
|
||||||
|
|
||||||
|
void raw_write_actlr(uint32_t actlr, uint32_t el)
|
||||||
|
{
|
||||||
|
SWITCH_CASE_WRITE(raw_write_actlr, actlr, el);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* AFSR0 */
|
/* AFSR0 */
|
||||||
|
@ -133,12 +145,24 @@ void raw_write_afsr0_el3(uint32_t afsr0_el3)
|
||||||
|
|
||||||
uint32_t raw_read_afsr0_current(void)
|
uint32_t raw_read_afsr0_current(void)
|
||||||
{
|
{
|
||||||
SWITCH_CASE_READ(raw_read_afsr0,afsr0,uint32_t);
|
uint32_t el = get_current_el();
|
||||||
|
return raw_read_afsr0(el);
|
||||||
}
|
}
|
||||||
|
|
||||||
void raw_write_afsr0_current(uint32_t afsr0)
|
void raw_write_afsr0_current(uint32_t afsr0)
|
||||||
{
|
{
|
||||||
SWITCH_CASE_WRITE(raw_write_afsr0,afsr0);
|
uint32_t el = get_current_el();
|
||||||
|
raw_write_afsr0(afsr0, el);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t raw_read_afsr0(uint32_t el)
|
||||||
|
{
|
||||||
|
SWITCH_CASE_READ(raw_read_afsr0, afsr0, uint32_t, el);
|
||||||
|
}
|
||||||
|
|
||||||
|
void raw_write_afsr0(uint32_t afsr0, uint32_t el)
|
||||||
|
{
|
||||||
|
SWITCH_CASE_WRITE(raw_write_afsr0, afsr0, el);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* AFSR1 */
|
/* AFSR1 */
|
||||||
|
@ -186,12 +210,24 @@ void raw_write_afsr1_el3(uint32_t afsr1_el3)
|
||||||
|
|
||||||
uint32_t raw_read_afsr1_current(void)
|
uint32_t raw_read_afsr1_current(void)
|
||||||
{
|
{
|
||||||
SWITCH_CASE_READ(raw_read_afsr1,afsr1,uint32_t);
|
uint32_t el = get_current_el();
|
||||||
|
return raw_read_afsr1(el);
|
||||||
}
|
}
|
||||||
|
|
||||||
void raw_write_afsr1_current(uint32_t afsr1)
|
void raw_write_afsr1_current(uint32_t afsr1)
|
||||||
{
|
{
|
||||||
SWITCH_CASE_WRITE(raw_write_afsr1,afsr1);
|
uint32_t el = get_current_el();
|
||||||
|
raw_write_afsr1(afsr1, el);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t raw_read_afsr1(uint32_t el)
|
||||||
|
{
|
||||||
|
SWITCH_CASE_READ(raw_read_afsr1, afsr1, uint32_t, el);
|
||||||
|
}
|
||||||
|
|
||||||
|
void raw_write_afsr1(uint32_t afsr1, uint32_t el)
|
||||||
|
{
|
||||||
|
SWITCH_CASE_WRITE(raw_write_afsr1, afsr1, el);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* AIDR */
|
/* AIDR */
|
||||||
|
@ -249,12 +285,24 @@ void raw_write_amair_el3(uint64_t amair_el3)
|
||||||
|
|
||||||
uint64_t raw_read_amair_current(void)
|
uint64_t raw_read_amair_current(void)
|
||||||
{
|
{
|
||||||
SWITCH_CASE_READ(raw_read_amair,amair,uint64_t);
|
uint32_t el = get_current_el();
|
||||||
|
return raw_read_amair(el);
|
||||||
}
|
}
|
||||||
|
|
||||||
void raw_write_amair_current(uint64_t amair)
|
void raw_write_amair_current(uint64_t amair)
|
||||||
{
|
{
|
||||||
SWITCH_CASE_WRITE(raw_write_amair,amair);
|
uint32_t el = get_current_el();
|
||||||
|
raw_write_amair(amair, el);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t raw_read_amair(uint32_t el)
|
||||||
|
{
|
||||||
|
SWITCH_CASE_READ(raw_read_amair, amair, uint64_t, el);
|
||||||
|
}
|
||||||
|
|
||||||
|
void raw_write_amair(uint64_t amair, uint32_t el)
|
||||||
|
{
|
||||||
|
SWITCH_CASE_WRITE(raw_write_amair, amair, el);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CCSIDR */
|
/* CCSIDR */
|
||||||
|
@ -391,12 +439,24 @@ void raw_write_esr_el3(uint32_t esr_el3)
|
||||||
|
|
||||||
uint32_t raw_read_esr_current(void)
|
uint32_t raw_read_esr_current(void)
|
||||||
{
|
{
|
||||||
SWITCH_CASE_READ(raw_read_esr,esr,uint32_t);
|
uint32_t el = get_current_el();
|
||||||
|
return raw_read_esr(el);
|
||||||
}
|
}
|
||||||
|
|
||||||
void raw_write_esr_current(uint32_t esr)
|
void raw_write_esr_current(uint32_t esr)
|
||||||
{
|
{
|
||||||
SWITCH_CASE_WRITE(raw_write_esr,esr);
|
uint32_t el = get_current_el();
|
||||||
|
raw_write_esr(esr, el);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t raw_read_esr(uint32_t el)
|
||||||
|
{
|
||||||
|
SWITCH_CASE_READ(raw_read_esr, esr, uint32_t, el);
|
||||||
|
}
|
||||||
|
|
||||||
|
void raw_write_esr(uint32_t esr, uint32_t el)
|
||||||
|
{
|
||||||
|
SWITCH_CASE_WRITE(raw_write_esr, esr, el);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FAR */
|
/* FAR */
|
||||||
|
@ -444,12 +504,24 @@ void raw_write_far_el3(uint64_t far_el3)
|
||||||
|
|
||||||
uint64_t raw_read_far_current(void)
|
uint64_t raw_read_far_current(void)
|
||||||
{
|
{
|
||||||
SWITCH_CASE_READ(raw_read_far,far,uint64_t);
|
uint32_t el = get_current_el();
|
||||||
|
return raw_read_far(el);
|
||||||
}
|
}
|
||||||
|
|
||||||
void raw_write_far_current(uint64_t far)
|
void raw_write_far_current(uint64_t far)
|
||||||
{
|
{
|
||||||
SWITCH_CASE_WRITE(raw_write_far,far);
|
uint32_t el = get_current_el();
|
||||||
|
raw_write_far(far, el);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t raw_read_far(uint32_t el)
|
||||||
|
{
|
||||||
|
SWITCH_CASE_READ(raw_read_far, far, uint64_t, el);
|
||||||
|
}
|
||||||
|
|
||||||
|
void raw_write_far(uint64_t far, uint32_t el)
|
||||||
|
{
|
||||||
|
SWITCH_CASE_WRITE(raw_write_far, far, el);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* HCR */
|
/* HCR */
|
||||||
|
@ -522,12 +594,24 @@ void raw_write_mair_el3(uint64_t mair_el3)
|
||||||
|
|
||||||
uint64_t raw_read_mair_current(void)
|
uint64_t raw_read_mair_current(void)
|
||||||
{
|
{
|
||||||
SWITCH_CASE_READ(raw_read_mair,mair,uint64_t);
|
uint32_t el = get_current_el();
|
||||||
|
return raw_read_mair(el);
|
||||||
}
|
}
|
||||||
|
|
||||||
void raw_write_mair_current(uint64_t mair)
|
void raw_write_mair_current(uint64_t mair)
|
||||||
{
|
{
|
||||||
SWITCH_CASE_WRITE(raw_write_mair,mair);
|
uint32_t el = get_current_el();
|
||||||
|
raw_write_mair(mair, el);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t raw_read_mair(uint32_t el)
|
||||||
|
{
|
||||||
|
SWITCH_CASE_READ(raw_read_mair, mair, uint64_t, el);
|
||||||
|
}
|
||||||
|
|
||||||
|
void raw_write_mair(uint64_t mair, uint32_t el)
|
||||||
|
{
|
||||||
|
SWITCH_CASE_WRITE(raw_write_mair, mair, el);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* MPIDR */
|
/* MPIDR */
|
||||||
|
@ -585,12 +669,24 @@ void raw_write_rmr_el3(uint32_t rmr_el3)
|
||||||
|
|
||||||
uint32_t raw_read_rmr_current(void)
|
uint32_t raw_read_rmr_current(void)
|
||||||
{
|
{
|
||||||
SWITCH_CASE_READ(raw_read_rmr,rmr,uint32_t);
|
uint32_t el = get_current_el();
|
||||||
|
return raw_read_rmr(el);
|
||||||
}
|
}
|
||||||
|
|
||||||
void raw_write_rmr_current(uint32_t rmr)
|
void raw_write_rmr_current(uint32_t rmr)
|
||||||
{
|
{
|
||||||
SWITCH_CASE_WRITE(raw_write_rmr,rmr);
|
uint32_t el = get_current_el();
|
||||||
|
raw_write_rmr(rmr, el);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t raw_read_rmr(uint32_t el)
|
||||||
|
{
|
||||||
|
SWITCH_CASE_READ(raw_read_rmr, rmr, uint32_t, el);
|
||||||
|
}
|
||||||
|
|
||||||
|
void raw_write_rmr(uint32_t rmr, uint32_t el)
|
||||||
|
{
|
||||||
|
SWITCH_CASE_WRITE(raw_write_rmr, rmr, el);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* RVBAR */
|
/* RVBAR */
|
||||||
|
@ -638,12 +734,24 @@ void raw_write_rvbar_el3(uint64_t rvbar_el3)
|
||||||
|
|
||||||
uint64_t raw_read_rvbar_current(void)
|
uint64_t raw_read_rvbar_current(void)
|
||||||
{
|
{
|
||||||
SWITCH_CASE_READ(raw_read_rvbar,rvbar,uint64_t);
|
uint32_t el = get_current_el();
|
||||||
|
return raw_read_rvbar(el);
|
||||||
}
|
}
|
||||||
|
|
||||||
void raw_write_rvbar_current(uint64_t rvbar)
|
void raw_write_rvbar_current(uint64_t rvbar)
|
||||||
{
|
{
|
||||||
SWITCH_CASE_WRITE(raw_write_rvbar,rvbar);
|
uint32_t el = get_current_el();
|
||||||
|
raw_write_rvbar(rvbar, el);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t raw_read_rvbar(uint32_t el)
|
||||||
|
{
|
||||||
|
SWITCH_CASE_READ(raw_read_rvbar, rvbar, uint64_t, el);
|
||||||
|
}
|
||||||
|
|
||||||
|
void raw_write_rvbar(uint64_t rvbar, uint32_t el)
|
||||||
|
{
|
||||||
|
SWITCH_CASE_WRITE(raw_write_rvbar, rvbar, el);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SCR */
|
/* SCR */
|
||||||
|
@ -706,12 +814,24 @@ void raw_write_sctlr_el3(uint32_t sctlr_el3)
|
||||||
|
|
||||||
uint32_t raw_read_sctlr_current(void)
|
uint32_t raw_read_sctlr_current(void)
|
||||||
{
|
{
|
||||||
SWITCH_CASE_READ(raw_read_sctlr,sctlr,uint32_t);
|
uint32_t el = get_current_el();
|
||||||
|
return raw_read_sctlr(el);
|
||||||
}
|
}
|
||||||
|
|
||||||
void raw_write_sctlr_current(uint32_t sctlr)
|
void raw_write_sctlr_current(uint32_t sctlr)
|
||||||
{
|
{
|
||||||
SWITCH_CASE_WRITE(raw_write_sctlr,sctlr);
|
uint32_t el = get_current_el();
|
||||||
|
raw_write_sctlr(sctlr, el);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t raw_read_sctlr(uint32_t el)
|
||||||
|
{
|
||||||
|
SWITCH_CASE_READ(raw_read_sctlr, sctlr, uint32_t, el);
|
||||||
|
}
|
||||||
|
|
||||||
|
void raw_write_sctlr(uint32_t sctlr, uint32_t el)
|
||||||
|
{
|
||||||
|
SWITCH_CASE_WRITE(raw_write_sctlr, sctlr, el);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TCR */
|
/* TCR */
|
||||||
|
@ -759,12 +879,24 @@ void raw_write_tcr_el3(uint32_t tcr_el3)
|
||||||
|
|
||||||
uint64_t raw_read_tcr_current(void)
|
uint64_t raw_read_tcr_current(void)
|
||||||
{
|
{
|
||||||
SWITCH_CASE_READ(raw_read_tcr, tcr, uint64_t);
|
uint32_t el = get_current_el();
|
||||||
|
return raw_read_tcr(el);
|
||||||
}
|
}
|
||||||
|
|
||||||
void raw_write_tcr_current(uint64_t tcr)
|
void raw_write_tcr_current(uint64_t tcr)
|
||||||
{
|
{
|
||||||
SWITCH_CASE_WRITE(raw_write_tcr, tcr);
|
uint32_t el = get_current_el();
|
||||||
|
raw_write_tcr(tcr, el);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t raw_read_tcr(uint32_t el)
|
||||||
|
{
|
||||||
|
SWITCH_CASE_READ(raw_read_tcr, tcr, uint64_t, el);
|
||||||
|
}
|
||||||
|
|
||||||
|
void raw_write_tcr(uint64_t tcr, uint32_t el)
|
||||||
|
{
|
||||||
|
SWITCH_CASE_WRITE(raw_write_tcr, tcr, el);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TTBR0 */
|
/* TTBR0 */
|
||||||
|
@ -812,12 +944,24 @@ void raw_write_ttbr0_el3(uint64_t ttbr0_el3)
|
||||||
|
|
||||||
uint64_t raw_read_ttbr0_current(void)
|
uint64_t raw_read_ttbr0_current(void)
|
||||||
{
|
{
|
||||||
SWITCH_CASE_READ(raw_read_ttbr0,ttbr0,uint64_t);
|
uint32_t el = get_current_el();
|
||||||
|
return raw_read_ttbr0(el);
|
||||||
}
|
}
|
||||||
|
|
||||||
void raw_write_ttbr0_current(uint64_t ttbr0)
|
void raw_write_ttbr0_current(uint64_t ttbr0)
|
||||||
{
|
{
|
||||||
SWITCH_CASE_WRITE(raw_write_ttbr0,ttbr0);
|
uint32_t el = get_current_el();
|
||||||
|
raw_write_ttbr0(ttbr0, el);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t raw_read_ttbr0(uint32_t el)
|
||||||
|
{
|
||||||
|
SWITCH_CASE_READ(raw_read_ttbr0, ttbr0, uint64_t, el);
|
||||||
|
}
|
||||||
|
|
||||||
|
void raw_write_ttbr0(uint64_t ttbr0, uint32_t el)
|
||||||
|
{
|
||||||
|
SWITCH_CASE_WRITE(raw_write_ttbr0, ttbr0, el);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TTBR1 */
|
/* TTBR1 */
|
||||||
|
@ -880,10 +1024,22 @@ void raw_write_vbar_el3(uint64_t vbar_el3)
|
||||||
|
|
||||||
uint64_t raw_read_vbar_current(void)
|
uint64_t raw_read_vbar_current(void)
|
||||||
{
|
{
|
||||||
SWITCH_CASE_READ(raw_read_vbar,vbar,uint64_t);
|
uint32_t el = get_current_el();
|
||||||
|
return raw_read_vbar(el);
|
||||||
}
|
}
|
||||||
|
|
||||||
void raw_write_vbar_current(uint64_t vbar)
|
void raw_write_vbar_current(uint64_t vbar)
|
||||||
{
|
{
|
||||||
SWITCH_CASE_WRITE(raw_write_vbar,vbar);
|
uint32_t el = get_current_el();
|
||||||
|
raw_write_vbar(vbar, el);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t raw_read_vbar(uint32_t el)
|
||||||
|
{
|
||||||
|
SWITCH_CASE_READ(raw_read_vbar, vbar, uint64_t, el);
|
||||||
|
}
|
||||||
|
|
||||||
|
void raw_write_vbar(uint64_t vbar, uint32_t el)
|
||||||
|
{
|
||||||
|
SWITCH_CASE_WRITE(raw_write_vbar, vbar, el);
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,13 @@ void tlbiall_el3(void)
|
||||||
|
|
||||||
void tlbiall_current(void)
|
void tlbiall_current(void)
|
||||||
{
|
{
|
||||||
SWITCH_CASE_TLBI(tlbiall);
|
uint32_t el = get_current_el();
|
||||||
|
tlbiall(el);
|
||||||
|
}
|
||||||
|
|
||||||
|
void tlbiall(uint32_t el)
|
||||||
|
{
|
||||||
|
SWITCH_CASE_TLBI(tlbiall, el);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TLBIALLIS */
|
/* TLBIALLIS */
|
||||||
|
@ -73,7 +79,13 @@ void tlbiallis_el3(void)
|
||||||
|
|
||||||
void tlbiallis_current(void)
|
void tlbiallis_current(void)
|
||||||
{
|
{
|
||||||
SWITCH_CASE_TLBI(tlbiallis);
|
uint32_t el = get_current_el();
|
||||||
|
tlbiallis(el);
|
||||||
|
}
|
||||||
|
|
||||||
|
void tlbiallis(uint32_t el)
|
||||||
|
{
|
||||||
|
SWITCH_CASE_TLBI(tlbiallis, el);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TLBIVAA */
|
/* TLBIVAA */
|
||||||
|
|
|
@ -96,57 +96,56 @@
|
||||||
#define CURRENT_EL_MASK 0x3
|
#define CURRENT_EL_MASK 0x3
|
||||||
#define CURRENT_EL_SHIFT 2
|
#define CURRENT_EL_SHIFT 2
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#define DAIF_DBG_BIT (1<<3)
|
#define DAIF_DBG_BIT (1<<3)
|
||||||
#define DAIF_ABT_BIT (1<<2)
|
#define DAIF_ABT_BIT (1<<2)
|
||||||
#define DAIF_IRQ_BIT (1<<1)
|
#define DAIF_IRQ_BIT (1<<1)
|
||||||
#define DAIF_FIQ_BIT (1<<0)
|
#define DAIF_FIQ_BIT (1<<0)
|
||||||
|
|
||||||
#define SWITCH_CASE_READ(func,var,type) do { \
|
#define SWITCH_CASE_READ(func, var, type, el) do { \
|
||||||
type var = -1; \
|
type var = -1; \
|
||||||
uint8_t current_el = get_current_el(); \
|
switch (el) { \
|
||||||
switch(current_el) { \
|
case EL1: \
|
||||||
case EL1: \
|
var = func##_el1(); \
|
||||||
var = func##_el1(); \
|
break; \
|
||||||
break; \
|
case EL2: \
|
||||||
case EL2: \
|
var = func##_el2(); \
|
||||||
var = func##_el2(); \
|
break; \
|
||||||
break; \
|
case EL3: \
|
||||||
case EL3: \
|
var = func##_el3(); \
|
||||||
var = func##_el3(); \
|
break; \
|
||||||
break; \
|
} \
|
||||||
} \
|
return var; \
|
||||||
return var; \
|
} while (0)
|
||||||
} while(0)
|
|
||||||
|
|
||||||
#define SWITCH_CASE_WRITE(func,var) do { \
|
#define SWITCH_CASE_WRITE(func, var, el) do { \
|
||||||
uint8_t current_el = get_current_el(); \
|
switch (el) { \
|
||||||
switch(current_el) { \
|
case EL1: \
|
||||||
case EL1: \
|
func##_el1(var); \
|
||||||
func##_el1(var); \
|
break; \
|
||||||
break; \
|
case EL2: \
|
||||||
case EL2: \
|
func##_el2(var); \
|
||||||
func##_el2(var); \
|
break; \
|
||||||
break; \
|
case EL3: \
|
||||||
case EL3: \
|
func##_el3(var); \
|
||||||
func##_el3(var); \
|
break; \
|
||||||
break; \
|
} \
|
||||||
} \
|
} while (0)
|
||||||
} while(0)
|
|
||||||
|
|
||||||
#define SWITCH_CASE_TLBI(func) do { \
|
#define SWITCH_CASE_TLBI(func, el) do { \
|
||||||
uint8_t current_el = get_current_el(); \
|
switch (el) { \
|
||||||
switch(current_el) { \
|
case EL1: \
|
||||||
case EL1: \
|
|
||||||
func##_el1(); \
|
func##_el1(); \
|
||||||
break; \
|
break; \
|
||||||
case EL2: \
|
case EL2: \
|
||||||
func##_el2(); \
|
func##_el2(); \
|
||||||
break; \
|
break; \
|
||||||
case EL3: \
|
case EL3: \
|
||||||
func##_el3(); \
|
func##_el3(); \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
} while(0)
|
} while (0)
|
||||||
|
|
||||||
/* PSTATE and special purpose register access functions */
|
/* PSTATE and special purpose register access functions */
|
||||||
uint32_t raw_read_current_el(void);
|
uint32_t raw_read_current_el(void);
|
||||||
|
@ -173,6 +172,8 @@ uint64_t raw_read_elr_el3(void);
|
||||||
void raw_write_elr_el3(uint64_t elr_el3);
|
void raw_write_elr_el3(uint64_t elr_el3);
|
||||||
uint64_t raw_read_elr_current(void);
|
uint64_t raw_read_elr_current(void);
|
||||||
void raw_write_elr_current(uint64_t elr);
|
void raw_write_elr_current(uint64_t elr);
|
||||||
|
uint64_t raw_read_elr(uint32_t el);
|
||||||
|
void raw_write_elr(uint64_t elr, uint32_t el);
|
||||||
uint32_t raw_read_fpcr(void);
|
uint32_t raw_read_fpcr(void);
|
||||||
void raw_write_fpcr(uint32_t fpcr);
|
void raw_write_fpcr(uint32_t fpcr);
|
||||||
uint32_t raw_read_fpsr(void);
|
uint32_t raw_read_fpsr(void);
|
||||||
|
@ -199,6 +200,8 @@ uint32_t raw_read_spsr_el3(void);
|
||||||
void raw_write_spsr_el3(uint32_t spsr_el3);
|
void raw_write_spsr_el3(uint32_t spsr_el3);
|
||||||
uint32_t raw_read_spsr_current(void);
|
uint32_t raw_read_spsr_current(void);
|
||||||
void raw_write_spsr_current(uint32_t spsr);
|
void raw_write_spsr_current(uint32_t spsr);
|
||||||
|
uint32_t raw_read_spsr(uint32_t el);
|
||||||
|
void raw_write_spsr(uint32_t spsr, uint32_t el);
|
||||||
uint32_t raw_read_spsr_fiq(void);
|
uint32_t raw_read_spsr_fiq(void);
|
||||||
void raw_write_spsr_fiq(uint32_t spsr_fiq);
|
void raw_write_spsr_fiq(uint32_t spsr_fiq);
|
||||||
uint32_t raw_read_spsr_irq(void);
|
uint32_t raw_read_spsr_irq(void);
|
||||||
|
@ -215,6 +218,8 @@ uint32_t raw_read_actlr_el3(void);
|
||||||
void raw_write_actlr_el3(uint32_t actlr_el3);
|
void raw_write_actlr_el3(uint32_t actlr_el3);
|
||||||
uint32_t raw_read_actlr_current(void);
|
uint32_t raw_read_actlr_current(void);
|
||||||
void raw_write_actlr_current(uint32_t actlr);
|
void raw_write_actlr_current(uint32_t actlr);
|
||||||
|
uint32_t raw_read_actlr(uint32_t el);
|
||||||
|
void raw_write_actlr(uint32_t actlr, uint32_t el);
|
||||||
uint32_t raw_read_afsr0_el1(void);
|
uint32_t raw_read_afsr0_el1(void);
|
||||||
void raw_write_afsr0_el1(uint32_t afsr0_el1);
|
void raw_write_afsr0_el1(uint32_t afsr0_el1);
|
||||||
uint32_t raw_read_afsr0_el2(void);
|
uint32_t raw_read_afsr0_el2(void);
|
||||||
|
@ -223,6 +228,8 @@ uint32_t raw_read_afsr0_el3(void);
|
||||||
void raw_write_afsr0_el3(uint32_t afsr0_el3);
|
void raw_write_afsr0_el3(uint32_t afsr0_el3);
|
||||||
uint32_t raw_read_afsr0_current(void);
|
uint32_t raw_read_afsr0_current(void);
|
||||||
void raw_write_afsr0_current(uint32_t afsr0);
|
void raw_write_afsr0_current(uint32_t afsr0);
|
||||||
|
uint32_t raw_read_afsr0(uint32_t el);
|
||||||
|
void raw_write_afsr0(uint32_t afsr0, uint32_t el);
|
||||||
uint32_t raw_read_afsr1_el1(void);
|
uint32_t raw_read_afsr1_el1(void);
|
||||||
void raw_write_afsr1_el1(uint32_t afsr1_el1);
|
void raw_write_afsr1_el1(uint32_t afsr1_el1);
|
||||||
uint32_t raw_read_afsr1_el2(void);
|
uint32_t raw_read_afsr1_el2(void);
|
||||||
|
@ -231,6 +238,8 @@ uint32_t raw_read_afsr1_el3(void);
|
||||||
void raw_write_afsr1_el3(uint32_t afsr1_el3);
|
void raw_write_afsr1_el3(uint32_t afsr1_el3);
|
||||||
uint32_t raw_read_afsr1_current(void);
|
uint32_t raw_read_afsr1_current(void);
|
||||||
void raw_write_afsr1_current(uint32_t afsr1);
|
void raw_write_afsr1_current(uint32_t afsr1);
|
||||||
|
uint32_t raw_read_afsr1(uint32_t el);
|
||||||
|
void raw_write_afsr1(uint32_t afsr1, uint32_t el);
|
||||||
uint32_t raw_read_aidr_el1(void);
|
uint32_t raw_read_aidr_el1(void);
|
||||||
uint64_t raw_read_amair_el1(void);
|
uint64_t raw_read_amair_el1(void);
|
||||||
void raw_write_amair_el1(uint64_t amair_el1);
|
void raw_write_amair_el1(uint64_t amair_el1);
|
||||||
|
@ -240,6 +249,8 @@ uint64_t raw_read_amair_el3(void);
|
||||||
void raw_write_amair_el3(uint64_t amair_el3);
|
void raw_write_amair_el3(uint64_t amair_el3);
|
||||||
uint64_t raw_read_amair_current(void);
|
uint64_t raw_read_amair_current(void);
|
||||||
void raw_write_amair_current(uint64_t amair);
|
void raw_write_amair_current(uint64_t amair);
|
||||||
|
uint64_t raw_read_amair(uint32_t el);
|
||||||
|
void raw_write_amair(uint64_t amair, uint32_t el);
|
||||||
uint32_t raw_read_ccsidr_el1(void);
|
uint32_t raw_read_ccsidr_el1(void);
|
||||||
uint32_t raw_read_clidr_el1(void);
|
uint32_t raw_read_clidr_el1(void);
|
||||||
uint32_t raw_read_cpacr_el1(void);
|
uint32_t raw_read_cpacr_el1(void);
|
||||||
|
@ -248,8 +259,6 @@ uint32_t raw_read_cptr_el2(void);
|
||||||
void raw_write_cptr_el2(uint32_t cptr_el2);
|
void raw_write_cptr_el2(uint32_t cptr_el2);
|
||||||
uint32_t raw_read_cptr_el3(void);
|
uint32_t raw_read_cptr_el3(void);
|
||||||
void raw_write_cptr_el3(uint32_t cptr_el3);
|
void raw_write_cptr_el3(uint32_t cptr_el3);
|
||||||
uint32_t raw_read_cptr_current(void);
|
|
||||||
void raw_write_cptr_current(uint32_t cptr);
|
|
||||||
uint32_t raw_read_csselr_el1(void);
|
uint32_t raw_read_csselr_el1(void);
|
||||||
void raw_write_csselr_el1(uint32_t csselr_el1);
|
void raw_write_csselr_el1(uint32_t csselr_el1);
|
||||||
uint32_t raw_read_ctr_el0(void);
|
uint32_t raw_read_ctr_el0(void);
|
||||||
|
@ -261,6 +270,8 @@ uint32_t raw_read_esr_el3(void);
|
||||||
void raw_write_esr_el3(uint32_t esr_el3);
|
void raw_write_esr_el3(uint32_t esr_el3);
|
||||||
uint32_t raw_read_esr_current(void);
|
uint32_t raw_read_esr_current(void);
|
||||||
void raw_write_esr_current(uint32_t esr);
|
void raw_write_esr_current(uint32_t esr);
|
||||||
|
uint32_t raw_read_esr(uint32_t el);
|
||||||
|
void raw_write_esr(uint32_t esr, uint32_t el);
|
||||||
uint64_t raw_read_far_el1(void);
|
uint64_t raw_read_far_el1(void);
|
||||||
void raw_write_far_el1(uint64_t far_el1);
|
void raw_write_far_el1(uint64_t far_el1);
|
||||||
uint64_t raw_read_far_el2(void);
|
uint64_t raw_read_far_el2(void);
|
||||||
|
@ -269,6 +280,8 @@ uint64_t raw_read_far_el3(void);
|
||||||
void raw_write_far_el3(uint64_t far_el3);
|
void raw_write_far_el3(uint64_t far_el3);
|
||||||
uint64_t raw_read_far_current(void);
|
uint64_t raw_read_far_current(void);
|
||||||
void raw_write_far_current(uint64_t far);
|
void raw_write_far_current(uint64_t far);
|
||||||
|
uint64_t raw_read_far(uint32_t el);
|
||||||
|
void raw_write_far(uint64_t far, uint32_t el);
|
||||||
uint64_t raw_read_hcr_el2(void);
|
uint64_t raw_read_hcr_el2(void);
|
||||||
void raw_write_hcr_el2(uint64_t hcr_el2);
|
void raw_write_hcr_el2(uint64_t hcr_el2);
|
||||||
uint64_t raw_read_aa64pfr0_el1(void);
|
uint64_t raw_read_aa64pfr0_el1(void);
|
||||||
|
@ -280,6 +293,8 @@ uint64_t raw_read_mair_el3(void);
|
||||||
void raw_write_mair_el3(uint64_t mair_el3);
|
void raw_write_mair_el3(uint64_t mair_el3);
|
||||||
uint64_t raw_read_mair_current(void);
|
uint64_t raw_read_mair_current(void);
|
||||||
void raw_write_mair_current(uint64_t mair);
|
void raw_write_mair_current(uint64_t mair);
|
||||||
|
uint64_t raw_read_mair(uint32_t el);
|
||||||
|
void raw_write_mair(uint64_t mair, uint32_t el);
|
||||||
uint64_t raw_read_mpidr_el1(void);
|
uint64_t raw_read_mpidr_el1(void);
|
||||||
uint32_t raw_read_rmr_el1(void);
|
uint32_t raw_read_rmr_el1(void);
|
||||||
void raw_write_rmr_el1(uint32_t rmr_el1);
|
void raw_write_rmr_el1(uint32_t rmr_el1);
|
||||||
|
@ -289,6 +304,8 @@ uint32_t raw_read_rmr_el3(void);
|
||||||
void raw_write_rmr_el3(uint32_t rmr_el3);
|
void raw_write_rmr_el3(uint32_t rmr_el3);
|
||||||
uint32_t raw_read_rmr_current(void);
|
uint32_t raw_read_rmr_current(void);
|
||||||
void raw_write_rmr_current(uint32_t rmr);
|
void raw_write_rmr_current(uint32_t rmr);
|
||||||
|
uint32_t raw_read_rmr(uint32_t el);
|
||||||
|
void raw_write_rmr(uint32_t rmr, uint32_t el);
|
||||||
uint64_t raw_read_rvbar_el1(void);
|
uint64_t raw_read_rvbar_el1(void);
|
||||||
void raw_write_rvbar_el1(uint64_t rvbar_el1);
|
void raw_write_rvbar_el1(uint64_t rvbar_el1);
|
||||||
uint64_t raw_read_rvbar_el2(void);
|
uint64_t raw_read_rvbar_el2(void);
|
||||||
|
@ -297,6 +314,8 @@ uint64_t raw_read_rvbar_el3(void);
|
||||||
void raw_write_rvbar_el3(uint64_t rvbar_el3);
|
void raw_write_rvbar_el3(uint64_t rvbar_el3);
|
||||||
uint64_t raw_read_rvbar_current(void);
|
uint64_t raw_read_rvbar_current(void);
|
||||||
void raw_write_rvbar_current(uint64_t rvbar);
|
void raw_write_rvbar_current(uint64_t rvbar);
|
||||||
|
uint64_t raw_read_rvbar(uint32_t el);
|
||||||
|
void raw_write_rvbar(uint64_t rvbar, uint32_t el);
|
||||||
uint32_t raw_read_scr_el3(void);
|
uint32_t raw_read_scr_el3(void);
|
||||||
void raw_write_scr_el3(uint32_t scr_el3);
|
void raw_write_scr_el3(uint32_t scr_el3);
|
||||||
uint32_t raw_read_sctlr_el1(void);
|
uint32_t raw_read_sctlr_el1(void);
|
||||||
|
@ -307,6 +326,8 @@ uint32_t raw_read_sctlr_el3(void);
|
||||||
void raw_write_sctlr_el3(uint32_t sctlr_el3);
|
void raw_write_sctlr_el3(uint32_t sctlr_el3);
|
||||||
uint32_t raw_read_sctlr_current(void);
|
uint32_t raw_read_sctlr_current(void);
|
||||||
void raw_write_sctlr_current(uint32_t sctlr);
|
void raw_write_sctlr_current(uint32_t sctlr);
|
||||||
|
uint32_t raw_read_sctlr(uint32_t el);
|
||||||
|
void raw_write_sctlr(uint32_t sctlr, uint32_t el);
|
||||||
uint64_t raw_read_tcr_el1(void);
|
uint64_t raw_read_tcr_el1(void);
|
||||||
void raw_write_tcr_el1(uint64_t tcr_el1);
|
void raw_write_tcr_el1(uint64_t tcr_el1);
|
||||||
uint32_t raw_read_tcr_el2(void);
|
uint32_t raw_read_tcr_el2(void);
|
||||||
|
@ -315,6 +336,8 @@ uint32_t raw_read_tcr_el3(void);
|
||||||
void raw_write_tcr_el3(uint32_t tcr_el3);
|
void raw_write_tcr_el3(uint32_t tcr_el3);
|
||||||
uint64_t raw_read_tcr_current(void);
|
uint64_t raw_read_tcr_current(void);
|
||||||
void raw_write_tcr_current(uint64_t tcr);
|
void raw_write_tcr_current(uint64_t tcr);
|
||||||
|
uint64_t raw_read_tcr(uint32_t el);
|
||||||
|
void raw_write_tcr(uint64_t tcr, uint32_t el);
|
||||||
uint64_t raw_read_ttbr0_el1(void);
|
uint64_t raw_read_ttbr0_el1(void);
|
||||||
void raw_write_ttbr0_el1(uint64_t ttbr0_el1);
|
void raw_write_ttbr0_el1(uint64_t ttbr0_el1);
|
||||||
uint64_t raw_read_ttbr0_el2(void);
|
uint64_t raw_read_ttbr0_el2(void);
|
||||||
|
@ -323,6 +346,8 @@ uint64_t raw_read_ttbr0_el3(void);
|
||||||
void raw_write_ttbr0_el3(uint64_t ttbr0_el3);
|
void raw_write_ttbr0_el3(uint64_t ttbr0_el3);
|
||||||
uint64_t raw_read_ttbr0_current(void);
|
uint64_t raw_read_ttbr0_current(void);
|
||||||
void raw_write_ttbr0_current(uint64_t ttbr0);
|
void raw_write_ttbr0_current(uint64_t ttbr0);
|
||||||
|
uint64_t raw_read_ttbr0(uint32_t el);
|
||||||
|
void raw_write_ttbr0(uint64_t ttbr0, uint32_t el);
|
||||||
uint64_t raw_read_ttbr1_el1(void);
|
uint64_t raw_read_ttbr1_el1(void);
|
||||||
void raw_write_ttbr1_el1(uint64_t ttbr1_el1);
|
void raw_write_ttbr1_el1(uint64_t ttbr1_el1);
|
||||||
uint64_t raw_read_vbar_el1(void);
|
uint64_t raw_read_vbar_el1(void);
|
||||||
|
@ -333,6 +358,8 @@ uint64_t raw_read_vbar_el3(void);
|
||||||
void raw_write_vbar_el3(uint64_t vbar_el3);
|
void raw_write_vbar_el3(uint64_t vbar_el3);
|
||||||
uint64_t raw_read_vbar_current(void);
|
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);
|
||||||
|
void raw_write_vbar(uint64_t vbar, uint32_t el);
|
||||||
|
|
||||||
/* Cache maintenance system instructions */
|
/* Cache maintenance system instructions */
|
||||||
void dccisw(uint64_t cisw);
|
void dccisw(uint64_t cisw);
|
||||||
|
@ -352,10 +379,12 @@ void tlbiall_el1(void);
|
||||||
void tlbiall_el2(void);
|
void tlbiall_el2(void);
|
||||||
void tlbiall_el3(void);
|
void tlbiall_el3(void);
|
||||||
void tlbiall_current(void);
|
void tlbiall_current(void);
|
||||||
|
void tlbiall(uint32_t el);
|
||||||
void tlbiallis_el1(void);
|
void tlbiallis_el1(void);
|
||||||
void tlbiallis_el2(void);
|
void tlbiallis_el2(void);
|
||||||
void tlbiallis_el3(void);
|
void tlbiallis_el3(void);
|
||||||
void tlbiallis_current(void);
|
void tlbiallis_current(void);
|
||||||
|
void tlbiallis(uint32_t el);
|
||||||
void tlbivaa_el1(uint64_t va);
|
void tlbivaa_el1(uint64_t va);
|
||||||
|
|
||||||
/* Memory barrier */
|
/* Memory barrier */
|
||||||
|
|
Loading…
Reference in New Issue