VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/Bhyve/AcpiTables/Madt.aslc@ 105668

Last change on this file since 105668 was 89983, checked in by vboxsync, 4 years ago

Devices/EFI: Merge edk-stable202105 and openssl 1.1.1j and make it build, bugref:4643

  • Property svn:eol-style set to native
File size: 4.1 KB
Line 
1/** @file
2 MADT Table
3
4 This file contains a structure definition for the ACPI 1.0 Multiple APIC
5 Description Table (MADT).
6
7 Copyright (c) 2020, Rebecca Cran <rebecca@bsdio.com>
8 Copyright (c) 2014, Pluribus Networks, Inc.
9 Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.<BR>
10
11 SPDX-License-Identifier: BSD-2-Clause-Patent
12
13**/
14
15#include <IndustryStandard/Acpi.h>
16#include <Platform.h>
17
18#define EFI_ACPI_OEM_TABLE_ID SIGNATURE_64('B','V','M','A','D','T',' ',' ')
19
20//
21// Local APIC address
22//
23#define EFI_ACPI_LOCAL_APIC_ADDRESS 0xFEE00000
24
25//
26// Multiple APIC Flags are defined in AcpiX.0.h
27//
28#define EFI_ACPI_1_0_MULTIPLE_APIC_FLAGS (EFI_ACPI_1_0_PCAT_COMPAT)
29
30//
31// Define the number of each table type.
32// This is where the table layout is modified.
33//
34#define EFI_ACPI_PROCESSOR_LOCAL_APIC_COUNT 1
35#define EFI_ACPI_INTERRUPT_SOURCE_OVERRIDE_COUNT 1
36#define EFI_ACPI_IO_APIC_COUNT 1
37
38//
39// Ensure proper structure formats
40//
41#pragma pack (1)
42
43//
44// ACPI 1.0 MADT structure
45//
46typedef struct {
47 EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER Header;
48
49#if EFI_ACPI_PROCESSOR_LOCAL_APIC_COUNT > 0
50 EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC_STRUCTURE LocalApic[EFI_ACPI_PROCESSOR_LOCAL_APIC_COUNT];
51#endif
52
53#if EFI_ACPI_INTERRUPT_SOURCE_OVERRIDE_COUNT > 0
54 EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE Iso[EFI_ACPI_INTERRUPT_SOURCE_OVERRIDE_COUNT];
55#endif
56
57#if EFI_ACPI_IO_APIC_COUNT > 0
58 EFI_ACPI_1_0_IO_APIC_STRUCTURE IoApic[EFI_ACPI_IO_APIC_COUNT];
59#endif
60
61} EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE;
62
63#pragma pack ()
64
65//
66// Multiple APIC Description Table
67//
68EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = {
69 {
70 {
71 EFI_ACPI_1_0_APIC_SIGNATURE,
72 sizeof (EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE),
73 EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION,
74 0x00, // Checksum will be updated at runtime
75 {EFI_ACPI_OEM_ID},
76 EFI_ACPI_OEM_TABLE_ID,
77 EFI_ACPI_OEM_REVISION,
78 EFI_ACPI_CREATOR_ID,
79 EFI_ACPI_CREATOR_REVISION
80 },
81
82 //
83 // MADT specific fields
84 //
85 EFI_ACPI_LOCAL_APIC_ADDRESS,
86 EFI_ACPI_1_0_MULTIPLE_APIC_FLAGS,
87 },
88
89 //
90 // Processor Local APIC Structure
91 //
92 {
93 {
94 EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC, // Type
95 sizeof (EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC_STRUCTURE), // Length
96 0x00, // Processor ID
97 0x00, // Local APIC ID
98 0x00000001 // Flags - Enabled by default
99 }
100 },
101
102 //
103 // Interrupt Source Override Structure
104 //
105 {
106 {
107 //
108 // IRQ0=>IRQ2 Interrupt Source Override Structure
109 //
110 EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE, // Type
111 sizeof (EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE),// Length
112 0x00, // Bus - ISA
113 0x00, // Source - IRQ0
114 0x00000002, // Global System Interrupt - IRQ2
115 0x0005 // Flags - Conforms to specifications of the bus
116 },
117 },
118
119 //
120 // IO APIC Structure
121 //
122 {
123 {
124 EFI_ACPI_1_0_IO_APIC, // Type
125 sizeof (EFI_ACPI_1_0_IO_APIC_STRUCTURE), // Length
126 0x01, // IO APIC ID
127 EFI_ACPI_RESERVED_BYTE, // Reserved
128 0xFEC00000, // IO APIC Address (physical)
129 0x00000000 // Global System Interrupt Base
130 }
131 },
132};
133
134
135VOID*
136ReferenceAcpiTable (
137 VOID
138 )
139{
140 //
141 // Reference the table being generated to prevent the optimizer from removing the
142 // data structure from the exeutable
143 //
144 return (VOID*)&Madt;
145}
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette