efi: Refactor our EFI code to use fuchsia's cleaner EFI headers.
* Drop gnu-efi Change-Id: Ib601fc8ced49b18281b6b98cf861a5aef1b9c065 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2026 Reviewed-by: Alex von Gluck IV <[email protected]> Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
571148258b
commit
485b5cf8bc
@@ -0,0 +1,205 @@
|
||||
// Copyright 2016 The Fuchsia Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <efi/types.h>
|
||||
#include <efi/protocol/device-path.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define EFI_BOOT_SERVICES_SIGNATURE 0x56524553544f4f42
|
||||
#define EFI_BOOT_SERVICES_REVISION EFI_SPECIFICATION_VERSION
|
||||
|
||||
typedef size_t efi_tpl;
|
||||
|
||||
#define TPL_APPLICATION 4
|
||||
#define TPL_CALLBACK 8
|
||||
#define TPL_NOTIFY 16
|
||||
#define TPL_HIGH_LEVEL 31
|
||||
|
||||
typedef enum {
|
||||
AllocateAnyPages,
|
||||
AllocateMaxAddress,
|
||||
AllocateAddress,
|
||||
MaxAllocateType
|
||||
} efi_allocate_type;
|
||||
|
||||
typedef struct {
|
||||
uint32_t Type;
|
||||
efi_physical_addr PhysicalStart;
|
||||
efi_virtual_addr VirtualStart;
|
||||
uint64_t NumberOfPages;
|
||||
uint64_t Attribute;
|
||||
} efi_memory_descriptor;
|
||||
|
||||
#define EFI_MEMORY_UC 0x0000000000000001
|
||||
#define EFI_MEMORY_WC 0x0000000000000002
|
||||
#define EFI_MEMORY_WT 0x0000000000000004
|
||||
#define EFI_MEMORY_WB 0x0000000000000008
|
||||
#define EFI_MEMORY_UCE 0x0000000000000010
|
||||
#define EFI_MEMORY_WP 0x0000000000001000
|
||||
#define EFI_MEMORY_RP 0x0000000000002000
|
||||
#define EFI_MEMORY_XP 0x0000000000004000
|
||||
#define EFI_MEMORY_NV 0x0000000000008000
|
||||
#define EFI_MEMORY_MORE_RELIABLE 0x0000000000010000
|
||||
#define EFI_MEMORY_RO 0x0000000000020000
|
||||
#define EFI_MEMORY_RUNTIME 0x8000000000000000
|
||||
|
||||
#define EFI_MEMORY_DESCRIPTOR_VERSION 1
|
||||
|
||||
typedef enum {
|
||||
EFI_NATIVE_INTERFACE
|
||||
} efi_interface_type;
|
||||
|
||||
typedef enum {
|
||||
AllHandles,
|
||||
ByRegisterNotify,
|
||||
ByProtocol
|
||||
} efi_locate_search_type;
|
||||
|
||||
#define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL 0x00000001
|
||||
#define EFI_OPEN_PROTOCOL_GET_PROTOCOL 0x00000002
|
||||
#define EFI_OPEN_PROTOCOL_TEST_PROTOCOL 0x00000004
|
||||
#define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008
|
||||
#define EFI_OPEN_PROTOCOL_BY_DRIVER 0x00000010
|
||||
#define EFI_OPEN_PROTOCOL_EXCLUSIVE 0x00000020
|
||||
|
||||
typedef struct {
|
||||
efi_handle agent_handle;
|
||||
efi_handle controller_handle;
|
||||
uint32_t attributes;
|
||||
uint32_t open_count;
|
||||
} efi_open_protocol_information_entry;
|
||||
|
||||
#define EFI_HII_PACKAGE_LIST_PROTOCOL_GUID \
|
||||
{0x6a1ee763, 0xd47a, 0x43b4, {0xaa, 0xbe, 0xef, 0x1d, 0xe2, 0xab, 0x56, 0xfc}}
|
||||
|
||||
typedef struct efi_hii_package_list_header efi_hii_package_list_header;
|
||||
typedef efi_hii_package_list_header* efi_hii_package_list_protocol;
|
||||
|
||||
// fwd declare efi_system_table to break circular dependencies
|
||||
typedef struct efi_system_table efi_system_table;
|
||||
typedef efi_status (*efi_image_entry_point) (efi_handle img, efi_system_table* sys) EFIAPI;
|
||||
|
||||
typedef struct {
|
||||
efi_table_header Hdr;
|
||||
|
||||
efi_tpl (*RaiseTPL) (efi_tpl new_tpl) EFIAPI;
|
||||
|
||||
void (*RestoreTPL) (efi_tpl old_tpl) EFIAPI;
|
||||
|
||||
efi_status (*AllocatePages) (efi_allocate_type type, efi_memory_type memory_type,
|
||||
size_t pages, efi_physical_addr* memory) EFIAPI;
|
||||
|
||||
efi_status (*FreePages) (efi_physical_addr memory, size_t pages) EFIAPI;
|
||||
|
||||
efi_status (*GetMemoryMap) (size_t* memory_map_size, efi_memory_descriptor* memory_map,
|
||||
size_t* map_key, size_t* desc_size, uint32_t* desc_version) EFIAPI;
|
||||
|
||||
efi_status (*AllocatePool) (efi_memory_type pool_type, size_t size, void** buf) EFIAPI;
|
||||
|
||||
efi_status (*FreePool) (void* buf) EFIAPI;
|
||||
|
||||
efi_status (*CreateEvent) (uint32_t type, efi_tpl notify_tpl,
|
||||
efi_event_notify notify_fn, void* notify_ctx,
|
||||
efi_event* event) EFIAPI;
|
||||
|
||||
efi_status (*SetTimer) (efi_event event, efi_timer_delay type, uint64_t trigger_time) EFIAPI;
|
||||
|
||||
efi_status (*WaitForEvent) (size_t num_events, efi_event* event, size_t* index) EFIAPI;
|
||||
|
||||
efi_status (*SignalEvent) (efi_event event) EFIAPI;
|
||||
|
||||
efi_status (*CloseEvent) (efi_event event) EFIAPI;
|
||||
|
||||
efi_status (*CheckEvent) (efi_event event) EFIAPI;
|
||||
|
||||
efi_status (*InstallProtocolInterface) (efi_handle* handle, efi_guid* protocol,
|
||||
efi_interface_type intf_type, void* intf) EFIAPI;
|
||||
|
||||
efi_status (*ReinstallProtocolInterface) (efi_handle hadle, efi_guid* protocol,
|
||||
void* old_intf, void* new_intf) EFIAPI;
|
||||
|
||||
efi_status (*UninstallProtocolInterface) (efi_handle handle, efi_guid* protocol,
|
||||
void* intf) EFIAPI;
|
||||
|
||||
efi_status (*HandleProtocol) (efi_handle handle, efi_guid* protocol, void** intf) EFIAPI;
|
||||
|
||||
void* Reserved;
|
||||
|
||||
efi_status (*RegisterProtocolNotify) (efi_guid* protocol, efi_event event,
|
||||
void** registration) EFIAPI;
|
||||
|
||||
efi_status (*LocateHandle) (efi_locate_search_type search_type, efi_guid* protocol,
|
||||
void* search_key, size_t* buf_size, efi_handle* buf) EFIAPI;
|
||||
|
||||
efi_status (*LocateDevicePath) (efi_guid* protocol, efi_device_path_protocol** path,
|
||||
efi_handle* device) EFIAPI;
|
||||
|
||||
efi_status (*InstallConfigurationTable) (efi_guid* guid, void* table) EFIAPI;
|
||||
|
||||
efi_status (*LoadImage) (bool boot_policy, efi_handle parent_image_handle,
|
||||
efi_device_path_protocol* path, void* src, size_t src_size,
|
||||
efi_handle* image_handle) EFIAPI;
|
||||
|
||||
efi_status (*StartImage) (efi_handle image_handle, size_t* exit_data_size,
|
||||
char16_t** exit_data) EFIAPI;
|
||||
|
||||
efi_status (*Exit) (efi_handle image_handle, efi_status exit_status,
|
||||
size_t exit_data_size, char16_t* exit_data) EFIAPI;
|
||||
|
||||
efi_status (*UnloadImage) (efi_handle image_handle) EFIAPI;
|
||||
|
||||
efi_status (*ExitBootServices) (efi_handle image_handle, size_t map_key) EFIAPI;
|
||||
|
||||
efi_status (*GetNextMonotonicCount) (uint64_t* count) EFIAPI;
|
||||
|
||||
efi_status (*Stall) (size_t microseconds) EFIAPI;
|
||||
|
||||
efi_status (*SetWatchdogTimer) (size_t timeout, uint64_t watchdog_code,
|
||||
size_t data_size, char16_t* watchdog_data) EFIAPI;
|
||||
|
||||
efi_status (*ConnectController) (efi_handle controller_handle,
|
||||
efi_handle* driver_image_handle,
|
||||
efi_device_path_protocol* remaining_path,
|
||||
bool recursive) EFIAPI;
|
||||
|
||||
efi_status (*DisconnectController) (efi_handle controller_handle,
|
||||
efi_handle driver_image_handle,
|
||||
efi_handle child_handle) EFIAPI;
|
||||
|
||||
efi_status (*OpenProtocol) (efi_handle handle, efi_guid* protocol, void** intf,
|
||||
efi_handle agent_handle, efi_handle controller_handle,
|
||||
uint32_t attributes) EFIAPI;
|
||||
|
||||
efi_status (*CloseProtocol) (efi_handle handle, efi_guid* protocol,
|
||||
efi_handle agent_handle, efi_handle controller_handle) EFIAPI;
|
||||
|
||||
efi_status (*OpenProtocolInformation) (efi_handle handle, efi_guid* protocol,
|
||||
efi_open_protocol_information_entry** entry_buf,
|
||||
size_t* entry_count) EFIAPI;
|
||||
|
||||
efi_status (*ProtocolsPerHandle) (efi_handle handle, efi_guid*** protocol_buf,
|
||||
size_t* protocol_buf_count) EFIAPI;
|
||||
|
||||
efi_status (*LocateHandleBuffer) (efi_locate_search_type search_type,
|
||||
efi_guid* protocol, void* search_key,
|
||||
size_t* num_handles, efi_handle** buf) EFIAPI;
|
||||
|
||||
efi_status (*LocateProtocol) (efi_guid* protocol, void* registration, void** intf) EFIAPI;
|
||||
|
||||
efi_status (*InstallMultipleProtocolInterfaces) (efi_handle* handle, ...) EFIAPI;
|
||||
|
||||
efi_status (*UninstallMultipleProtocolInterfaces) (efi_handle handle, ...) EFIAPI;
|
||||
|
||||
efi_status (*CalculateCrc32) (void* data, size_t len, uint32_t* crc32) EFIAPI;
|
||||
|
||||
void (*CopyMem) (void* dest, const void* src, size_t len) EFIAPI;
|
||||
|
||||
void (*SetMem) (void* buf, size_t len, uint8_t val) EFIAPI;
|
||||
|
||||
efi_status (*CreateEventEx) (uint32_t type, efi_tpl notify_tpl,
|
||||
efi_event_notify notify_fn, const void* notify_ctx,
|
||||
const efi_guid* event_group, efi_event* event) EFIAPI;
|
||||
} efi_boot_services;
|
||||
@@ -0,0 +1,56 @@
|
||||
// Copyright 2016 The Fuchsia Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <efi/types.h>
|
||||
#include <efi/boot-services.h>
|
||||
#include <efi/runtime-services.h>
|
||||
|
||||
#define EFI_BLOCK_IO_PROTOCOL_GUID \
|
||||
{0x964e5b21, 0x6459, 0x11d2, {0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b}}
|
||||
|
||||
extern efi_guid BlockIoProtocol;
|
||||
|
||||
#define EFI_BLOCK_IO_PROTOCOL_REVISION2 0x00020001
|
||||
#define EFI_BLOCK_IO_PROTOCOL_REVISION3 0x00020031
|
||||
|
||||
typedef struct efi_block_io_media efi_block_io_media;
|
||||
typedef struct efi_block_io_protocol efi_block_io_protocol;
|
||||
|
||||
struct efi_block_io_protocol {
|
||||
uint64_t Revision;
|
||||
efi_block_io_media* Media;
|
||||
efi_status (*Reset)(efi_block_io_protocol* self,
|
||||
bool ExtendedVerification) EFIAPI;
|
||||
efi_status (*ReadBlocks)(efi_block_io_protocol* self,
|
||||
uint32_t MediaId, uint64_t LBA,
|
||||
uint64_t BufferSize, void* Buffer) EFIAPI;
|
||||
efi_status (*WriteBlocks)(efi_block_io_protocol* self,
|
||||
uint32_t MediaId, uint64_t LBA,
|
||||
uint64_t BufferSize, const void* Buffer) EFIAPI;
|
||||
efi_status (*FlushBlocks)(efi_block_io_protocol* self);
|
||||
|
||||
|
||||
};
|
||||
|
||||
struct efi_block_io_media {
|
||||
// present in rev1
|
||||
uint32_t MediaId;
|
||||
bool RemovableMedia;
|
||||
bool MediaPresent;
|
||||
bool LogicalPartition;
|
||||
bool ReadOnly;
|
||||
bool WriteCaching;
|
||||
uint32_t BlockSize;
|
||||
uint32_t IoAlign;
|
||||
uint64_t LastBlock;
|
||||
|
||||
// present in rev2
|
||||
uint64_t LowestAlignedLba;
|
||||
uint32_t LogicalBlocksPerPhysicalBlock;
|
||||
|
||||
// present in rev3
|
||||
uint32_t OptimalTransferLengthGranularity;
|
||||
};
|
||||
@@ -0,0 +1,21 @@
|
||||
// Copyright 2016 The Fuchsia Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <efi/types.h>
|
||||
#include <efi/protocol/device-path.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID \
|
||||
{0x8b843e20, 0x8132, 0x4852, {0x90, 0xcc, 0x55, 0x1a, 0x4e, 0x4a, 0x7f, 0x1c}}
|
||||
extern efi_guid DevicePathToTextProtocol;
|
||||
|
||||
typedef struct efi_device_path_to_text_protocol {
|
||||
char16_t* (*ConvertDeviceNodeToText) (const efi_device_path_protocol* dev_node,
|
||||
bool display_only, bool allow_shortcuts) EFIAPI;
|
||||
|
||||
char16_t* (*ConvertDevicePathToText) (const efi_device_path_protocol* dev_path,
|
||||
bool display_only, bool allow_shortcuts) EFIAPI;
|
||||
} efi_device_path_to_text_protocol;
|
||||
@@ -0,0 +1,52 @@
|
||||
// Copyright 2016 The Fuchsia Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <efi/types.h>
|
||||
|
||||
#define EFI_DEVICE_PATH_PROTOCOL_GUID \
|
||||
{0x09576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b}}
|
||||
extern efi_guid DevicePathProtocol;
|
||||
|
||||
typedef struct efi_device_path_protocol {
|
||||
uint8_t Type;
|
||||
uint8_t SubType;
|
||||
uint8_t Length[2];
|
||||
} efi_device_path_protocol;
|
||||
|
||||
#define DEVICE_PATH_HARDWARE 0x01
|
||||
#define DEVICE_PATH_ACPI 0x02
|
||||
#define DEVICE_PATH_MESSAGING 0x03
|
||||
#define DEVICE_PATH_MEDIA 0x04
|
||||
#define DEVICE_PATH_BIOS_BOOT_SPEC 0x05
|
||||
#define DEVICE_PATH_END 0x7f
|
||||
|
||||
#define DEVICE_PATH_INSTANCE_END 0x01
|
||||
#define DEVICE_PATH_ENTIRE_END 0xff
|
||||
|
||||
#define DEVICE_PATH_HW_PCI 0x01
|
||||
#define DEVICE_PATH_HW_PCCARD 0x02
|
||||
#define DEVICE_PATH_HW_MEMMAP 0x03
|
||||
#define DEVICE_PATH_HW_VENDOR 0x04
|
||||
#define DEVICE_PATH_HW_CONTROLLER 0x05
|
||||
#define DEVICE_PATH_HW_BMC 0x06
|
||||
|
||||
// TODO: sub-types for other types (ACPI, etc)
|
||||
|
||||
// DEVICE_PATH_MEDIA Types
|
||||
#define MEDIA_HARDDRIVE_DP 0x01
|
||||
#define MEDIA_CDROM_DP 0x02
|
||||
#define MEDIA_VENDOR_DP 0x03
|
||||
#define MEDIA_FILEPATH_DP 0x04
|
||||
#define MEDIA_PROTOCOL_DP 0x05
|
||||
|
||||
// TODO: move this to another header? would break circular dependencies between
|
||||
// boot-services.h and this header, for efi_memory_type
|
||||
typedef struct {
|
||||
efi_device_path_protocol Header;
|
||||
efi_memory_type MemoryType;
|
||||
efi_physical_addr StartAddress;
|
||||
efi_physical_addr EndAddress;
|
||||
} efi_device_path_hw_memmap;
|
||||
@@ -0,0 +1,28 @@
|
||||
// Copyright 2016 The Fuchsia Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <efi/types.h>
|
||||
#include <efi/boot-services.h>
|
||||
#include <efi/runtime-services.h>
|
||||
|
||||
#define EFI_DISK_IO_PROTOCOL_GUID \
|
||||
{0xCE345171, 0xBA0B, 0x11d2, {0x8e, 0x4F, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b}}
|
||||
|
||||
extern efi_guid DiskIoProtocol;
|
||||
|
||||
#define EFI_DISK_IO_PROTOCOL_REVISION 0x00010000
|
||||
|
||||
typedef struct efi_disk_io_protocol efi_disk_io_protocol;
|
||||
|
||||
struct efi_disk_io_protocol {
|
||||
uint64_t Revision;
|
||||
efi_status (*ReadDisk)(efi_disk_io_protocol* self,
|
||||
uint32_t MediaId, uint64_t Offset,
|
||||
uint64_t BufferSize, void* Buffer) EFIAPI;
|
||||
efi_status (*WriteDisk)(efi_disk_io_protocol* self,
|
||||
uint32_t MediaId, uint64_t Offset,
|
||||
uint64_t BufferSize, const void* Buffer) EFIAPI;
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
// Copyright 2016 The Fuchsia Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <efi/types.h>
|
||||
#include <efi/protocol/device-path.h>
|
||||
|
||||
#define EFI_DRIVER_BINDING_PROTOCOL_GUID \
|
||||
{0x18a031ab, 0xb443, 0x4d1a, {0xa5, 0xc0, 0x0c, 0x09, 0x26, 0x1e, 0x9f, 0x71}}
|
||||
extern efi_guid DriverBindingProtocol;
|
||||
|
||||
typedef struct efi_driver_binding_protocol {
|
||||
efi_status (*Supported) (struct efi_driver_binding_protocol* self,
|
||||
efi_handle controller_handle,
|
||||
efi_device_path_protocol* remaining_path) EFIAPI;
|
||||
|
||||
efi_status (*Start) (struct efi_driver_binding_protocol* self,
|
||||
efi_handle controller_handle,
|
||||
efi_device_path_protocol* remaining_path) EFIAPI;
|
||||
|
||||
efi_status (*Stop) (struct efi_driver_binding_protocol* self,
|
||||
efi_handle controller_handle,
|
||||
size_t num_children, efi_handle* child_handle_buf) EFIAPI;
|
||||
|
||||
uint32_t Version;
|
||||
efi_handle ImageHandle;
|
||||
efi_handle DriverBindingHandle;
|
||||
} efi_driver_binding_protocol;
|
||||
@@ -0,0 +1,97 @@
|
||||
// Copyright 2016 The Fuchsia Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <efi/types.h>
|
||||
#include <efi/boot-services.h>
|
||||
#include <efi/runtime-services.h>
|
||||
|
||||
#define EFI_FILE_PROTOCOL_REVISION 0x00010000
|
||||
#define EFI_FILE_PROTOCOL_REVISION2 0x00020000
|
||||
#define EFI_FILE_PROTOCOL_LATEST_REVISION EFI_FILE_PROTOCOL_REVISION2
|
||||
|
||||
#define EFI_FILE_MODE_READ 0x0000000000000001
|
||||
#define EFI_FILE_MODE_WRITE 0x0000000000000002
|
||||
#define EFI_FILE_MODE_CREATE 0x8000000000000000
|
||||
|
||||
#define EFI_FILE_READ_ONLY 0x0000000000000001
|
||||
#define EFI_FILE_HIDDEN 0x0000000000000002
|
||||
#define EFI_FILE_SYSTEM 0x0000000000000004
|
||||
#define EFI_FILE_RESERVED 0x0000000000000008
|
||||
#define EFI_FILE_DIRECTORY 0x0000000000000010
|
||||
#define EFI_FILE_ARCHIVE 0x0000000000000020
|
||||
#define EFI_FILE_VALID_ATTR 0x0000000000000037
|
||||
|
||||
typedef struct {
|
||||
efi_event Event;
|
||||
efi_status Status;
|
||||
size_t BufferSize;
|
||||
void* Buffer;
|
||||
} efi_file_io_token;
|
||||
|
||||
#define EFI_FILE_INFO_GUID \
|
||||
{0x09576e92, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b}}
|
||||
extern efi_guid FileInfoGuid;
|
||||
|
||||
typedef struct {
|
||||
uint64_t Size;
|
||||
uint64_t FileSize;
|
||||
uint64_t PhysicalSize;
|
||||
efi_time CreateTime;
|
||||
efi_time LastAccessTime;
|
||||
efi_time ModificationTime;
|
||||
uint64_t Attribute;
|
||||
char16_t FileName[];
|
||||
} efi_file_info;
|
||||
|
||||
#define EFI_FILE_SYSTEM_INFO_GUID \
|
||||
{0x09576e93, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b}}
|
||||
extern efi_guid FileSystemInfoGuid;
|
||||
|
||||
typedef struct {
|
||||
uint64_t Size;
|
||||
bool ReadOnly;
|
||||
uint64_t VolumeSize;
|
||||
uint64_t FreeSpace;
|
||||
uint32_t BlockSize;
|
||||
char16_t* VolumeLabel[];
|
||||
} efi_file_system_info;
|
||||
|
||||
typedef struct efi_file_protocol {
|
||||
uint64_t Revision;
|
||||
|
||||
efi_status (*Open) (struct efi_file_protocol* self, struct efi_file_protocol** new_handle,
|
||||
const char16_t* filename, uint64_t open_mode, uint64_t attributes) EFIAPI;
|
||||
|
||||
efi_status (*Close) (struct efi_file_protocol* self) EFIAPI;
|
||||
|
||||
efi_status (*Delete) (struct efi_file_protocol* self) EFIAPI;
|
||||
|
||||
efi_status (*Read) (struct efi_file_protocol* self, size_t* len, void* buf) EFIAPI;
|
||||
|
||||
efi_status (*Write) (struct efi_file_protocol* self, size_t* len, void* buf) EFIAPI;
|
||||
|
||||
efi_status (*GetPosition) (struct efi_file_protocol* self, uint64_t* position) EFIAPI;
|
||||
|
||||
efi_status (*SetPosition) (struct efi_file_protocol* self, uint64_t position) EFIAPI;
|
||||
|
||||
efi_status (*GetInfo) (struct efi_file_protocol* self, efi_guid* info_type,
|
||||
size_t* buf_size, void* buf) EFIAPI;
|
||||
|
||||
efi_status (*SetInfo) (struct efi_file_protocol* self, efi_guid* info_type,
|
||||
size_t buf_size, void* buf) EFIAPI;
|
||||
|
||||
efi_status (*Flush) (struct efi_file_protocol* self) EFIAPI;
|
||||
|
||||
efi_status (*OpenEx) (struct efi_file_protocol* self, struct efi_file_protocol* new_handle,
|
||||
char16_t* filename, uint64_t open_mode, uint64_t attributes,
|
||||
efi_file_io_token* token) EFIAPI;
|
||||
|
||||
efi_status (*ReadEx) (struct efi_file_protocol* self, efi_file_io_token* token) EFIAPI;
|
||||
|
||||
efi_status (*WriteEx) (struct efi_file_protocol* self, efi_file_io_token* token) EFIAPI;
|
||||
|
||||
efi_status (*FlushEx) (struct efi_file_protocol* self, efi_file_io_token* token) EFIAPI;
|
||||
} efi_file_protocol;
|
||||
@@ -0,0 +1,76 @@
|
||||
// Copyright 2016 The Fuchsia Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <efi/types.h>
|
||||
|
||||
#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \
|
||||
{0x9042a9de, 0x23dc, 0x4a38, {0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a}}
|
||||
extern efi_guid GraphicsOutputProtocol;
|
||||
|
||||
typedef struct {
|
||||
uint32_t RedMask;
|
||||
uint32_t GreenMask;
|
||||
uint32_t BlueMask;
|
||||
uint32_t ReservedMask;
|
||||
} efi_pixel_bitmask;
|
||||
|
||||
typedef enum {
|
||||
PixelRedGreenBlueReserved8BitPerColor,
|
||||
PixelBlueGreenRedReserved8BitPerColor,
|
||||
PixelBitMask,
|
||||
PixelBltOnly,
|
||||
PixelFormatMax
|
||||
} efi_graphics_pixel_format;
|
||||
|
||||
typedef struct {
|
||||
uint32_t Version;
|
||||
uint32_t HorizontalResolution;
|
||||
uint32_t VerticalResolution;
|
||||
efi_graphics_pixel_format PixelFormat;
|
||||
efi_pixel_bitmask PixelInformation;
|
||||
uint32_t PixelsPerScanLine;
|
||||
} efi_graphics_output_mode_information;
|
||||
|
||||
typedef struct {
|
||||
uint32_t MaxMode;
|
||||
uint32_t Mode;
|
||||
efi_graphics_output_mode_information* Info;
|
||||
size_t SizeOfInfo;
|
||||
efi_physical_addr FrameBufferBase;
|
||||
size_t FrameBufferSize;
|
||||
} efi_graphics_output_mode;
|
||||
|
||||
typedef struct {
|
||||
uint8_t Blue;
|
||||
uint8_t Green;
|
||||
uint8_t Red;
|
||||
uint8_t Reserved;
|
||||
} efi_graphics_output_blt_pixel;
|
||||
|
||||
typedef enum {
|
||||
EfiBltVideoFill,
|
||||
EfiBltVideoToBltBuffer,
|
||||
EfiBltBufferToVideo,
|
||||
EfiBltVideoToVideo,
|
||||
EfiGraphicsOutputBltOperationMax
|
||||
} efi_graphics_output_blt_operation;
|
||||
|
||||
typedef struct efi_graphics_output_protocol {
|
||||
efi_status (*QueryMode) (struct efi_graphics_output_protocol* self,
|
||||
uint32_t mode_num, size_t* info_len,
|
||||
efi_graphics_output_mode_information** info) EFIAPI;
|
||||
|
||||
efi_status (*SetMode) (struct efi_graphics_output_protocol* self,
|
||||
uint32_t mode_num) EFIAPI;
|
||||
|
||||
efi_status (*Blt) (struct efi_graphics_output_protocol* self,
|
||||
efi_graphics_output_blt_pixel* blt_buf,
|
||||
efi_graphics_output_blt_operation blt_operation,
|
||||
size_t src_x, size_t src_y, size_t dest_x, size_t dest_y,
|
||||
size_t width, size_t height, size_t delta) EFIAPI;
|
||||
|
||||
efi_graphics_output_mode* Mode;
|
||||
} efi_graphics_output_protocol;
|
||||
@@ -0,0 +1,32 @@
|
||||
// Copyright 2016 The Fuchsia Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <efi/types.h>
|
||||
#include <efi/system-table.h>
|
||||
#include <efi/protocol/device-path.h>
|
||||
|
||||
#define EFI_LOADED_IMAGE_PROTOCOL_GUID \
|
||||
{0x5b1b31a1, 0x9562, 0x11d2, {0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b}}
|
||||
extern efi_guid LoadedImageProtocol;
|
||||
|
||||
#define EFI_LOADED_IMAGE_PROTOCOL_REVISION 0x1000
|
||||
|
||||
typedef struct {
|
||||
uint32_t Revision;
|
||||
efi_handle ParentHandle;
|
||||
efi_system_table* SystemTable;
|
||||
efi_handle DeviceHandle;
|
||||
efi_device_path_protocol* FilePath;
|
||||
void* Reserved;
|
||||
uint32_t LoadOptionsSize;
|
||||
void* LoadOptions;
|
||||
void* ImageBase;
|
||||
uint64_t ImageSize;
|
||||
efi_memory_type ImageCodeType;
|
||||
efi_memory_type ImageDataType;
|
||||
|
||||
efi_status (*Unload) (efi_handle img) EFIAPI;
|
||||
} efi_loaded_image_protocol;
|
||||
@@ -0,0 +1,92 @@
|
||||
// Copyright 2016 The Fuchsia Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <efi/types.h>
|
||||
#include <efi/protocol/simple-network.h>
|
||||
|
||||
#define EFI_MANAGED_NETWORK_PROTOCOL_GUID \
|
||||
{0x7ab33a91, 0xace5, 0x4326,{0xb5, 0x72, 0xe7, 0xee, 0x33, 0xd3, 0x9f, 0x16}}
|
||||
extern efi_guid ManagedNetworkProtocol;
|
||||
|
||||
typedef struct {
|
||||
efi_time Timestamp;
|
||||
efi_event RecycleEvent;
|
||||
uint32_t PacketLength;
|
||||
uint32_t HeaderLength;
|
||||
uint32_t AddressLength;
|
||||
uint32_t DataLength;
|
||||
bool BroadcastFlag;
|
||||
bool MulticastFlag;
|
||||
bool PromiscuousFlag;
|
||||
uint16_t ProtocolType;
|
||||
void* DestinationAddress;
|
||||
void* SourceAddress;
|
||||
void* MediaHeader;
|
||||
void* PacketData;
|
||||
} efi_managed_network_receive_data;
|
||||
|
||||
typedef struct {
|
||||
uint32_t FragmentLength;
|
||||
void* FragmentBuffer;
|
||||
} efi_managed_network_fragment_data;
|
||||
|
||||
typedef struct {
|
||||
efi_mac_addr* DestinationAddress;
|
||||
efi_mac_addr* SourceAddress;
|
||||
uint16_t ProtocolType;
|
||||
uint32_t DataLength;
|
||||
uint16_t HeaderLength;
|
||||
uint16_t FragmentCount;
|
||||
efi_managed_network_fragment_data FragmentTable[1];
|
||||
} efi_managed_network_transmit_data;
|
||||
|
||||
typedef struct {
|
||||
uint32_t ReceivedQueueTimeoutValue;
|
||||
uint32_t TransmitQueueTimeoutValue;
|
||||
uint16_t ProtocolTypeFilter;
|
||||
bool EnableUnicastReceive;
|
||||
bool EnableMulticastReceive;
|
||||
bool EnableBroadcastReceive;
|
||||
bool EnablePromiscuousReceive;
|
||||
bool FlushQueuesOnReset;
|
||||
bool EnableReceiveTimestamps;
|
||||
bool DisableBackgroundPolling;
|
||||
} efi_managed_network_config_data;
|
||||
|
||||
typedef struct {
|
||||
efi_event Event;
|
||||
efi_status Status;
|
||||
union {
|
||||
efi_managed_network_receive_data* RxData;
|
||||
efi_managed_network_transmit_data* TxData;
|
||||
} Packet;
|
||||
} efi_managed_network_sync_completion_token;
|
||||
|
||||
typedef struct efi_managed_network_protocol {
|
||||
efi_status (*GetModeData) (struct efi_managed_network_protocol* self,
|
||||
efi_managed_network_config_data* mnp_config_data,
|
||||
efi_simple_network_mode* snp_mode_data) EFIAPI;
|
||||
|
||||
efi_status (*Configure) (struct efi_managed_network_protocol* self,
|
||||
efi_managed_network_config_data* mnp_config_data) EFIAPI;
|
||||
|
||||
efi_status (*McastIpToMac) (struct efi_managed_network_protocol* self,
|
||||
bool ipv6_flag, efi_ip_addr* ip_addr, efi_mac_addr* mac_addr) EFIAPI;
|
||||
|
||||
efi_status (*Groups) (struct efi_managed_network_protocol* self, bool join_flag,
|
||||
efi_mac_addr* mac_addr) EFIAPI;
|
||||
|
||||
efi_status (*Transmit) (struct efi_managed_network_protocol* self,
|
||||
efi_managed_network_sync_completion_token* token) EFIAPI;
|
||||
|
||||
efi_status (*Receive) (struct efi_managed_network_protocol* self,
|
||||
efi_managed_network_sync_completion_token* token) EFIAPI;
|
||||
|
||||
efi_status (*Cancel) (struct efi_managed_network_protocol* self,
|
||||
efi_managed_network_sync_completion_token* token) EFIAPI;
|
||||
|
||||
efi_status (*Poll) (struct efi_managed_network_protocol* self) EFIAPI;
|
||||
} efi_managed_network_protocol;
|
||||
@@ -0,0 +1,115 @@
|
||||
// Copyright 2016 The Fuchsia Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <efi/boot-services.h>
|
||||
#include <efi/types.h>
|
||||
|
||||
#define EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID \
|
||||
{0x2f707ebb, 0x4a1a, 0x11D4, {0x9a, 0x38, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d}}
|
||||
extern efi_guid PciRootBridgeIoProtocol;
|
||||
|
||||
typedef enum {
|
||||
EfiPciWidthUint8,
|
||||
EfiPciWidthUint16,
|
||||
EfiPciWidthUint32,
|
||||
EfiPciWidthUint64,
|
||||
EfiPciWidthFifoUint8,
|
||||
EfiPciWidthFifoUint16,
|
||||
EfiPciWidthFifoUint32,
|
||||
EfiPciWidthFifoUint64,
|
||||
EfiPciWidthFillUint8,
|
||||
EfiPciWidthFillUint16,
|
||||
EfiPciWidthFillUint32,
|
||||
EfiPciWidthFillUint64,
|
||||
EfiPciWidthMaximum,
|
||||
} efi_pci_root_bridge_io_width;
|
||||
|
||||
struct efi_pci_root_bridge_io_protocol;
|
||||
|
||||
typedef struct {
|
||||
efi_status (*Read) (struct efi_pci_root_bridge_io_protocol* self,
|
||||
efi_pci_root_bridge_io_width width,
|
||||
uint64_t addr, size_t count, void* buffer) EFIAPI;
|
||||
efi_status (*Write) (struct efi_pci_root_bridge_io_protocol* self,
|
||||
efi_pci_root_bridge_io_width width,
|
||||
uint64_t addr, size_t count, void* buffer) EFIAPI;
|
||||
} efi_pci_root_bridge_io_access;
|
||||
|
||||
#define EFI_PCI_ATTRIBUTE_ISA_MOTHERBOARD_IO 0x0001
|
||||
#define EFI_PCI_ATTRIBUTE_ISA_IO 0x0002
|
||||
#define EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO 0x0004
|
||||
#define EFI_PCI_ATTRIBUTE_VGA_MEMORY 0x0008
|
||||
#define EFI_PCI_ATTRIBUTE_VGA_IO 0x0010
|
||||
#define EFI_PCI_ATTRIBUTE_IDE_PRIMARY_IO 0x0020
|
||||
#define EFI_PCI_ATTRIBUTE_IDE_SECONDARY_IO 0x0040
|
||||
#define EFI_PCI_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x0080
|
||||
#define EFI_PCI_ATTRIBUTE_MEMORY_CACHED 0x0800
|
||||
#define EFI_PCI_ATTRIBUTE_MEMORY_DISABLE 0x1000
|
||||
#define EFI_PCI_ATTRIBUTE_DUAL_ADDRESS_CYCLE 0x8000
|
||||
#define EFI_PCI_ATTRIBUTE_ISA_IO_16 0x10000
|
||||
#define EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO_16 0x20000
|
||||
#define EFI_PCI_ATTRIBUTE_VGA_IO_16 0x40000
|
||||
|
||||
typedef enum {
|
||||
EfiPciOperationBusMasterRead,
|
||||
EfiPciOperationBusMasterWrite,
|
||||
EfiPciOperationBusMasterCommonBuffer,
|
||||
EfiPciOperationBusMasterRead64,
|
||||
EfiPciOperationBusMasterWrite64,
|
||||
EfiPciOperationBusMasterCommonBuffer64,
|
||||
EfiPciOperationMaximum,
|
||||
} efi_pci_root_bridge_io_operation;
|
||||
|
||||
typedef struct efi_pci_root_bridge_io_protocol {
|
||||
efi_handle ParentHandle;
|
||||
|
||||
efi_status (*PollMem) (struct efi_pci_root_bridge_io_protocol *self,
|
||||
efi_pci_root_bridge_io_width width,
|
||||
uint64_t addr, uint64_t mask, uint64_t value, uint64_t delay,
|
||||
uint64_t* result) EFIAPI;
|
||||
|
||||
efi_status (*PollIo) (struct efi_pci_root_bridge_io_protocol *self,
|
||||
efi_pci_root_bridge_io_width width,
|
||||
uint64_t addr, uint64_t mask, uint64_t value, uint64_t delay,
|
||||
uint64_t* result) EFIAPI;
|
||||
|
||||
efi_pci_root_bridge_io_access Mem;
|
||||
efi_pci_root_bridge_io_access Io;
|
||||
efi_pci_root_bridge_io_access Pci;
|
||||
|
||||
efi_status (*CopyMem) (struct efi_pci_root_bridge_io_protocol* self,
|
||||
efi_pci_root_bridge_io_width width,
|
||||
uint64_t dest_addr, uint64_t src_addr, size_t count) EFIAPI;
|
||||
|
||||
efi_status (*Map) (struct efi_pci_root_bridge_io_protocol* self,
|
||||
efi_pci_root_bridge_io_operation operation,
|
||||
void* host_addr, size_t* num_bytes,
|
||||
efi_physical_addr* device_addr, void** mapping) EFIAPI;
|
||||
|
||||
efi_status (*Unmap) (struct efi_pci_root_bridge_io_protocol* self,
|
||||
void* mapping) EFIAPI;
|
||||
|
||||
efi_status (*AllocateBuffer) (struct efi_pci_root_bridge_io_protocol* self,
|
||||
efi_allocate_type type, efi_memory_type memory_type,
|
||||
size_t pages, void** host_addr, uint64_t attributes) EFIAPI;
|
||||
|
||||
efi_status (*FreeBuffer) (struct efi_pci_root_bridge_io_protocol* self,
|
||||
size_t pages, void* host_addr) EFIAPI;
|
||||
|
||||
efi_status (*Flush) (struct efi_pci_root_bridge_io_protocol* self) EFIAPI;
|
||||
|
||||
efi_status (*GetAttributes) (struct efi_pci_root_bridge_io_protocol* self,
|
||||
uint64_t* supports, uint64_t* attributes) EFIAPI;
|
||||
|
||||
efi_status (*SetAttributes) (struct efi_pci_root_bridge_io_protocol* self,
|
||||
uint64_t attributes, uint64_t* resource_base,
|
||||
uint64_t* resource_len) EFIAPI;
|
||||
|
||||
efi_status (*Configuration) (struct efi_pci_root_bridge_io_protocol* self,
|
||||
void** resources) EFIAPI;
|
||||
|
||||
uint32_t SegmentNumber;
|
||||
} efi_pci_root_bridge_io_protocol;
|
||||
@@ -0,0 +1,67 @@
|
||||
// Copyright 2016-2019 The Fuchsia Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <efi/types.h>
|
||||
#include <efi/boot-services.h>
|
||||
#include <efi/runtime-services.h>
|
||||
|
||||
#define EFI_SERIAL_IO_PROTOCOL_GUID \
|
||||
{0xBB25CF6F, 0xF1D4, 0x11D2, {0x9A, 0x0C, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0xFD}}
|
||||
|
||||
extern efi_guid SerialIoProtocol;
|
||||
|
||||
#define EFI_SERIAL_IO_PROTOCOL_REVISION 0x00010000
|
||||
|
||||
typedef struct efi_serial_io_protocol efi_serial_io_protocol;
|
||||
|
||||
typedef struct {
|
||||
uint32_t ControlMask;
|
||||
|
||||
// current Attributes
|
||||
uint32_t Timeout;
|
||||
uint64_t BaudRate;
|
||||
uint32_t ReceiveFifoDepth;
|
||||
uint32_t DataBits;
|
||||
uint32_t Parity;
|
||||
uint32_t StopBits;
|
||||
} efi_serial_io_mode;
|
||||
|
||||
typedef enum {
|
||||
DefaultParity,
|
||||
NoParity,
|
||||
EvenParity,
|
||||
OddParity,
|
||||
MarkParity,
|
||||
SpaceParity
|
||||
} efi_parity_type;
|
||||
|
||||
typedef enum {
|
||||
DefaultStopBits,
|
||||
OneStopBit,
|
||||
OneFiveStopBits,
|
||||
TwoStopBits
|
||||
} efi_stop_bits_type;
|
||||
|
||||
|
||||
typedef struct efi_serial_io_protocol {
|
||||
uint32_t Revision;
|
||||
|
||||
efi_status (*Reset)(efi_serial_io_protocol* self) EFIAPI;
|
||||
efi_status (*SetAttributes)(efi_serial_io_protocol* self,
|
||||
uint64_t BaudRate, uint32_t ReceiveFifoDepth,
|
||||
uint32_t Timeout, efi_parity_type Parity,
|
||||
uint8_t DataBits, efi_stop_bits_type StopBits) EFIAPI;
|
||||
efi_status (*SetControl)(efi_serial_io_protocol* self,
|
||||
uint32_t Control) EFIAPI;
|
||||
efi_status (*GetControl)(efi_serial_io_protocol* self,
|
||||
uint32_t* Control) EFIAPI;
|
||||
efi_status (*Write)(efi_serial_io_protocol* self,
|
||||
size_t* BufferSize, void* Buffer) EFIAPI;
|
||||
efi_status (*Read)(efi_serial_io_protocol* self,
|
||||
size_t* BufferSize, void* Buffer) EFIAPI;
|
||||
|
||||
efi_serial_io_mode* Mode;
|
||||
} efi_serial_io_protocol;
|
||||
@@ -0,0 +1,21 @@
|
||||
// Copyright 2016 The Fuchsia Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <efi/types.h>
|
||||
#include <efi/protocol/file.h>
|
||||
|
||||
#define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID \
|
||||
{0x0964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b}}
|
||||
extern efi_guid SimpleFileSystemProtocol;
|
||||
|
||||
#define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION 0x00010000
|
||||
|
||||
typedef struct efi_simple_file_system_protocol {
|
||||
uint64_t Revision;
|
||||
|
||||
efi_status (*OpenVolume) (struct efi_simple_file_system_protocol* self,
|
||||
efi_file_protocol** root) EFIAPI;
|
||||
} efi_simple_file_system_protocol;
|
||||
@@ -0,0 +1,132 @@
|
||||
// Copyright 2016 The Fuchsia Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <efi/types.h>
|
||||
|
||||
#define EFI_SIMPLE_NETWORK_PROTOCOL_GUID \
|
||||
{0xa19832b9, 0xac25, 0x11d3, {0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d}}
|
||||
extern efi_guid SimpleNetworkProtocol;
|
||||
|
||||
#define EFI_SIMPLE_NETWORK_PROTOCOL_REVISION 0x00010000
|
||||
|
||||
#define MAX_MCAST_FILTER_CNT 16
|
||||
typedef struct {
|
||||
uint32_t State;
|
||||
uint32_t HwAddressSize;
|
||||
uint32_t MediaHeaderSize;
|
||||
uint32_t MaxPacketSize;
|
||||
uint32_t NvRamSize;
|
||||
uint32_t NvRamAccessSize;
|
||||
uint32_t ReceiveFilterMask;
|
||||
uint32_t ReceiveFilterSetting;
|
||||
uint32_t MaxMCastFilterCount;
|
||||
uint32_t MCastFilterCount;
|
||||
efi_mac_addr MCastFilter[MAX_MCAST_FILTER_CNT];
|
||||
efi_mac_addr CurrentAddress;
|
||||
efi_mac_addr BroadcastAddress;
|
||||
efi_mac_addr PermanentAddress;
|
||||
uint8_t IfType;
|
||||
bool MacAddressChangeable;
|
||||
bool MultipleTxSupported;
|
||||
bool MediaPresentSupported;
|
||||
bool MediaPresent;
|
||||
} efi_simple_network_mode;
|
||||
|
||||
typedef enum {
|
||||
EfiSimpleNetworkStopped,
|
||||
EfiSimpleNetworkStarted,
|
||||
EfiSimpleNetworkInitialized,
|
||||
EfiSimpleNetworkMaxState
|
||||
} efi_simple_network_state;
|
||||
|
||||
#define EFI_SIMPLE_NETWORK_RECEIVE_UNICAST 0x01
|
||||
#define EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST 0x02
|
||||
#define EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST 0x04
|
||||
#define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS 0x08
|
||||
#define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST 0x10
|
||||
|
||||
typedef struct {
|
||||
uint64_t RxTotalFrames;
|
||||
uint64_t RxGoodFrames;
|
||||
uint64_t RxUndersizeFrames;
|
||||
uint64_t RxOversizeFrames;
|
||||
uint64_t RxDroppedFrames;
|
||||
uint64_t RxUnicastFrames;
|
||||
uint64_t RxBroadcastFrames;
|
||||
uint64_t RxMulticastFrames;
|
||||
uint64_t RxCrcErrorFrames;
|
||||
uint64_t RxTotalBytes;
|
||||
uint64_t TxTotalFrames;
|
||||
uint64_t TxGoodFrames;
|
||||
uint64_t TxUndersizeFrames;
|
||||
uint64_t TxOversizeFrames;
|
||||
uint64_t TxDroppedFrames;
|
||||
uint64_t TxUnicastFrames;
|
||||
uint64_t TxBroadcastFrames;
|
||||
uint64_t TxMulticastFrames;
|
||||
uint64_t TxCrcErrorFrames;
|
||||
uint64_t TxTotalBytes;
|
||||
uint64_t Collisions;
|
||||
uint64_t UnsupportedProtocol;
|
||||
uint64_t RxDuplicatedFrames;
|
||||
uint64_t RxDecryptErrorFrames;
|
||||
uint64_t TxErrorFrames;
|
||||
uint64_t TxRetryFrames;
|
||||
} efi_network_statistics;
|
||||
|
||||
#define EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT 0x01
|
||||
#define EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT 0x02
|
||||
#define EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT 0x04
|
||||
#define EFI_SIMPLE_NETWORK_SOFTWARE_INTERRUPT 0x08
|
||||
|
||||
typedef struct efi_simple_network_protocol {
|
||||
uint64_t Revision;
|
||||
|
||||
efi_status (*Start) (struct efi_simple_network_protocol* self) EFIAPI;
|
||||
|
||||
efi_status (*Stop) (struct efi_simple_network_protocol* self) EFIAPI;
|
||||
|
||||
efi_status (*Initialize) (struct efi_simple_network_protocol* self,
|
||||
size_t extra_rx_buf_size, size_t extra_tx_buf_size) EFIAPI;
|
||||
|
||||
efi_status (*Reset) (struct efi_simple_network_protocol* self,
|
||||
bool extended_verification) EFIAPI;
|
||||
|
||||
efi_status (*Shutdown) (struct efi_simple_network_protocol* self) EFIAPI;
|
||||
|
||||
efi_status (*ReceiveFilters) (struct efi_simple_network_protocol* self,
|
||||
uint32_t enable, uint32_t disable,
|
||||
bool reset_mcast_filter, size_t mcast_filter_count,
|
||||
efi_mac_addr* mcast_filter) EFIAPI;
|
||||
|
||||
efi_status (*StationAddress) (struct efi_simple_network_protocol* self,
|
||||
bool reset, efi_mac_addr* new_addr) EFIAPI;
|
||||
|
||||
efi_status (*Statistics) (struct efi_simple_network_protocol* self,
|
||||
bool reset, size_t* stats_size,
|
||||
efi_network_statistics* stats_table) EFIAPI;
|
||||
|
||||
efi_status (*MCastIpToMac) (struct efi_simple_network_protocol* self,
|
||||
bool ipv6, efi_ip_addr* ip, efi_mac_addr* mac) EFIAPI;
|
||||
|
||||
efi_status (*NvData) (struct efi_simple_network_protocol* self,
|
||||
bool read_write, size_t offset, size_t buf_size, void* buf) EFIAPI;
|
||||
|
||||
efi_status (*GetStatus) (struct efi_simple_network_protocol* self,
|
||||
uint32_t* interrupt_status, void** tx_buf) EFIAPI;
|
||||
|
||||
efi_status (*Transmit) (struct efi_simple_network_protocol* self,
|
||||
size_t header_size, size_t buf_size, void* buf,
|
||||
efi_mac_addr* src, efi_mac_addr* dest, uint16_t* protocol) EFIAPI;
|
||||
|
||||
efi_status (*Receive) (struct efi_simple_network_protocol* self,
|
||||
size_t* header_size, size_t* buf_size, void* buf,
|
||||
efi_mac_addr* src, efi_mac_addr* dest, uint16_t* protocol) EFIAPI;
|
||||
|
||||
efi_event WaitForPacket;
|
||||
efi_simple_network_mode* Mode;
|
||||
} efi_simple_network_protocol;
|
||||
@@ -0,0 +1,26 @@
|
||||
// Copyright 2016 The Fuchsia Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <efi/types.h>
|
||||
|
||||
#define EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID \
|
||||
{0x387477c1, 0x69c7, 0x11d2, {0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b}}
|
||||
extern efi_guid SimpleTextInputProtocol;
|
||||
|
||||
typedef struct {
|
||||
uint16_t ScanCode;
|
||||
char16_t UnicodeChar;
|
||||
} efi_input_key;
|
||||
|
||||
typedef struct efi_simple_text_input_protocol {
|
||||
efi_status (*Reset) (struct efi_simple_text_input_protocol* self,
|
||||
bool extendend_verification) EFIAPI;
|
||||
|
||||
efi_status (*ReadKeyStroke) (struct efi_simple_text_input_protocol* self,
|
||||
efi_input_key* key) EFIAPI;
|
||||
|
||||
efi_event WaitForKey;
|
||||
} efi_simple_text_input_protocol;
|
||||
@@ -0,0 +1,143 @@
|
||||
// Copyright 2016 The Fuchsia Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <efi/types.h>
|
||||
|
||||
#define EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID \
|
||||
{0x387477c2, 0x69c7, 0x11d2, {0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b}}
|
||||
extern efi_guid SimpleTextOutputProtocol;
|
||||
|
||||
typedef struct {
|
||||
int32_t MaxMode;
|
||||
int32_t Mode;
|
||||
int32_t Attribute;
|
||||
int32_t CursorColumn;
|
||||
int32_t CursorRow;
|
||||
bool CursorVisible;
|
||||
} simple_text_output_mode;
|
||||
|
||||
//*******************************************************
|
||||
// UNICODE DRAWING CHARACTERS
|
||||
//*******************************************************
|
||||
#define BOXDRAW_HORIZONTAL 0x2500
|
||||
#define BOXDRAW_VERTICAL 0x2502
|
||||
#define BOXDRAW_DOWN_RIGHT 0x250c
|
||||
#define BOXDRAW_DOWN_LEFT 0x2510
|
||||
#define BOXDRAW_UP_RIGHT 0x2514
|
||||
#define BOXDRAW_UP_LEFT 0x2518
|
||||
#define BOXDRAW_VERTICAL_RIGHT 0x251c
|
||||
#define BOXDRAW_VERTICAL_LEFT 0x2524
|
||||
#define BOXDRAW_DOWN_HORIZONTAL 0x252c
|
||||
#define BOXDRAW_UP_HORIZONTAL 0x2534
|
||||
#define BOXDRAW_VERTICAL_HORIZONTAL 0x253c
|
||||
#define BOXDRAW_DOUBLE_HORIZONTAL 0x2550
|
||||
#define BOXDRAW_DOUBLE_VERTICAL 0x2551
|
||||
#define BOXDRAW_DOWN_RIGHT_DOUBLE 0x2552
|
||||
#define BOXDRAW_DOWN_DOUBLE_RIGHT 0x2553
|
||||
#define BOXDRAW_DOUBLE_DOWN_RIGHT 0x2554
|
||||
#define BOXDRAW_DOWN_LEFT_DOUBLE 0x2555
|
||||
#define BOXDRAW_DOWN_DOUBLE_LEFT 0x2556
|
||||
#define BOXDRAW_DOUBLE_DOWN_LEFT 0x2557
|
||||
#define BOXDRAW_UP_RIGHT_DOUBLE 0x2558
|
||||
#define BOXDRAW_UP_DOUBLE_RIGHT 0x2559
|
||||
#define BOXDRAW_DOUBLE_UP_RIGHT 0x255a
|
||||
#define BOXDRAW_UP_LEFT_DOUBLE 0x255b
|
||||
#define BOXDRAW_UP_DOUBLE_LEFT 0x255c
|
||||
#define BOXDRAW_DOUBLE_UP_LEFT 0x255d
|
||||
#define BOXDRAW_VERTICAL_RIGHT_DOUBLE 0x255e
|
||||
#define BOXDRAW_VERTICAL_DOUBLE_RIGHT 0x255f
|
||||
#define BOXDRAW_DOUBLE_VERTICAL_RIGHT 0x2560
|
||||
#define BOXDRAW_VERTICAL_LEFT_DOUBLE 0x2561
|
||||
#define BOXDRAW_VERTICAL_DOUBLE_LEFT 0x2562
|
||||
#define BOXDRAW_DOUBLE_VERTICAL_LEFT 0x2563
|
||||
#define BOXDRAW_DOWN_HORIZONTAL_DOUBLE 0x2564
|
||||
#define BOXDRAW_DOWN_DOUBLE_HORIZONTAL 0x2565
|
||||
#define BOXDRAW_DOUBLE_DOWN_HORIZONTAL 0x2566
|
||||
#define BOXDRAW_UP_HORIZONTAL_DOUBLE 0x2567
|
||||
#define BOXDRAW_UP_DOUBLE_HORIZONTAL 0x2568
|
||||
#define BOXDRAW_DOUBLE_UP_HORIZONTAL 0x2569
|
||||
#define BOXDRAW_VERTICAL_HORIZONTAL_DOUBLE 0x256a
|
||||
#define BOXDRAW_VERTICAL_DOUBLE_HORIZONTAL 0x256b
|
||||
#define BOXDRAW_DOUBLE_VERTICAL_HORIZONTAL 0x256c
|
||||
|
||||
//*******************************************************
|
||||
// EFI Required Block Elements Code Chart
|
||||
//*******************************************************
|
||||
#define BLOCKELEMENT_FULL_BLOCK 0x2588
|
||||
#define BLOCKELEMENT_LIGHT_SHADE 0x2591
|
||||
|
||||
//*******************************************************
|
||||
// EFI Required Geometric Shapes Code Chart
|
||||
//*******************************************************
|
||||
#define GEOMETRICSHAPE_UP_TRIANGLE 0x25b2
|
||||
#define GEOMETRICSHAPE_RIGHT_TRIANGLE 0x25ba
|
||||
#define GEOMETRICSHAPE_DOWN_TRIANGLE 0x25bc
|
||||
#define GEOMETRICSHAPE_LEFT_TRIANGLE 0x25c4
|
||||
|
||||
//*******************************************************
|
||||
// EFI Required Arrow shapes
|
||||
//*******************************************************
|
||||
#define ARROW_UP 0x2191
|
||||
#define ARROW_DOWN 0x2193
|
||||
|
||||
//*******************************************************
|
||||
// Attributes
|
||||
//*******************************************************
|
||||
#define EFI_BLACK 0x00
|
||||
#define EFI_BLUE 0x01
|
||||
#define EFI_GREEN 0x02
|
||||
#define EFI_CYAN 0x03
|
||||
#define EFI_RED 0x04
|
||||
#define EFI_ZIRCON 0x05
|
||||
#define EFI_BROWN 0x06
|
||||
#define EFI_LIGHTGRAY 0x07
|
||||
#define EFI_BRIGHT 0x08
|
||||
#define EFI_DARKGRAY 0x08
|
||||
#define EFI_LIGHTBLUE 0x09
|
||||
#define EFI_LIGHTGREEN 0x0A
|
||||
#define EFI_LIGHTCYAN 0x0B
|
||||
#define EFI_LIGHTRED 0x0C
|
||||
#define EFI_LIGHTZIRCON 0x0D
|
||||
#define EFI_YELLOW 0x0E
|
||||
#define EFI_WHITE 0x0F
|
||||
#define EFI_BACKGROUND_BLACK 0x00
|
||||
#define EFI_BACKGROUND_BLUE 0x10
|
||||
#define EFI_BACKGROUND_GREEN 0x20
|
||||
#define EFI_BACKGROUND_CYAN 0x30
|
||||
#define EFI_BACKGROUND_RED 0x40
|
||||
#define EFI_BACKGROUND_ZIRCON 0x50
|
||||
#define EFI_BACKGROUND_BROWN 0x60
|
||||
#define EFI_BACKGROUND_LIGHTGRAY 0x70
|
||||
|
||||
typedef struct efi_simple_text_output_protocol {
|
||||
efi_status (*Reset) (struct efi_simple_text_output_protocol* self,
|
||||
bool extended_verification) EFIAPI;
|
||||
|
||||
efi_status (*OutputString) (struct efi_simple_text_output_protocol* self,
|
||||
char16_t* string) EFIAPI;
|
||||
|
||||
efi_status (*TestString) (struct efi_simple_text_output_protocol* self,
|
||||
char16_t* string) EFIAPI;
|
||||
|
||||
efi_status (*QueryMode) (struct efi_simple_text_output_protocol* self,
|
||||
size_t mode_num, size_t* cols, size_t* rows) EFIAPI;
|
||||
|
||||
efi_status (*SetMode) (struct efi_simple_text_output_protocol* self,
|
||||
size_t mode_num) EFIAPI;
|
||||
|
||||
efi_status (*SetAttribute) (struct efi_simple_text_output_protocol* self,
|
||||
size_t attribute) EFIAPI;
|
||||
|
||||
efi_status (*ClearScreen) (struct efi_simple_text_output_protocol* self) EFIAPI;
|
||||
|
||||
efi_status (*SetCursorPosition) (struct efi_simple_text_output_protocol* self,
|
||||
size_t col, size_t row) EFIAPI;
|
||||
|
||||
efi_status (*EnableCursor) (struct efi_simple_text_output_protocol* self,
|
||||
bool visible) EFIAPI;
|
||||
|
||||
simple_text_output_mode* Mode;
|
||||
} efi_simple_text_output_protocol;
|
||||
@@ -0,0 +1,147 @@
|
||||
// Copyright 2016 The Fuchsia Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <efi/types.h>
|
||||
|
||||
#define EFI_USB_IO_PROTOCOL_GUID \
|
||||
{0x2b2f68d6, 0x0cd2, 0x44cf, {0x8e, 0x8b, 0xbb, 0xa2, 0x0b, 0x1b, 0x5b, 0x75}}
|
||||
extern efi_guid UsbIoProtocol;
|
||||
|
||||
typedef enum {
|
||||
EfiUsbDataIn,
|
||||
EfiUsbDataOut,
|
||||
EfiUsbNoData
|
||||
} efi_usb_data_direction;
|
||||
|
||||
#define EFI_USB_NOERROR 0x0000
|
||||
#define EFI_USB_ERR_NOTEXECUTE 0x0001
|
||||
#define EFI_USB_ERR_STALL 0x0002
|
||||
#define EFI_USB_ERR_BUFFER 0x0004
|
||||
#define EFI_USB_ERR_BABBLE 0x0008
|
||||
#define EFI_USB_ERR_NAK 0x0010
|
||||
#define EFI_USB_ERR_CRC 0x0020
|
||||
#define EFI_USB_ERR_TIMEOUT 0x0040
|
||||
#define EFI_USB_ERR_BITSTUFF 0x0080
|
||||
#define EFI_USB_ERR_SYSTEM 0x0100
|
||||
|
||||
typedef struct {
|
||||
uint8_t RequestType;
|
||||
uint8_t Request;
|
||||
uint16_t Value;
|
||||
uint16_t Index;
|
||||
uint16_t Length;
|
||||
} efi_usb_device_request;
|
||||
|
||||
typedef efi_status (*efi_async_usb_transfer_callback) (
|
||||
void* Data, size_t DataLength, void* Context, uint32_t Status) EFIAPI;
|
||||
|
||||
typedef struct {
|
||||
uint8_t Length;
|
||||
uint8_t DescriptorType;
|
||||
uint16_t BcdUSB;
|
||||
uint8_t DeviceClass;
|
||||
uint8_t DeviceSubClass;
|
||||
uint8_t DeviceProtocol;
|
||||
uint8_t MaxPacketSize0;
|
||||
uint16_t IdVendor;
|
||||
uint16_t IdProduct;
|
||||
uint16_t BcdDevice;
|
||||
uint8_t StrManufacturer;
|
||||
uint8_t StrProduct;
|
||||
uint8_t StrSerialNumber;
|
||||
uint8_t NumConfigurations;
|
||||
} efi_usb_device_descriptor;
|
||||
|
||||
typedef struct {
|
||||
uint8_t Length;
|
||||
uint8_t DescriptorType;
|
||||
uint16_t TotalLength;
|
||||
uint8_t NumInterfaces;
|
||||
uint8_t ConfigurationValue;
|
||||
uint8_t Configuration;
|
||||
uint8_t Attributes;
|
||||
uint8_t MaxPower;
|
||||
} efi_usb_config_descriptor;
|
||||
|
||||
typedef struct {
|
||||
uint8_t Length;
|
||||
uint8_t DescriptorType;
|
||||
uint8_t InterfaceNumber;
|
||||
uint8_t AlternateSetting;
|
||||
uint8_t NumEndpoints;
|
||||
uint8_t InterfaceClass;
|
||||
uint8_t InterfaceSubClass;
|
||||
uint8_t InterfaceProtocol;
|
||||
uint8_t Interface;
|
||||
} efi_usb_interface_descriptor;
|
||||
|
||||
typedef struct {
|
||||
uint8_t Length;
|
||||
uint8_t DescriptorType;
|
||||
uint8_t EndpointAddress;
|
||||
uint8_t Attributes;
|
||||
uint16_t MaxPacketSize;
|
||||
uint8_t Interval;
|
||||
} efi_usb_endpoint_descriptor;
|
||||
|
||||
typedef struct efi_usb_io_protocol {
|
||||
efi_status (*UsbControlTransfer) (struct efi_usb_io_protocol* self,
|
||||
efi_usb_device_request* request,
|
||||
efi_usb_data_direction direction,
|
||||
uint32_t timeout, void* data,
|
||||
size_t data_len, uint32_t* status) EFIAPI;
|
||||
|
||||
efi_status (*UsbBulkTransfer) (struct efi_usb_io_protocol* self,
|
||||
uint8_t endpoint, void* data,
|
||||
size_t data_len, size_t timeout,
|
||||
uint32_t* status) EFIAPI;
|
||||
|
||||
efi_status (*UsbAsyncInterruptTransfer) (struct efi_usb_io_protocol* self,
|
||||
uint8_t endpoint, bool is_new_transfer,
|
||||
size_t polling_interval,
|
||||
size_t data_len,
|
||||
efi_async_usb_transfer_callback interrupt_cb,
|
||||
void* context) EFIAPI;
|
||||
|
||||
efi_status (*UsbSyncInterruptTransfer) (struct efi_usb_io_protocol* self,
|
||||
uint8_t endpoint, void* data,
|
||||
size_t* data_len, size_t timeout,
|
||||
uint32_t* status) EFIAPI;
|
||||
|
||||
efi_status (*UsbIsochronousTransfer) (struct efi_usb_io_protocol* self,
|
||||
uint8_t endpoint,
|
||||
void* data, size_t data_len,
|
||||
uint32_t* status) EFIAPI;
|
||||
|
||||
efi_status (*UsbAsyncIsochronousTransfer) (struct efi_usb_io_protocol* self,
|
||||
uint8_t endpoint,
|
||||
void* data, size_t data_len,
|
||||
efi_async_usb_transfer_callback isoc_cb,
|
||||
void* context) EFIAPI;
|
||||
|
||||
efi_status (*UsbGetDeviceDescriptor) (struct efi_usb_io_protocol* self,
|
||||
efi_usb_device_descriptor* descriptor) EFIAPI;
|
||||
|
||||
efi_status (*UsbGetConfigDescriptor) (struct efi_usb_io_protocol* self,
|
||||
efi_usb_config_descriptor* descriptor) EFIAPI;
|
||||
|
||||
efi_status (*UsbGetInterfaceDescriptor) (struct efi_usb_io_protocol* self,
|
||||
efi_usb_interface_descriptor* descriptor) EFIAPI;
|
||||
|
||||
efi_status (*UsbGetEndpointDescriptor) (struct efi_usb_io_protocol* self,
|
||||
uint8_t endpt_index,
|
||||
efi_usb_endpoint_descriptor* descriptor) EFIAPI;
|
||||
|
||||
efi_status (*UsbGetStringDescriptor) (struct efi_usb_io_protocol* self,
|
||||
uint16_t langid, uint8_t stringid,
|
||||
char16_t** str) EFIAPI;
|
||||
|
||||
efi_status (*UsbGetSupportedLanguages) (struct efi_usb_io_protocol* self,
|
||||
uint16_t** langid_table,
|
||||
uint16_t* table_size) EFIAPI;
|
||||
|
||||
efi_status (*UsbPortReset) (struct efi_usb_io_protocol* self) EFIAPI;
|
||||
} efi_usb_io_protocol;
|
||||
@@ -0,0 +1,151 @@
|
||||
// Copyright 2016 The Fuchsia Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <efi/types.h>
|
||||
#include <efi/boot-services.h>
|
||||
|
||||
#define EFI_RUNTIME_SERVICES_SIGNATURE 0x56524553544e5552
|
||||
#define EFI_RUNTIME_SERVICES_REVISION EFI_SPECIFICATION_VERSION
|
||||
|
||||
#define EFI_VARIABLE_NON_VOLATILE 0x00000001
|
||||
#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002
|
||||
#define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004
|
||||
#define EFI_VARIABLE_HARDWARE_ERROR_RECORD 0x00000008
|
||||
#define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 0x00000010
|
||||
#define EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS 0x00000020
|
||||
#define EFI_VARIABLE_APPEND_WRITE 0x00000040
|
||||
|
||||
// TODO: implement the win_certificate structs if we need them
|
||||
//typedef struct {
|
||||
// uint64_t MonotonicCount;
|
||||
// win_certificate_uefi_guid AuthInfo;
|
||||
//} efi_variable_authentication;
|
||||
//
|
||||
//typedef struct {
|
||||
// efi_time TimeStamp;
|
||||
// win_certificate_uefi_guid AuthInfo;
|
||||
//} efi_variable_authentication_2;
|
||||
|
||||
#define EFI_HARDWARE_ERROR_VARIABLE \
|
||||
{0x414e6bdd, 0xe47b, 0x47cc, {0xb2, 0x44, 0xbb, 0x61, 0x02, 0x0c, 0xf5, 0x16}}
|
||||
|
||||
typedef struct {
|
||||
uint16_t Year;
|
||||
uint8_t Month;
|
||||
uint8_t Day;
|
||||
uint8_t Hour;
|
||||
uint8_t Minute;
|
||||
uint8_t Second;
|
||||
uint8_t Pad1;
|
||||
uint32_t Nanosecond;
|
||||
int16_t TimeZone;
|
||||
uint8_t Daylight;
|
||||
uint8_t Pad2;
|
||||
} efi_time;
|
||||
|
||||
#define EFI_TIME_ADJUST_DAYLIGHT 0x01
|
||||
#define EFI_TIME_IN_DAYLIGHT 0x02
|
||||
|
||||
#define EFI_UNSPECIFIED_TIMEZONE 0x07FF
|
||||
|
||||
typedef struct {
|
||||
uint32_t Resolution;
|
||||
uint32_t Accuracy;
|
||||
bool SetsToZero;
|
||||
} efi_time_capabilities;
|
||||
|
||||
#define EFI_OPTIONAL_PTR 0x00000001
|
||||
|
||||
typedef enum {
|
||||
EfiResetCold,
|
||||
EfiResetWarm,
|
||||
EfiResetShutdown,
|
||||
EfiResetPlatformSpecific
|
||||
} efi_reset_type;
|
||||
|
||||
typedef struct {
|
||||
uint64_t Length;
|
||||
union {
|
||||
efi_physical_addr DataBlock;
|
||||
efi_physical_addr ContinuationPointer;
|
||||
} Union;
|
||||
} efi_capsule_block_descriptor;
|
||||
|
||||
typedef struct {
|
||||
efi_guid CapsuleGuid;
|
||||
uint32_t HeaderSize;
|
||||
uint32_t Flags;
|
||||
uint32_t CapsuleImageSize;
|
||||
} efi_capsule_header;
|
||||
|
||||
#define CAPSULE_FLAGS_PERSIST_ACROSS_RESET 0x00010000
|
||||
#define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE 0x00020000
|
||||
#define CAPSULE_FLAGS_INITIATE_RESET 0x00040000
|
||||
|
||||
#define EFI_OS_INDICATIONS_BOOT_TO_FW_UI 0x0000000000000001
|
||||
#define EFI_OS_INDICATIONS_TIMESTAMP_REVOCATION 0x0000000000000002
|
||||
#define EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED 0x0000000000000004
|
||||
#define EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED 0x0000000000000008
|
||||
#define EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED 0x0000000000000010
|
||||
#define EFI_OS_INDICATIONS_START_OS_RECOVERY 0x0000000000000020
|
||||
#define EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY 0x0000000000000040
|
||||
|
||||
#define EFI_CAPSULE_REPORT_GUID \
|
||||
{0x39b68c46, 0xf7fb, 0x441b, {0xb6, 0xec, 0x16, 0xb0, 0xf6, 0x98, 0x21, 0xf3}}
|
||||
|
||||
typedef struct {
|
||||
uint32_t VariableTotalSize;
|
||||
uint32_t Reserved;
|
||||
efi_guid CapsuleGuid;
|
||||
efi_time CapsuleProcessed;
|
||||
efi_status CapsuleStatus;
|
||||
} efi_capsule_result_variable_header;
|
||||
|
||||
typedef struct {
|
||||
efi_table_header Hdr;
|
||||
|
||||
efi_status (*GetTime) (efi_time* time, efi_time_capabilities* capabilities) EFIAPI;
|
||||
|
||||
efi_status (*SetTime) (efi_time* time) EFIAPI;
|
||||
|
||||
efi_status (*GetWakeupTime) (bool* enabled, bool* pending, efi_time* time) EFIAPI;
|
||||
|
||||
efi_status (*SetWakeupTime) (bool enable, efi_time* time) EFIAPI;
|
||||
|
||||
efi_status (*SetVirtualAddressMap) (size_t memory_map_size, size_t desc_size,
|
||||
uint32_t desc_version,
|
||||
efi_memory_descriptor* virtual_map) EFIAPI;
|
||||
|
||||
efi_status (*ConvertPointer) (size_t debug_disposition, void** addr) EFIAPI;
|
||||
|
||||
efi_status (*GetVariable) (char16_t* var_name, efi_guid* vendor_guid,
|
||||
uint32_t* attributes, size_t* data_size, void* data) EFIAPI;
|
||||
|
||||
efi_status (*GetNextVariableName) (size_t* var_name_size, char16_t* var_name,
|
||||
efi_guid* vendor_guid) EFIAPI;
|
||||
|
||||
efi_status (*SetVariable) (char16_t* var_name, efi_guid* vendor_guid,
|
||||
uint32_t attributes, size_t data_size, void* data) EFIAPI;
|
||||
|
||||
efi_status (*GetNextHighMonotonicCount) (uint32_t* high_count) EFIAPI;
|
||||
|
||||
efi_status (*ResetSystem) (efi_reset_type reset_type, efi_status reset_status,
|
||||
size_t data_size, void* reset_data) EFIAPI;
|
||||
|
||||
efi_status (*UpdateCapsule) (efi_capsule_header** capsule_header_array,
|
||||
size_t capsule_count,
|
||||
efi_physical_addr scatter_gather_list) EFIAPI;
|
||||
|
||||
efi_status (*QueryCapsuleCapabilities) (efi_capsule_header** capsule_header_array,
|
||||
size_t capsule_count,
|
||||
uint64_t* max_capsule_size,
|
||||
efi_reset_type* reset_type) EFIAPI;
|
||||
|
||||
efi_status (*QueryVariableInfo) (uint32_t attributes,
|
||||
uint64_t* max_var_storage_size,
|
||||
uint64_t* remaining_var_storage_size,
|
||||
uint64_t* max_var_size) EFIAPI;
|
||||
} efi_runtime_services;
|
||||
@@ -0,0 +1,48 @@
|
||||
// Copyright 2016 The Fuchsia Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <efi/types.h>
|
||||
#include <efi/boot-services.h>
|
||||
#include <efi/runtime-services.h>
|
||||
#include <efi/protocol/simple-text-input.h>
|
||||
#include <efi/protocol/simple-text-output.h>
|
||||
|
||||
#define EFI_SYSTEM_TABLE_SIGNATURE 0x5453595320494249
|
||||
#define EFI_2_60_SYSTEM_TABLE_REVISION ((2<<16) | (60))
|
||||
#define EFI_2_50_SYSTEM_TABLE_REVISION ((2<<16) | (50))
|
||||
#define EFI_2_40_SYSTEM_TABLE_REVISION ((2<<16) | (40))
|
||||
#define EFI_2_31_SYSTEM_TABLE_REVISION ((2<<16) | (31))
|
||||
#define EFI_2_30_SYSTEM_TABLE_REVISION ((2<<16) | (30))
|
||||
#define EFI_2_20_SYSTEM_TABLE_REVISION ((2<<16) | (20))
|
||||
#define EFI_2_10_SYSTEM_TABLE_REVISION ((2<<16) | (10))
|
||||
#define EFI_2_00_SYSTEM_TABLE_REVISION ((2<<16) | (00))
|
||||
#define EFI_1_10_SYSTEM_TABLE_REVISION ((1<<16) | (10))
|
||||
#define EFI_1_02_SYSTEM_TABLE_REVISION ((1<<16) | (02))
|
||||
#define EFI_SPECIFICATION_VERSION EFI_SYSTEM_TABLE_REVISION
|
||||
#define EFI_SYSTEM_TABLE_REVISION EFI_2_60_SYSTEM_TABLE_REVISION
|
||||
|
||||
typedef struct {
|
||||
efi_guid VendorGuid;
|
||||
void* VendorTable;
|
||||
} efi_configuration_table;
|
||||
|
||||
typedef struct efi_system_table {
|
||||
efi_table_header Hdr;
|
||||
char16_t* FirmwareVendor;
|
||||
uint32_t FirmwareRevision;
|
||||
efi_handle ConsoleInHandle;
|
||||
efi_simple_text_input_protocol* ConIn;
|
||||
efi_handle ConsoleOutHandle;
|
||||
efi_simple_text_output_protocol* ConOut;
|
||||
efi_handle StandardErrorHandle;
|
||||
efi_simple_text_output_protocol* StdErr;
|
||||
efi_runtime_services *RuntimeServices;
|
||||
efi_boot_services* BootServices;
|
||||
size_t NumberOfTableEntries;
|
||||
efi_configuration_table *ConfigurationTable;
|
||||
} efi_system_table;
|
||||
@@ -0,0 +1,150 @@
|
||||
// Copyright 2016 The Fuchsia Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define EFIAPI __attribute__((ms_abi))
|
||||
|
||||
#define EFI_ERROR_MASK 0x8000000000000000
|
||||
#define EFI_ERR(x) (EFI_ERROR_MASK | x)
|
||||
#define EFI_ERROR(x) (((int64_t)x) < 0)
|
||||
|
||||
#define EFI_SUCCESS 0
|
||||
#define EFI_LOAD_ERROR EFI_ERR(1)
|
||||
#define EFI_INVALID_PARAMETER EFI_ERR(2)
|
||||
#define EFI_UNSUPPORTED EFI_ERR(3)
|
||||
#define EFI_BAD_BUFFER_SIZE EFI_ERR(4)
|
||||
#define EFI_BUFFER_TOO_SMALL EFI_ERR(5)
|
||||
#define EFI_NOT_READY EFI_ERR(6)
|
||||
#define EFI_DEVICE_ERROR EFI_ERR(7)
|
||||
#define EFI_WRITE_PROTECTED EFI_ERR(8)
|
||||
#define EFI_OUT_OF_RESOURCES EFI_ERR(9)
|
||||
#define EFI_VOLUME_CORRUPTED EFI_ERR(10)
|
||||
#define EFI_VOLUME_FULL EFI_ERR(11)
|
||||
#define EFI_NO_MEDIA EFI_ERR(12)
|
||||
#define EFI_MEDIA_CHANGED EFI_ERR(13)
|
||||
#define EFI_NOT_FOUND EFI_ERR(14)
|
||||
#define EFI_ACCESS_DENIED EFI_ERR(15)
|
||||
#define EFI_NO_RESPONSE EFI_ERR(16)
|
||||
#define EFI_NO_MAPPING EFI_ERR(17)
|
||||
#define EFI_TIMEOUT EFI_ERR(18)
|
||||
#define EFI_NOT_STARTED EFI_ERR(19)
|
||||
#define EFI_ALREADY_STARTED EFI_ERR(20)
|
||||
#define EFI_ABORTED EFI_ERR(21)
|
||||
#define EFI_ICMP_ERROR EFI_ERR(22)
|
||||
#define EFI_TFTP_ERROR EFI_ERR(23)
|
||||
#define EFI_PROTOCOL_ERROR EFI_ERR(24)
|
||||
#define EFI_INCOMPATIBLE_VERSION EFI_ERR(25)
|
||||
#define EFI_SECURITY_VIOLATION EFI_ERR(26)
|
||||
#define EFI_CRC_ERROR EFI_ERR(27)
|
||||
#define EFI_END_OF_MEDIA EFI_ERR(28)
|
||||
#define EFI_END_OF_FILE EFI_ERR(31)
|
||||
#define EFI_INVALID_LANGUAGE EFI_ERR(32)
|
||||
#define EFI_COMPROMISED_DATA EFI_ERR(33)
|
||||
#define EFI_IP_ADDRESS_CONFLICT EFI_ERR(34)
|
||||
#define EFI_HTTP_ERROR EFI_ERR(35)
|
||||
|
||||
// TODO: figure out where to put these. They're just mentioned in passing in the
|
||||
// spec as some of many industry standard GUIDs but not part of the spec itself.
|
||||
#define ACPI_TABLE_GUID \
|
||||
{0xeb9d2d30, 0x2d88, 0x11d3, {0x9a, 0x16, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d}}
|
||||
#define ACPI_20_TABLE_GUID \
|
||||
{0x8868e871, 0xe4f1, 0x11d3, {0xbc, 0x22, 0x00, 0x80, 0xc7, 0x3c, 0x88, 0x81}}
|
||||
#define SMBIOS_TABLE_GUID \
|
||||
{0xeb9d2d31, 0x2d88, 0x11d3, {0x9a, 0x16, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d}}
|
||||
#define SMBIOS3_TABLE_GUID \
|
||||
{0xf2fd1544, 0x9794, 0x4a2c, {0x99, 0x2e, 0xe5, 0xbb, 0xcf, 0x20, 0xe3, 0x94}}
|
||||
|
||||
typedef struct {
|
||||
uint64_t Signature;
|
||||
uint32_t Revision;
|
||||
uint32_t HeaderSize;
|
||||
uint32_t CRC32;
|
||||
uint32_t Reserved;
|
||||
} efi_table_header;
|
||||
|
||||
typedef struct efi_guid {
|
||||
uint32_t data1;
|
||||
uint16_t data2;
|
||||
uint16_t data3;
|
||||
uint8_t data4[8];
|
||||
} efi_guid;
|
||||
|
||||
typedef void* efi_handle;
|
||||
|
||||
typedef size_t efi_status;
|
||||
|
||||
typedef struct {
|
||||
uint8_t addr[32];
|
||||
} efi_mac_addr;
|
||||
|
||||
typedef struct {
|
||||
uint8_t addr[4];
|
||||
} efi_ipv4_addr;
|
||||
|
||||
typedef struct {
|
||||
uint8_t addr[16];
|
||||
} efi_ipv6_addr;
|
||||
|
||||
typedef union {
|
||||
efi_ipv4_addr v4;
|
||||
efi_ipv6_addr v6;
|
||||
} efi_ip_addr;
|
||||
|
||||
// This really belongs in boot-services.h, but causes circular dependencies with
|
||||
// device-path.h.
|
||||
typedef enum {
|
||||
EfiReservedMemoryType,
|
||||
EfiLoaderCode,
|
||||
EfiLoaderData,
|
||||
EfiBootServicesCode,
|
||||
EfiBootServicesData,
|
||||
EfiRuntimeServicesCode,
|
||||
EfiRuntimeServicesData,
|
||||
EfiConventionalMemory,
|
||||
EfiUnusableMemory,
|
||||
EfiACPIReclaimMemory,
|
||||
EfiACPIMemoryNVS,
|
||||
EfiMemoryMappedIO,
|
||||
EfiMemoryMappedIOPortSpace,
|
||||
EfiPalCode,
|
||||
EfiPersistentMemory,
|
||||
EfiMaxMemoryType
|
||||
} efi_memory_type;
|
||||
|
||||
typedef uint64_t efi_physical_addr;
|
||||
typedef uint64_t efi_virtual_addr;
|
||||
|
||||
typedef void* efi_event;
|
||||
|
||||
#define EVT_TIMER 0x80000000
|
||||
#define EVT_RUNTIME 0x40000000
|
||||
#define EVT_NOTIFY_WAIT 0x00000100
|
||||
#define EVT_NOTIFY_SIGNAL 0x00000200
|
||||
#define EVT_SIGNAL_EXIT_BOOT_SERVICES 0x00000201
|
||||
#define EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE 0x60000202
|
||||
|
||||
#define EFI_EVENT_GROUP_EXIT_BOOT_SERVICES \
|
||||
{0x27abf055, 0xb1b8, 0x4c26, {0x80, 0x48, 0x74, 0x8f, 0x37, 0xba, 0xa2, 0xdf}}
|
||||
#define EFI_EVENT_GROUP_VIRTUAL_ADDRESS_CHANGE \
|
||||
{0x13fa7698, 0xc831, 0x49c7, {0x87, 0xea, 0x8f, 0x43, 0xfc, 0xc2, 0x51, 0x96}}
|
||||
#define EFI_EVENT_GROUP_MEMORY_MAP_CHANGE \
|
||||
{0x78bee926, 0x692f, 0x48fd, {0x9e, 0xdb, 0x01, 0x42, 0x2e, 0xf0, 0xd7, 0xab}}
|
||||
#define EFI_EVENT_GROUP_READY_TO_BOOT \
|
||||
{0x7ce88fb3, 0x4bd7, 0x4679, {0x87, 0xa8, 0xa8, 0xd8, 0xde, 0xe5, 0x0d, 0x2b}}
|
||||
|
||||
typedef void (*efi_event_notify) (efi_event event, void* ctx) EFIAPI;
|
||||
|
||||
typedef enum {
|
||||
TimerCancel,
|
||||
TimerPeriodic,
|
||||
TimerRelative
|
||||
} efi_timer_delay;
|
||||
|
||||
#ifndef __cplusplus
|
||||
typedef unsigned short char16_t;
|
||||
#endif
|
||||
Reference in New Issue
Block a user