Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bhyve/acpi.c
Show All 27 Lines | |||||
* $FreeBSD$ | * $FreeBSD$ | ||||
*/ | */ | ||||
/* | /* | ||||
* bhyve ACPI table generator. | * bhyve ACPI table generator. | ||||
* | * | ||||
* 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. | ||||
rpokala: Since you're in here: "... and **then** compiling them ..." | |||||
Done Inline ActionsThat's far enough away from anything I'm touching I'm inclined to leave it be in this revision, but feel free to do a drive-by typo fix in the comment if you feel strongly about it :-). cem: That's far enough away from anything I'm touching I'm inclined to leave it be in this revision… | |||||
* 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 (No longer correct at FADT and beyond due to properly | * Layout (No longer correct at FADT and beyond due to properly | ||||
* calculating the size of the MADT to allow for changes to | * calculating the size of the MADT to allow for changes to | ||||
* VM_MAXCPU above 21 which overflows this layout.) | * VM_MAXCPU above 21 which overflows this layout.) | ||||
Show All 24 Lines | |||||
#include <unistd.h> | #include <unistd.h> | ||||
#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" | ||||
#include "vmgenc.h" | |||||
/* | /* | ||||
* Define the base address of the ACPI tables, the sizes of some tables, | * Define the base address of the ACPI tables, the sizes of some tables, | ||||
* and the offsets to 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 | ||||
▲ Show 20 Lines • Show All 277 Lines • ▼ Show 20 Lines | EFPRINTF(fp, "[0004]\t\tPM1A Event Block Address : %08X\n", | ||||
PM1A_EVT_ADDR); | PM1A_EVT_ADDR); | ||||
EFPRINTF(fp, "[0004]\t\tPM1B Event Block Address : 00000000\n"); | EFPRINTF(fp, "[0004]\t\tPM1B Event Block Address : 00000000\n"); | ||||
EFPRINTF(fp, "[0004]\t\tPM1A Control Block Address : %08X\n", | EFPRINTF(fp, "[0004]\t\tPM1A Control Block Address : %08X\n", | ||||
PM1A_CNT_ADDR); | PM1A_CNT_ADDR); | ||||
EFPRINTF(fp, "[0004]\t\tPM1B Control Block Address : 00000000\n"); | EFPRINTF(fp, "[0004]\t\tPM1B Control Block Address : 00000000\n"); | ||||
EFPRINTF(fp, "[0004]\t\tPM2 Control Block Address : 00000000\n"); | EFPRINTF(fp, "[0004]\t\tPM2 Control Block Address : 00000000\n"); | ||||
EFPRINTF(fp, "[0004]\t\tPM Timer Block Address : %08X\n", | EFPRINTF(fp, "[0004]\t\tPM Timer Block Address : %08X\n", | ||||
IO_PMTMR); | IO_PMTMR); | ||||
EFPRINTF(fp, "[0004]\t\tGPE0 Block Address : 00000000\n"); | EFPRINTF(fp, "[0004]\t\tGPE0 Block Address : %08X\n", IO_GPE0_BLK); | ||||
EFPRINTF(fp, "[0004]\t\tGPE1 Block Address : 00000000\n"); | EFPRINTF(fp, "[0004]\t\tGPE1 Block Address : 00000000\n"); | ||||
EFPRINTF(fp, "[0001]\t\tPM1 Event Block Length : 04\n"); | EFPRINTF(fp, "[0001]\t\tPM1 Event Block Length : 04\n"); | ||||
EFPRINTF(fp, "[0001]\t\tPM1 Control Block Length : 02\n"); | EFPRINTF(fp, "[0001]\t\tPM1 Control Block Length : 02\n"); | ||||
EFPRINTF(fp, "[0001]\t\tPM2 Control Block Length : 00\n"); | EFPRINTF(fp, "[0001]\t\tPM2 Control Block Length : 00\n"); | ||||
EFPRINTF(fp, "[0001]\t\tPM Timer Block Length : 04\n"); | EFPRINTF(fp, "[0001]\t\tPM Timer Block Length : 04\n"); | ||||
EFPRINTF(fp, "[0001]\t\tGPE0 Block Length : 00\n"); | EFPRINTF(fp, "[0001]\t\tGPE0 Block Length : %02x\n", IO_GPE0_LEN); | ||||
EFPRINTF(fp, "[0001]\t\tGPE1 Block Length : 00\n"); | EFPRINTF(fp, "[0001]\t\tGPE1 Block Length : 00\n"); | ||||
EFPRINTF(fp, "[0001]\t\tGPE1 Base Offset : 00\n"); | EFPRINTF(fp, "[0001]\t\tGPE1 Base Offset : 00\n"); | ||||
EFPRINTF(fp, "[0001]\t\t_CST Support : 00\n"); | EFPRINTF(fp, "[0001]\t\t_CST Support : 00\n"); | ||||
EFPRINTF(fp, "[0002]\t\tC2 Latency : 0000\n"); | EFPRINTF(fp, "[0002]\t\tC2 Latency : 0000\n"); | ||||
EFPRINTF(fp, "[0002]\t\tC3 Latency : 0000\n"); | EFPRINTF(fp, "[0002]\t\tC3 Latency : 0000\n"); | ||||
EFPRINTF(fp, "[0002]\t\tCPU Cache Size : 0000\n"); | EFPRINTF(fp, "[0002]\t\tCPU Cache Size : 0000\n"); | ||||
EFPRINTF(fp, "[0002]\t\tCache Flush Stride : 0000\n"); | EFPRINTF(fp, "[0002]\t\tCache Flush Stride : 0000\n"); | ||||
EFPRINTF(fp, "[0001]\t\tDuty Cycle Offset : 00\n"); | EFPRINTF(fp, "[0001]\t\tDuty Cycle Offset : 00\n"); | ||||
▲ Show 20 Lines • Show All 111 Lines • ▼ Show 20 Lines | basl_fwrite_fadt(FILE *fp) | ||||
EFPRINTF(fp, | EFPRINTF(fp, | ||||
"[0001]\t\tEncoded Access Width : 03 [DWord Access:32]\n"); | "[0001]\t\tEncoded Access Width : 03 [DWord Access:32]\n"); | ||||
EFPRINTF(fp, "[0008]\t\tAddress : 00000000%08X\n", | EFPRINTF(fp, "[0008]\t\tAddress : 00000000%08X\n", | ||||
IO_PMTMR); | IO_PMTMR); | ||||
EFPRINTF(fp, "\n"); | EFPRINTF(fp, "\n"); | ||||
EFPRINTF(fp, "[0012]\t\tGPE0 Block : [Generic Address Structure]\n"); | EFPRINTF(fp, "[0012]\t\tGPE0 Block : [Generic Address Structure]\n"); | ||||
EFPRINTF(fp, "[0001]\t\tSpace ID : 01 [SystemIO]\n"); | EFPRINTF(fp, "[0001]\t\tSpace ID : 01 [SystemIO]\n"); | ||||
EFPRINTF(fp, "[0001]\t\tBit Width : 00\n"); | EFPRINTF(fp, "[0001]\t\tBit Width : %02x\n", IO_GPE0_LEN * (8 / 2)); | ||||
EFPRINTF(fp, "[0001]\t\tBit Offset : 00\n"); | EFPRINTF(fp, "[0001]\t\tBit Offset : 00\n"); | ||||
EFPRINTF(fp, "[0001]\t\tEncoded Access Width : 01 [Byte Access:8]\n"); | EFPRINTF(fp, "[0001]\t\tEncoded Access Width : 01 [Byte Access:8]\n"); | ||||
EFPRINTF(fp, "[0008]\t\tAddress : 0000000000000000\n"); | EFPRINTF(fp, "[0008]\t\tAddress : %016X\n", IO_GPE0_BLK); | ||||
EFPRINTF(fp, "\n"); | EFPRINTF(fp, "\n"); | ||||
EFPRINTF(fp, "[0012]\t\tGPE1 Block : [Generic Address Structure]\n"); | EFPRINTF(fp, "[0012]\t\tGPE1 Block : [Generic Address Structure]\n"); | ||||
EFPRINTF(fp, "[0001]\t\tSpace ID : 01 [SystemIO]\n"); | EFPRINTF(fp, "[0001]\t\tSpace ID : 01 [SystemIO]\n"); | ||||
EFPRINTF(fp, "[0001]\t\tBit Width : 00\n"); | EFPRINTF(fp, "[0001]\t\tBit Width : 00\n"); | ||||
EFPRINTF(fp, "[0001]\t\tBit Offset : 00\n"); | EFPRINTF(fp, "[0001]\t\tBit Offset : 00\n"); | ||||
EFPRINTF(fp, | EFPRINTF(fp, | ||||
"[0001]\t\tEncoded Access Width : 00 [Undefined/Legacy]\n"); | "[0001]\t\tEncoded Access Width : 00 [Undefined/Legacy]\n"); | ||||
▲ Show 20 Lines • Show All 235 Lines • ▼ Show 20 Lines | basl_fwrite_dsdt(FILE *fp) | ||||
dsdt_line(" Name (_CRS, ResourceTemplate ()"); | dsdt_line(" Name (_CRS, ResourceTemplate ()"); | ||||
dsdt_line(" {"); | dsdt_line(" {"); | ||||
dsdt_indent(4); | dsdt_indent(4); | ||||
dsdt_fixed_mem32(0xFED00000, 0x400); | dsdt_fixed_mem32(0xFED00000, 0x400); | ||||
dsdt_unindent(4); | dsdt_unindent(4); | ||||
dsdt_line(" })"); | dsdt_line(" })"); | ||||
dsdt_line(" }"); | dsdt_line(" }"); | ||||
dsdt_line(" }"); | dsdt_line(" }"); | ||||
vmgenc_write_dsdt(); | |||||
dsdt_line("}"); | dsdt_line("}"); | ||||
if (dsdt_error != 0) | if (dsdt_error != 0) | ||||
return (dsdt_error); | return (dsdt_error); | ||||
EFFLUSH(fp); | EFFLUSH(fp); | ||||
return (0); | return (0); | ||||
▲ Show 20 Lines • Show All 233 Lines • Show Last 20 Lines |
Since you're in here: "... and then compiling them ..."