iPXE
hvm.h
Go to the documentation of this file.
1 #ifndef _HVM_H
2 #define _HVM_H
3 
4 /** @file
5  *
6  * Xen HVM driver
7  *
8  */
9 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 
12 #include <stdint.h>
13 #include <ipxe/xen.h>
14 #include <xen/hvm/hvm_op.h>
15 #include <xen/hvm/params.h>
16 
17 /** Minimum CPUID base */
18 #define HVM_CPUID_MIN 0x40000000UL
19 
20 /** Maximum CPUID base */
21 #define HVM_CPUID_MAX 0x4000ff00UL
22 
23 /** Increment between CPUID bases */
24 #define HVM_CPUID_STEP 0x00000100UL
25 
26 /** Magic signature */
27 #define HVM_CPUID_MAGIC "XenVMMXenVMM"
28 
29 /** Get Xen version */
30 #define HVM_CPUID_VERSION 1
31 
32 /** Get number of hypercall pages */
33 #define HVM_CPUID_PAGES 2
34 
35 /** PCI MMIO BAR */
36 #define HVM_MMIO_BAR PCI_BASE_ADDRESS_1
37 
38 /** A Xen HVM device */
39 struct hvm_device {
40  /** Xen hypervisor */
42  /** CPUID base */
44  /** Length of hypercall table */
45  size_t hypercall_len;
46  /** MMIO base address */
47  unsigned long mmio;
48  /** Current offset within MMIO address space */
49  size_t mmio_offset;
50  /** Length of MMIO address space */
51  size_t mmio_len;
52 };
53 
54 /**
55  * Get HVM parameter value
56  *
57  * @v xen Xen hypervisor
58  * @v index Parameter index
59  * @v value Value to fill in
60  * @ret xenrc Xen status code
61  */
62 static inline int xen_hvm_get_param ( struct xen_hypervisor *xen,
63  unsigned int index, uint64_t *value ) {
64  struct xen_hvm_param param;
65  int xenrc;
66 
67  param.domid = DOMID_SELF;
68  param.index = index;
69  xenrc = xen_hypercall_2 ( xen, __HYPERVISOR_hvm_op, HVMOP_get_param,
70  virt_to_phys ( &param ) );
71  *value = param.value;
72  return xenrc;
73 }
74 
75 #endif /* _HVM_H */
size_t mmio_offset
Current offset within MMIO address space.
Definition: hvm.h:49
static int xen_hvm_get_param(struct xen_hypervisor *xen, unsigned int index, uint64_t *value)
Get HVM parameter value.
Definition: hvm.h:62
struct xen_hypervisor xen
Xen hypervisor.
Definition: hvm.h:41
unsigned long long uint64_t
Definition: stdint.h:13
static __always_inline unsigned long virt_to_phys(volatile const void *addr)
Convert virtual address to a physical address.
Definition: uaccess.h:287
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
A Xen hypervisor.
Definition: xen.h:51
Xen interface.
pseudo_bit_t value[0x00020]
Definition: arbel.h:13
size_t hypercall_len
Length of hypercall table.
Definition: hvm.h:45
unsigned long mmio
MMIO base address.
Definition: hvm.h:47
struct hv_monitor_parameter param[4][32]
Parameters.
Definition: hyperv.h:24
#define HVMOP_get_param
Definition: hvm_op.h:32
A Xen HVM device.
Definition: hvm.h:39
unsigned int uint32_t
Definition: stdint.h:12
size_t mmio_len
Length of MMIO address space.
Definition: hvm.h:51
#define DOMID_SELF
Definition: xen.h:501
uint64_t index
Index of the first segment within the content.
Definition: pccrc.h:21
#define __HYPERVISOR_hvm_op
Definition: xen.h:100
uint32_t cpuid_base
CPUID base.
Definition: hvm.h:43