]> git.proxmox.com Git - mirror_edk2.git/blob - QuarkPlatformPkg/Acpi/Dxe/AcpiPlatform/Madt.h
QuarkPlatformPkg: Add new package for Galileo boards
[mirror_edk2.git] / QuarkPlatformPkg / Acpi / Dxe / AcpiPlatform / Madt.h
1 /** @file
2 This file describes the contents of the ACPI Multiple APIC Description
3 Table (MADT). Some additional ACPI values are defined in Acpi10.h and
4 Acpi20.h.
5 To make changes to the MADT, it is necessary to update the count for the
6 APIC structure being updated, and to modify table found in Madt.c.
7
8 Copyright (c) 2013-2015 Intel Corporation.
9
10 This program and the accompanying materials
11 are licensed and made available under the terms and conditions of the BSD License
12 which accompanies this distribution. The full text of the license may be found at
13 http://opensource.org/licenses/bsd-license.php
14
15 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
16 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17
18
19 **/
20
21 #ifndef _MADT_H
22 #define _MADT_H
23
24
25 //
26 // Statements that include other files
27 //
28
29 #include <IndustryStandard/Acpi.h>
30 #include <Library/PcdLib.h>
31
32 //
33 // MADT Definitions
34 //
35
36 #define EFI_ACPI_OEM_MADT_REVISION 0x00000001
37
38 //
39 // Local APIC address
40 //
41
42 #define EFI_ACPI_LOCAL_APIC_ADDRESS 0xFEE00000
43
44 //
45 // Multiple APIC Flags are defined in AcpiX.0.h
46 //
47 #define EFI_ACPI_1_0_MULTIPLE_APIC_FLAGS (EFI_ACPI_1_0_PCAT_COMPAT)
48 #define EFI_ACPI_2_0_MULTIPLE_APIC_FLAGS (EFI_ACPI_2_0_PCAT_COMPAT)
49
50 //
51 // Define the number of each table type.
52 // This is where the table layout is modified.
53 //
54
55 #define EFI_ACPI_PROCESSOR_LOCAL_APIC_COUNT 2
56 #define EFI_ACPI_IO_APIC_COUNT 1
57 #define EFI_ACPI_INTERRUPT_SOURCE_OVERRIDE_COUNT 2
58 #define EFI_ACPI_NON_MASKABLE_INTERRUPT_SOURCE_COUNT 0
59 #define EFI_ACPI_LOCAL_APIC_NMI_COUNT 2
60 #define EFI_ACPI_LOCAL_APIC_ADDRESS_OVERRIDE_COUNT 0
61 #define EFI_ACPI_IO_SAPIC_COUNT 0
62 #define EFI_ACPI_PROCESSOR_LOCAL_SAPIC_COUNT 0
63 #define EFI_ACPI_PLATFORM_INTERRUPT_SOURCES_COUNT 0
64
65 #define EFI_ACPI_INTERRUPT_SOURCE_OVERRIDE_COUNT_MAX 16
66
67 //
68 // MADT structure
69 //
70
71 //
72 // Ensure proper structure formats
73 //
74 #pragma pack (1)
75
76 //
77 // ACPI 1.0 Table structure
78 //
79 typedef struct {
80 EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER Header;
81
82 #if EFI_ACPI_PROCESSOR_LOCAL_APIC_COUNT > 0
83 EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC_STRUCTURE LocalApic[EFI_ACPI_PROCESSOR_LOCAL_APIC_COUNT];
84 #endif
85
86 #if EFI_ACPI_IO_APIC_COUNT > 0
87 EFI_ACPI_1_0_IO_APIC_STRUCTURE IoApic[EFI_ACPI_IO_APIC_COUNT];
88 #endif
89
90 #if EFI_ACPI_INTERRUPT_SOURCE_OVERRIDE_COUNT > 0
91 EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE Iso[EFI_ACPI_INTERRUPT_SOURCE_OVERRIDE_COUNT];
92 #endif
93
94 #if EFI_ACPI_NON_MASKABLE_INTERRUPT_SOURCE_COUNT > 0
95 EFI_ACPI_1_0_NON_MASKABLE_INTERRUPT_SOURCE_STRUCTURE NmiSource[EFI_ACPI_NON_MASKABLE_INTERRUPT_SOURCE_COUNT];
96 #endif
97
98 #if EFI_ACPI_LOCAL_APIC_NMI_COUNT > 0
99 EFI_ACPI_1_0_LOCAL_APIC_NMI_STRUCTURE LocalApicNmi[EFI_ACPI_LOCAL_APIC_NMI_COUNT];
100 #endif
101
102 #if EFI_ACPI_LOCAL_APIC_ADDRESS_OVERRIDE_COUNT > 0
103 EFI_ACPI_1_0_LOCAL_APIC_ADDRESS_OVERRIDE_STRUCTURE LocalApicOverride[EFI_ACPI_LOCAL_APIC_OVERRIDE_COUNT];
104 #endif
105
106 } EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE;
107
108 //
109 // ACPI 2.0 Table structure
110 //
111 typedef struct {
112 EFI_ACPI_2_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER Header;
113
114 #if EFI_ACPI_PROCESSOR_LOCAL_APIC_COUNT > 0
115 EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC_STRUCTURE LocalApic[EFI_ACPI_PROCESSOR_LOCAL_APIC_COUNT];
116 #endif
117
118 #if EFI_ACPI_IO_APIC_COUNT > 0
119 EFI_ACPI_2_0_IO_APIC_STRUCTURE IoApic[EFI_ACPI_IO_APIC_COUNT];
120 #endif
121
122 #if EFI_ACPI_INTERRUPT_SOURCE_OVERRIDE_COUNT > 0
123 EFI_ACPI_2_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE Iso[EFI_ACPI_INTERRUPT_SOURCE_OVERRIDE_COUNT];
124 #endif
125
126 #if EFI_ACPI_NON_MASKABLE_INTERRUPT_SOURCE_COUNT > 0
127 EFI_ACPI_2_0_NON_MASKABLE_INTERRUPT_SOURCE_STRUCTURE NmiSource[EFI_ACPI_NON_MASKABLE_INTERRUPT_SOURCE_COUNT];
128 #endif
129
130 #if EFI_ACPI_LOCAL_APIC_NMI_COUNT > 0
131 EFI_ACPI_2_0_LOCAL_APIC_NMI_STRUCTURE LocalApicNmi[EFI_ACPI_LOCAL_APIC_NMI_COUNT];
132 #endif
133
134 #if EFI_ACPI_LOCAL_APIC_ADDRESS_OVERRIDE_COUNT > 0
135 EFI_ACPI_2_0_LOCAL_APIC_ADDRESS_OVERRIDE_STRUCTURE LocalApicOverride[EFI_ACPI_LOCAL_APIC_ADDRESS_OVERRIDE_COUNT];
136 #endif
137
138 #if EFI_ACPI_IO_SAPIC_COUNT > 0
139 EFI_ACPI_2_0_IO_SAPIC_STRUCTURE IoSapic[EFI_ACPI_IO_SAPIC_COUNT];
140 #endif
141
142 #if EFI_ACPI_PROCESSOR_LOCAL_SAPIC_COUNT > 0
143 EFI_ACPI_2_0_PROCESSOR_LOCAL_SAPIC_STRUCTURE LocalSapic[EFI_ACPI_PROCESSOR_LOCAL_SAPIC_COUNT];
144 #endif
145
146 #if EFI_ACPI_PLATFORM_INTERRUPT_SOURCES_COUNT > 0
147 EFI_ACPI_2_0_PLATFORM_INTERRUPT_SOURCES_STRUCTURE PlatformInterruptSources[EFI_ACPI_PLATFORM_INTERRUPT_SOURCES_COUNT];
148 #endif
149
150 } EFI_ACPI_2_0_MULTIPLE_APIC_DESCRIPTION_TABLE;
151
152 #define _PcdIntSettingTblEnable(x) PcdGet8 (PcdInterruptOverrideSettingTable##x##Enable)
153 #define PcdIntSettingTblEnable(x) _PcdIntSettingTblEnable(x)
154
155 #define _PcdIntSettingTblSourceIrq(x) PcdGet8 (PcdInterruptOverrideSettingTable##x##Enable)
156 #define PcdIntSettingTblSourceIrq(x) _PcdIntSettingTblSourceIrq(x)
157
158 #define _PcdIntSettingTblPolarity(x) PcdGet8 (PcdInterruptOverrideSettingTable##x##Polarity)
159 #define PcdIntSettingTblPolarity(x) _PcdIntSettingTblPolarity(x)
160
161 #define _PcdIntSettingTableTrigerMode(x) PcdGet8 (PcdInterruptOverrideSettingTable##x##TrigerMode)
162 #define PcdIntSettingTableTrigerMode(x) _PcdIntSettingTableTrigerMode(x)
163
164 #define _PcdIntSettingTableGlobalIrq(x) PcdGet32 (PcdInterruptOverrideSettingTable##x##GlobalIrq)
165 #define PcdIntSettingTableGlobalIrq(x) _PcdIntSettingTableGlobalIrq(x)
166
167 typedef struct {
168 UINT8 Enable;
169 UINT8 SourceIrq;
170 UINT8 Polarity;
171 UINT8 TrigerMode;
172 UINT32 GlobalIrq;
173 } INTERRUPT_OVERRIDE_SETTING;
174
175
176 typedef struct {
177 UINT32 IoApicAddress;
178 UINT32 GlobalInterruptBase;
179 UINT8 IoApicId;
180 UINT8 NmiEnable;
181 UINT8 NmiSource;
182 UINT8 Polarity;
183 UINT8 TrigerMode;
184 } IO_APIC_SETTING;
185
186 typedef struct {
187 UINT8 NmiEnabelApicIdMask;
188 UINT8 AddressOverrideEnable;
189 UINT8 Polarity;
190 UINT8 TrigerMode;
191 UINT8 LocalApicLint;
192 UINT8 Reserve[3];
193 UINT32 LocalApicAddress;
194 UINT64 LocalApicAddressOverride;
195 } LOCAL_APIC_SETTING;
196
197 typedef struct _MADT_CONFIG_DATA {
198 INTERRUPT_OVERRIDE_SETTING MadtInterruptSetting[EFI_ACPI_INTERRUPT_SOURCE_OVERRIDE_COUNT_MAX];
199 IO_APIC_SETTING MadtIoApicSetting;
200 LOCAL_APIC_SETTING MadtLocalApicSetting;
201 }MADT_CONFIG_DATA;
202
203 #pragma pack ()
204
205 EFI_STATUS
206 EFIAPI
207 MadtTableInitialize (
208 OUT EFI_ACPI_COMMON_HEADER **MadtTable,
209 OUT UINTN *Size
210 );
211
212
213 #endif