Merge tag 'efi-fixes-for-v6.10-3' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-block.git] / drivers / ras / ras.c
CommitLineData
b2441318 1// SPDX-License-Identifier: GPL-2.0
76ac8275
CG
2/*
3 * Copyright (C) 2014 Intel Corporation
4 *
5 * Authors:
6 * Chen, Gong <gong.chen@linux.intel.com>
7 */
8
d963cd95
CG
9#include <linux/init.h>
10#include <linux/ras.h>
297b64c7 11#include <linux/uuid.h>
d963cd95 12
3f317499
YG
13#if IS_ENABLED(CONFIG_AMD_ATL)
14/*
15 * Once set, this function pointer should never be unset.
16 *
17 * The library module will set this pointer if it successfully loads. The module
18 * should not be unloaded except for testing and debug purposes.
19 */
20static unsigned long (*amd_atl_umc_na_to_spa)(struct atl_err *err);
21
22void amd_atl_register_decoder(unsigned long (*f)(struct atl_err *))
23{
24 amd_atl_umc_na_to_spa = f;
25}
26EXPORT_SYMBOL_GPL(amd_atl_register_decoder);
27
28void amd_atl_unregister_decoder(void)
29{
30 amd_atl_umc_na_to_spa = NULL;
31}
32EXPORT_SYMBOL_GPL(amd_atl_unregister_decoder);
33
34unsigned long amd_convert_umc_mca_addr_to_sys_addr(struct atl_err *err)
35{
36 if (!amd_atl_umc_na_to_spa)
37 return -EINVAL;
38
39 return amd_atl_umc_na_to_spa(err);
40}
41EXPORT_SYMBOL_GPL(amd_convert_umc_mca_addr_to_sys_addr);
42#endif /* CONFIG_AMD_ATL */
43
76ac8275
CG
44#define CREATE_TRACE_POINTS
45#define TRACE_INCLUDE_PATH ../../include/ras
46#include <ras/ras_event.h>
47
9359a8cb 48void log_non_standard_event(const guid_t *sec_type, const guid_t *fru_id,
297b64c7
TB
49 const char *fru_text, const u8 sev, const u8 *err,
50 const u32 len)
51{
52 trace_non_standard_event(sec_type, fru_id, fru_text, sev, err, len);
53}
54
e9279e83
TB
55void log_arm_hw_error(struct cper_sec_proc_arm *err)
56{
57 trace_arm_event(err);
58}
59
d963cd95
CG
60static int __init ras_init(void)
61{
62 int rc = 0;
63
64 ras_debugfs_init();
65 rc = ras_add_daemon_trace();
66
67 return rc;
68}
69subsys_initcall(ras_init);
70
2dfb7d51
CG
71#if defined(CONFIG_ACPI_EXTLOG) || defined(CONFIG_ACPI_EXTLOG_MODULE)
72EXPORT_TRACEPOINT_SYMBOL_GPL(extlog_mem_event);
73#endif
76ac8275 74EXPORT_TRACEPOINT_SYMBOL_GPL(mc_event);
297b64c7 75EXPORT_TRACEPOINT_SYMBOL_GPL(non_standard_event);
e9279e83 76EXPORT_TRACEPOINT_SYMBOL_GPL(arm_event);
011d8261 77
5f0744e5 78static int __init parse_ras_param(char *str)
011d8261
BP
79{
80#ifdef CONFIG_RAS_CEC
81 parse_cec_param(str);
82#endif
83
84 return 1;
85}
86__setup("ras", parse_ras_param);