xref: /linux/include/cxl/einj.h (revision 0c436dfe5c25d0931b164b944165259f95e5281f)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * CXL protocol Error INJection support.
4  *
5  * Copyright (c) 2023 Advanced Micro Devices, Inc.
6  * All Rights Reserved.
7  *
8  * Author: Ben Cheatham <benjamin.cheatham@amd.com>
9  */
10 #ifndef EINJ_CXL_H
11 #define EINJ_CXL_H
12 
13 #include <linux/errno.h>
14 #include <linux/types.h>
15 
16 struct pci_dev;
17 struct seq_file;
18 
19 #if IS_ENABLED(CONFIG_ACPI_APEI_EINJ_CXL)
20 int einj_cxl_available_error_type_show(struct seq_file *m, void *v);
21 int einj_cxl_inject_error(struct pci_dev *dport_dev, u64 type);
22 int einj_cxl_inject_rch_error(u64 rcrb, u64 type);
23 bool einj_cxl_is_initialized(void);
24 #else /* !IS_ENABLED(CONFIG_ACPI_APEI_EINJ_CXL) */
25 static inline int einj_cxl_available_error_type_show(struct seq_file *m,
26 						     void *v)
27 {
28 	return -ENXIO;
29 }
30 
31 static inline int einj_cxl_inject_error(struct pci_dev *dport_dev, u64 type)
32 {
33 	return -ENXIO;
34 }
35 
36 static inline int einj_cxl_inject_rch_error(u64 rcrb, u64 type)
37 {
38 	return -ENXIO;
39 }
40 
41 static inline bool einj_cxl_is_initialized(void) { return false; }
42 #endif /* CONFIG_ACPI_APEI_EINJ_CXL */
43 
44 #endif /* EINJ_CXL_H */
45