xref: /rk3399_ARM-atf/include/plat/marvell/odyssey/csr/ody-warn.h (revision 55877c6341b29c416ed88b705dca1a6343db194f)
1 /***********************license start***********************************
2 * Copyright (C) 2021-2026 Marvell.
3 * SPDX-License-Identifier: BSD-3-Clause
4 * https://spdx.org/licenses
5 ***********************license end**************************************/
6 
7 /**
8  * @file
9  *
10  * Functions for reporting errors and warnings.
11  *
12  * <hr>$Revision: 49448 $<hr>
13  *
14  * @defgroup stdio Standard IO related functions
15  * @{
16  */
17 
18 extern void __ody_die(void) __attribute__ ((noreturn));
19 extern void ody_fatal(const char *format, ...) __attribute__ ((noreturn, format(printf, 1, 2)));
20 extern void ody_error(const char *format, ...) __attribute__ ((format(printf, 1, 2)));
21 extern void ody_warn(const char *format, ...) __attribute__ ((format(printf, 1, 2)));
22 extern void __ody_trace_printf(const char *format, ...) __attribute__ ((format(printf, 1, 2)));
23 #define ody_warn_if(expression, format, ...) do { if (ody_unlikely(expression)) ody_warn (format, ##__VA_ARGS__); } while (0)
24 
25 /* The following defines control detailed tracing of various parts of the
26    ODY. Each one can be enabled(1) or disabled(0) independently. These
27    should be disabled unless you are trying to debug something specific */
28 
29 typedef enum {
30 	TRACE_ENABLE_DRAM,              /* DRAM initialization */
31 	TRACE_ENABLE_DRAM_TEST,         /* DRAM test code */
32 	TRACE_ENABLE_INIT,              /* Early initialization, before main() */
33 	TRACE_ENABLE_ECAM,              /* ECAM initialization */
34 	TRACE_ENABLE_QLM,               /* QLM related debug */
35 	TRACE_ENABLE_EMMC,              /* eMMC related debug */
36 	TRACE_ENABLE_PCIE,              /* PCIe link init */
37 	TRACE_ENABLE_PCIE_CONFIG,       /* PCIe config space reads / writes */
38 	TRACE_ENABLE_SPI,               /* SPI related debug */
39 	TRACE_ENABLE_ENV,               /* Environment variables related debug */
40 	TRACE_ENABLE_DEVICE,            /* ECAM based device framework */
41 	TRACE_ENABLE_DEVICE_SCAN,       /* ECAM based device scanning detail */
42 	TRACE_ENABLE_FDT_OS,            /* Device tree passed to OS */
43 	TRACE_ENABLE_USB_XHCI,          /* USB XHCI block */
44 	__TRACE_ENABLE_LAST,            /* Must always be last value */
45 } ody_trace_enable_t;
46 
47 /* See ody-config.c to change the trace level for before config files are loaded */
48 extern uint64_t ody_trace_enables;
49 
50 /**
51  * Macro for low level tracing of ODY functions. When enabled,
52  * these translate to printf() calls. The "area" is a string
53  * that is appended to "TRACE_ENABLE_" to figure out which
54  * enable macro to use. The macro expects a ';' after it.
55  */
56 #define TRACE(area, format, ...) do {                       \
57 	if (ody_trace_enables & (1ull << TRACE_ENABLE_##area))  \
58 	__ody_trace_printf(#area ": " format, ##__VA_ARGS__);   \
59 } while (0)
60 
61 /* The following defines control detailed tracing of various parts of the
62    ATF. Each one can be enabled(1) or disabled(0) independently. These
63    should be disabled unless you are trying to debug something specific.
64 
65    Implementation note: this order must match ATF 'mrvl_tf_log_module_e'.
66 */
67 typedef enum {
68 	/* gap (matches ATF mrvl_tf_log_module_e) */
69 	ATF_TRACE_MODULE_RVU = 9,  /* ATF RVU driver messages */
70 	ATF_TRACE_MODULE_PARSE,    /* ATF platform parsing messages */
71 	ATF_TRACE_MODULE_PLAT_ECAM,/* ATF plat-specific ecam driver messages */
72 	ATF_TRACE_MODULE_GEN_ECAM, /* ATF generic ecam driver messages */
73 	ATF_TRACE_MODULE_UPDATE,   /* ATF update driver */
74 	ATF_TRACE_MODULE_ETH_CMD,  /* ATF network driver messages */
75 	ATF_TRACE_MODULE_ETH_LINK, /* ATF network driver link message */
76 	ATF_TRACE_MODULE_ETH_LINK_MGMT, /* ATF ECP link interface */
77 	ATF_TRACE_MODULE_GSERM,    /* ATF GSERM driver messages */
78 	ATF_TRACE_MODULE_ETH_SFP_MGMT,    /* ATF SFP mgmt driver messages */
79 	__ATF_TRACE_MODULE_LAST,   /* Must always be last value */
80 } atf_trace_module_t;
81 
82 /** @} */
83