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 extern uint32_t *cpu_to_apicid;
52 
53 #define LAPIC_BASE_ADDRESS  0xfee00000
54 
55 #define PCI_ISA_DEVFN       0x08    /* dev 1, fn 0 */
56 #define PCI_ISA_IRQ_MASK    0x0c20U /* ISA IRQs 5,10,11 are PCI connected */
57 
58 #define ACPI_TIS_HDR_ADDRESS 0xFED40F00UL
59 
60 extern uint32_t pci_mem_start;
61 extern uint32_t pci_mem_end;
62 extern uint64_t pci_hi_mem_start, pci_hi_mem_end;
63 
64 extern bool acpi_enabled;
65 
66 /* Memory map. */
67 #define SCRATCH_PHYSICAL_ADDRESS      0x00010000
68 #define HYPERCALL_PHYSICAL_ADDRESS    0x00080000
69 #define VGABIOS_PHYSICAL_ADDRESS      0x000C0000
70 #define HVMLOADER_PHYSICAL_ADDRESS    0x00100000
71 /* Special BIOS mappings, etc. are allocated from here upwards... */
72 #define RESERVED_MEMBASE              0xFC000000
73 /* NB. ACPI_INFO_PHYSICAL_ADDRESS *MUST* match definition in acpi/dsdt.asl! */
74 #define ACPI_INFO_PHYSICAL_ADDRESS    0xFC000000
75 #define ACPI_MEMORY_DYNAMIC_START     0xFC001000
76 #define RESERVED_MEMORY_DYNAMIC_START 0xFC100000
77 #define RESERVED_MEMORY_DYNAMIC_END   0xFE000000
78 /*
79  * GUEST_RESERVED: Physical address space reserved for guest use.
80  * This is not dynamically advertised to guests, so this range must *never*
81  * be used for any purpose by us, in future. It must always be marked as
82  * reserved in the memory map (e.g., E820_RESERVED) so that mechanisms such
83  * as PCI BAR remapping do not allocate from this region.
84  */
85 #define GUEST_RESERVED_START          0xFE700000
86 #define GUEST_RESERVED_END            0xFE800000
87 
88 extern unsigned long scratch_start;
89 
90 #endif /* __HVMLOADER_CONFIG_H__ */
91 
92 /*
93  * Local variables:
94  * mode: C
95  * c-file-style: "BSD"
96  * c-basic-offset: 4
97  * tab-width: 4
98  * indent-tabs-mode: nil
99  * End:
100  */
101