2 * Copyright(c) 2009 Intel Corporation. All rights reserved.
4 * SPDX-License-Identifier: GPL-2.0+ BSD-3-Clause
11 #include <linux/types.h>
13 /* Table signatures reserved by the SFI specification */
14 #define SFI_SIG_SYST "SYST"
15 #define SFI_SIG_FREQ "FREQ"
16 #define SFI_SIG_CPUS "CPUS"
17 #define SFI_SIG_MTMR "MTMR"
18 #define SFI_SIG_MRTC "MRTC"
19 #define SFI_SIG_MMAP "MMAP"
20 #define SFI_SIG_APIC "APIC"
21 #define SFI_SIG_XSDT "XSDT"
22 #define SFI_SIG_WAKE "WAKE"
23 #define SFI_SIG_DEVS "DEVS"
24 #define SFI_SIG_GPIO "GPIO"
26 #define SFI_SIGNATURE_SIZE 4
27 #define SFI_OEM_ID_SIZE 6
28 #define SFI_OEM_TABLE_ID_SIZE 8
30 #define SFI_NAME_LEN 16
31 #define SFI_TABLE_MAX_ENTRIES 16
33 #define SFI_GET_NUM_ENTRIES(ptable, entry_type) \
34 ((ptable->header.len - sizeof(struct sfi_table_header)) / \
37 * Table structures must be byte-packed to match the SFI specification,
38 * as they are provided by the BIOS.
40 struct __packed sfi_table_header {
41 char sig[SFI_SIGNATURE_SIZE];
45 char oem_id[SFI_OEM_ID_SIZE];
46 char oem_table_id[SFI_OEM_TABLE_ID_SIZE];
49 struct __packed sfi_table_simple {
50 struct sfi_table_header header;
54 /* Comply with UEFI spec 2.1 */
55 struct __packed sfi_mem_entry {
63 struct __packed sfi_cpu_table_entry {
67 struct __packed sfi_cstate_table_entry {
68 u32 hint; /* MWAIT hint */
69 u32 latency; /* latency in ms */
72 struct __packed sfi_apic_table_entry {
73 u64 phys_addr; /* phy base addr for APIC reg */
76 struct __packed sfi_freq_table_entry {
77 u32 freq_mhz; /* in MHZ */
78 u32 latency; /* transition latency in ms */
79 u32 ctrl_val; /* value to write to PERF_CTL */
82 struct __packed sfi_wake_table_entry {
83 u64 phys_addr; /* pointer to where the wake vector locates */
86 struct __packed sfi_timer_table_entry {
87 u64 phys_addr; /* phy base addr for the timer */
88 u32 freq_hz; /* in HZ */
92 struct __packed sfi_rtc_table_entry {
93 u64 phys_addr; /* phy base addr for the RTC */
97 struct __packed sfi_device_table_entry {
98 u8 type; /* bus type, I2C, SPI or ...*/
99 u8 host_num; /* attached to host 0, 1...*/
103 char name[SFI_NAME_LEN];
107 SFI_DEV_TYPE_SPI = 0,
115 struct __packed sfi_gpio_table_entry {
116 char controller_name[SFI_NAME_LEN];
118 char pin_name[SFI_NAME_LEN];
121 struct sfi_xsdt_header {
122 uint32_t oem_revision;
124 uint32_t creator_revision;
127 typedef int (*sfi_table_handler) (struct sfi_table_header *table);
130 * write_sfi_table() - Write Simple Firmware Interface tables
132 * @base: Address to write table to
133 * @return address to use for the next table
135 u32 write_sfi_table(u32 base);
137 #endif /*_LINUX_SFI_H */