23 FIRMWARE_CONFIG_ITEM Item;
29 }
else if (Size !=
sizeof (*CpuCount)) {
30 return EFI_BAD_BUFFER_SIZE;
42 Size =
sizeof (*CpuCount);
47 return EFI_UNSUPPORTED;
53BhyveInstallAcpiMadtTable (
55 IN VOID *AcpiTableBuffer,
73 Status = BhyveGetCpuCount (&CpuCount);
74 if (!EFI_ERROR (Status)) {
75 DEBUG ((DEBUG_INFO,
"Retrieved CpuCount %d\n", CpuCount));
76 ASSERT (CpuCount >= 1);
78 DEBUG ((DEBUG_INFO,
"CpuCount retrieval error\n"));
82 NewBufferSize = 1 *
sizeof (*Madt) +
83 CpuCount *
sizeof (*LocalApic) +
84 1 *
sizeof (*IoApic) +
89 return EFI_OUT_OF_RESOURCES;
93 Madt->Header.Length = (UINT32)NewBufferSize;
94 Madt->LocalApicAddress = 0xFEE00000;
99 for (Loop = 0; Loop < CpuCount; ++Loop) {
100 LocalApic->Type = EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC;
101 LocalApic->Length =
sizeof (*LocalApic);
102 LocalApic->AcpiProcessorId = (UINT8)Loop;
103 LocalApic->ApicId = (UINT8)Loop;
104 LocalApic->Flags = 1;
111 IoApic->Type = EFI_ACPI_1_0_IO_APIC;
113 IoApic->IoApicId = (UINT8)CpuCount;
114 IoApic->Reserved = EFI_ACPI_RESERVED_BYTE;
115 IoApic->IoApicAddress = 0xFEC00000;
116 IoApic->SystemVectorBase = 0x00000000;
123 Iso->Type = EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE;
124 Iso->Length =
sizeof (*Iso);
127 Iso->GlobalSystemInterruptVector = 0x00000002;
131 ASSERT ((
UINTN)((UINT8 *)Ptr - (UINT8 *)Madt) == NewBufferSize);
141BhyveInstallAcpiTable (
143 IN VOID *AcpiTableBuffer,
152 switch (Hdr->Signature) {
154 TableInstallFunction = BhyveInstallAcpiMadtTable;
160 return TableInstallFunction (
#define EFI_ACPI_1_0_APIC_SIGNATURE
#define EFI_ACPI_1_0_PCAT_COMPAT
EFI_STATUS EFIAPI InstallAcpiTable(IN EFI_ACPI_TABLE_PROTOCOL *This, IN VOID *AcpiTableBuffer, IN UINTN AcpiTableBufferSize, OUT UINTN *TableKey)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
RETURN_STATUS EFIAPI BhyveFwCtlGet(IN CONST CHAR8 *Name, OUT VOID *Item, IN OUT UINTN *Size)
VOID EFIAPI FreePool(IN VOID *Buffer)
STATIC CONST ACPI_PARSER IoApic[]
#define DEBUG(Expression)
EFI_STATUS(EFIAPI * EFI_ACPI_TABLE_INSTALL_ACPI_TABLE)(IN EFI_ACPI_TABLE_PROTOCOL *This, IN VOID *AcpiTableBuffer, IN UINTN AcpiTableBufferSize, OUT UINTN *TableKey)
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
RETURN_STATUS EFIAPI QemuFwCfgFindFile(IN CONST CHAR8 *Name, OUT FIRMWARE_CONFIG_ITEM *Item, OUT UINTN *Size)
VOID EFIAPI QemuFwCfgReadBytes(IN UINTN Size, IN VOID *Buffer OPTIONAL)
VOID EFIAPI QemuFwCfgSelectItem(IN FIRMWARE_CONFIG_ITEM QemuFwCfgItem)
BOOLEAN EFIAPI QemuFwCfgIsAvailable(VOID)