50#ifndef _EPAPR_HCALLS_H
51#define _EPAPR_HCALLS_H
53#include <uapi/asm/epapr_hcalls.h>
92#define EV_HCALL_CLOBBERS "r0", "r12", "xer", "ctr", "lr", "cc", "memory"
94#define EV_HCALL_CLOBBERS8 EV_HCALL_CLOBBERS
95#define EV_HCALL_CLOBBERS7 EV_HCALL_CLOBBERS8, "r10"
96#define EV_HCALL_CLOBBERS6 EV_HCALL_CLOBBERS7, "r9"
97#define EV_HCALL_CLOBBERS5 EV_HCALL_CLOBBERS6, "r8"
98#define EV_HCALL_CLOBBERS4 EV_HCALL_CLOBBERS5, "r7"
99#define EV_HCALL_CLOBBERS3 EV_HCALL_CLOBBERS4, "r6"
100#define EV_HCALL_CLOBBERS2 EV_HCALL_CLOBBERS3, "r5"
101#define EV_HCALL_CLOBBERS1 EV_HCALL_CLOBBERS2, "r4"
103extern bool epapr_paravirt_enabled;
104extern uint32_t epapr_hypercall_start[];
106#ifdef CONFIG_EPAPR_PARAVIRT
107int __init epapr_paravirt_early_init(
void);
109static inline int epapr_paravirt_early_init(
void) {
return 0; }
134static inline unsigned int ev_int_set_config(
unsigned int interrupt,
135 uint32_t
config,
unsigned int priority, uint32_t destination)
137 register uintptr_t r11 __asm__(
"r11");
138 register uintptr_t r3 __asm__(
"r3");
139 register uintptr_t r4 __asm__(
"r4");
140 register uintptr_t r5 __asm__(
"r5");
141 register uintptr_t r6 __asm__(
"r6");
143 r11 = EV_HCALL_TOKEN(EV_INT_SET_CONFIG);
149 asm volatile(
"bl epapr_hypercall_start"
150 :
"+r" (r11),
"+r" (r3),
"+r" (r4),
"+r" (r5),
"+r" (r6)
151 : : EV_HCALL_CLOBBERS4
166static inline unsigned int ev_int_get_config(
unsigned int interrupt,
167 uint32_t *
config,
unsigned int *priority, uint32_t *destination)
169 register uintptr_t r11 __asm__(
"r11");
170 register uintptr_t r3 __asm__(
"r3");
171 register uintptr_t r4 __asm__(
"r4");
172 register uintptr_t r5 __asm__(
"r5");
173 register uintptr_t r6 __asm__(
"r6");
175 r11 = EV_HCALL_TOKEN(EV_INT_GET_CONFIG);
178 asm volatile(
"bl epapr_hypercall_start"
179 :
"+r" (r11),
"+r" (r3),
"=r" (r4),
"=r" (r5),
"=r" (r6)
180 : : EV_HCALL_CLOBBERS4
197static inline unsigned int ev_int_set_mask(
unsigned int interrupt,
200 register uintptr_t r11 __asm__(
"r11");
201 register uintptr_t r3 __asm__(
"r3");
202 register uintptr_t r4 __asm__(
"r4");
204 r11 = EV_HCALL_TOKEN(EV_INT_SET_MASK);
208 asm volatile(
"bl epapr_hypercall_start"
209 :
"+r" (r11),
"+r" (r3),
"+r" (r4)
210 : : EV_HCALL_CLOBBERS2
223static inline unsigned int ev_int_get_mask(
unsigned int interrupt,
226 register uintptr_t r11 __asm__(
"r11");
227 register uintptr_t r3 __asm__(
"r3");
228 register uintptr_t r4 __asm__(
"r4");
230 r11 = EV_HCALL_TOKEN(EV_INT_GET_MASK);
233 asm volatile(
"bl epapr_hypercall_start"
234 :
"+r" (r11),
"+r" (r3),
"=r" (r4)
235 : : EV_HCALL_CLOBBERS2
253static inline unsigned int ev_int_eoi(
unsigned int interrupt)
255 register uintptr_t r11 __asm__(
"r11");
256 register uintptr_t r3 __asm__(
"r3");
258 r11 = EV_HCALL_TOKEN(EV_INT_EOI);
261 asm volatile(
"bl epapr_hypercall_start"
262 :
"+r" (r11),
"+r" (r3)
263 : : EV_HCALL_CLOBBERS1
280static inline unsigned int ev_byte_channel_send(
unsigned int handle,
281 unsigned int *count,
const char buffer[EV_BYTE_CHANNEL_MAX_BYTES])
283 register uintptr_t r11 __asm__(
"r11");
284 register uintptr_t r3 __asm__(
"r3");
285 register uintptr_t r4 __asm__(
"r4");
286 register uintptr_t r5 __asm__(
"r5");
287 register uintptr_t r6 __asm__(
"r6");
288 register uintptr_t r7 __asm__(
"r7");
289 register uintptr_t r8 __asm__(
"r8");
290 const uint32_t *
p = (
const uint32_t *) buffer;
292 r11 = EV_HCALL_TOKEN(EV_BYTE_CHANNEL_SEND);
300 asm volatile(
"bl epapr_hypercall_start"
301 :
"+r" (r11),
"+r" (r3),
302 "+r" (r4),
"+r" (r5),
"+r" (r6),
"+r" (r7),
"+r" (r8)
303 : : EV_HCALL_CLOBBERS6
323static inline unsigned int ev_byte_channel_receive(
unsigned int handle,
324 unsigned int *count,
char buffer[EV_BYTE_CHANNEL_MAX_BYTES])
326 register uintptr_t r11 __asm__(
"r11");
327 register uintptr_t r3 __asm__(
"r3");
328 register uintptr_t r4 __asm__(
"r4");
329 register uintptr_t r5 __asm__(
"r5");
330 register uintptr_t r6 __asm__(
"r6");
331 register uintptr_t r7 __asm__(
"r7");
332 register uintptr_t r8 __asm__(
"r8");
333 uint32_t *
p = (uint32_t *) buffer;
335 r11 = EV_HCALL_TOKEN(EV_BYTE_CHANNEL_RECEIVE);
339 asm volatile(
"bl epapr_hypercall_start"
340 :
"+r" (r11),
"+r" (r3),
"+r" (r4),
341 "=r" (r5),
"=r" (r6),
"=r" (r7),
"=r" (r8)
342 : : EV_HCALL_CLOBBERS6
366static inline unsigned int ev_byte_channel_poll(
unsigned int handle,
367 unsigned int *rx_count,
unsigned int *tx_count)
369 register uintptr_t r11 __asm__(
"r11");
370 register uintptr_t r3 __asm__(
"r3");
371 register uintptr_t r4 __asm__(
"r4");
372 register uintptr_t r5 __asm__(
"r5");
374 r11 = EV_HCALL_TOKEN(EV_BYTE_CHANNEL_POLL);
377 asm volatile(
"bl epapr_hypercall_start"
378 :
"+r" (r11),
"+r" (r3),
"=r" (r4),
"=r" (r5)
379 : : EV_HCALL_CLOBBERS3
400static inline unsigned int ev_int_iack(
unsigned int handle,
401 unsigned int *vector)
403 register uintptr_t r11 __asm__(
"r11");
404 register uintptr_t r3 __asm__(
"r3");
405 register uintptr_t r4 __asm__(
"r4");
407 r11 = EV_HCALL_TOKEN(EV_INT_IACK);
410 asm volatile(
"bl epapr_hypercall_start"
411 :
"+r" (r11),
"+r" (r3),
"=r" (r4)
412 : : EV_HCALL_CLOBBERS2
426static inline unsigned int ev_doorbell_send(
unsigned int handle)
428 register uintptr_t r11 __asm__(
"r11");
429 register uintptr_t r3 __asm__(
"r3");
431 r11 = EV_HCALL_TOKEN(EV_DOORBELL_SEND);
434 asm volatile(
"bl epapr_hypercall_start"
435 :
"+r" (r11),
"+r" (r3)
436 : : EV_HCALL_CLOBBERS1
447static inline unsigned int ev_idle(
void)
449 register uintptr_t r11 __asm__(
"r11");
450 register uintptr_t r3 __asm__(
"r3");
452 r11 = EV_HCALL_TOKEN(EV_IDLE);
454 asm volatile(
"bl epapr_hypercall_start"
455 :
"+r" (r11),
"=r" (r3)
456 : : EV_HCALL_CLOBBERS1
462#ifdef CONFIG_EPAPR_PARAVIRT
463static inline unsigned long epapr_hypercall(
unsigned long *in,
467 unsigned long register r0
asm(
"r0");
468 unsigned long register r3
asm(
"r3") = in[0];
469 unsigned long register r4
asm(
"r4") = in[1];
470 unsigned long register r5
asm(
"r5") = in[2];
471 unsigned long register r6
asm(
"r6") = in[3];
472 unsigned long register r7
asm(
"r7") = in[4];
473 unsigned long register r8
asm(
"r8") = in[5];
474 unsigned long register r9
asm(
"r9") = in[6];
475 unsigned long register r10
asm(
"r10") = in[7];
476 unsigned long register r11
asm(
"r11") = nr;
477 unsigned long register r12
asm(
"r12");
479 asm volatile(
"bl epapr_hypercall_start"
480 :
"=r"(r0),
"=r"(r3),
"=r"(r4),
"=r"(r5),
"=r"(r6),
481 "=r"(r7),
"=r"(r8),
"=r"(r9),
"=r"(r10),
"=r"(r11),
483 :
"r"(r3),
"r"(r4),
"r"(r5),
"r"(r6),
"r"(r7),
"r"(r8),
484 "r"(r9),
"r"(r10),
"r"(r11)
485 :
"memory",
"cc",
"xer",
"ctr",
"lr");
499static unsigned long epapr_hypercall(
unsigned long *in,
503 return EV_UNIMPLEMENTED;
507static inline long epapr_hypercall0_1(
unsigned int nr,
unsigned long *r2)
510 unsigned long out[8];
513 r = epapr_hypercall(in, out, nr);
519static inline long epapr_hypercall0(
unsigned int nr)
522 unsigned long out[8];
524 return epapr_hypercall(in, out, nr);
527static inline long epapr_hypercall1(
unsigned int nr,
unsigned long p1)
530 unsigned long out[8];
533 return epapr_hypercall(in, out, nr);
536static inline long epapr_hypercall2(
unsigned int nr,
unsigned long p1,
540 unsigned long out[8];
544 return epapr_hypercall(in, out, nr);
547static inline long epapr_hypercall3(
unsigned int nr,
unsigned long p1,
548 unsigned long p2,
unsigned long p3)
551 unsigned long out[8];
556 return epapr_hypercall(in, out, nr);
559static inline long epapr_hypercall4(
unsigned int nr,
unsigned long p1,
560 unsigned long p2,
unsigned long p3,
564 unsigned long out[8];
570 return epapr_hypercall(in, out, nr);
Definition: deflate.c:114
unsigned p
Definition: tte.h:17
This header file provides interfaces of the system endianness support.