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