]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/AcpiTables/Madt.aslc
OvmfPkg: generate full MADT dynamically, synchronize contents with qemu
[mirror_edk2.git] / OvmfPkg / AcpiTables / Madt.aslc
CommitLineData
49ba9447 1/** @file\r
2 MADT Table\r
3\r
54235984 4 This file contains a structure definition for the ACPI 1.0 Multiple APIC\r
5 Description Table (MADT).\r
6\r
7 Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.<BR>\r
56d7640a 8 This program and the accompanying materials are\r
49ba9447 9 licensed and made available under the terms and conditions of the BSD License\r
10 which accompanies this distribution. The full text of the license may be found at\r
11 http://opensource.org/licenses/bsd-license.php\r
54235984 12\r
49ba9447 13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
15\r
54235984 16**/\r
49ba9447 17\r
18#include <IndustryStandard/Acpi.h>\r
498f7d8d 19#include <Platform.h>\r
49ba9447 20\r
21//\r
22// Local APIC address\r
23//\r
24#define EFI_ACPI_LOCAL_APIC_ADDRESS 0xFEE00000 // TBD\r
25\r
26//\r
27// Multiple APIC Flags are defined in AcpiX.0.h\r
28//\r
29#define EFI_ACPI_1_0_MULTIPLE_APIC_FLAGS (EFI_ACPI_1_0_PCAT_COMPAT)\r
30\r
31//\r
32// Define the number of each table type.\r
33// This is where the table layout is modified.\r
34//\r
35#define EFI_ACPI_PROCESSOR_LOCAL_APIC_COUNT 1\r
36#define EFI_ACPI_INTERRUPT_SOURCE_OVERRIDE_COUNT 2\r
37#define EFI_ACPI_IO_APIC_COUNT 1\r
38\r
39//\r
40// Ensure proper structure formats\r
41//\r
42#pragma pack (1)\r
43\r
44//\r
45// ACPI 1.0 MADT structure\r
46//\r
47typedef struct {\r
48 EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER Header;\r
49\r
50#if EFI_ACPI_PROCESSOR_LOCAL_APIC_COUNT > 0\r
51 EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC_STRUCTURE LocalApic[EFI_ACPI_PROCESSOR_LOCAL_APIC_COUNT];\r
52#endif\r
53\r
54#if EFI_ACPI_INTERRUPT_SOURCE_OVERRIDE_COUNT > 0\r
55 EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE Iso[EFI_ACPI_INTERRUPT_SOURCE_OVERRIDE_COUNT];\r
56#endif\r
57\r
58#if EFI_ACPI_IO_APIC_COUNT > 0\r
59 EFI_ACPI_1_0_IO_APIC_STRUCTURE IoApic[EFI_ACPI_IO_APIC_COUNT];\r
60#endif\r
61\r
62} EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE;\r
63\r
64#pragma pack ()\r
65\r
66//\r
67// Multiple APIC Description Table\r
68//\r
69EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = {\r
70 EFI_ACPI_1_0_APIC_SIGNATURE,\r
71 sizeof (EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE),\r
72 EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION,\r
498f7d8d 73 0x00, // Checksum will be updated at runtime\r
74 EFI_ACPI_OEM_ID,\r
75 EFI_ACPI_OEM_TABLE_ID,\r
76 EFI_ACPI_OEM_REVISION,\r
77 EFI_ACPI_CREATOR_ID,\r
78 EFI_ACPI_CREATOR_REVISION,\r
49ba9447 79\r
80 //\r
81 // MADT specific fields\r
82 //\r
83 EFI_ACPI_LOCAL_APIC_ADDRESS,\r
84 EFI_ACPI_1_0_MULTIPLE_APIC_FLAGS,\r
54235984 85\r
49ba9447 86 //\r
87 // Processor Local APIC Structure\r
88 //\r
89\r
90 EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC, // Type\r
91 sizeof (EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC_STRUCTURE), // Length\r
54235984 92 0x00, // Processor ID\r
49ba9447 93 0x00, // Local APIC ID\r
94 0x00000001, // Flags - Enabled by default\r
95\r
96 //\r
97 // Interrupt Source Override Structure\r
98 //\r
99\r
100 //\r
101 // IRQ0=>IRQ2 Interrupt Source Override Structure\r
102 //\r
103 EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE, // Type\r
104 sizeof (EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE),// Length\r
105 0x00, // Bus - ISA\r
106 0x00, // Source - IRQ0\r
107 0x00000002, // Global System Interrupt - IRQ2\r
108 0x0000, // Flags - Conforms to specifications of the bus\r
109\r
110 //\r
111 // ISO (SCI Active High) Interrupt Source Override Structure\r
112 //\r
113 EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE, // Type\r
114 sizeof (EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE),// Length\r
115 0x00, // Bus - ISA\r
116 0x09, // Source - IRQ0\r
117 0x00000009, // Global System Interrupt - IRQ2\r
118 0x000D, // Flags - Level-tiggered, Active High\r
119\r
120 //\r
121 // IO APIC Structure\r
122 //\r
123 EFI_ACPI_1_0_IO_APIC, // Type\r
124 sizeof (EFI_ACPI_1_0_IO_APIC_STRUCTURE), // Length\r
125 0x02, // IO APIC ID\r
126 EFI_ACPI_RESERVED_BYTE, // Reserved\r
127 0xFEC00000, // IO APIC Address (physical)\r
128 0x00000000 // Global System Interrupt Base\r
129};\r
130\r
131\r
132VOID*\r
133ReferenceAcpiTable (\r
134 VOID\r
135 )\r
136{\r
137 //\r
54235984 138 // Reference the table being generated to prevent the optimizer from removing the\r
49ba9447 139 // data structure from the exeutable\r
140 //\r
141 return (VOID*)&Madt;\r
142}\r