Changeset View
Changeset View
Standalone View
Standalone View
head/usr.sbin/bhyve/acpi.c
Show All 33 Lines | |||||
* Create the minimal set of ACPI tables required to boot FreeBSD (and | * Create the minimal set of ACPI tables required to boot FreeBSD (and | ||||
* hopefully other o/s's) by writing out ASL template files for each of | * hopefully other o/s's) by writing out ASL template files for each of | ||||
* the tables and the compiling them to AML with the Intel iasl compiler. | * the tables and the compiling them to AML with the Intel iasl compiler. | ||||
* The AML files are then read into guest memory. | * The AML files are then read into guest memory. | ||||
* | * | ||||
* The tables are placed in the guest's ROM area just below 1MB physical, | * The tables are placed in the guest's ROM area just below 1MB physical, | ||||
* above the MPTable. | * above the MPTable. | ||||
* | * | ||||
* Layout | * Layout (No longer correct at FADT and beyond due to properly | ||||
* calculating the size of the MADT to allow for changes to | |||||
* VM_MAXCPU above 21 which overflows this layout.) | |||||
* ------ | * ------ | ||||
* RSDP -> 0xf2400 (36 bytes fixed) | * RSDP -> 0xf2400 (36 bytes fixed) | ||||
* RSDT -> 0xf2440 (36 bytes + 4*7 table addrs, 4 used) | * RSDT -> 0xf2440 (36 bytes + 4*7 table addrs, 4 used) | ||||
* XSDT -> 0xf2480 (36 bytes + 8*7 table addrs, 4 used) | * XSDT -> 0xf2480 (36 bytes + 8*7 table addrs, 4 used) | ||||
* MADT -> 0xf2500 (depends on #CPUs) | * MADT -> 0xf2500 (depends on #CPUs) | ||||
* FADT -> 0xf2600 (268 bytes) | * FADT -> 0xf2600 (268 bytes) | ||||
* HPET -> 0xf2740 (56 bytes) | * HPET -> 0xf2740 (56 bytes) | ||||
* MCFG -> 0xf2780 (60 bytes) | * MCFG -> 0xf2780 (60 bytes) | ||||
Show All 18 Lines | |||||
#include <machine/vmm.h> | #include <machine/vmm.h> | ||||
#include <vmmapi.h> | #include <vmmapi.h> | ||||
#include "bhyverun.h" | #include "bhyverun.h" | ||||
#include "acpi.h" | #include "acpi.h" | ||||
#include "pci_emul.h" | #include "pci_emul.h" | ||||
/* | /* | ||||
* Define the base address of the ACPI tables, and the offsets to | * Define the base address of the ACPI tables, the sizes of some tables, | ||||
* the individual tables | * and the offsets to the individual tables, | ||||
*/ | */ | ||||
#define BHYVE_ACPI_BASE 0xf2400 | #define BHYVE_ACPI_BASE 0xf2400 | ||||
#define RSDT_OFFSET 0x040 | #define RSDT_OFFSET 0x040 | ||||
#define XSDT_OFFSET 0x080 | #define XSDT_OFFSET 0x080 | ||||
#define MADT_OFFSET 0x100 | #define MADT_OFFSET 0x100 | ||||
#define FADT_OFFSET 0x200 | /* | ||||
#define HPET_OFFSET 0x340 | * The MADT consists of: | ||||
#define MCFG_OFFSET 0x380 | * 44 Fixed Header | ||||
#define FACS_OFFSET 0x3C0 | * 8 * maxcpu Processor Local APIC entries | ||||
#define DSDT_OFFSET 0x400 | * 12 I/O APIC entry | ||||
* 2 * 10 Interrupt Source Override entires | |||||
* 6 Local APIC NMI entry | |||||
*/ | |||||
#define MADT_SIZE (44 + VM_MAXCPU*8 + 12 + 2*10 + 6) | |||||
#define FADT_OFFSET (MADT_OFFSET + MADT_SIZE) | |||||
#define FADT_SIZE 0x140 | |||||
#define HPET_OFFSET (FADT_OFFSET + FADT_SIZE) | |||||
#define HPET_SIZE 0x40 | |||||
#define MCFG_OFFSET (HPET_OFFSET + HPET_SIZE) | |||||
#define MCFG_SIZE 0x40 | |||||
#define FACS_OFFSET (MCFG_OFFSET + MCFG_SIZE) | |||||
#define FACS_SIZE 0x40 | |||||
#define DSDT_OFFSET (FACS_OFFSET + FACS_SIZE) | |||||
#define BHYVE_ASL_TEMPLATE "bhyve.XXXXXXX" | #define BHYVE_ASL_TEMPLATE "bhyve.XXXXXXX" | ||||
#define BHYVE_ASL_SUFFIX ".aml" | #define BHYVE_ASL_SUFFIX ".aml" | ||||
#define BHYVE_ASL_COMPILER "/usr/sbin/iasl" | #define BHYVE_ASL_COMPILER "/usr/sbin/iasl" | ||||
static int basl_keep_temps; | static int basl_keep_temps; | ||||
static int basl_verbose_iasl; | static int basl_verbose_iasl; | ||||
static int basl_ncpu; | static int basl_ncpu; | ||||
▲ Show 20 Lines • Show All 888 Lines • Show Last 20 Lines |