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