1 /* $OpenBSD: pvvar.h,v 1.11 2023/01/07 06:40:21 asou 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 #define PVBUS_KVOP_MAXSIZE (64 * 1024) 34 35 #ifdef _KERNEL 36 enum { 37 PVBUS_KVM, 38 PVBUS_HYPERV, 39 PVBUS_VMWARE, 40 PVBUS_XEN, 41 PVBUS_BHYVE, 42 PVBUS_OPENBSD, 43 44 PVBUS_MAX 45 }; 46 47 enum { 48 PVBUS_KVREAD, 49 PVBUS_KVWRITE, 50 PVBUS_KVLS 51 }; 52 53 struct pvbus_hv { 54 uint32_t hv_base; 55 uint32_t hv_features; 56 uint16_t hv_major; 57 uint16_t hv_minor; 58 59 void *hv_arg; 60 int (*hv_kvop)(void *, int, char *, char *, size_t); 61 void (*hv_init_cpu)(struct pvbus_hv *); 62 }; 63 64 struct pvbus_softc { 65 struct device pvbus_dev; 66 struct pvbus_hv *pvbus_hv; 67 }; 68 69 struct pvbus_attach_args { 70 const char *pvba_busname; 71 }; 72 73 struct bus_dma_tag; 74 75 struct pv_attach_args { 76 const char *pva_busname; 77 struct pvbus_hv *pva_hv; 78 struct bus_dma_tag *pva_dmat; 79 }; 80 81 void pvbus_identify(void); 82 int pvbus_probe(void); 83 void pvbus_init_cpu(void); 84 void pvbus_reboot(struct device *); 85 void pvbus_shutdown(struct device *); 86 87 #endif /* _KERNEL */ 88 #endif /* _DEV_PV_PVBUS_H_ */ 89