xref: /aosp_15_r20/external/coreboot/src/drivers/intel/fsp2_0/include/fsp/debug.h (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #ifndef _FSP2_0_DEBUG_H_
4 #define _FSP2_0_DEBUG_H_
5 
6 #include <fsp/util.h>
7 
8 enum fsp_log_level {
9 	FSP_LOG_LEVEL_DISABLE = 0,
10 	FSP_LOG_LEVEL_ERR,
11 	FSP_LOG_LEVEL_ERR_WARN,
12 	FSP_LOG_LEVEL_ERR_WARN_INFO,
13 	FSP_LOG_LEVEL_ERR_WARN_INFO_EVENT,
14 	FSP_LOG_LEVEL_VERBOSE
15 };
16 
17 /* FSP debug API */
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,
31 	const FSPM_UPD *new);
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);
35 
36 /* Callbacks for displaying UPD parameters - place in a separate file
37  * that is conditionally build with CONFIG(DISPLAY_UPD_DATA).
38  */
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);
43 
44 /* Callbacks for displaying HOBs - place in a separate file that is
45  * conditionally build with CONFIG(DISPLAY_HOBS).
46  */
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);
50 
51 /* FSP debug utility functions */
52 void fsp_display_upd_value(const char *name, size_t size, uint64_t old,
53 	uint64_t new);
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);
60 
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);
65 
66 #endif /* _FSP2_0_DEBUG_H_ */
67