-/* $OpenBSD: hypervisor.h,v 1.2 2008/07/21 13:30:04 art Exp $ */
+/* $OpenBSD: hypervisor.h,v 1.3 2008/08/10 13:55:19 kettenis Exp $ */
/*
* Copyright (c) 2008 Mark Kettenis
* CPU services
*/
+void hv_cpu_yield(void);
int64_t hv_cpu_qconf(uint64_t queue, uint64_t base, uint64_t nentries);
#define CPU_MONDO_QUEUE 0x3c
int64_t hv_cpu_mondo_send(uint64_t ncpus, paddr_t cpulist, paddr_t data);
int64_t hv_cpu_myid(uint64_t *cpuid);
-void hv_cpu_yield(void);
-
/*
* MMU services
*/
#define PCI_MAP_ATTR_READ 0x01 /* From memory */
#define PCI_MAP_ATTR_WRITE 0x02 /* To memory */
+int64_t hv_rng_get_diag_control(void);
+int64_t hv_rng_ctl_read(paddr_t raddr, uint64_t *state, uint64_t *delta);
+int64_t hv_rng_ctl_write(paddr_t raddr, uint64_t state, uint64_t timeout,
+ uint64_t *delta);
+
+#define RNG_STATE_UNCONFIGURED 0
+#define RNG_STATE_CONFIGURED 1
+#define RNG_STATE_HEALTHCHECK 2
+#define RNG_STATE_ERROR 3
+
+int64_t hv_rng_data_read_diag(paddr_t raddr, uint64_t size, uint64_t *delta);
+int64_t hv_rng_data_read(paddr_t raddr, uint64_t *delta);
+
/*
* Error codes
*/
-/* $OpenBSD: hvcall.S,v 1.2 2008/07/21 13:30:05 art Exp $ */
+/* $OpenBSD: hvcall.S,v 1.3 2008/08/10 13:55:19 kettenis Exp $ */
/*
* Copyright (c) 2008 Mark Kettenis
#define PCI_CONFIG_GET 0xb4
#define PCI_CONFIG_PUT 0xb5
+#define RNG_GET_DIAG_CONTROL 0x130
+#define RNG_CTL_READ 0x131
+#define RNG_CTL_WRITE 0x132
+#define RNG_DATA_READ_DIAG 0x133
+#define RNG_DATA_READ 0x134
+
#define API_SET_VERSION 0x00
#define API_PUTCHAR 0x01
#define API_EXIT 0x02
retl
nop
+ENTRY(hv_cpu_yield)
+ mov CPU_YIELD, %o5
+ ta FAST_TRAP
+ retl
+ nop
+
ENTRY(hv_cpu_qconf)
mov CPU_QCONF, %o5
ta FAST_TRAP
retl
stx %o1, [%g5]
-ENTRY(hv_cpu_yield)
- mov CPU_YIELD, %o5
+ENTRY(hv_rng_get_diag_control)
+ mov RNG_GET_DIAG_CONTROL, %o5
ta FAST_TRAP
retl
nop
+
+ENTRY(hv_rng_ctl_read)
+ mov %o2, %o4
+ mov %o1, %o3
+ mov RNG_CTL_READ, %o5
+ ta FAST_TRAP
+ stx %o1, [%o3]
+ retl
+ stx %o2, [%o4]
+
+ENTRY(hv_rng_ctl_write)
+ mov RNG_CTL_WRITE, %o5
+ ta FAST_TRAP
+ retl
+ stx %o1, [%o3]
+
+ENTRY(hv_rng_data_read_diag)
+ mov RNG_DATA_READ_DIAG, %o5
+ ta FAST_TRAP
+ retl
+ stx %o1, [%o2]
+
+ENTRY(hv_rng_data_read)
+ mov %o1, %o2
+ mov RNG_DATA_READ, %o5
+ ta FAST_TRAP
+ retl
+ stx %o1, [%o2]