1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 #ifndef _FSP2_0_DEBUG_H_
4 #define _FSP2_0_DEBUG_H_
9 FSP_LOG_LEVEL_DISABLE
= 0,
11 FSP_LOG_LEVEL_ERR_WARN
,
12 FSP_LOG_LEVEL_ERR_WARN_INFO
,
13 FSP_LOG_LEVEL_ERR_WARN_INFO_EVENT
,
18 enum fsp_log_level
fsp_map_console_log_level(void);
19 void fsp_debug_before_memory_init(fsp_memory_init_fn memory_init
,
20 const FSPM_UPD
*fspm_old_upd
,
21 const FSPM_UPD
*fspm_new_upd
);
22 void fsp_debug_after_memory_init(efi_return_status_t status
);
23 void fsp_debug_before_silicon_init(fsp_silicon_init_fn silicon_init
,
24 const FSPS_UPD
*fsps_old_upd
,
25 const FSPS_UPD
*fsps_new_upd
);
26 void fsp_debug_after_silicon_init(efi_return_status_t status
);
27 void fsp_before_debug_notify(fsp_notify_fn notify
,
28 const struct fsp_notify_params
*notify_params
);
29 void fsp_debug_after_notify(efi_return_status_t status
);
30 void fspm_display_upd_values(const FSPM_UPD
*old
,
32 void fsp_display_hobs(void);
33 void fsp_verify_memory_init_hobs(void);
34 void fsp_print_header_info(const struct fsp_header
*hdr
);
36 /* Callbacks for displaying UPD parameters - place in a separate file
37 * that is conditionally build with CONFIG(DISPLAY_UPD_DATA).
39 void soc_display_fspm_upd_params(const FSPM_UPD
*fspm_old_upd
,
40 const FSPM_UPD
*fspm_new_upd
);
41 void soc_display_fsps_upd_params(const FSPS_UPD
*fsps_old_upd
,
42 const FSPS_UPD
*fsps_new_upd
);
44 /* Callbacks for displaying HOBs - place in a separate file that is
45 * conditionally build with CONFIG(DISPLAY_HOBS).
47 const char *soc_get_hob_type_name(const struct hob_header
*hob
);
48 const char *soc_get_guid_name(const uint8_t *guid
);
49 void soc_display_hob(const struct hob_header
*hob
);
51 /* FSP debug utility functions */
52 void fsp_display_upd_value(const char *name
, size_t size
, uint64_t old
,
54 void fsp_print_guid(int level
, const void *guid
);
55 void fsp_print_memory_resource_hobs(void);
56 void fsp_print_resource_descriptor(const void *base
);
57 const char *fsp_get_hob_type_name(const struct hob_header
*hob
);
58 const char *fsp_get_guid_name(const uint8_t *guid
);
59 void fsp_print_guid_extension_hob(const struct hob_header
*hob
);
61 /* Callback to snapshot all GPIO configurations. */
62 void gpio_snapshot(void);
63 /* Callback to verify that current GPIO configuration matches the saved snapshot */
64 size_t gpio_verify_snapshot(void);
67 * Retrieve fsp_pcd_debug_level file from option backend (e.g. CBFS) to identify the log-level
68 * used for outputting FSP debug messages.
70 * 1. Critical errors, need action etc., FSP_LOG_LEVEL_ERR aka value 1
71 * 2. #1 including warnings, FSP_LOG_LEVEL_ERR_WARN aka value 2
72 * 3. #2 including additional informational messages, FSP_LOG_LEVEL_ERR_WARN_INFO aka value 3
74 * The default log-level is setup in coreboot while stitching the CBFS option binaries
75 * depending upon the coreboot log-level. One can override that using below example:
77 * Here is an example of adding fsp_pcd_debug_level option binary file into the RO-CBFS
78 * to specify the FSP log-level:
79 * - cbfstool <AP FW image> add-int -i <log-level> -n option/fsp_pcd_debug_level
81 * If OPTION_BACKEND_NONE then the then, use log levels will be determined by
82 * calling into fsp_map_console_log_level API.
84 enum fsp_log_level
fsp_get_pcd_debug_log_level(void);
86 * Retrieve fsp_mrc_debug_level file from option backend (e.g. CBFS) to identify the log-level
87 * used for outputting FSP debug messages.
89 * 1. Critical errors, need action etc., FSP_LOG_LEVEL_ERR aka value 1
90 * 2. #1 including warnings, FSP_LOG_LEVEL_ERR_WARN aka value 2
91 * 3. #2 including additional informational messages, FSP_LOG_LEVEL_ERR_WARN_INFO aka value 3
92 * 4. #3 including event logs, FSP_LOG_LEVEL_ERR_WARN_INFO_EVENT aka value 4
93 * 5. Use FSP_LOG_LEVEL_VERBOSE aka 5 for all types of debug messages.
95 * The default log-level is setup in coreboot while stitching the CBFS option binaries
96 * depending upon the coreboot log-level. One can override that using below example:
98 * Here is an example of adding fsp_mrc_debug_level option binary file into the RO-CBFS
99 * to specify the FSP log-level:
100 * - cbfstool <AP FW image> add-int -i <log-level> -n option/fsp_mrc_debug_level
102 * If OPTION_BACKEND_NONE then the then, use log levels will be determined by
103 * calling into fsp_map_console_log_level API.
105 enum fsp_log_level
fsp_get_mrc_debug_log_level(void);
107 #endif /* _FSP2_0_DEBUG_H_ */