Add support for some UEFI 2.0 protocols

* DevicePath[To|From]Text
* BlockIo2
* DiskIo2
* Ex calls for Simple File System

Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
This commit is contained in:
Nigel Croxon 2016-08-16 10:18:58 -04:00
parent 1b10394e06
commit 7993cbcc72
4 changed files with 237 additions and 31 deletions

View File

@ -543,5 +543,48 @@ typedef union {
} EFI_DEV_PATH_PTR;
#define EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID \
{ 0x8b843e20, 0x8132, 0x4852, {0x90, 0xcc, 0x55, 0x1a, 0x4e, 0x4a, 0x7f, 0x1c} }
typedef
CHAR16*
(EFIAPI *EFI_DEVICE_PATH_TO_TEXT_NODE) (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode,
IN BOOLEAN DisplayOnly,
IN BOOLEAN AllowShortcuts
);
typedef
CHAR16*
(EFIAPI *EFI_DEVICE_PATH_TO_TEXT_PATH) (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
IN BOOLEAN DisplayOnly,
IN BOOLEAN AllowShortcuts
);
typedef struct _EFI_DEVICE_PATH_TO_TEXT_PROTOCOL {
EFI_DEVICE_PATH_TO_TEXT_NODE ConvertDeviceNodeToText;
EFI_DEVICE_PATH_TO_TEXT_PATH ConvertDevicePathToText;
} EFI_DEVICE_PATH_TO_TEXT_PROTOCOL;
#define EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID \
{ 0x5c99a21, 0xc70f, 0x4ad2, {0x8a, 0x5f, 0x35, 0xdf, 0x33, 0x43, 0xf5, 0x1e} }
typedef
EFI_DEVICE_PATH_PROTOCOL*
(EFIAPI *EFI_DEVICE_PATH_FROM_TEXT_NODE) (
IN CONST CHAR16 *TextDeviceNode
);
typedef
EFI_DEVICE_PATH_PROTOCOL*
(EFIAPI *EFI_DEVICE_PATH_FROM_TEXT_PATH) (
IN CONST CHAR16 *TextDevicePath
);
typedef struct {
EFI_DEVICE_PATH_FROM_TEXT_NODE ConvertTextToDeviceNode;
EFI_DEVICE_PATH_FROM_TEXT_PATH ConvertTextToDevicePath;
} EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL;
#endif

View File

@ -37,6 +37,8 @@ extern EFI_BOOT_SERVICES *BS;
extern EFI_RUNTIME_SERVICES *RT;
extern EFI_GUID DevicePathProtocol;
extern EFI_GUID DevicePathToTextProtocol;
extern EFI_GUID DevicePathFromTextProtocol;
extern EFI_GUID LoadedImageProtocol;
extern EFI_GUID TextInProtocol;
extern EFI_GUID TextOutProtocol;
@ -45,7 +47,9 @@ extern EFI_GUID EdidDiscoveredProtocol;
extern EFI_GUID EdidActiveProtocol;
extern EFI_GUID EdidOverrideProtocol;
extern EFI_GUID BlockIoProtocol;
extern EFI_GUID BlockIo2Protocol;
extern EFI_GUID DiskIoProtocol;
extern EFI_GUID DiskIo2Protocol;
extern EFI_GUID FileSystemProtocol;
extern EFI_GUID LoadFileProtocol;
extern EFI_GUID DeviceIoProtocol;
@ -67,7 +71,6 @@ extern EFI_GUID PciIoProtocol;
extern EFI_GUID DriverBindingProtocol;
extern EFI_GUID ComponentNameProtocol;
extern EFI_GUID ComponentName2Protocol;
extern EFI_GUID LoadedImageProtocol;
extern EFI_GUID HashProtocol;
extern EFI_GUID PlatformDriverOverrideProtocol;
extern EFI_GUID BusSpecificDriverOverrideProtocol;
@ -202,7 +205,7 @@ VOID
SetMem (
IN VOID *Buffer,
IN UINTN Size,
IN UINT8 Value
IN UINT8 Value
);
VOID
@ -279,7 +282,7 @@ UINTN
strlena (
IN CONST CHAR8 *s1
);
UINTN
strcmpa (
IN CONST CHAR8 *s1,
@ -303,13 +306,13 @@ Atoi (
CONST CHAR16 *str
);
BOOLEAN
BOOLEAN
MetaMatch (
IN CHAR16 *String,
IN CHAR16 *Pattern
);
BOOLEAN
BOOLEAN
MetaiMatch (
IN CHAR16 *String,
IN CHAR16 *Pattern
@ -807,7 +810,7 @@ OpenSimpleReadFile (
IN VOID *SourceBuffer OPTIONAL,
IN UINTN SourceSize,
IN OUT EFI_DEVICE_PATH **FilePath,
OUT EFI_HANDLE *DeviceHandle,
OUT EFI_HANDLE *DeviceHandle,
OUT SIMPLE_READ_FILE *SimpleReadHandle
);
@ -848,7 +851,7 @@ LibGetSystemConfigurationTable(
BOOLEAN
LibIsValidTextGraphics (
IN CHAR16 Graphic,
IN CHAR16 Graphic,
OUT CHAR8 *PcAnsi, OPTIONAL
OUT CHAR8 *Ascii OPTIONAL
);
@ -889,34 +892,34 @@ InitializeGlobalIoDevice (
IN EFI_DEVICE_PATH *DevicePath,
IN EFI_GUID *Protocol,
IN CHAR8 *ErrorStr,
OUT EFI_DEVICE_IO_INTERFACE **GlobalIoFncs
OUT EFI_DEVICE_IO_INTERFACE **GlobalIoFncs
);
UINT32
UINT32
ReadPort (
IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs,
IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs,
IN EFI_IO_WIDTH Width,
IN UINTN Port
);
UINT32
UINT32
WritePort (
IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs,
IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs,
IN EFI_IO_WIDTH Width,
IN UINTN Port,
IN UINTN Data
);
UINT32
UINT32
ReadPciConfig (
IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs,
IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs,
IN EFI_IO_WIDTH Width,
IN UINTN Port
);
UINT32
UINT32
WritePciConfig (
IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs,
IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs,
IN EFI_IO_WIDTH Width,
IN UINTN Port,
IN UINTN Data

View File

@ -125,6 +125,59 @@ typedef struct _EFI_BLOCK_IO_PROTOCOL {
typedef struct _EFI_BLOCK_IO_PROTOCOL _EFI_BLOCK_IO;
typedef EFI_BLOCK_IO_PROTOCOL EFI_BLOCK_IO;
#define EFI_BLOCK_IO2_PROTOCOL_GUID \
{ 0xa77b2472, 0xe282, 0x4e9f, {0xa2, 0x45, 0xc2, 0xc0, 0xe2, 0x7b, 0xbc, 0xc1} }
INTERFACE_DECL(_EFI_BLOCK_IO2_PROTOCOL);
typedef struct {
EFI_EVENT Event;
EFI_STATUS TransactionStatus;
} EFI_BLOCK_IO2_TOKEN;
typedef
EFI_STATUS
(EFIAPI *EFI_BLOCK_RESET_EX) (
IN struct _EFI_BLOCK_IO2_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
);
typedef
EFI_STATUS
(EFIAPI *EFI_BLOCK_READ_EX) (
IN struct _EFI_BLOCK_IO2_PROTOCOL *This,
IN UINT32 MediaId,
IN EFI_LBA LBA,
IN OUT EFI_BLOCK_IO2_TOKEN *Token,
IN UINTN BufferSize,
OUT VOID *Buffer
);
typedef
EFI_STATUS
(EFIAPI *EFI_BLOCK_WRITE_EX) (
IN struct _EFI_BLOCK_IO2_PROTOCOL *This,
IN UINT32 MediaId,
IN EFI_LBA LBA,
IN OUT EFI_BLOCK_IO2_TOKEN *Token,
IN UINTN BufferSize,
IN VOID *Buffer
);
typedef
EFI_STATUS
(EFIAPI *EFI_BLOCK_FLUSH_EX) (
IN struct _EFI_BLOCK_IO2_PROTOCOL *This,
IN OUT EFI_BLOCK_IO2_TOKEN *Token
);
typedef struct _EFI_BLOCK_IO2_PROTOCOL {
EFI_BLOCK_IO_MEDIA *Media;
EFI_BLOCK_RESET_EX Reset;
EFI_BLOCK_READ_EX ReadBlocksEx;
EFI_BLOCK_WRITE_EX WriteBlocksEx;
EFI_BLOCK_FLUSH_EX FlushBlocksEx;
} EFI_BLOCK_IO2_PROTOCOL;
//
// Disk Block IO protocol
@ -170,6 +223,62 @@ typedef struct _EFI_DISK_IO_PROTOCOL {
typedef struct _EFI_DISK_IO_PROTOCOL _EFI_DISK_IO;
typedef EFI_DISK_IO_PROTOCOL EFI_DISK_IO;
#define EFI_DISK_IO2_PROTOCOL_GUID \
{ 0x151c8eae, 0x7f2c, 0x472c, {0x9e, 0x54, 0x98, 0x28, 0x19, 0x4f, 0x6a, 0x88} }
#define EFI_DISK_IO2_PROTOCOL_REVISION 0x00020000
INTERFACE_DECL(_EFI_DISK_IO2_PROTOCOL);
typedef struct {
EFI_EVENT Event;
EFI_STATUS TransactionStatus;
} EFI_DISK_IO2_TOKEN;
typedef
EFI_STATUS
(EFIAPI *EFI_DISK_CANCEL_EX) (
IN struct _EFI_DISK_IO2_PROTOCOL *This
);
typedef
EFI_STATUS
(EFIAPI *EFI_DISK_READ_EX) (
IN struct _EFI_DISK_IO2_PROTOCOL *This,
IN UINT32 MediaId,
IN UINT64 Offset,
IN OUT EFI_DISK_IO2_TOKEN *Token,
IN UINTN BufferSize,
OUT VOID *Buffer
);
typedef
EFI_STATUS
(EFIAPI *EFI_DISK_WRITE_EX) (
IN struct _EFI_DISK_IO2_PROTOCOL *This,
IN UINT32 MediaId,
IN UINT64 Offset,
IN OUT EFI_DISK_IO2_TOKEN *Token,
IN UINTN BufferSize,
IN VOID *Buffer
);
typedef
EFI_STATUS
(EFIAPI *EFI_DISK_FLUSH_EX) (
IN struct _EFI_DISK_IO2_PROTOCOL *This,
IN OUT EFI_DISK_IO2_TOKEN *Token
);
typedef struct _EFI_DISK_IO2_PROTOCOL {
UINT64 Revision;
EFI_DISK_CANCEL_EX Cancel;
EFI_DISK_READ_EX ReadDiskEx;
EFI_DISK_WRITE_EX WriteDiskEx;
EFI_DISK_FLUSH_EX FlushDiskEx;
} EFI_DISK_IO2_PROTOCOL;
//
// Simple file system protocol
//
@ -293,9 +402,50 @@ EFI_STATUS
IN struct _EFI_FILE_HANDLE *File
);
typedef struct {
EFI_EVENT Event;
EFI_STATUS Status;
UINTN BufferSize;
VOID *Buffer;
} EFI_FILE_IO_TOKEN;
typedef
EFI_STATUS
(EFIAPI *EFI_FILE_OPEN_EX)(
IN struct _EFI_FILE_HANDLE *File,
OUT struct _EFI_FILE_HANDLE **NewHandle,
IN CHAR16 *FileName,
IN UINT64 OpenMode,
IN UINT64 Attributes,
IN OUT EFI_FILE_IO_TOKEN *Token
);
typedef
EFI_STATUS
(EFIAPI *EFI_FILE_READ_EX) (
IN struct _EFI_FILE_HANDLE *File,
IN OUT EFI_FILE_IO_TOKEN *Token
);
typedef
EFI_STATUS
(EFIAPI *EFI_FILE_WRITE_EX) (
IN struct _EFI_FILE_HANDLE *File,
IN OUT EFI_FILE_IO_TOKEN *Token
);
typedef
EFI_STATUS
(EFIAPI *EFI_FILE_FLUSH_EX) (
IN struct _EFI_FILE_HANDLE *File,
IN OUT EFI_FILE_IO_TOKEN *Token
);
#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_HANDLE_REVISION EFI_FILE_PROTOCOL_REVISION
#define EFI_FILE_HANDLE_REVISION 0x00010000
typedef struct _EFI_FILE_HANDLE {
UINT64 Revision;
EFI_FILE_OPEN Open;
@ -308,7 +458,13 @@ typedef struct _EFI_FILE_HANDLE {
EFI_FILE_GET_INFO GetInfo;
EFI_FILE_SET_INFO SetInfo;
EFI_FILE_FLUSH Flush;
} EFI_FILE, *EFI_FILE_HANDLE;
EFI_FILE_OPEN_EX OpenEx;
EFI_FILE_READ_EX ReadEx;
EFI_FILE_WRITE_EX WriteEx;
EFI_FILE_FLUSH_EX FlushEx;
} EFI_FILE_PROTOCOL, *EFI_FILE_HANDLE;
typedef EFI_FILE_PROTOCOL EFI_FILE;
//

View File

@ -55,7 +55,7 @@ EFI_UNICODE_COLLATION_INTERFACE LibStubUnicodeInterface = {
NULL, // FatToStr
NULL, // StrToFat
NULL // SupportedLanguages
};
};
EFI_UNICODE_COLLATION_INTERFACE *UnicodeInterface = &LibStubUnicodeInterface;
@ -87,16 +87,20 @@ EFI_GUID NullGuid = { 0,0,0,{0,0,0,0,0,0,0,0} };
// Protocol IDs
//
EFI_GUID DevicePathProtocol = DEVICE_PATH_PROTOCOL;
EFI_GUID LoadedImageProtocol = LOADED_IMAGE_PROTOCOL;
EFI_GUID DevicePathProtocol = EFI_DEVICE_PATH_PROTOCOL_GUID;
EFI_GUID DevicePathToTextProtocol = EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID;
EFI_GUID DevicePathFromTextProtocol = EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID;
EFI_GUID LoadedImageProtocol = EFI_LOADED_IMAGE_PROTOCOL_GUID;
EFI_GUID TextInProtocol = SIMPLE_TEXT_INPUT_PROTOCOL;
EFI_GUID TextOutProtocol = SIMPLE_TEXT_OUTPUT_PROTOCOL;
EFI_GUID BlockIoProtocol = BLOCK_IO_PROTOCOL;
EFI_GUID DiskIoProtocol = DISK_IO_PROTOCOL;
EFI_GUID FileSystemProtocol = SIMPLE_FILE_SYSTEM_PROTOCOL;
EFI_GUID LoadFileProtocol = LOAD_FILE_PROTOCOL;
EFI_GUID DeviceIoProtocol = DEVICE_IO_PROTOCOL;
EFI_GUID UnicodeCollationProtocol = UNICODE_COLLATION_PROTOCOL;
EFI_GUID BlockIoProtocol = EFI_BLOCK_IO_PROTOCOL_GUID;
EFI_GUID BlockIo2Protocol = EFI_BLOCK_IO_PROTOCOL_GUID;
EFI_GUID DiskIoProtocol = EFI_DISK_IO_PROTOCOL_GUID;
EFI_GUID DiskIo2Protocol = EFI_DISK_IO2_PROTOCOL_GUID;
EFI_GUID FileSystemProtocol = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID;
EFI_GUID LoadFileProtocol = EFI_LOAD_FILE_PROTOCOL_GUID;
EFI_GUID DeviceIoProtocol = EFI_DEVICE_IO_PROTOCOL_GUID;
EFI_GUID UnicodeCollationProtocol = EFI_UNICODE_COLLATION_PROTOCOL_GUID;
EFI_GUID SerialIoProtocol = SERIAL_IO_PROTOCOL;
EFI_GUID SimpleNetworkProtocol = EFI_SIMPLE_NETWORK_PROTOCOL;
EFI_GUID PxeBaseCodeProtocol = EFI_PXE_BASE_CODE_PROTOCOL;
@ -104,10 +108,10 @@ EFI_GUID PxeCallbackProtocol = EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL;
EFI_GUID NetworkInterfaceIdentifierProtocol = EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL;
EFI_GUID UiProtocol = EFI_UI_PROTOCOL;
EFI_GUID PciIoProtocol = EFI_PCI_IO_PROTOCOL;
EFI_GUID DriverBindingProtocol = DRIVER_BINDING_PROTOCOL;
EFI_GUID ComponentNameProtocol = COMPONENT_NAME_PROTOCOL;
EFI_GUID ComponentName2Protocol = COMPONENT_NAME2_PROTOCOL;
EFI_GUID HashProtocol = HASH_PROTOCOL;
EFI_GUID DriverBindingProtocol = EFI_DRIVER_BINDING_PROTOCOL_GUID;
EFI_GUID ComponentNameProtocol = EFI_COMPONENT_NAME_PROTOCOL_GUID;
EFI_GUID ComponentName2Protocol = EFI_COMPONENT_NAME2_PROTOCOL_GUID;
EFI_GUID HashProtocol = EFI_HASH_PROTOCOL_GUID;
EFI_GUID PlatformDriverOverrideProtocol = EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL_GUID;
EFI_GUID BusSpecificDriverOverrideProtocol = EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL_GUID;
EFI_GUID DriverFamilyOverrideProtocol = EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL_GUID;