gnu-efi/lib/data.c

219 lines
7.4 KiB
C
Raw Normal View History

2013-01-31 01:25:25 +04:00
/*++
Copyright (c) 1998 Intel Corporation
Module Name:
data.c
Abstract:
EFI library global data
Revision History
--*/
#include "lib.h"
//
// LibInitialized - TRUE once InitializeLib() is called for the first time
//
BOOLEAN LibInitialized = FALSE;
//
// ImageHandle - Current ImageHandle, as passed to InitializeLib
//
EFI_HANDLE LibImageHandle;
2013-01-31 01:25:25 +04:00
//
// ST - pointer to the EFI system table
//
EFI_SYSTEM_TABLE *ST;
//
// BS - pointer to the boot services table
//
EFI_BOOT_SERVICES *BS;
//
// Default pool allocation type
//
EFI_MEMORY_TYPE PoolAllocationType = EfiBootServicesData;
//
// Unicode collation functions that are in use
//
EFI_UNICODE_COLLATION_INTERFACE LibStubUnicodeInterface = {
LibStubStriCmp,
LibStubMetaiMatch,
LibStubStrLwrUpr,
LibStubStrLwrUpr,
NULL, // FatToStr
NULL, // StrToFat
NULL // SupportedLanguages
};
2013-01-31 01:25:25 +04:00
EFI_UNICODE_COLLATION_INTERFACE *UnicodeInterface = &LibStubUnicodeInterface;
//
// Root device path
//
EFI_DEVICE_PATH RootDevicePath[] = {
{END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE, {END_DEVICE_PATH_LENGTH,0}}
};
EFI_DEVICE_PATH EndDevicePath[] = {
{END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE, {END_DEVICE_PATH_LENGTH, 0}}
};
EFI_DEVICE_PATH EndInstanceDevicePath[] = {
{END_DEVICE_PATH_TYPE, END_INSTANCE_DEVICE_PATH_SUBTYPE, {END_DEVICE_PATH_LENGTH, 0}}
};
//
// EFI IDs
//
Update global protocol GUIDs definitions to match EDK2 This patch introduces the use of the EDK2 names for the global GUID variables, to allow for easier code conversion between EDK2 and gnu-efi. All the existing GUID global variables have also been aliased for backwards compatibility. The patch also completes some of the earlier work with regards to protocol struct definitions to also match the EDK2, with the following caveat: Because some of gnu-efi GUID macro definitions were declared with the name that the EDK2 uses for the protocol struct itself, we have to immediately deprecate the following GUID data aliases: EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL EFI_SIMPLE_NETWORK_PROTOCOL EFI_PCI_IO_PROTOCOL EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL This means that existing code using one of the above will break on compilation. To mitigate this, explicit warnings have been placed at the location where a developer will look for breakage, detailing how they should amend their code. The KnownGuids short labels in guid.c were also updated/amended in a manner that should be a bit more consistent (though I have no idea what the EDK2 does here, since I haven't looked at the actual EDK2 source). Finally, besides clean up (typo, whitespaces, duplicate removal), we introduce the _GNU_EFI macro, in efi.h, to allow for conditional selection of specific gnu-efi API calls, in code that may be compiled with either EDK2 or gnu-efi. Signed-off-by: Pete Batard <pete@akeo.ie> Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-08-18 15:42:11 +03:00
EFI_GUID gEfiGlobalVariableGuid = EFI_GLOBAL_VARIABLE;
2013-01-31 01:25:25 +04:00
EFI_GUID NullGuid = { 0,0,0,{0,0,0,0,0,0,0,0} };
//
// Protocol IDs
//
Update global protocol GUIDs definitions to match EDK2 This patch introduces the use of the EDK2 names for the global GUID variables, to allow for easier code conversion between EDK2 and gnu-efi. All the existing GUID global variables have also been aliased for backwards compatibility. The patch also completes some of the earlier work with regards to protocol struct definitions to also match the EDK2, with the following caveat: Because some of gnu-efi GUID macro definitions were declared with the name that the EDK2 uses for the protocol struct itself, we have to immediately deprecate the following GUID data aliases: EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL EFI_SIMPLE_NETWORK_PROTOCOL EFI_PCI_IO_PROTOCOL EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL This means that existing code using one of the above will break on compilation. To mitigate this, explicit warnings have been placed at the location where a developer will look for breakage, detailing how they should amend their code. The KnownGuids short labels in guid.c were also updated/amended in a manner that should be a bit more consistent (though I have no idea what the EDK2 does here, since I haven't looked at the actual EDK2 source). Finally, besides clean up (typo, whitespaces, duplicate removal), we introduce the _GNU_EFI macro, in efi.h, to allow for conditional selection of specific gnu-efi API calls, in code that may be compiled with either EDK2 or gnu-efi. Signed-off-by: Pete Batard <pete@akeo.ie> Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-08-18 15:42:11 +03:00
EFI_GUID gEfiDevicePathProtocolGuid = EFI_DEVICE_PATH_PROTOCOL_GUID;
EFI_GUID gEfiDevicePathToTextProtocolGuid = EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID;
EFI_GUID gEfiDevicePathFromTextProtocolGuid = EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID;
EFI_GUID gEfiDevicePathUtilitiesProtocolGuid = EFI_DEVICE_PATH_UTILITIES_PROTOCOL_GUID;
Update global protocol GUIDs definitions to match EDK2 This patch introduces the use of the EDK2 names for the global GUID variables, to allow for easier code conversion between EDK2 and gnu-efi. All the existing GUID global variables have also been aliased for backwards compatibility. The patch also completes some of the earlier work with regards to protocol struct definitions to also match the EDK2, with the following caveat: Because some of gnu-efi GUID macro definitions were declared with the name that the EDK2 uses for the protocol struct itself, we have to immediately deprecate the following GUID data aliases: EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL EFI_SIMPLE_NETWORK_PROTOCOL EFI_PCI_IO_PROTOCOL EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL This means that existing code using one of the above will break on compilation. To mitigate this, explicit warnings have been placed at the location where a developer will look for breakage, detailing how they should amend their code. The KnownGuids short labels in guid.c were also updated/amended in a manner that should be a bit more consistent (though I have no idea what the EDK2 does here, since I haven't looked at the actual EDK2 source). Finally, besides clean up (typo, whitespaces, duplicate removal), we introduce the _GNU_EFI macro, in efi.h, to allow for conditional selection of specific gnu-efi API calls, in code that may be compiled with either EDK2 or gnu-efi. Signed-off-by: Pete Batard <pete@akeo.ie> Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-08-18 15:42:11 +03:00
EFI_GUID gEfiLoadedImageProtocolGuid = EFI_LOADED_IMAGE_PROTOCOL_GUID;
EFI_GUID gEfiSimpleTextInProtocolGuid = EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID;
EFI_GUID gEfiSimpleTextOutProtocolGuid = EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID;
EFI_GUID gEfiBlockIoProtocolGuid = EFI_BLOCK_IO_PROTOCOL_GUID;
EFI_GUID gEfiBlockIo2ProtocolGuid = EFI_BLOCK_IO2_PROTOCOL_GUID;
EFI_GUID gEfiDiskIoProtocolGuid = EFI_DISK_IO_PROTOCOL_GUID;
EFI_GUID gEfiDiskIo2ProtocolGuid = EFI_DISK_IO2_PROTOCOL_GUID;
EFI_GUID gEfiSimpleFileSystemProtocolGuid = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID;
EFI_GUID gEfiLoadFileProtocolGuid = EFI_LOAD_FILE_PROTOCOL_GUID;
EFI_GUID gEfiDeviceIoProtocolGuid = EFI_DEVICE_IO_PROTOCOL_GUID;
EFI_GUID gEfiUnicodeCollationProtocolGuid = EFI_UNICODE_COLLATION_PROTOCOL_GUID;
EFI_GUID gEfiSerialIoProtocolGuid = EFI_SERIAL_IO_PROTOCOL_GUID;
EFI_GUID gEfiSimpleNetworkProtocolGuid = EFI_SIMPLE_NETWORK_PROTOCOL_GUID;
EFI_GUID gEfiPxeBaseCodeProtocolGuid = EFI_PXE_BASE_CODE_PROTOCOL_GUID;
EFI_GUID gEfiPxeBaseCodeCallbackProtocolGuid = EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL_GUID;
EFI_GUID gEfiNetworkInterfaceIdentifierProtocolGuid = EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_GUID;
EFI_GUID gEFiUiInterfaceProtocolGuid = EFI_UI_INTERFACE_PROTOCOL_GUID;
EFI_GUID gEfiPciIoProtocolGuid = EFI_PCI_IO_PROTOCOL_GUID;
EFI_GUID gEfiPciRootBridgeIoProtocolGuid = EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID;
Update global protocol GUIDs definitions to match EDK2 This patch introduces the use of the EDK2 names for the global GUID variables, to allow for easier code conversion between EDK2 and gnu-efi. All the existing GUID global variables have also been aliased for backwards compatibility. The patch also completes some of the earlier work with regards to protocol struct definitions to also match the EDK2, with the following caveat: Because some of gnu-efi GUID macro definitions were declared with the name that the EDK2 uses for the protocol struct itself, we have to immediately deprecate the following GUID data aliases: EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL EFI_SIMPLE_NETWORK_PROTOCOL EFI_PCI_IO_PROTOCOL EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL This means that existing code using one of the above will break on compilation. To mitigate this, explicit warnings have been placed at the location where a developer will look for breakage, detailing how they should amend their code. The KnownGuids short labels in guid.c were also updated/amended in a manner that should be a bit more consistent (though I have no idea what the EDK2 does here, since I haven't looked at the actual EDK2 source). Finally, besides clean up (typo, whitespaces, duplicate removal), we introduce the _GNU_EFI macro, in efi.h, to allow for conditional selection of specific gnu-efi API calls, in code that may be compiled with either EDK2 or gnu-efi. Signed-off-by: Pete Batard <pete@akeo.ie> Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-08-18 15:42:11 +03:00
EFI_GUID gEfiDriverBindingProtocolGuid = EFI_DRIVER_BINDING_PROTOCOL_GUID;
EFI_GUID gEfiComponentNameProtocolGuid = EFI_COMPONENT_NAME_PROTOCOL_GUID;
EFI_GUID gEfiComponentName2ProtocolGuid = EFI_COMPONENT_NAME2_PROTOCOL_GUID;
EFI_GUID gEfiHashProtocolGuid = EFI_HASH_PROTOCOL_GUID;
EFI_GUID gEfiPlatformDriverOverrideProtocolGuid = EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL_GUID;
EFI_GUID gEfiBusSpecificDriverOverrideProtocolGuid = EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL_GUID;
EFI_GUID gEfiDriverFamilyOverrideProtocolGuid = EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL_GUID;
EFI_GUID gEfiEbcProtocolGuid = EFI_EBC_PROTOCOL_GUID;
2013-01-31 01:25:25 +04:00
//
// File system information IDs
//
Update global protocol GUIDs definitions to match EDK2 This patch introduces the use of the EDK2 names for the global GUID variables, to allow for easier code conversion between EDK2 and gnu-efi. All the existing GUID global variables have also been aliased for backwards compatibility. The patch also completes some of the earlier work with regards to protocol struct definitions to also match the EDK2, with the following caveat: Because some of gnu-efi GUID macro definitions were declared with the name that the EDK2 uses for the protocol struct itself, we have to immediately deprecate the following GUID data aliases: EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL EFI_SIMPLE_NETWORK_PROTOCOL EFI_PCI_IO_PROTOCOL EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL This means that existing code using one of the above will break on compilation. To mitigate this, explicit warnings have been placed at the location where a developer will look for breakage, detailing how they should amend their code. The KnownGuids short labels in guid.c were also updated/amended in a manner that should be a bit more consistent (though I have no idea what the EDK2 does here, since I haven't looked at the actual EDK2 source). Finally, besides clean up (typo, whitespaces, duplicate removal), we introduce the _GNU_EFI macro, in efi.h, to allow for conditional selection of specific gnu-efi API calls, in code that may be compiled with either EDK2 or gnu-efi. Signed-off-by: Pete Batard <pete@akeo.ie> Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-08-18 15:42:11 +03:00
EFI_GUID gEfiFileInfoGuid = EFI_FILE_INFO_ID;
EFI_GUID gEfiFileSystemInfoGuid = EFI_FILE_SYSTEM_INFO_ID;
EFI_GUID gEfiFileSystemVolumeLabelInfoIdGuid = EFI_FILE_SYSTEM_VOLUME_LABEL_ID;
2013-01-31 01:25:25 +04:00
//
// Reference implementation public protocol IDs
//
EFI_GUID InternalShellProtocol = INTERNAL_SHELL_GUID;
EFI_GUID VariableStoreProtocol = VARIABLE_STORE_PROTOCOL;
EFI_GUID LegacyBootProtocol = LEGACY_BOOT_PROTOCOL;
EFI_GUID VgaClassProtocol = VGA_CLASS_DRIVER_PROTOCOL;
EFI_GUID TextOutSpliterProtocol = TEXT_OUT_SPLITER_PROTOCOL;
EFI_GUID ErrorOutSpliterProtocol = ERROR_OUT_SPLITER_PROTOCOL;
EFI_GUID TextInSpliterProtocol = TEXT_IN_SPLITER_PROTOCOL;
/* Added for GOP support */
Update global protocol GUIDs definitions to match EDK2 This patch introduces the use of the EDK2 names for the global GUID variables, to allow for easier code conversion between EDK2 and gnu-efi. All the existing GUID global variables have also been aliased for backwards compatibility. The patch also completes some of the earlier work with regards to protocol struct definitions to also match the EDK2, with the following caveat: Because some of gnu-efi GUID macro definitions were declared with the name that the EDK2 uses for the protocol struct itself, we have to immediately deprecate the following GUID data aliases: EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL EFI_SIMPLE_NETWORK_PROTOCOL EFI_PCI_IO_PROTOCOL EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL This means that existing code using one of the above will break on compilation. To mitigate this, explicit warnings have been placed at the location where a developer will look for breakage, detailing how they should amend their code. The KnownGuids short labels in guid.c were also updated/amended in a manner that should be a bit more consistent (though I have no idea what the EDK2 does here, since I haven't looked at the actual EDK2 source). Finally, besides clean up (typo, whitespaces, duplicate removal), we introduce the _GNU_EFI macro, in efi.h, to allow for conditional selection of specific gnu-efi API calls, in code that may be compiled with either EDK2 or gnu-efi. Signed-off-by: Pete Batard <pete@akeo.ie> Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-08-18 15:42:11 +03:00
EFI_GUID gEfiGraphicsOutputProtocolGuid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
EFI_GUID gEfiEdidDiscoveredProtocolGuid = EFI_EDID_DISCOVERED_PROTOCOL_GUID;
EFI_GUID gEfiEdidActiveProtocolGuid = EFI_EDID_ACTIVE_PROTOCOL_GUID;
EFI_GUID gEfiEdidOverrideProtocolGuid = EFI_EDID_OVERRIDE_PROTOCOL_GUID;
2013-01-31 01:25:25 +04:00
EFI_GUID AdapterDebugProtocol = ADAPTER_DEBUG_PROTOCOL;
//
// Device path media protocol IDs
//
Update global protocol GUIDs definitions to match EDK2 This patch introduces the use of the EDK2 names for the global GUID variables, to allow for easier code conversion between EDK2 and gnu-efi. All the existing GUID global variables have also been aliased for backwards compatibility. The patch also completes some of the earlier work with regards to protocol struct definitions to also match the EDK2, with the following caveat: Because some of gnu-efi GUID macro definitions were declared with the name that the EDK2 uses for the protocol struct itself, we have to immediately deprecate the following GUID data aliases: EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL EFI_SIMPLE_NETWORK_PROTOCOL EFI_PCI_IO_PROTOCOL EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL This means that existing code using one of the above will break on compilation. To mitigate this, explicit warnings have been placed at the location where a developer will look for breakage, detailing how they should amend their code. The KnownGuids short labels in guid.c were also updated/amended in a manner that should be a bit more consistent (though I have no idea what the EDK2 does here, since I haven't looked at the actual EDK2 source). Finally, besides clean up (typo, whitespaces, duplicate removal), we introduce the _GNU_EFI macro, in efi.h, to allow for conditional selection of specific gnu-efi API calls, in code that may be compiled with either EDK2 or gnu-efi. Signed-off-by: Pete Batard <pete@akeo.ie> Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-08-18 15:42:11 +03:00
EFI_GUID gEfiPcAnsiGuid = EFI_PC_ANSI_GUID;
EFI_GUID gEfiVT100Guid = EFI_VT_100_GUID;
EFI_GUID gEfiVT100PlusGuid = EFI_VT_100_PLUS_GUID;
EFI_GUID gEfiVTUTF8Guid = EFI_VT_UTF8_GUID;
2013-01-31 01:25:25 +04:00
//
// EFI GPT Partition Type GUIDs
//
EFI_GUID EfiPartTypeSystemPartitionGuid = EFI_PART_TYPE_EFI_SYSTEM_PART_GUID;
EFI_GUID EfiPartTypeLegacyMbrGuid = EFI_PART_TYPE_LEGACY_MBR_GUID;
//
// Reference implementation Vendor Device Path Guids
//
EFI_GUID UnknownDevice = UNKNOWN_DEVICE_GUID;
//
// Configuration Table GUIDs
//
EFI_GUID MpsTableGuid = MPS_TABLE_GUID;
EFI_GUID AcpiTableGuid = ACPI_TABLE_GUID;
EFI_GUID gEfiSmbiosTableGuid = SMBIOS_TABLE_GUID;
EFI_GUID gEfiSmbios3TableGuid = SMBIOS3_TABLE_GUID;
2013-01-31 01:25:25 +04:00
EFI_GUID SalSystemTableGuid = SAL_SYSTEM_TABLE_GUID;
EFI_GUID EfiDtbTableGuid = EFI_DTB_TABLE_GUID;
//
// Network protocol GUIDs
//
EFI_GUID Ip4ServiceBindingProtocol = EFI_IP4_SERVICE_BINDING_PROTOCOL;
EFI_GUID Ip4Protocol = EFI_IP4_PROTOCOL;
EFI_GUID Udp4ServiceBindingProtocol = EFI_UDP4_SERVICE_BINDING_PROTOCOL;
EFI_GUID Udp4Protocol = EFI_UDP4_PROTOCOL;
EFI_GUID Tcp4ServiceBindingProtocol = EFI_TCP4_SERVICE_BINDING_PROTOCOL;
EFI_GUID Tcp4Protocol = EFI_TCP4_PROTOCOL;
//
// Pointer protocol GUIDs
//
EFI_GUID SimplePointerProtocol = EFI_SIMPLE_POINTER_PROTOCOL_GUID;
EFI_GUID AbsolutePointerProtocol = EFI_ABSOLUTE_POINTER_PROTOCOL_GUID;
//
// Debugger protocol GUIDs
//
EFI_GUID gEfiDebugImageInfoTableGuid = EFI_DEBUG_IMAGE_INFO_TABLE_GUID;
EFI_GUID gEfiDebugSupportProtocolGuid = EFI_DEBUG_SUPPORT_PROTOCOL_GUID;
//
// Console extension protocol GUIDs
//
EFI_GUID SimpleTextInputExProtocol = EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID;
//
// Shell protocol GUIDs
//
EFI_GUID ShellProtocolGuid = EFI_SHELL_PROTOCOL_GUID;
EFI_GUID ShellParametersProtocolGuid = EFI_SHELL_PARAMETERS_PROTOCOL_GUID;
EFI_GUID ShellDynamicCommandProtocolGuid = EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL_GUID;