1 /*++ 2 3 Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR> 4 5 This program and the accompanying materials are licensed and made available under 6 the terms and conditions of the BSD License that accompanies this distribution. 7 The full text of the license may be found at 8 http://opensource.org/licenses/bsd-license.php. 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 13 14 Module Name: 15 16 Madt.h 17 18 Abstract: 19 20 This file describes the contents of the ACPI Multiple APIC Description 21 Table (MADT). Some additional ACPI values are defined in Acpi1_0.h and 22 Acpi2_0.h. 23 To make changes to the MADT, it is necessary to update the count for the 24 APIC structure being updated, and to modify table found in Madt.c. 25 26 --*/ 27 28 #ifndef _MADT_H 29 #define _MADT_H 30 31 // 32 // Statements that include other files 33 // 34 #include "AcpiTablePlatform.h" 35 #include <IndustryStandard/Acpi10.h> 36 #include <IndustryStandard/Acpi20.h> 37 #include <IndustryStandard/Acpi30.h> 38 #include "Platform.h" 39 40 // 41 // MADT Definitions 42 // 43 #define EFI_ACPI_OEM_MADT_REVISION 0x00000000 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 #define EFI_ACPI_3_0_MULTIPLE_APIC_FLAGS (EFI_ACPI_3_0_PCAT_COMPAT) 50 #define EFI_ACPI_4_0_MULTIPLE_APIC_FLAGS (EFI_ACPI_4_0_PCAT_COMPAT) 51 52 // 53 // Define the number of each table type. 54 // This is where the table layout is modified. 55 // 56 #define EFI_ACPI_PROCESSOR_LOCAL_APIC_COUNT MAX_CPU_NUM 57 #define EFI_ACPI_LOCAL_APIC_NMI_COUNT MAX_CPU_NUM 58 #define EFI_ACPI_IO_APIC_COUNT 1 59 #define EFI_ACPI_INTERRUPT_SOURCE_OVERRIDE_COUNT 2 60 #define EFI_ACPI_NON_MASKABLE_INTERRUPT_SOURCE_COUNT 0 61 #define EFI_ACPI_LOCAL_APIC_ADDRESS_OVERRIDE_COUNT 0 62 #define EFI_ACPI_IO_SAPIC_COUNT 0 63 #define EFI_ACPI_PROCESSOR_LOCAL_SAPIC_COUNT 0 64 #define EFI_ACPI_PLATFORM_INTERRUPT_SOURCES_COUNT 0 65 66 // 67 // MADT structure 68 // 69 // 70 // Ensure proper structure formats 71 // 72 #pragma pack(1) 73 // 74 // ACPI 1.0 Table structure 75 // 76 typedef struct { 77 EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER Header; 78 79 #if EFI_ACPI_PROCESSOR_LOCAL_APIC_COUNT > 0 80 EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC_STRUCTURE LocalApic[EFI_ACPI_PROCESSOR_LOCAL_APIC_COUNT]; 81 #endif 82 83 #if EFI_ACPI_IO_APIC_COUNT > 0 84 EFI_ACPI_1_0_IO_APIC_STRUCTURE IoApic[EFI_ACPI_IO_APIC_COUNT]; 85 #endif 86 87 #if EFI_ACPI_INTERRUPT_SOURCE_OVERRIDE_COUNT > 0 88 EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE Iso[EFI_ACPI_INTERRUPT_SOURCE_OVERRIDE_COUNT]; 89 #endif 90 91 #if EFI_ACPI_NON_MASKABLE_INTERRUPT_SOURCE_COUNT > 0 92 EFI_ACPI_1_0_NON_MASKABLE_INTERRUPT_SOURCE_STRUCTURE NmiSource[EFI_ACPI_NON_MASKABLE_INTERRUPT_SOURCE_COUNT]; 93 #endif 94 95 #if EFI_ACPI_LOCAL_APIC_NMI_COUNT > 0 96 EFI_ACPI_1_0_LOCAL_APIC_NMI_STRUCTURE LocalApicNmi[EFI_ACPI_LOCAL_APIC_NMI_COUNT]; 97 #endif 98 99 #if EFI_ACPI_LOCAL_APIC_ADDRESS_OVERRIDE_COUNT > 0 100 EFI_ACPI_1_0_LOCAL_APIC_ADDRESS_OVERRIDE_STRUCTURE LocalApicOverride[EFI_ACPI_LOCAL_APIC_ADDRESS_OVERRIDE_COUNT]; 101 #endif 102 103 } EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE; 104 105 // 106 // ACPI 2.0 Table structure 107 // 108 typedef struct { 109 EFI_ACPI_2_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER Header; 110 111 #if EFI_ACPI_PROCESSOR_LOCAL_APIC_COUNT > 0 112 EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC_STRUCTURE LocalApic[EFI_ACPI_PROCESSOR_LOCAL_APIC_COUNT]; 113 #endif 114 115 #if EFI_ACPI_IO_APIC_COUNT > 0 116 EFI_ACPI_2_0_IO_APIC_STRUCTURE IoApic[EFI_ACPI_IO_APIC_COUNT]; 117 #endif 118 119 #if EFI_ACPI_INTERRUPT_SOURCE_OVERRIDE_COUNT > 0 120 EFI_ACPI_2_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE Iso[EFI_ACPI_INTERRUPT_SOURCE_OVERRIDE_COUNT]; 121 #endif 122 123 #if EFI_ACPI_NON_MASKABLE_INTERRUPT_SOURCE_COUNT > 0 124 EFI_ACPI_2_0_NON_MASKABLE_INTERRUPT_SOURCE_STRUCTURE NmiSource[EFI_ACPI_NON_MASKABLE_INTERRUPT_SOURCE_COUNT]; 125 #endif 126 127 #if EFI_ACPI_LOCAL_APIC_NMI_COUNT > 0 128 EFI_ACPI_2_0_LOCAL_APIC_NMI_STRUCTURE LocalApicNmi[EFI_ACPI_LOCAL_APIC_NMI_COUNT]; 129 #endif 130 131 #if EFI_ACPI_LOCAL_APIC_ADDRESS_OVERRIDE_COUNT > 0 132 EFI_ACPI_2_0_LOCAL_APIC_ADDRESS_OVERRIDE_STRUCTURE LocalApicOverride[EFI_ACPI_LOCAL_APIC_ADDRESS_OVERRIDE_COUNT]; 133 #endif 134 135 #if EFI_ACPI_IO_SAPIC_COUNT > 0 136 EFI_ACPI_2_0_IO_SAPIC_STRUCTURE IoSapic[EFI_ACPI_IO_SAPIC_COUNT]; 137 #endif 138 139 #if EFI_ACPI_PROCESSOR_LOCAL_SAPIC_COUNT > 0 140 EFI_ACPI_2_0_PROCESSOR_LOCAL_SAPIC_STRUCTURE LocalSapic[EFI_ACPI_PROCESSOR_LOCAL_SAPIC_COUNT]; 141 #endif 142 143 #if EFI_ACPI_PLATFORM_INTERRUPT_SOURCES_COUNT > 0 144 EFI_ACPI_2_0_PLATFORM_INTERRUPT_SOURCES_STRUCTURE PlatformInterruptSources[EFI_ACPI_PLATFORM_INTERRUPT_SOURCES_COUNT]; 145 #endif 146 147 } EFI_ACPI_2_0_MULTIPLE_APIC_DESCRIPTION_TABLE; 148 149 // 150 // ACPI 3.0 Table structure 151 // 152 typedef struct { 153 EFI_ACPI_3_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER Header; 154 155 #if EFI_ACPI_PROCESSOR_LOCAL_APIC_COUNT > 0 // Type 0x00 156 EFI_ACPI_3_0_PROCESSOR_LOCAL_APIC_STRUCTURE LocalApic[EFI_ACPI_PROCESSOR_LOCAL_APIC_COUNT]; 157 #endif 158 159 #if EFI_ACPI_IO_APIC_COUNT > 0 // Type 0x01 160 EFI_ACPI_3_0_IO_APIC_STRUCTURE IoApic[EFI_ACPI_IO_APIC_COUNT]; 161 #endif 162 163 #if EFI_ACPI_INTERRUPT_SOURCE_OVERRIDE_COUNT > 0 // Type 0x02 164 EFI_ACPI_3_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE Iso[EFI_ACPI_INTERRUPT_SOURCE_OVERRIDE_COUNT]; 165 #endif 166 167 #if EFI_ACPI_NON_MASKABLE_INTERRUPT_SOURCE_COUNT > 0 // Type 0x03 168 EFI_ACPI_3_0_NON_MASKABLE_INTERRUPT_SOURCE_STRUCTURE NmiSource[EFI_ACPI_NON_MASKABLE_INTERRUPT_SOURCE_COUNT]; 169 #endif 170 171 #if EFI_ACPI_LOCAL_APIC_NMI_COUNT > 0 // Type 0x04 172 EFI_ACPI_3_0_LOCAL_APIC_NMI_STRUCTURE LocalApicNmi[EFI_ACPI_LOCAL_APIC_NMI_COUNT]; 173 #endif 174 175 #if EFI_ACPI_LOCAL_APIC_ADDRESS_OVERRIDE_COUNT > 0 // Type 0x05 176 EFI_ACPI_3_0_LOCAL_APIC_ADDRESS_OVERRIDE_STRUCTURE LocalApicOverride[EFI_ACPI_LOCAL_APIC_ADDRESS_OVERRIDE_COUNT]; 177 #endif 178 179 #if EFI_ACPI_IO_SAPIC_COUNT > 0 // Type 0x06 180 EFI_ACPI_3_0_IO_SAPIC_STRUCTURE IoSapic[EFI_ACPI_IO_SAPIC_COUNT]; 181 #endif 182 183 #if EFI_ACPI_PROCESSOR_LOCAL_SAPIC_COUNT > 0 // Type 0x07 : This table changes in madt 2.0 184 EFI_ACPI_3_0_PROCESSOR_LOCAL_SAPIC_STRUCTURE LocalSapic[EFI_ACPI_PROCESSOR_LOCAL_SAPIC_COUNT]; 185 #endif 186 187 #if EFI_ACPI_PLATFORM_INTERRUPT_SOURCES_COUNT > 0 // Type 0x08 188 EFI_ACPI_3_0_PLATFORM_INTERRUPT_SOURCES_STRUCTURE PlatformInterruptSources[EFI_ACPI_PLATFORM_INTERRUPT_SOURCES_COUNT]; 189 #endif 190 191 } EFI_ACPI_3_0_MULTIPLE_APIC_DESCRIPTION_TABLE; 192 193 #pragma pack() 194 195 #endif 196