commit 3151d6e6198552f618be05e388c3fd330e437eea
parent 0f0f84d952bb7d41ce9079e5b945a6f41c12e1a6
Author: Dimitris Papastamos <dimitris.papastamos@arm.com>
Date: Mon, 15 Oct 2018 11:51:55 +0100
[arm64] Add mmio accessor functions
Change-Id: I80cc7281aa1cd62575adf1c91a8dd1b6c3d0d98b
Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com>
Diffstat:
2 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/arch.s b/arch/arm64/arch.s
@@ -9,7 +9,8 @@ DAIF_DBG = 4
.globl rd_id_aa64rmfr0_r,wr_id_aa64rmfr0_r
.globl rd_rcr_r,wr_rcr_r,rd_rdscr_r,wr_rdscr_r
.globl rd_sctlr_rwr_sctlr_r,rd_rvbar_el3,wr_sp_r
- .globl vectbl,swtch,isb
+ .globl vectbl,swtch,isb,inm8,inm16,inm32
+ .globl outm8,outm16,outm32
enaabt:
msr daifclr,DAIF_ABT
@@ -90,6 +91,30 @@ wr_sp_r:
msr spsel,x1
ret
+inm8:
+ ldrb w0,[x0]
+ ret
+
+inm16:
+ ldrh w0,[x0]
+ ret
+
+inm32:
+ ldr w0,[x0]
+ ret
+
+outm8:
+ strb w0,[x1]
+ ret
+
+outm16:
+ strh w0,[x1]
+ ret
+
+outm32:
+ str w0, [x1]
+ ret
+
panic:
stp x1,x0,[sp,#-16]!
stp x3,x2,[sp,#-16]!
diff --git a/include/rcode.h b/include/rcode.h
@@ -81,6 +81,12 @@ extern void wr_sctlr_r(unsigned long long v);
extern void *rd_rvbar_el3(void);
extern void wr_sp_r(void *);
extern void isb(void);
+extern unsigned inm8(void);
+extern unsigned inm16(void);
+extern unsigned long inm32(void);
+extern unsigned outm8(unsigned val, void *addr);
+extern unsigned outm16(unsigned val, void *addr);
+extern unsigned long outm32(unsigned long val, void *addr);
/* global constant variables */
extern const struct rowidx rowidx[];