Linux Audio

Check our new training course

Linux debugging, profiling, tracing and performance analysis training

Mar 24-27, 2025, special US time zones
Register
Loading...
v6.2
  1/* SPDX-License-Identifier: GPL-2.0 */
  2#ifndef BOOT_COMPRESSED_EFI_H
  3#define BOOT_COMPRESSED_EFI_H
  4
  5#if defined(_LINUX_EFI_H) || defined(_ASM_X86_EFI_H)
  6#error Please do not include kernel proper namespace headers
  7#endif
  8
  9typedef guid_t efi_guid_t __aligned(__alignof__(u32));
 10
 11#define EFI_GUID(a, b, c, d...) (efi_guid_t){ {					\
 12	(a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff,	\
 13	(b) & 0xff, ((b) >> 8) & 0xff,						\
 14	(c) & 0xff, ((c) >> 8) & 0xff, d } }
 15
 16#define ACPI_TABLE_GUID				EFI_GUID(0xeb9d2d30, 0x2d88, 0x11d3,  0x9a, 0x16, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d)
 17#define ACPI_20_TABLE_GUID			EFI_GUID(0x8868e871, 0xe4f1, 0x11d3,  0xbc, 0x22, 0x00, 0x80, 0xc7, 0x3c, 0x88, 0x81)
 18#define EFI_CC_BLOB_GUID			EFI_GUID(0x067b1f5f, 0xcf26, 0x44c5, 0x85, 0x54, 0x93, 0xd7, 0x77, 0x91, 0x2d, 0x42)
 
 19
 20#define EFI32_LOADER_SIGNATURE	"EL32"
 21#define EFI64_LOADER_SIGNATURE	"EL64"
 22
 23/*
 24 * Generic EFI table header
 25 */
 26typedef	struct {
 27	u64 signature;
 28	u32 revision;
 29	u32 headersize;
 30	u32 crc32;
 31	u32 reserved;
 32} efi_table_hdr_t;
 33
 34#define EFI_CONVENTIONAL_MEMORY		 7
 
 35
 36#define EFI_MEMORY_MORE_RELIABLE \
 37				((u64)0x0000000000010000ULL)	/* higher reliability */
 38#define EFI_MEMORY_SP		((u64)0x0000000000040000ULL)	/* soft reserved */
 39
 40#define EFI_PAGE_SHIFT		12
 41
 42typedef struct {
 43	u32 type;
 44	u32 pad;
 45	u64 phys_addr;
 46	u64 virt_addr;
 47	u64 num_pages;
 48	u64 attribute;
 49} efi_memory_desc_t;
 50
 51#define efi_early_memdesc_ptr(map, desc_size, n)			\
 52	(efi_memory_desc_t *)((void *)(map) + ((n) * (desc_size)))
 53
 54typedef struct {
 55	efi_guid_t guid;
 56	u64 table;
 57} efi_config_table_64_t;
 58
 59typedef struct {
 60	efi_guid_t guid;
 61	u32 table;
 62} efi_config_table_32_t;
 63
 64typedef struct {
 65	efi_table_hdr_t hdr;
 66	u64 fw_vendor;	/* physical addr of CHAR16 vendor string */
 67	u32 fw_revision;
 68	u32 __pad1;
 69	u64 con_in_handle;
 70	u64 con_in;
 71	u64 con_out_handle;
 72	u64 con_out;
 73	u64 stderr_handle;
 74	u64 stderr;
 75	u64 runtime;
 76	u64 boottime;
 77	u32 nr_tables;
 78	u32 __pad2;
 79	u64 tables;
 80} efi_system_table_64_t;
 81
 82typedef struct {
 83	efi_table_hdr_t hdr;
 84	u32 fw_vendor;	/* physical addr of CHAR16 vendor string */
 85	u32 fw_revision;
 86	u32 con_in_handle;
 87	u32 con_in;
 88	u32 con_out_handle;
 89	u32 con_out;
 90	u32 stderr_handle;
 91	u32 stderr;
 92	u32 runtime;
 93	u32 boottime;
 94	u32 nr_tables;
 95	u32 tables;
 96} efi_system_table_32_t;
 97
 98/* kexec external ABI */
 99struct efi_setup_data {
100	u64 fw_vendor;
101	u64 __unused;
102	u64 tables;
103	u64 smbios;
104	u64 reserved[8];
 
 
 
 
 
 
 
 
105};
106
107static inline int efi_guidcmp (efi_guid_t left, efi_guid_t right)
108{
109	return memcmp(&left, &right, sizeof (efi_guid_t));
110}
111
112#ifdef CONFIG_EFI
113bool __pure __efi_soft_reserve_enabled(void);
114
115static inline bool __pure efi_soft_reserve_enabled(void)
116{
117	return IS_ENABLED(CONFIG_EFI_SOFT_RESERVE)
118		&& __efi_soft_reserve_enabled();
119}
120#else
121static inline bool efi_soft_reserve_enabled(void)
122{
123	return false;
124}
125#endif /* CONFIG_EFI */
126#endif /* BOOT_COMPRESSED_EFI_H */
v6.8
  1/* SPDX-License-Identifier: GPL-2.0 */
  2#ifndef BOOT_COMPRESSED_EFI_H
  3#define BOOT_COMPRESSED_EFI_H
  4
  5#if defined(_LINUX_EFI_H) || defined(_ASM_X86_EFI_H)
  6#error Please do not include kernel proper namespace headers
  7#endif
  8
  9typedef guid_t efi_guid_t __aligned(__alignof__(u32));
 10
 11#define EFI_GUID(a, b, c, d...) (efi_guid_t){ {					\
 12	(a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff,	\
 13	(b) & 0xff, ((b) >> 8) & 0xff,						\
 14	(c) & 0xff, ((c) >> 8) & 0xff, d } }
 15
 16#define ACPI_TABLE_GUID				EFI_GUID(0xeb9d2d30, 0x2d88, 0x11d3,  0x9a, 0x16, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d)
 17#define ACPI_20_TABLE_GUID			EFI_GUID(0x8868e871, 0xe4f1, 0x11d3,  0xbc, 0x22, 0x00, 0x80, 0xc7, 0x3c, 0x88, 0x81)
 18#define EFI_CC_BLOB_GUID			EFI_GUID(0x067b1f5f, 0xcf26, 0x44c5, 0x85, 0x54, 0x93, 0xd7, 0x77, 0x91, 0x2d, 0x42)
 19#define LINUX_EFI_UNACCEPTED_MEM_TABLE_GUID	EFI_GUID(0xd5d1de3c, 0x105c, 0x44f9,  0x9e, 0xa9, 0xbc, 0xef, 0x98, 0x12, 0x00, 0x31)
 20
 21#define EFI32_LOADER_SIGNATURE	"EL32"
 22#define EFI64_LOADER_SIGNATURE	"EL64"
 23
 24/*
 25 * Generic EFI table header
 26 */
 27typedef	struct {
 28	u64 signature;
 29	u32 revision;
 30	u32 headersize;
 31	u32 crc32;
 32	u32 reserved;
 33} efi_table_hdr_t;
 34
 35#define EFI_CONVENTIONAL_MEMORY		 7
 36#define EFI_UNACCEPTED_MEMORY		15
 37
 38#define EFI_MEMORY_MORE_RELIABLE \
 39				((u64)0x0000000000010000ULL)	/* higher reliability */
 40#define EFI_MEMORY_SP		((u64)0x0000000000040000ULL)	/* soft reserved */
 41
 42#define EFI_PAGE_SHIFT		12
 43
 44typedef struct {
 45	u32 type;
 46	u32 pad;
 47	u64 phys_addr;
 48	u64 virt_addr;
 49	u64 num_pages;
 50	u64 attribute;
 51} efi_memory_desc_t;
 52
 53#define efi_early_memdesc_ptr(map, desc_size, n)			\
 54	(efi_memory_desc_t *)((void *)(map) + ((n) * (desc_size)))
 55
 56typedef struct {
 57	efi_guid_t guid;
 58	u64 table;
 59} efi_config_table_64_t;
 60
 61typedef struct {
 62	efi_guid_t guid;
 63	u32 table;
 64} efi_config_table_32_t;
 65
 66typedef struct {
 67	efi_table_hdr_t hdr;
 68	u64 fw_vendor;	/* physical addr of CHAR16 vendor string */
 69	u32 fw_revision;
 70	u32 __pad1;
 71	u64 con_in_handle;
 72	u64 con_in;
 73	u64 con_out_handle;
 74	u64 con_out;
 75	u64 stderr_handle;
 76	u64 stderr;
 77	u64 runtime;
 78	u64 boottime;
 79	u32 nr_tables;
 80	u32 __pad2;
 81	u64 tables;
 82} efi_system_table_64_t;
 83
 84typedef struct {
 85	efi_table_hdr_t hdr;
 86	u32 fw_vendor;	/* physical addr of CHAR16 vendor string */
 87	u32 fw_revision;
 88	u32 con_in_handle;
 89	u32 con_in;
 90	u32 con_out_handle;
 91	u32 con_out;
 92	u32 stderr_handle;
 93	u32 stderr;
 94	u32 runtime;
 95	u32 boottime;
 96	u32 nr_tables;
 97	u32 tables;
 98} efi_system_table_32_t;
 99
100/* kexec external ABI */
101struct efi_setup_data {
102	u64 fw_vendor;
103	u64 __unused;
104	u64 tables;
105	u64 smbios;
106	u64 reserved[8];
107};
108
109struct efi_unaccepted_memory {
110	u32 version;
111	u32 unit_size;
112	u64 phys_base;
113	u64 size;
114	unsigned long bitmap[];
115};
116
117static inline int efi_guidcmp (efi_guid_t left, efi_guid_t right)
118{
119	return memcmp(&left, &right, sizeof (efi_guid_t));
120}
121
122#ifdef CONFIG_EFI
123bool __pure __efi_soft_reserve_enabled(void);
124
125static inline bool __pure efi_soft_reserve_enabled(void)
126{
127	return IS_ENABLED(CONFIG_EFI_SOFT_RESERVE)
128		&& __efi_soft_reserve_enabled();
129}
130#else
131static inline bool efi_soft_reserve_enabled(void)
132{
133	return false;
134}
135#endif /* CONFIG_EFI */
136#endif /* BOOT_COMPRESSED_EFI_H */