1 /* $OpenBSD: pvvar.h,v 1.10 2017/06/22 06:21:12 jmatthew Exp $ */ 2 3 /* 4 * Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org> 5 * 6 * Permission to use, copy, modify, and distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19 #ifndef _DEV_PV_PVVAR_H_ 20 #define _DEV_PV_PVVAR_H_ 21 22 struct pvbus_req { 23 size_t pvr_keylen; 24 char *pvr_key; 25 size_t pvr_valuelen; 26 char *pvr_value; 27 }; 28 29 #define PVBUSIOC_KVREAD _IOWR('V', 1, struct pvbus_req) 30 #define PVBUSIOC_KVWRITE _IOWR('V', 2, struct pvbus_req) 31 #define PVBUSIOC_TYPE _IOWR('V', 3, struct pvbus_req) 32 33 #ifdef _KERNEL 34 enum { 35 PVBUS_KVM, 36 PVBUS_HYPERV, 37 PVBUS_VMWARE, 38 PVBUS_XEN, 39 PVBUS_BHYVE, 40 PVBUS_OPENBSD, 41 42 PVBUS_MAX 43 }; 44 45 enum { 46 PVBUS_KVREAD, 47 PVBUS_KVWRITE, 48 PVBUS_KVLS 49 }; 50 51 struct pvbus_hv { 52 uint32_t hv_base; 53 uint32_t hv_features; 54 uint16_t hv_major; 55 uint16_t hv_minor; 56 57 void *hv_arg; 58 int (*hv_kvop)(void *, int, char *, char *, size_t); 59 void (*hv_init_cpu)(struct pvbus_hv *); 60 }; 61 62 struct pvbus_softc { 63 struct device pvbus_dev; 64 struct pvbus_hv *pvbus_hv; 65 }; 66 67 struct pvbus_attach_args { 68 const char *pvba_busname; 69 }; 70 71 struct bus_dma_tag; 72 73 struct pv_attach_args { 74 const char *pva_busname; 75 struct pvbus_hv *pva_hv; 76 struct bus_dma_tag *pva_dmat; 77 }; 78 79 void pvbus_identify(void); 80 int pvbus_probe(void); 81 void pvbus_init_cpu(void); 82 void pvbus_reboot(struct device *); 83 void pvbus_shutdown(struct device *); 84 85 #endif /* _KERNEL */ 86 #endif /* _DEV_PV_PVBUS_H_ */ 87