Madt30.aslc 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. /*++
  2. Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>
  3. SPDX-License-Identifier: BSD-2-Clause-Patent
  4. Module Name:
  5. Madt3.0.c
  6. Abstract:
  7. This file contains a structure definition for the ACPI 2.0 Multiple APIC
  8. Description Table (MADT). Any changes to the MADT table require updating the
  9. respective structure count in Madt.h and then adding the structure to the
  10. MADT defined in this file. The table layout is defined in Madt.h and the
  11. table contents are defined in Acpi3_0.h and Madt.h.
  12. --*/
  13. //
  14. // Statements that include other files
  15. //
  16. #include "Madt.h"
  17. #include <IndustryStandard/Acpi50.h>
  18. //
  19. // Multiple APIC Description Table
  20. //
  21. EFI_ACPI_3_0_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = {
  22. EFI_ACPI_3_0_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE, // **Signatures are the same 1.0-3.0 because it says "APIC".
  23. sizeof (EFI_ACPI_3_0_MULTIPLE_APIC_DESCRIPTION_TABLE), // **Length
  24. EFI_ACPI_5_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION,
  25. //
  26. // EFI_ACPI_3_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION, // **Table Revision must be 2.0 for ACPI 3.0
  27. // Checksum will be updated at runtime
  28. //
  29. 0x00, // **Check sum
  30. //
  31. // It is expected that these values will be programmed at runtime
  32. //
  33. ' ', // OEMID
  34. ' ', // Creative way to
  35. ' ', // make six bytes
  36. ' ', // of space in
  37. ' ', // a table for
  38. ' ', // **OEMID
  39. 0, // **OEM Table ID
  40. EFI_ACPI_OEM_MADT_REVISION, // **OEM Revision
  41. 0, // **Creator ID
  42. 0, // **Creator Revision
  43. //
  44. // MADT specific fields
  45. //
  46. LOCAL_APIC_ADDRESS, // **Local APIC Address
  47. EFI_ACPI_4_0_MULTIPLE_APIC_FLAGS, // **Flags
  48. //
  49. // Processor Local APIC Structure
  50. // Correct processor order, Primary threads first then Hyper threads
  51. // And correct APIC-ids
  52. // This text below is included as a reference until Thurley is 100%:
  53. // According to EDS the Local APIC ID is determined based of a bit structure
  54. // Bit 24: Core ID Bit 25: Core Pair ID Bit 26-27: Reserved Bit 28-30: Socket ID Bit 31: Reserved
  55. // 4 Sockets and 4 Cores per Socket.
  56. // So possible LAPIC IDs 00, 01, 02, 03, 10, 11, 12, 13, 20, 21, 22, 23, 30, 31, 32, 33
  57. // Static Entries 00, 10, 20, 30, 01, 11, 21, 31, 02, 12, 22, 32, 03, 13, 23, 33
  58. // BSP needs to be first entry in table. Check before boot. If BSP non zero need to rotate the entries.
  59. // Suppore BSP is LAPIC ID xy. Rotate the table by using formula [x + (y * 4)]
  60. // So if BSP LAPIC ID is 21 then table rotated 6 times.
  61. // End of Reference Text.
  62. // Thurley is supposed to be 2 sockets, 4 cores, and hyperthreading available per each core.
  63. // 2 (sockets) x 4 (cores) = 8 (processors non-HT), 8 (processors non-HT) x 2 (HT/proc) = 16 (HT procs)
  64. // Rhyme & reason of the ordering below. This is a best guess ordering for now,
  65. // Thurley EPS may give better info on LAPIC numbers.
  66. // Ordering was established to help dissipate heat across two sockets evenly.
  67. // Since logical processor number only has to be unique, I followed
  68. // a similar approach to high end servers and have the first digit of the LAPIC
  69. // id the socket number.
  70. //
  71. EFI_ACPI_3_0_PROCESSOR_LOCAL_APIC, // Type 0x00
  72. sizeof (EFI_ACPI_3_0_PROCESSOR_LOCAL_APIC_STRUCTURE), // Length
  73. 0x01, // Processor ID
  74. 0x00, // Local APIC ID
  75. 0x00000001, // Flags - Disabled (until initialized by platform driver)
  76. EFI_ACPI_3_0_PROCESSOR_LOCAL_APIC, // Type
  77. sizeof (EFI_ACPI_3_0_PROCESSOR_LOCAL_APIC_STRUCTURE), // Length
  78. 0x02, // Processor ID
  79. 0x04, // Local APIC ID
  80. 0x00000001, // Flags - Disabled (until initialized by platform driver)
  81. EFI_ACPI_3_0_PROCESSOR_LOCAL_APIC, // Type
  82. sizeof (EFI_ACPI_3_0_PROCESSOR_LOCAL_APIC_STRUCTURE), // Length
  83. 0x03, // Processor ID
  84. 0x02, // Local APIC ID
  85. 0x00000001, // Flags - Disabled (until initialized by platform driver)
  86. EFI_ACPI_3_0_PROCESSOR_LOCAL_APIC, // Type
  87. sizeof (EFI_ACPI_3_0_PROCESSOR_LOCAL_APIC_STRUCTURE), // Length
  88. 0x04, // Processor ID
  89. 0x06, // Local APIC ID
  90. 0x00000001, // Flags - Disabled (until initialized by platform driver)
  91. //
  92. // *************** IO APIC Structure ******************
  93. //
  94. //
  95. //
  96. // ************************** I/O APIC **************
  97. //
  98. EFI_ACPI_3_0_IO_APIC, // Type 0x01
  99. sizeof (EFI_ACPI_3_0_IO_APIC_STRUCTURE), // Length
  100. ICH_IOAPIC_ID, // IO APIC ID
  101. EFI_ACPI_RESERVED_BYTE, // Reserved EFI_ACPI_RESERVED_BYTE
  102. IO_APIC_ADDRESS, // IO APIC Address (physical) 0xFEC00000
  103. 0x18 * 0, // Global System Interrupt Base
  104. //
  105. // Interrupt Source Override Structure: Sample
  106. //
  107. // EFI_ACPI_2_0_INTERRUPT_SOURCE_OVERRIDE, // Type 0x02
  108. // sizeof (EFI_ACPI_2_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE),// Length
  109. // 0x00, // Bus
  110. // 0x00, // Source
  111. // 0x00000000, // Global System Interrupt
  112. // 0x0000, // Flags
  113. //
  114. // IRQ0=>IRQ2 Interrupt Source Override Structure
  115. //
  116. EFI_ACPI_3_0_INTERRUPT_SOURCE_OVERRIDE, // Type 0x02
  117. sizeof (EFI_ACPI_3_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE), // Length
  118. 0x00, // Bus - ISA
  119. 0x00, // Source - IRQ0
  120. 0x00000002, // Global System Interrupt - IRQ2
  121. 0x0000, // Flags - Conforms to specifications of the bus
  122. //
  123. // ISO (SCI Active High) Interrupt Source Override Structure
  124. //
  125. EFI_ACPI_3_0_INTERRUPT_SOURCE_OVERRIDE, // Type 0x02
  126. sizeof (EFI_ACPI_3_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE), // Length
  127. 0x00, // Bus - ISA
  128. 0x09, // Source - IRQ0
  129. 0x00000009, // Global System Interrupt - IRQ2
  130. 0x000D, // Flags - Level-tiggered, Active High
  131. EFI_ACPI_3_0_LOCAL_APIC_NMI, // Type
  132. sizeof (EFI_ACPI_3_0_LOCAL_APIC_NMI_STRUCTURE), // Length
  133. 0x01, // ACPI Processor ID
  134. 0x000D, // Flags - Level-tiggered, Active High
  135. 0x01, // Local APIC LINT#
  136. EFI_ACPI_3_0_LOCAL_APIC_NMI, // Type
  137. sizeof (EFI_ACPI_3_0_LOCAL_APIC_NMI_STRUCTURE), // Length
  138. 0x02, // ACPI Processor ID
  139. 0x000D, // Flags - Level-tiggered, Active High
  140. 0x01, // Local APIC LINT#
  141. EFI_ACPI_3_0_LOCAL_APIC_NMI, // Type
  142. sizeof (EFI_ACPI_3_0_LOCAL_APIC_NMI_STRUCTURE), // Length
  143. 0x03, // ACPI Processor ID
  144. 0x000D, // Flags - Level-tiggered, Active High
  145. 0x01, // Local APIC LINT#
  146. EFI_ACPI_3_0_LOCAL_APIC_NMI, // Type
  147. sizeof (EFI_ACPI_3_0_LOCAL_APIC_NMI_STRUCTURE), // Length
  148. 0x04, // ACPI Processor ID
  149. 0x000D, // Flags - Level-tiggered, Active High
  150. 0x01, // Local APIC LINT#
  151. };
  152. VOID*
  153. ReferenceAcpiTable (
  154. VOID
  155. )
  156. {
  157. //
  158. // Reference the table being generated to prevent the optimizer from
  159. // removing the data structure from the executable
  160. //
  161. return (VOID*)&Madt;
  162. }