1 #ifndef __HVMLOADER_CONFIG_H__
2 #define __HVMLOADER_CONFIG_H__
3 
4 #include <stdint.h>
5 #include <stdbool.h>
6 
7 enum virtual_vga { VGA_none, VGA_std, VGA_cirrus, VGA_pt };
8 extern enum virtual_vga virtual_vga;
9 
10 extern unsigned long igd_opregion_pgbase;
11 #define IGD_OPREGION_PAGES 3
12 
13 struct bios_config {
14     const char *name;
15 
16     /* BIOS ROM image bits */
17     void *image;
18     unsigned int image_size;
19 
20     /* Physical address to load at */
21     unsigned int bios_address;
22 
23     /* ROMS */
24     void (*load_roms)(void);
25 
26     void (*bios_load)(const struct bios_config *config, void *addr,
27                       uint32_t size, void *extra_addr);
28 
29     void (*bios_info_setup)(void);
30     void (*bios_info_finish)(void);
31 
32     void (*e820_setup)(void);
33 
34     void (*acpi_build_tables)(void);
35     void (*create_mp_tables)(void);
36     void (*create_smbios_tables)(void);
37     void (*create_pir_tables)(void);
38 };
39 
40 extern struct bios_config rombios_config;
41 extern struct bios_config seabios_config;
42 extern struct bios_config ovmf_config;
43 
44 #define PAGE_SHIFT 12
45 #define PAGE_SIZE  (1ul << PAGE_SHIFT)
46 
47 extern uint8_t ioapic_version;
48 
49 #define IOAPIC_ID           0x01
50 
51 #define LAPIC_BASE_ADDRESS  0xfee00000
52 #define LAPIC_ID(vcpu_id)   ((vcpu_id) * 2)
53 
54 #define PCI_ISA_DEVFN       0x08    /* dev 1, fn 0 */
55 #define PCI_ISA_IRQ_MASK    0x0c20U /* ISA IRQs 5,10,11 are PCI connected */
56 
57 #define ACPI_TIS_HDR_ADDRESS 0xFED40F00UL
58 
59 extern uint32_t pci_mem_start;
60 extern const uint32_t pci_mem_end;
61 extern uint64_t pci_hi_mem_start, pci_hi_mem_end;
62 
63 extern bool acpi_enabled;
64 
65 /* Memory map. */
66 #define SCRATCH_PHYSICAL_ADDRESS      0x00010000
67 #define HYPERCALL_PHYSICAL_ADDRESS    0x00080000
68 #define VGABIOS_PHYSICAL_ADDRESS      0x000C0000
69 #define HVMLOADER_PHYSICAL_ADDRESS    0x00100000
70 /* Special BIOS mappings, etc. are allocated from here upwards... */
71 #define RESERVED_MEMBASE              0xFC000000
72 /* NB. ACPI_INFO_PHYSICAL_ADDRESS *MUST* match definition in acpi/dsdt.asl! */
73 #define ACPI_INFO_PHYSICAL_ADDRESS    0xFC000000
74 #define ACPI_MEMORY_DYNAMIC_START     0xFC001000
75 #define RESERVED_MEMORY_DYNAMIC_START 0xFC100000
76 #define RESERVED_MEMORY_DYNAMIC_END   0xFE000000
77 /*
78  * GUEST_RESERVED: Physical address space reserved for guest use.
79  * This is not dynamically advertised to guests, so this range must *never*
80  * be used for any purpose by us, in future. It must always be marked as
81  * reserved in the memory map (e.g., E820_RESERVED) so that mechanisms such
82  * as PCI BAR remapping do not allocate from this region.
83  */
84 #define GUEST_RESERVED_START          0xFE700000
85 #define GUEST_RESERVED_END            0xFE800000
86 
87 extern unsigned long scratch_start;
88 
89 #endif /* __HVMLOADER_CONFIG_H__ */
90 
91 /*
92  * Local variables:
93  * mode: C
94  * c-file-style: "BSD"
95  * c-basic-offset: 4
96  * tab-width: 4
97  * indent-tabs-mode: nil
98  * End:
99  */
100