blob: 4cef48e16e51c6f00e357ba9a759eab92aa98f96 [file] [log] [blame]
Kevin O'Connore7cc7642009-10-04 10:05:16 -04001#ifndef __PV_H
2#define __PV_H
3
4#include "util.h"
5
6/* This CPUID returns the signature 'KVMKVMKVM' in ebx, ecx, and edx. It
7 * should be used to determine that a VM is running under KVM.
8 */
9#define KVM_CPUID_SIGNATURE 0x40000000
10
11static inline int kvm_para_available(void)
12{
13 unsigned int eax, ebx, ecx, edx;
14 char signature[13];
15
16 cpuid(KVM_CPUID_SIGNATURE, &eax, &ebx, &ecx, &edx);
17 memcpy(signature + 0, &ebx, 4);
18 memcpy(signature + 4, &ecx, 4);
19 memcpy(signature + 8, &edx, 4);
20 signature[12] = 0;
21
22 if (strcmp(signature, "KVMKVMKVM") == 0)
23 return 1;
24
25 return 0;
26}
27
28#define QEMU_CFG_SIGNATURE 0x00
29#define QEMU_CFG_ID 0x01
30#define QEMU_CFG_UUID 0x02
31#define QEMU_CFG_NUMA 0x0d
32#define QEMU_CFG_BOOT_MENU 0x0e
33#define QEMU_CFG_MAX_CPUS 0x0f
Gerd Hoffmannc4c9fae2009-12-18 12:16:04 +010034#define QEMU_CFG_FILE_DIR 0x19
Kevin O'Connore7cc7642009-10-04 10:05:16 -040035#define QEMU_CFG_ARCH_LOCAL 0x8000
36#define QEMU_CFG_ACPI_TABLES (QEMU_CFG_ARCH_LOCAL + 0)
37#define QEMU_CFG_SMBIOS_ENTRIES (QEMU_CFG_ARCH_LOCAL + 1)
Kevin O'Connor812654a2009-10-12 12:02:33 -040038#define QEMU_CFG_IRQ0_OVERRIDE (QEMU_CFG_ARCH_LOCAL + 2)
Kevin O'Connore7cc7642009-10-04 10:05:16 -040039
40extern int qemu_cfg_present;
41
42void qemu_cfg_port_probe(void);
43int qemu_cfg_show_boot_menu(void);
44void qemu_cfg_get_uuid(u8 *uuid);
Kevin O'Connor4d2b6192009-10-08 21:37:21 -040045int qemu_cfg_irq0_override(void);
Kevin O'Connorcc6dc462009-10-08 21:18:41 -040046u16 qemu_cfg_acpi_additional_tables(void);
47u16 qemu_cfg_next_acpi_table_len(void);
48void *qemu_cfg_next_acpi_table_load(void *addr, u16 len);
Kevin O'Connor4e4b4102009-10-08 21:21:59 -040049u16 qemu_cfg_smbios_entries(void);
50size_t qemu_cfg_smbios_load_field(int type, size_t offset, void *addr);
51int qemu_cfg_smbios_load_external(int type, char **p, unsigned *nr_structs,
52 unsigned *max_struct_size, char *end);
Kevin O'Connor590e5542009-10-08 22:09:02 -040053int qemu_cfg_get_numa_nodes(void);
54void qemu_cfg_get_numa_data(u64 *data, int n);
Kevin O'Connor84705852009-10-08 22:13:15 -040055u16 qemu_cfg_get_max_cpus(void);
Kevin O'Connore7cc7642009-10-04 10:05:16 -040056
Gerd Hoffmannc4c9fae2009-12-18 12:16:04 +010057typedef struct QemuCfgFile {
58 u32 size; /* file size */
59 u16 select; /* write this to 0x510 to read it */
60 u16 reserved;
61 char name[56];
62} QemuCfgFile;
63
64u16 qemu_cfg_first_file(QemuCfgFile *entry);
65u16 qemu_cfg_next_file(QemuCfgFile *entry);
66u32 qemu_cfg_read_file(QemuCfgFile *entry, void *dst, u32 maxlen);
67
Kevin O'Connore7cc7642009-10-04 10:05:16 -040068#endif