include/device/pci_def.h: Add PCIe SRIOV definitions
[coreboot2.git] / src / include / elog.h
blobdb59b76ac897db2a8400e120227ff413c24c370b
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #ifndef ELOG_H_
4 #define ELOG_H_
6 #include <commonlib/bsd/elog.h>
7 #include <stdint.h>
9 #if CONFIG(ELOG)
10 /* Eventlog backing storage must be initialized before calling elog_init(). */
11 int elog_init(void);
12 int elog_clear(void);
13 /* Event addition functions return < 0 on failure and 0 on success. */
14 int elog_add_event_raw(u8 event_type, void *data, u8 data_size);
15 int elog_add_event(u8 event_type);
16 int elog_add_event_byte(u8 event_type, u8 data);
17 int elog_add_event_word(u8 event_type, u16 data);
18 int elog_add_event_dword(u8 event_type, u32 data);
19 int elog_add_event_wake(u8 source, u32 instance);
20 int elog_smbios_write_type15(unsigned long *current, int handle);
21 int elog_add_extended_event(u8 type, u32 complement);
22 #else
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,
34 int handle) {
35 return 0;
37 static inline int elog_add_extended_event(u8 type, u32 complement) { return 0; }
38 #endif
40 #if CONFIG(ELOG_GSMI)
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
44 #else
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; }
48 #endif
50 u32 gsmi_exec(u8 command, u32 *param);
52 #if CONFIG(ELOG_BOOT_COUNT)
53 u32 boot_count_read(void);
54 #else
55 static inline u32 boot_count_read(void)
57 return 0;
59 #endif
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
70 * information.
72 void elog_gsmi_cb_platform_log_wake_source(void);
75 * Callback from GSMI handler to allow mainboard to log any wake source
76 * information.
78 void elog_gsmi_cb_mainboard_log_wake_source(void);
80 #endif /* ELOG_H_ */