Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/efi.h
Show All 34 Lines | |||||
#define EFI_PAGE_SHIFT 12 | #define EFI_PAGE_SHIFT 12 | ||||
#define EFI_PAGE_SIZE (1 << EFI_PAGE_SHIFT) | #define EFI_PAGE_SIZE (1 << EFI_PAGE_SHIFT) | ||||
#define EFI_PAGE_MASK (EFI_PAGE_SIZE - 1) | #define EFI_PAGE_MASK (EFI_PAGE_SIZE - 1) | ||||
#define EFI_TABLE_SMBIOS \ | #define EFI_TABLE_SMBIOS \ | ||||
{0xeb9d2d31,0x2d88,0x11d3,0x9a,0x16,{0x00,0x90,0x27,0x3f,0xc1,0x4d}} | {0xeb9d2d31,0x2d88,0x11d3,0x9a,0x16,{0x00,0x90,0x27,0x3f,0xc1,0x4d}} | ||||
#define EFI_TABLE_SMBIOS3 \ | #define EFI_TABLE_SMBIOS3 \ | ||||
{0xf2fd1544,0x9794,0x4a2c,0x99,0x2e,{0xe5,0xbb,0xcf,0x20,0xe3,0x94}} | {0xf2fd1544,0x9794,0x4a2c,0x99,0x2e,{0xe5,0xbb,0xcf,0x20,0xe3,0x94}} | ||||
#define EFI_TABLE_ESRT \ | |||||
{0xb122a263,0x3661,0x4f68,0x99,0x29,{0x78,0xf8,0xb0,0xd6,0x21,0x80}} | |||||
#define EFI_PROPERTIES_TABLE \ | |||||
{0x880aaca3,0x4adc,0x4a04,0x90,0x79,{0xb7,0x47,0x34,0x08,0x25,0xe5}} | |||||
enum efi_reset { | enum efi_reset { | ||||
EFI_RESET_COLD = 0, | EFI_RESET_COLD = 0, | ||||
EFI_RESET_WARM = 1, | EFI_RESET_WARM = 1, | ||||
EFI_RESET_SHUTDOWN = 2, | EFI_RESET_SHUTDOWN = 2, | ||||
}; | }; | ||||
typedef uint16_t efi_char; | typedef uint16_t efi_char; | ||||
▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | |||||
struct efi_tblhdr { | struct efi_tblhdr { | ||||
uint64_t th_sig; | uint64_t th_sig; | ||||
uint32_t th_rev; | uint32_t th_rev; | ||||
uint32_t th_hdrsz; | uint32_t th_hdrsz; | ||||
uint32_t th_crc32; | uint32_t th_crc32; | ||||
uint32_t __res; | uint32_t __res; | ||||
}; | }; | ||||
#define ESRT_FIRMWARE_RESOURCE_VERSION 1 | |||||
struct efi_esrt_table { | |||||
uint32_t fw_resource_count; | |||||
uint32_t fw_resource_count_max; | |||||
uint64_t fw_resource_version; | |||||
uint8_t entries[]; | |||||
}; | |||||
struct efi_esrt_entry_v1 { | |||||
struct uuid fw_class; | |||||
uint32_t fw_type; | |||||
uint32_t fw_version; | |||||
uint32_t lowest_supported_fw_version; | |||||
uint32_t capsule_flags; | |||||
uint32_t last_attempt_version; | |||||
uint32_t last_attempt_status; | |||||
}; | |||||
struct efi_prop_table { | |||||
uint32_t version; | |||||
uint32_t length; | |||||
uint64_t memory_protection_attribute; | |||||
}; | |||||
#ifdef _KERNEL | #ifdef _KERNEL | ||||
#ifdef EFIABI_ATTR | #ifdef EFIABI_ATTR | ||||
struct efi_rt { | struct efi_rt { | ||||
struct efi_tblhdr rt_hdr; | struct efi_tblhdr rt_hdr; | ||||
efi_status (*rt_gettime)(struct efi_tm *, struct efi_tmcap *) | efi_status (*rt_gettime)(struct efi_tm *, struct efi_tmcap *) | ||||
EFIABI_ATTR; | EFIABI_ATTR; | ||||
efi_status (*rt_settime)(struct efi_tm *) EFIABI_ATTR; | efi_status (*rt_settime)(struct efi_tm *) EFIABI_ATTR; | ||||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | |||||
struct efi_ops { | struct efi_ops { | ||||
/* | /* | ||||
* The EFI calls might be virtualized in some environments, requiring | * The EFI calls might be virtualized in some environments, requiring | ||||
* FreeBSD to use a different interface (ie: hypercalls) in order to | * FreeBSD to use a different interface (ie: hypercalls) in order to | ||||
* access them. | * access them. | ||||
*/ | */ | ||||
int (*rt_ok)(void); | int (*rt_ok)(void); | ||||
int (*get_table)(struct uuid *, void **); | int (*get_table)(struct uuid *, void **); | ||||
int (*copy_table)(struct uuid *, void **, size_t, size_t *); | |||||
int (*get_time)(struct efi_tm *); | int (*get_time)(struct efi_tm *); | ||||
int (*get_time_capabilities)(struct efi_tmcap *); | int (*get_time_capabilities)(struct efi_tmcap *); | ||||
int (*reset_system)(enum efi_reset); | int (*reset_system)(enum efi_reset); | ||||
int (*set_time)(struct efi_tm *); | int (*set_time)(struct efi_tm *); | ||||
int (*var_get)(uint16_t *, struct uuid *, uint32_t *, size_t *, | int (*var_get)(uint16_t *, struct uuid *, uint32_t *, size_t *, | ||||
void *); | void *); | ||||
int (*var_nextname)(size_t *, uint16_t *, struct uuid *); | int (*var_nextname)(size_t *, uint16_t *, struct uuid *); | ||||
int (*var_set)(uint16_t *, struct uuid *, uint32_t, size_t, void *); | int (*var_set)(uint16_t *, struct uuid *, uint32_t, size_t, void *); | ||||
Show All 10 Lines | |||||
} | } | ||||
static inline int efi_get_table(struct uuid *uuid, void **ptr) | static inline int efi_get_table(struct uuid *uuid, void **ptr) | ||||
{ | { | ||||
if (active_efi_ops->get_table == NULL) | if (active_efi_ops->get_table == NULL) | ||||
return (ENXIO); | return (ENXIO); | ||||
return (active_efi_ops->get_table(uuid, ptr)); | return (active_efi_ops->get_table(uuid, ptr)); | ||||
} | |||||
static inline int efi_copy_table(struct uuid *uuid, void **buf, | |||||
size_t buf_len, size_t *table_len) | |||||
{ | |||||
if (active_efi_ops->copy_table == NULL) | |||||
return (ENXIO); | |||||
return (active_efi_ops->copy_table(uuid, buf, buf_len, table_len)); | |||||
} | } | ||||
static inline int efi_get_time(struct efi_tm *tm) | static inline int efi_get_time(struct efi_tm *tm) | ||||
{ | { | ||||
if (active_efi_ops->get_time == NULL) | if (active_efi_ops->get_time == NULL) | ||||
return (ENXIO); | return (ENXIO); | ||||
return (active_efi_ops->get_time(tm)); | return (active_efi_ops->get_time(tm)); | ||||
▲ Show 20 Lines • Show All 58 Lines • Show Last 20 Lines |