Skip to content

Commit 958c3a6

Browse files
skoralahdavejiang
authored andcommitted
efi/cper, cxl: Make definitions and structures global
In preparation to add tracepoint support, move protocol error UUID definition to a common location, Also, make struct CXL RAS capability, cxl_cper_sec_prot_err and CPER validation flags global for use across different modules. Signed-off-by: Smita Koralahalli <[email protected]> Reviewed-by: Jonathan Cameron <[email protected]> Reviewed-by: Ira Weiny <[email protected]> Reviewed-by: Dave Jiang <[email protected]> Reviewed-by: Fan Ni <[email protected]> Reviewed-by: Gregory Price <[email protected]> Reviewed-by: Dan Williams <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Dave Jiang <[email protected]>
1 parent 8497333 commit 958c3a6

File tree

5 files changed

+86
-85
lines changed

5 files changed

+86
-85
lines changed

drivers/firmware/efi/cper.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <linux/bcd.h>
2525
#include <acpi/ghes.h>
2626
#include <ras/ras_event.h>
27+
#include <cxl/event.h>
2728
#include "cper_cxl.h"
2829

2930
/*

drivers/firmware/efi/cper_cxl.c

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,9 @@
88
*/
99

1010
#include <linux/cper.h>
11+
#include <cxl/event.h>
1112
#include "cper_cxl.h"
1213

13-
#define PROT_ERR_VALID_AGENT_TYPE BIT_ULL(0)
14-
#define PROT_ERR_VALID_AGENT_ADDRESS BIT_ULL(1)
15-
#define PROT_ERR_VALID_DEVICE_ID BIT_ULL(2)
16-
#define PROT_ERR_VALID_SERIAL_NUMBER BIT_ULL(3)
17-
#define PROT_ERR_VALID_CAPABILITY BIT_ULL(4)
18-
#define PROT_ERR_VALID_DVSEC BIT_ULL(5)
19-
#define PROT_ERR_VALID_ERROR_LOG BIT_ULL(6)
20-
21-
/* CXL RAS Capability Structure, CXL v3.0 sec 8.2.4.16 */
22-
struct cxl_ras_capability_regs {
23-
u32 uncor_status;
24-
u32 uncor_mask;
25-
u32 uncor_severity;
26-
u32 cor_status;
27-
u32 cor_mask;
28-
u32 cap_control;
29-
u32 header_log[16];
30-
};
31-
3214
static const char * const prot_err_agent_type_strs[] = {
3315
"Restricted CXL Device",
3416
"Restricted CXL Host Downstream Port",
@@ -40,21 +22,6 @@ static const char * const prot_err_agent_type_strs[] = {
4022
"CXL Upstream Switch Port",
4123
};
4224

43-
/*
44-
* The layout of the enumeration and the values matches CXL Agent Type
45-
* field in the UEFI 2.10 Section N.2.13,
46-
*/
47-
enum {
48-
RCD, /* Restricted CXL Device */
49-
RCH_DP, /* Restricted CXL Host Downstream Port */
50-
DEVICE, /* CXL Device */
51-
LD, /* CXL Logical Device */
52-
FMLD, /* CXL Fabric Manager managed Logical Device */
53-
RP, /* CXL Root Port */
54-
DSP, /* CXL Downstream Switch Port */
55-
USP, /* CXL Upstream Switch Port */
56-
};
57-
5825
void cxl_cper_print_prot_err(const char *pfx,
5926
const struct cxl_cper_sec_prot_err *prot_err)
6027
{

drivers/firmware/efi/cper_cxl.h

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -10,57 +10,6 @@
1010
#ifndef LINUX_CPER_CXL_H
1111
#define LINUX_CPER_CXL_H
1212

13-
/* CXL Protocol Error Section */
14-
#define CPER_SEC_CXL_PROT_ERR \
15-
GUID_INIT(0x80B9EFB4, 0x52B5, 0x4DE3, 0xA7, 0x77, 0x68, 0x78, \
16-
0x4B, 0x77, 0x10, 0x48)
17-
18-
#pragma pack(1)
19-
20-
/* Compute Express Link Protocol Error Section, UEFI v2.10 sec N.2.13 */
21-
struct cxl_cper_sec_prot_err {
22-
u64 valid_bits;
23-
u8 agent_type;
24-
u8 reserved[7];
25-
26-
/*
27-
* Except for RCH Downstream Port, all the remaining CXL Agent
28-
* types are uniquely identified by the PCIe compatible SBDF number.
29-
*/
30-
union {
31-
u64 rcrb_base_addr;
32-
struct {
33-
u8 function;
34-
u8 device;
35-
u8 bus;
36-
u16 segment;
37-
u8 reserved_1[3];
38-
};
39-
} agent_addr;
40-
41-
struct {
42-
u16 vendor_id;
43-
u16 device_id;
44-
u16 subsystem_vendor_id;
45-
u16 subsystem_id;
46-
u8 class_code[2];
47-
u16 slot;
48-
u8 reserved_1[4];
49-
} device_id;
50-
51-
struct {
52-
u32 lower_dw;
53-
u32 upper_dw;
54-
} dev_serial_num;
55-
56-
u8 capability[60];
57-
u16 dvsec_len;
58-
u16 err_len;
59-
u8 reserved_2[4];
60-
};
61-
62-
#pragma pack()
63-
6413
void cxl_cper_print_prot_err(const char *pfx,
6514
const struct cxl_cper_sec_prot_err *prot_err);
6615

include/cxl/event.h

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,86 @@ struct cxl_cper_work_data {
164164
struct cxl_cper_event_rec rec;
165165
};
166166

167+
#define PROT_ERR_VALID_AGENT_TYPE BIT_ULL(0)
168+
#define PROT_ERR_VALID_AGENT_ADDRESS BIT_ULL(1)
169+
#define PROT_ERR_VALID_DEVICE_ID BIT_ULL(2)
170+
#define PROT_ERR_VALID_SERIAL_NUMBER BIT_ULL(3)
171+
#define PROT_ERR_VALID_CAPABILITY BIT_ULL(4)
172+
#define PROT_ERR_VALID_DVSEC BIT_ULL(5)
173+
#define PROT_ERR_VALID_ERROR_LOG BIT_ULL(6)
174+
175+
/*
176+
* The layout of the enumeration and the values matches CXL Agent Type
177+
* field in the UEFI 2.10 Section N.2.13,
178+
*/
179+
enum {
180+
RCD, /* Restricted CXL Device */
181+
RCH_DP, /* Restricted CXL Host Downstream Port */
182+
DEVICE, /* CXL Device */
183+
LD, /* CXL Logical Device */
184+
FMLD, /* CXL Fabric Manager managed Logical Device */
185+
RP, /* CXL Root Port */
186+
DSP, /* CXL Downstream Switch Port */
187+
USP, /* CXL Upstream Switch Port */
188+
};
189+
190+
#pragma pack(1)
191+
192+
/* Compute Express Link Protocol Error Section, UEFI v2.10 sec N.2.13 */
193+
struct cxl_cper_sec_prot_err {
194+
u64 valid_bits;
195+
u8 agent_type;
196+
u8 reserved[7];
197+
198+
/*
199+
* Except for RCH Downstream Port, all the remaining CXL Agent
200+
* types are uniquely identified by the PCIe compatible SBDF number.
201+
*/
202+
union {
203+
u64 rcrb_base_addr;
204+
struct {
205+
u8 function;
206+
u8 device;
207+
u8 bus;
208+
u16 segment;
209+
u8 reserved_1[3];
210+
};
211+
} agent_addr;
212+
213+
struct {
214+
u16 vendor_id;
215+
u16 device_id;
216+
u16 subsystem_vendor_id;
217+
u16 subsystem_id;
218+
u8 class_code[2];
219+
u16 slot;
220+
u8 reserved_1[4];
221+
} device_id;
222+
223+
struct {
224+
u32 lower_dw;
225+
u32 upper_dw;
226+
} dev_serial_num;
227+
228+
u8 capability[60];
229+
u16 dvsec_len;
230+
u16 err_len;
231+
u8 reserved_2[4];
232+
};
233+
234+
#pragma pack()
235+
236+
/* CXL RAS Capability Structure, CXL v3.0 sec 8.2.4.16 */
237+
struct cxl_ras_capability_regs {
238+
u32 uncor_status;
239+
u32 uncor_mask;
240+
u32 uncor_severity;
241+
u32 cor_status;
242+
u32 cor_mask;
243+
u32 cap_control;
244+
u32 header_log[16];
245+
};
246+
167247
#ifdef CONFIG_ACPI_APEI_GHES
168248
int cxl_cper_register_work(struct work_struct *work);
169249
int cxl_cper_unregister_work(struct work_struct *work);

include/linux/cper.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ enum {
8989
#define CPER_NOTIFY_DMAR \
9090
GUID_INIT(0x667DD791, 0xC6B3, 0x4c27, 0x8A, 0x6B, 0x0F, 0x8E, \
9191
0x72, 0x2D, 0xEB, 0x41)
92+
/* CXL Protocol Error Section */
93+
#define CPER_SEC_CXL_PROT_ERR \
94+
GUID_INIT(0x80B9EFB4, 0x52B5, 0x4DE3, 0xA7, 0x77, 0x68, 0x78, \
95+
0x4B, 0x77, 0x10, 0x48)
9296

9397
/* CXL Event record UUIDs are formatted as GUIDs and reported in section type */
9498
/*

0 commit comments

Comments
 (0)