1 /* SPDX-License-Identifier: BSD-2-Clause */ 2 /* 3 * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved. 4 * 5 * * @par Reference(s): 6 * - UEFI Platform Initialization Specification 7 * (https://uefi.org/specs/PI/1.8/index.html) 8 */ 9 10 #ifndef __MPINFO_H 11 #define __MPINFO_H 12 13 #include <stdbool.h> 14 #include <stdint.h> 15 #include <util.h> 16 17 /* 18 * Value used in the NumberProcessors parameter of 19 * the GetProcessorInfo function 20 */ 21 #define CPU_V2_EXTENDED_TOPOLOGY BIT(24) 22 23 /* 24 * This bit is used in the StatusFlag field of EFI_PROCESSOR_INFORMATION and 25 * indicates whether the processor is playing the role of BSP. 26 * If the bit is 1, then the processor is BSP. Otherwise, it is AP. 27 */ 28 #define PROCESSOR_AS_BSP_BIT BIT(0) 29 30 /* 31 * This bit is used in the StatusFlag field of EFI_PROCESSOR_INFORMATION and 32 * indicates whether the processor is enabled. If the bit is 1, 33 * then the processor is enabled. Otherwise, it is disabled. 34 */ 35 #define PROCESSOR_ENABLED_BIT BIT(1) 36 37 /* 38 * This bit is used in the StatusFlag field of EFI_PROCESSOR_INFORMATION and 39 * indicates whether the processor is healthy. If the bit is 1, then the 40 * processor is healthy. Otherwise, 41 * some fault has been detected for the processor. 42 */ 43 #define PROCESSOR_HEALTH_STATUS_BIT BIT(2) 44 45 /* 46 * Structure that describes the pyhiscal location of a logical CPU. 47 */ 48 struct efi_cpu_physical_location { 49 uint32_t package; 50 uint32_t core; 51 uint32_t thread; 52 }; 53 54 /* 55 * Structure that defines the 6-level physical location of the processor 56 */ 57 struct efi_cpu_physical_location2 { 58 uint32_t package; 59 uint32_t module; 60 uint32_t tile; 61 uint32_t die; 62 uint32_t core; 63 uint32_t thread; 64 }; 65 66 union extended_processor_information { 67 /* 68 * The 6-level physical location of the processor, including 69 * the physical package number that identifies the cartridge, 70 * the physical module number within package, 71 * the physical tile number within the module, 72 * the physical die number within the tile, 73 * the physical core number within package, and 74 * logical thread number within core. 75 */ 76 struct efi_cpu_physical_location2 location2; 77 }; 78 79 /* 80 * Structure that describes information about a logical CPU. 81 */ 82 struct efi_processor_information { 83 /* 84 * The unique processor ID determined by system hardware. 85 */ 86 uint64_t processor_id; 87 88 /* 89 * Flags indicating if the processor is BSP or AP, 90 * if the processor is enabled or disabled, and 91 * if the processor is healthy. 92 * Bits 3..31 are reserved and must be 0. 93 * 94 * BSP ENABLED HEALTH Description 95 * === ======= ====== =============================================== 96 * 0 0 0 Unhealthy Disabled AP. 97 * 0 0 1 Healthy Disabled AP. 98 * 0 1 0 Unhealthy Enabled AP. 99 * 0 1 1 Healthy Enabled AP. 100 * 1 0 0 Invalid. The BSP can never be in the disabled state. 101 * 1 0 1 Invalid. The BSP can never be in the disabled state. 102 * 1 1 0 Unhealthy Enabled BSP. 103 * 1 1 1 Healthy Enabled BSP. 104 */ 105 uint32_t status_flags; 106 107 /* 108 * The physical location of the processor, including 109 * the physical package number that identifies the cartridge, 110 * the physical core number within package, and logical thread number 111 * within core. 112 */ 113 struct efi_cpu_physical_location location; 114 115 /* 116 * The extended information of the processor. 117 * This field is filled only when CPU_V2_EXTENDED_TOPOLOGY is set 118 * in parameter ProcessorNumber. 119 */ 120 union extended_processor_information extended_information; 121 }; 122 123 struct efi_mp_information_hob_data { 124 uint64_t number_of_processors; 125 uint64_t number_of_enabled_processors; 126 struct efi_processor_information processor_info[]; 127 }; 128 129 #endif 130 131