aboutsummaryrefslogtreecommitdiff
path: root/lib/libhvcall
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-07-27 15:45:36 +1000
committerThomas Huth <thuth@linux.vnet.ibm.com>2011-10-12 13:20:00 +0200
commit35fc16fee354457ab171247d9e2b5387304b5eb3 (patch)
tree353b81cabc5d1d936c0bbe97e6cb3263a8bb9349 /lib/libhvcall
parent32e3430c018ceb8413cb808477449d1968c42497 (diff)
downloadSLOF-35fc16fee354457ab171247d9e2b5387304b5eb3.zip
SLOF-35fc16fee354457ab171247d9e2b5387304b5eb3.tar.gz
SLOF-35fc16fee354457ab171247d9e2b5387304b5eb3.tar.bz2
Move MMIO accessors to board-js2x and implement h-calls based ones for qemu
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'lib/libhvcall')
-rw-r--r--lib/libhvcall/hvcall.S18
-rw-r--r--lib/libhvcall/hvcall.code40
-rw-r--r--lib/libhvcall/hvcall.in11
-rw-r--r--lib/libhvcall/libhvcall.h6
4 files changed, 73 insertions, 2 deletions
diff --git a/lib/libhvcall/hvcall.S b/lib/libhvcall/hvcall.S
index 5cc0bd7..b36f9cb 100644
--- a/lib/libhvcall/hvcall.S
+++ b/lib/libhvcall/hvcall.S
@@ -78,6 +78,24 @@ ENTRY(hv_send_logical_lan)
HVCALL
blr
+ENTRY(hv_logical_ci_load)
+ mr r5,r4
+ mr r4,r3
+ li r3,H_LOGICAL_CI_LOAD
+ HVCALL
+ cmpdi cr0,r3,0
+ mr r3,r4
+ beqlr
+ li r3,-1
+ blr
+
+ENTRY(hv_logical_ci_store)
+ mr r6,r5
+ mr r5,r4
+ mr r4,r3
+ li r3,H_LOGICAL_CI_STORE
+ blr
+
.section ".bss"
inbuf: .space 16
inlen: .space 4
diff --git a/lib/libhvcall/hvcall.code b/lib/libhvcall/hvcall.code
index 4e47c06..6d4a141 100644
--- a/lib/libhvcall/hvcall.code
+++ b/lib/libhvcall/hvcall.code
@@ -1,5 +1,5 @@
/******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation
+ * Copyright (c) 2004, 2011 IBM Corporation
* All rights reserved.
* This program and the accompanying materials
* are made available under the terms of the BSD License
@@ -49,3 +49,41 @@ PRIM(hv_X2d_send_X2d_crq)
unsigned int unit = TOS.u;
TOS.n = hv_send_crq(unit, msgaddr);
MIRP
+
+
+PRIM(RB_X40)
+ unsigned long qaddr = TOS.u;
+ TOS.u = hv_logical_ci_load(1, qaddr);
+MIRP
+PRIM(RB_X21)
+ unsigned long qaddr = TOS.u; POP;
+ unsigned char val = TOS.u; POP;
+ hv_logical_ci_store(1, qaddr, val);
+MIRP
+PRIM(RW_X40)
+ unsigned long qaddr = TOS.u;
+ TOS.u = hv_logical_ci_load(2, qaddr);
+MIRP
+PRIM(RW_X21)
+ unsigned long qaddr = TOS.u; POP;
+ unsigned short val = TOS.u; POP;
+ hv_logical_ci_store(2, qaddr, val);
+MIRP
+PRIM(RL_X40)
+ unsigned long qaddr = TOS.u;
+ TOS.u = hv_logical_ci_load(4, qaddr);
+MIRP
+PRIM(RL_X21)
+ unsigned long qaddr = TOS.u; POP;
+ unsigned int val = TOS.u; POP;
+ hv_logical_ci_store(4, qaddr, val);
+MIRP
+PRIM(RX_X40)
+ unsigned long qaddr = TOS.u;
+ TOS.u = hv_logical_ci_load(8, qaddr);
+MIRP
+PRIM(RX_X21)
+ unsigned long qaddr = TOS.u; POP;
+ unsigned long val = TOS.u; POP;
+ hv_logical_ci_store(8, qaddr, val);
+MIRP
diff --git a/lib/libhvcall/hvcall.in b/lib/libhvcall/hvcall.in
index 827aed4..13fa790 100644
--- a/lib/libhvcall/hvcall.in
+++ b/lib/libhvcall/hvcall.in
@@ -1,5 +1,5 @@
/******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation
+ * Copyright (c) 2004, 2011 IBM Corporation
* All rights reserved.
* This program and the accompanying materials
* are made available under the terms of the BSD License
@@ -16,3 +16,12 @@ cod(hv-haschar)
cod(hv-reg-crq)
cod(hv-free-crq)
cod(hv-send-crq)
+
+cod(RB@)
+cod(RB!)
+cod(RW@)
+cod(RW!)
+cod(RL@)
+cod(RL!)
+cod(RX@)
+cod(RX!)
diff --git a/lib/libhvcall/libhvcall.h b/lib/libhvcall/libhvcall.h
index db1d890..ad7088d 100644
--- a/lib/libhvcall/libhvcall.h
+++ b/lib/libhvcall/libhvcall.h
@@ -3,6 +3,8 @@
#define H_SUCCESS 0
+#define H_LOGICAL_CI_LOAD 0x3c
+#define H_LOGICAL_CI_STORE 0x40
#define H_GET_TERM_CHAR 0x54
#define H_PUT_TERM_CHAR 0x58
#define H_REG_CRQ 0xFC
@@ -60,6 +62,10 @@ static inline long h_add_logical_lan_buffer(unsigned long unit_address,
return hv_generic(H_ADD_LOGICAL_LAN_BUFFER, unit_address, buffer);
}
+extern unsigned long hv_logical_ci_load(unsigned long size, unsigned long addr);
+extern unsigned long hv_logical_ci_store(unsigned long size, unsigned long addr,
+ unsigned long value);
+
#endif /* __ASSEMBLY__ */
#endif /* __LIBHVCALL_H__ */