summaryrefslogtreecommitdiff
path: root/Platform/AMD/AgesaModulePkg/Include/Protocol/FabricNumaServices2.h
blob: a16f4084e43405cada8e97fd8504e4cba4b62793 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/** @file

  Copyright (C) 2018-2025 Advanced Micro Devices, Inc. All rights reserved.<BR>

  SPDX-License-Identifier: BSD-2-Clause-Patent

**/

#ifndef FABRIC_NUMA_SERVICES2_H_
#define FABRIC_NUMA_SERVICES2_H_
#include "AMD.h"

#pragma pack (push, 1)

#define  MAX_PXM_VALUES_PER_QUADRANT  16

/// Domain type
typedef enum {
  NumaDram,
  NumaSLink,
  NumaCxl,
  MaxNumaDomainType2
} DOMAIN_TYPE2;

/// Reported Domain Info
typedef struct {
  DOMAIN_TYPE2    Type;           ///< Type
  UINT32          SocketMap;      ///< Bitmap indicating physical socket location
  UINT32          PhysicalDomain; ///< Physical domain number
} DOMAIN_INFO2;

/// Physical Dram Info
typedef struct {
  UINT32    NormalizedCsMap;                  ///< Bitmap of CSs comprising this physical domain
  UINT32    SharingEntityCount;               ///< Number of virtual domains sharing this physical domain
  UINT32    SharingEntityMap;                 ///< Bitmap of reported domains that share this physical domain
  UINT32    Reserved;                         ///< Reserved
} PHYS_DOMAIN_INFO;

/// Proximity Domain Info
typedef struct {
  UINTN    Count;                               ///< Entries in Domain array
  UINTN    Domain[MAX_PXM_VALUES_PER_QUADRANT]; ///< Domains in Quadrant
} PXM_DOMAIN_INFO;

///
/// Forward declaration for the FABRIC_NUMA_SERVICES2_PROTOCOL
///
typedef struct _FABRIC_NUMA_SERVICES2_PROTOCOL FABRIC_NUMA_SERVICES2_PROTOCOL;

/**
 * @brief Get the numa domain information.
 *
 * @details Get the numa domain information.
 *
 * @param[in]   This                       A pointer to the FABRIC_NUMA_SERVICES2_PROTOCOL instance.
 * @param[out]  NumberOfDomainsInSystem    Number of unique NUMA domains
 * @param[out]  DomainInfo                 An array with information about each domain
 * @param[out]  CcxAsNumaDomain            TRUE: each core complex is its own domain
 *                                         FALSE: physical mapping is employed
 * @retval EFI_STATUS                      0: Success, NonZero: Standard EFI Error.
 */
typedef
EFI_STATUS
(EFIAPI *FABRIC_NUMA_SERVICES2_GET_DOMAIN_INFO)(
  IN       FABRIC_NUMA_SERVICES2_PROTOCOL  *This,
  OUT   UINT32                          *NumberOfDomainsInSystem,
  OUT   DOMAIN_INFO2                   **DomainInfo,
  OUT   BOOLEAN                         *CcxAsNumaDomain
  );

/**
 * @brief Translates a core's physical location to the appropriate NUMA domain.
 *
 * @details Translates a core's physical location to the appropriate NUMA domain.
 *
 * @param[in]  This               A pointer to the FABRIC_NUMA_SERVICES2_PROTOCOL instance.
 * @param[in]  Socket             Zero based socket that the core is attached to
 * @param[in]  Die                DF die on socket that the core is attached to
 * @param[in]  Ccd                Logical CCD the core is on
 * @param[in]  Ccx                Logical core complex
 * @param[out] Domain             Domain the core belongs to
 * @retval EFI_STATUS             0: Success, NonZero: Standard EFI Error.
 */
typedef
EFI_STATUS
(EFIAPI *FABRIC_NUMA_SERVICES2_DOMAIN_XLAT)(
  IN       FABRIC_NUMA_SERVICES2_PROTOCOL  *This,
  IN       UINTN                            Socket,
  IN       UINTN                            Die,
  IN       UINTN                            Ccd,
  IN       UINTN                            Ccx,
  OUT   UINT32                          *Domain
  );

/**
 * @brief Get physical numa domain information.
 *
 * @details Get physical numa domain information.
 *
 * @param[in]  This                           A pointer to the FABRIC_NUMA_SERVICES2_PROTOCOL instance.
 * @param[out] NumberOfPhysDomainsInSystem    Number of valid domains in the system
 * @param[out] PhysDomainInfo                 An array with information about each physical domain
 * @param[out] PhysNodesPerSocket             Actual NPS as determined by ABL (not including SLink)
 * @param[out] NumberOfSystemSLinkDomains     Number of domains describing SLink connected memory
 * @retval EFI_STATUS                         0: Success, NonZero: Standard EFI Error.
 */
typedef
EFI_STATUS
(EFIAPI *FABRIC_NUMA_SERVICES2_GET_PHYSICAL_DOMAIN_INFO)(
  IN       FABRIC_NUMA_SERVICES2_PROTOCOL  *This,
  OUT   UINT32                          *NumberOfPhysDomainsInSystem,
  OUT   PHYS_DOMAIN_INFO               **PhysDomainInfo,
  OUT   UINT32                          *PhysNodesPerSocket,
  OUT   UINT32                          *NumberOfSystemSLinkDomains
  );

/**
 * @brief Get the proximity domain information about a PCIe root-port bridge
 *
 * @details Get the proximity domain information about a PCIe root-port bridge
 *
 * @param[in]  This                           A pointer to the FABRIC_NUMA_SERVICES2_PROTOCOL instance.
 * @param[in]  RootPortBDF                    BDF for root-port bridge in PCI_ADDR format.
 * @param[out] PxmDomainInfo                  Pointer to a structure returning associated NUMA node(s).
 * @retval EFI_STATUS                         0: Success, NonZero: Standard EFI Error.
 */
typedef
EFI_STATUS
(EFIAPI *FABRIC_NUMA_SERVICES2_GET_PROXIMITY_DOMAIN_INFO)(
  IN       FABRIC_NUMA_SERVICES2_PROTOCOL  *This,
  IN       PCI_ADDR                         RootPortBDF,
  OUT   PXM_DOMAIN_INFO                 *PxmDomainInfo
  );

///
/// When installed, the Fabric NUMA Services 2 Protocol produces a collection of
/// services that return various information associated with non-uniform memory
/// architecture.
///
struct _FABRIC_NUMA_SERVICES2_PROTOCOL {
  UINTN                                              Revision;          ///< Revision Number
  FABRIC_NUMA_SERVICES2_GET_DOMAIN_INFO              GetDomainInfo;     ///< Get Domain Info
  FABRIC_NUMA_SERVICES2_DOMAIN_XLAT                  DomainXlat;        ///< Domain Translation
  FABRIC_NUMA_SERVICES2_GET_PHYSICAL_DOMAIN_INFO     GetPhysDomainInfo; ///< Get Physical Domain Info
  FABRIC_NUMA_SERVICES2_GET_PROXIMITY_DOMAIN_INFO    GetPxmDomainInfo;  ///< Get Proximity Domain Info
};

///
/// Guid declaration for the FABRIC_NUMA_SERVICES2_PROTOCOL.
///
extern EFI_GUID  gAmdFabricNumaServices2ProtocolGuid;

#pragma pack (pop)
#endif // _FABRIC_NUMA_SERVICES2_H_