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