2020-04-02 23:48:27 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2012-06-24 01:08:47 +02:00
|
|
|
|
|
|
|
#ifndef ELOG_H_
|
|
|
|
#define ELOG_H_
|
|
|
|
|
2021-07-17 01:44:58 +02:00
|
|
|
#include <commonlib/bsd/elog.h>
|
2020-07-12 09:03:22 +02:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2019-03-06 01:53:33 +01:00
|
|
|
#if CONFIG(ELOG)
|
2014-04-14 01:45:31 +02:00
|
|
|
/* Eventlog backing storage must be initialized before calling elog_init(). */
|
2012-06-24 01:08:47 +02:00
|
|
|
extern int elog_init(void);
|
|
|
|
extern int elog_clear(void);
|
2016-08-06 17:02:37 +02:00
|
|
|
/* Event addition functions return < 0 on failure and 0 on success. */
|
|
|
|
extern int elog_add_event_raw(u8 event_type, void *data, u8 data_size);
|
|
|
|
extern int elog_add_event(u8 event_type);
|
|
|
|
extern int elog_add_event_byte(u8 event_type, u8 data);
|
|
|
|
extern int elog_add_event_word(u8 event_type, u16 data);
|
|
|
|
extern int elog_add_event_dword(u8 event_type, u32 data);
|
|
|
|
extern int elog_add_event_wake(u8 source, u32 instance);
|
2012-06-24 01:13:42 +02:00
|
|
|
extern int elog_smbios_write_type15(unsigned long *current, int handle);
|
2018-08-20 22:51:30 +02:00
|
|
|
extern int elog_add_extended_event(u8 type, u32 complement);
|
2014-05-09 05:04:02 +02:00
|
|
|
#else
|
|
|
|
/* Stubs to help avoid littering sources with #if CONFIG_ELOG */
|
|
|
|
static inline int elog_init(void) { return -1; }
|
|
|
|
static inline int elog_clear(void) { return -1; }
|
2016-11-04 17:17:54 +01:00
|
|
|
static inline int elog_add_event_raw(u8 event_type, void *data,
|
|
|
|
u8 data_size) { return 0; }
|
2016-08-06 17:02:37 +02:00
|
|
|
static inline int elog_add_event(u8 event_type) { return 0; }
|
|
|
|
static inline int elog_add_event_byte(u8 event_type, u8 data) { return 0; }
|
|
|
|
static inline int elog_add_event_word(u8 event_type, u16 data) { return 0; }
|
|
|
|
static inline int elog_add_event_dword(u8 event_type, u32 data) { return 0; }
|
|
|
|
static inline int elog_add_event_wake(u8 source, u32 instance) { return 0; }
|
2014-05-09 05:04:02 +02:00
|
|
|
static inline int elog_smbios_write_type15(unsigned long *current,
|
|
|
|
int handle) {
|
|
|
|
return 0;
|
|
|
|
}
|
2018-08-20 22:51:30 +02:00
|
|
|
static inline int elog_add_extended_event(u8 type, u32 complement) { return 0; }
|
2014-05-09 05:04:02 +02:00
|
|
|
#endif
|
2012-06-24 01:08:47 +02:00
|
|
|
|
2019-11-06 10:04:27 +01:00
|
|
|
#if CONFIG(ELOG_GSMI)
|
|
|
|
#define elog_gsmi_add_event elog_add_event
|
|
|
|
#define elog_gsmi_add_event_byte elog_add_event_byte
|
|
|
|
#define elog_gsmi_add_event_word elog_add_event_word
|
|
|
|
#else
|
|
|
|
static inline int elog_gsmi_add_event(u8 event_type) { return 0; }
|
|
|
|
static inline int elog_gsmi_add_event_byte(u8 event_type, u8 data) { return 0; }
|
|
|
|
static inline int elog_gsmi_add_event_word(u8 event_type, u16 data) { return 0; }
|
|
|
|
#endif
|
|
|
|
|
2012-06-24 01:48:38 +02:00
|
|
|
extern u32 gsmi_exec(u8 command, u32 *param);
|
|
|
|
|
2019-03-06 01:53:33 +01:00
|
|
|
#if CONFIG(ELOG_BOOT_COUNT)
|
2012-06-24 01:37:45 +02:00
|
|
|
u32 boot_count_read(void);
|
2018-05-25 02:00:45 +02:00
|
|
|
#else
|
|
|
|
static inline u32 boot_count_read(void)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
2012-06-24 01:37:45 +02:00
|
|
|
u32 boot_count_increment(void);
|
|
|
|
|
2019-09-11 16:12:26 +02:00
|
|
|
static inline void elog_boot_notify(int s3_resume)
|
|
|
|
{
|
|
|
|
if (CONFIG(ELOG_BOOT_COUNT) && !s3_resume)
|
|
|
|
boot_count_increment();
|
|
|
|
}
|
|
|
|
|
2017-10-15 03:12:25 +02:00
|
|
|
/*
|
|
|
|
* Callback from GSMI handler to allow platform to log any wake source
|
|
|
|
* information.
|
|
|
|
*/
|
|
|
|
void elog_gsmi_cb_platform_log_wake_source(void);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Callback from GSMI handler to allow mainboard to log any wake source
|
|
|
|
* information.
|
|
|
|
*/
|
|
|
|
void elog_gsmi_cb_mainboard_log_wake_source(void);
|
|
|
|
|
2012-06-24 01:08:47 +02:00
|
|
|
#endif /* ELOG_H_ */
|