blob: 208d0fb8eaed4f606f9c574dc20cc5a16e514a2b [file] [log] [blame]
Kevin O'Connore7cc7642009-10-04 10:05:16 -04001#ifndef __PV_H
2#define __PV_H
3
Kevin O'Connor02313b22013-02-07 22:42:25 -05004#include "config.h" // CONFIG_*
Kevin O'Connor02313b22013-02-07 22:42:25 -05005#include "biosvar.h" // GET_GLOBAL
6
7// Types of paravirtualized platforms.
8#define PF_QEMU (1<<0)
9#define PF_XEN (1<<1)
Kevin O'Connor7b5bc502013-02-09 13:07:23 -050010#define PF_KVM (1<<2)
Kevin O'Connor02313b22013-02-07 22:42:25 -050011
12// misc.c
13extern int PlatformRunningOn;
14
15static inline int runningOnQEMU(void) {
16 return CONFIG_QEMU || (
17 CONFIG_QEMU_HARDWARE && GET_GLOBAL(PlatformRunningOn) & PF_QEMU);
18}
19static inline int runningOnXen(void) {
20 return CONFIG_XEN && GET_GLOBAL(PlatformRunningOn) & PF_XEN;
21}
Kevin O'Connor7b5bc502013-02-09 13:07:23 -050022static inline int runningOnKVM(void) {
23 return CONFIG_QEMU && GET_GLOBAL(PlatformRunningOn) & PF_KVM;
Kevin O'Connore7cc7642009-10-04 10:05:16 -040024}
25
Kevin O'Connor7b5bc502013-02-09 13:07:23 -050026// QEMU "firmware config (fw_cfg)" interface
Kevin O'Connor7a08ae72012-03-14 21:11:39 -040027#define QEMU_CFG_SIGNATURE 0x00
28#define QEMU_CFG_ID 0x01
29#define QEMU_CFG_UUID 0x02
30#define QEMU_CFG_NUMA 0x0d
31#define QEMU_CFG_BOOT_MENU 0x0e
32#define QEMU_CFG_MAX_CPUS 0x0f
Gerd Hoffmannc4c9fae2009-12-18 12:16:04 +010033#define QEMU_CFG_FILE_DIR 0x19
Kevin O'Connor7a08ae72012-03-14 21:11:39 -040034#define QEMU_CFG_ARCH_LOCAL 0x8000
35#define QEMU_CFG_ACPI_TABLES (QEMU_CFG_ARCH_LOCAL + 0)
36#define QEMU_CFG_SMBIOS_ENTRIES (QEMU_CFG_ARCH_LOCAL + 1)
37#define QEMU_CFG_IRQ0_OVERRIDE (QEMU_CFG_ARCH_LOCAL + 2)
38#define QEMU_CFG_E820_TABLE (QEMU_CFG_ARCH_LOCAL + 3)
Kevin O'Connore7cc7642009-10-04 10:05:16 -040039
40extern int qemu_cfg_present;
41
Kevin O'Connor8ed2e532013-01-21 02:32:48 -050042void qemu_ramsize_preinit(void);
43void qemu_biostable_setup(void);
Kevin O'Connord83c87b2013-01-21 01:14:12 -050044void qemu_cfg_preinit(void);
Kevin O'Connore7cc7642009-10-04 10:05:16 -040045int qemu_cfg_show_boot_menu(void);
46void qemu_cfg_get_uuid(u8 *uuid);
Kevin O'Connor4d2b6192009-10-08 21:37:21 -040047int qemu_cfg_irq0_override(void);
Kevin O'Connorcc6dc462009-10-08 21:18:41 -040048u16 qemu_cfg_acpi_additional_tables(void);
49u16 qemu_cfg_next_acpi_table_len(void);
50void *qemu_cfg_next_acpi_table_load(void *addr, u16 len);
Kevin O'Connor4e4b4102009-10-08 21:21:59 -040051u16 qemu_cfg_smbios_entries(void);
52size_t qemu_cfg_smbios_load_field(int type, size_t offset, void *addr);
53int qemu_cfg_smbios_load_external(int type, char **p, unsigned *nr_structs,
54 unsigned *max_struct_size, char *end);
Kevin O'Connor590e5542009-10-08 22:09:02 -040055int qemu_cfg_get_numa_nodes(void);
56void qemu_cfg_get_numa_data(u64 *data, int n);
Kevin O'Connor84705852009-10-08 22:13:15 -040057u16 qemu_cfg_get_max_cpus(void);
Jes Sorensen0360e8e2010-02-16 09:46:08 +010058struct e820_reservation {
59 u64 address;
60 u64 length;
61 u32 type;
62};
Jes Sorensen0360e8e2010-02-16 09:46:08 +010063u32 qemu_cfg_e820_entries(void);
64void* qemu_cfg_e820_load_next(void *addr);
Kevin O'Connord83c87b2013-01-21 01:14:12 -050065void qemu_romfile_init(void);
Gerd Hoffmannc4c9fae2009-12-18 12:16:04 +010066
Kevin O'Connore7cc7642009-10-04 10:05:16 -040067#endif