1 /* SPDX-License-Identifier: GPL-2.0-only */
6 #include <commonlib/bsd/elog.h>
10 /* Eventlog backing storage must be initialized before calling elog_init(). */
11 extern int elog_init(void);
12 extern int elog_clear(void);
13 /* Event addition functions return < 0 on failure and 0 on success. */
14 extern int elog_add_event_raw(u8 event_type
, void *data
, u8 data_size
);
15 extern int elog_add_event(u8 event_type
);
16 extern int elog_add_event_byte(u8 event_type
, u8 data
);
17 extern int elog_add_event_word(u8 event_type
, u16 data
);
18 extern int elog_add_event_dword(u8 event_type
, u32 data
);
19 extern int elog_add_event_wake(u8 source
, u32 instance
);
20 extern int elog_smbios_write_type15(unsigned long *current
, int handle
);
21 extern int elog_add_extended_event(u8 type
, u32 complement
);
23 /* Stubs to help avoid littering sources with #if CONFIG_ELOG */
24 static inline int elog_init(void) { return -1; }
25 static inline int elog_clear(void) { return -1; }
26 static inline int elog_add_event_raw(u8 event_type
, void *data
,
27 u8 data_size
) { return 0; }
28 static inline int elog_add_event(u8 event_type
) { return 0; }
29 static inline int elog_add_event_byte(u8 event_type
, u8 data
) { return 0; }
30 static inline int elog_add_event_word(u8 event_type
, u16 data
) { return 0; }
31 static inline int elog_add_event_dword(u8 event_type
, u32 data
) { return 0; }
32 static inline int elog_add_event_wake(u8 source
, u32 instance
) { return 0; }
33 static inline int elog_smbios_write_type15(unsigned long *current
,
37 static inline int elog_add_extended_event(u8 type
, u32 complement
) { return 0; }
41 #define elog_gsmi_add_event elog_add_event
42 #define elog_gsmi_add_event_byte elog_add_event_byte
43 #define elog_gsmi_add_event_word elog_add_event_word
45 static inline int elog_gsmi_add_event(u8 event_type
) { return 0; }
46 static inline int elog_gsmi_add_event_byte(u8 event_type
, u8 data
) { return 0; }
47 static inline int elog_gsmi_add_event_word(u8 event_type
, u16 data
) { return 0; }
50 extern u32
gsmi_exec(u8 command
, u32
*param
);
52 #if CONFIG(ELOG_BOOT_COUNT)
53 u32
boot_count_read(void);
55 static inline u32
boot_count_read(void)
60 u32
boot_count_increment(void);
62 static inline void elog_boot_notify(int s3_resume
)
64 if (CONFIG(ELOG_BOOT_COUNT
) && !s3_resume
)
65 boot_count_increment();
69 * Callback from GSMI handler to allow platform to log any wake source
72 void elog_gsmi_cb_platform_log_wake_source(void);
75 * Callback from GSMI handler to allow mainboard to log any wake source
78 void elog_gsmi_cb_mainboard_log_wake_source(void);