1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright 2019 Broadcom.
4  */
5 
6 #ifndef BCM_ELOG_H
7 #define BCM_ELOG_H
8 
9 #include <mm/core_memprot.h>
10 
11 /* Error logging signature offset and value */
12 #define BCM_ELOG_SIG_OFFSET	0x0000
13 #define BCM_ELOG_SIG_VAL	0x75767971
14 
15 /* Current logging offset that points to where new logs should be added */
16 #define BCM_ELOG_OFF_OFFSET	0x0004
17 
18 /* Current logging length (excluding header) */
19 #define BCM_ELOG_LEN_OFFSET	0x0008
20 
21 #define BCM_ELOG_HEADER_LEN	12
22 
23 /*
24  * @base: base address of memory where log is saved
25  * @max_size: max size of memory reserved for logging
26  */
27 struct bcm_elog {
28 	struct io_pa_va base;
29 	uint32_t max_size;
30 };
31 
32 void bcm_elog_init(uintptr_t pa_base, uint32_t size);
33 void bcm_elog_putchar(char ch);
34 
35 #endif /* BCM_ELOG_H */
36