]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/AcpiTables/Madt.aslc
OvmfPkg/Bhyve/AcpiPlatformDxe: fix file path typo in comment
[mirror_edk2.git] / OvmfPkg / AcpiTables / Madt.aslc
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) 2008 - 2012, Intel Corporation. All rights reserved.<BR>
8 SPDX-License-Identifier: BSD-2-Clause-Patent
9
10 **/
11
12 #include <IndustryStandard/Acpi.h>
13 #include <Platform.h>
14
15 //
16 // Local APIC address
17 //
18 #define EFI_ACPI_LOCAL_APIC_ADDRESS 0xFEE00000 // TBD
19
20 //
21 // Multiple APIC Flags are defined in AcpiX.0.h
22 //
23 #define EFI_ACPI_1_0_MULTIPLE_APIC_FLAGS (EFI_ACPI_1_0_PCAT_COMPAT)
24
25 //
26 // Define the number of each table type.
27 // This is where the table layout is modified.
28 //
29 #define EFI_ACPI_PROCESSOR_LOCAL_APIC_COUNT 1
30 #define EFI_ACPI_INTERRUPT_SOURCE_OVERRIDE_COUNT 2
31 #define EFI_ACPI_IO_APIC_COUNT 1
32
33 //
34 // Ensure proper structure formats
35 //
36 #pragma pack (1)
37
38 //
39 // ACPI 1.0 MADT structure
40 //
41 typedef struct {
42 EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER Header;
43
44 #if EFI_ACPI_PROCESSOR_LOCAL_APIC_COUNT > 0
45 EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC_STRUCTURE LocalApic[EFI_ACPI_PROCESSOR_LOCAL_APIC_COUNT];
46 #endif
47
48 #if EFI_ACPI_INTERRUPT_SOURCE_OVERRIDE_COUNT > 0
49 EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE Iso[EFI_ACPI_INTERRUPT_SOURCE_OVERRIDE_COUNT];
50 #endif
51
52 #if EFI_ACPI_IO_APIC_COUNT > 0
53 EFI_ACPI_1_0_IO_APIC_STRUCTURE IoApic[EFI_ACPI_IO_APIC_COUNT];
54 #endif
55
56 } EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE;
57
58 #pragma pack ()
59
60 //
61 // Multiple APIC Description Table
62 //
63 EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = {
64 {
65 {
66 EFI_ACPI_1_0_APIC_SIGNATURE,
67 sizeof (EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE),
68 EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION,
69 0x00, // Checksum will be updated at runtime
70 {EFI_ACPI_OEM_ID},
71 EFI_ACPI_OEM_TABLE_ID,
72 EFI_ACPI_OEM_REVISION,
73 EFI_ACPI_CREATOR_ID,
74 EFI_ACPI_CREATOR_REVISION
75 },
76
77 //
78 // MADT specific fields
79 //
80 EFI_ACPI_LOCAL_APIC_ADDRESS,
81 EFI_ACPI_1_0_MULTIPLE_APIC_FLAGS,
82 },
83
84 //
85 // Processor Local APIC Structure
86 //
87 {
88 {
89 EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC, // Type
90 sizeof (EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC_STRUCTURE), // Length
91 0x00, // Processor ID
92 0x00, // Local APIC ID
93 0x00000001 // Flags - Enabled by default
94 }
95 },
96
97 //
98 // Interrupt Source Override Structure
99 //
100
101 {
102 {
103 //
104 // IRQ0=>IRQ2 Interrupt Source Override Structure
105 //
106 EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE, // Type
107 sizeof (EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE),// Length
108 0x00, // Bus - ISA
109 0x00, // Source - IRQ0
110 0x00000002, // Global System Interrupt - IRQ2
111 0x0000 // Flags - Conforms to specifications of the bus
112 },
113
114 {
115 //
116 // ISO (SCI Active High) Interrupt Source Override Structure
117 //
118 EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE, // Type
119 sizeof (EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE),// Length
120 0x00, // Bus - ISA
121 0x09, // Source - IRQ0
122 0x00000009, // Global System Interrupt - IRQ2
123 0x000D // Flags - Level-tiggered, Active High
124 }
125 },
126
127 //
128 // IO APIC Structure
129 //
130 {
131 {
132 EFI_ACPI_1_0_IO_APIC, // Type
133 sizeof (EFI_ACPI_1_0_IO_APIC_STRUCTURE), // Length
134 0x02, // IO APIC ID
135 EFI_ACPI_RESERVED_BYTE, // Reserved
136 0xFEC00000, // IO APIC Address (physical)
137 0x00000000 // Global System Interrupt Base
138 }
139 },
140 };
141
142
143 VOID*
144 ReferenceAcpiTable (
145 VOID
146 )
147 {
148 //
149 // Reference the table being generated to prevent the optimizer from removing the
150 // data structure from the executable
151 //
152 return (VOID*)&Madt;
153 }