X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=ArmPlatformPkg%2FBds%2FBdsInternal.h;h=ddf5308e8b234d7ff5a75a5c8b823f5bd66a4358;hp=9ef36a1ff6749d1c2326aac5075723eb9dd75ef4;hb=90b10821cd3518d07e4ae106d4a02e77179e5b6f;hpb=ea46ebbe6a5a579ff341071a13ae625e15edae64 diff --git a/ArmPlatformPkg/Bds/BdsInternal.h b/ArmPlatformPkg/Bds/BdsInternal.h index 9ef36a1ff6..ddf5308e8b 100644 --- a/ArmPlatformPkg/Bds/BdsInternal.h +++ b/ArmPlatformPkg/Bds/BdsInternal.h @@ -1,6 +1,6 @@ /** @file * -* Copyright (c) 2011, ARM Limited. All rights reserved. +* Copyright (c) 2011-2015, ARM Limited. All rights reserved. * * This program and the accompanying materials * are licensed and made available under the terms and conditions of the BSD License @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include @@ -32,22 +31,21 @@ #include #include +#include #define BOOT_DEVICE_DESCRIPTION_MAX 100 #define BOOT_DEVICE_FILEPATH_MAX 100 -#define BOOT_DEVICE_OPTION_MAX 100 -#define BOOT_DEVICE_ADDRESS_MAX 20 +#define BOOT_DEVICE_OPTION_MAX 300 +#define BOOT_DEVICE_ADDRESS_MAX (sizeof(L"0x0000000000000000")) -typedef enum { - BDS_LOADER_EFI_APPLICATION = 0, - BDS_LOADER_KERNEL_LINUX_ATAG, - BDS_LOADER_KERNEL_LINUX_FDT, -} BDS_LOADER_TYPE; +#define UPDATE_BOOT_ENTRY L"Update entry: " +#define DELETE_BOOT_ENTRY L"Delete entry: " +#define MOVE_BOOT_ENTRY L"Move entry: " typedef struct { - BDS_LOADER_TYPE LoaderType; - CHAR8 Arguments[]; -} BDS_LOADER_OPTIONAL_DATA; + LIST_ENTRY Link; + BDS_LOAD_OPTION* BdsLoadOption; +} BDS_LOAD_OPTION_ENTRY; typedef enum { BDS_DEVICE_FILESYSTEM = 0, @@ -58,47 +56,34 @@ typedef enum { } BDS_SUPPORTED_DEVICE_TYPE; typedef struct { - LIST_ENTRY Link; - CHAR16 Description[BOOT_DEVICE_DESCRIPTION_MAX]; - EFI_DEVICE_PATH_PROTOCOL* DevicePathProtocol; + LIST_ENTRY Link; + CHAR16 Description[BOOT_DEVICE_DESCRIPTION_MAX]; + EFI_DEVICE_PATH_PROTOCOL* DevicePathProtocol; struct _BDS_LOAD_OPTION_SUPPORT* Support; } BDS_SUPPORTED_DEVICE; #define SUPPORTED_BOOT_DEVICE_FROM_LINK(a) BASE_CR(a, BDS_SUPPORTED_DEVICE, Link) -typedef UINT8* EFI_LOAD_OPTION; - -typedef struct { - LIST_ENTRY Link; - - UINT16 LoadOptionIndex; - EFI_LOAD_OPTION LoadOption; - UINTN LoadOptionSize; - - UINT32 Attributes; - UINT16 FilePathListLength; - CHAR16 *Description; - EFI_DEVICE_PATH_PROTOCOL *FilePathList; - BDS_LOADER_OPTIONAL_DATA *OptionalData; -} BDS_LOAD_OPTION; - typedef struct _BDS_LOAD_OPTION_SUPPORT { BDS_SUPPORTED_DEVICE_TYPE Type; EFI_STATUS (*ListDevices)(IN OUT LIST_ENTRY* BdsLoadOptionList); - BOOLEAN (*IsSupported)(IN BDS_LOAD_OPTION* BdsLoadOption); - EFI_STATUS (*CreateDevicePathNode)(IN BDS_SUPPORTED_DEVICE* BdsLoadOption, OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode, OUT BDS_LOADER_TYPE *BootType, OUT UINT32 *Attributes); - EFI_STATUS (*UpdateDevicePathNode)(IN BDS_LOAD_OPTION *BootOption, OUT EFI_DEVICE_PATH_PROTOCOL** NewDevicePath, OUT BDS_LOADER_TYPE *BootType, OUT UINT32 *Attributes); + BOOLEAN (*IsSupported)(IN EFI_DEVICE_PATH *DevicePath); + EFI_STATUS (*CreateDevicePathNode)(IN CHAR16* FileName, OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNodes); + EFI_STATUS (*UpdateDevicePathNode)(IN EFI_DEVICE_PATH *OldDevicePath, IN CHAR16* FileName, OUT EFI_DEVICE_PATH_PROTOCOL** NewDevicePath); + + /// Define if the boot menu should request if the file is a EFI binary or a Linux kernel + /// Example: PXE boot always deliver a UEFI application. + BOOLEAN RequestBootType; } BDS_LOAD_OPTION_SUPPORT; -#define LOAD_OPTION_FROM_LINK(a) BASE_CR(a, BDS_LOAD_OPTION, Link) +#define LOAD_OPTION_ENTRY_FROM_LINK(a) BASE_CR(a, BDS_LOAD_OPTION_ENTRY, Link) +#define LOAD_OPTION_FROM_LINK(a) ((BDS_LOAD_OPTION_ENTRY*)BASE_CR(a, BDS_LOAD_OPTION_ENTRY, Link))->BdsLoadOption -EFI_STATUS -GetEnvironmentVariable ( - IN CONST CHAR16* VariableName, - IN VOID* DefaultValue, - IN OUT UINTN* Size, - OUT VOID** Value - ); +// GUID of the EFI Linux Loader +extern CONST EFI_GUID mLinuxLoaderAppGuid; + +// Device path of the EFI Linux Loader in the Firmware Volume +extern EFI_DEVICE_PATH* mLinuxLoaderDevicePath; EFI_STATUS BootDeviceListSupportedInit ( @@ -107,13 +92,26 @@ BootDeviceListSupportedInit ( EFI_STATUS BootDeviceListSupportedFree ( - IN LIST_ENTRY *SupportedDeviceList + IN LIST_ENTRY *SupportedDeviceList, + IN BDS_SUPPORTED_DEVICE *Except ); EFI_STATUS BootDeviceGetDeviceSupport ( - IN BDS_LOAD_OPTION *BootOption, - OUT BDS_LOAD_OPTION_SUPPORT** DeviceSupport + IN EFI_DEVICE_PATH *DevicePath, + OUT BDS_LOAD_OPTION_SUPPORT **DeviceSupport + ); + +EFI_STATUS +GetHIInputStr ( + IN OUT CHAR16 *CmdLine, + IN UINTN MaxCmdLine + ); + +EFI_STATUS +EditHIInputStr ( + IN OUT CHAR16 *CmdLine, + IN UINTN MaxCmdLine ); EFI_STATUS @@ -139,13 +137,14 @@ GetHIInputIP ( ); EFI_STATUS -GetHIInputBoolean ( - OUT BOOLEAN *Value +EditHIInputIP ( + IN EFI_IP_ADDRESS *InIpAddr, + OUT EFI_IP_ADDRESS *OutIpAddr ); -BOOLEAN -HasFilePathEfiExtension ( - IN CHAR16* FilePath +EFI_STATUS +GetHIInputBoolean ( + OUT BOOLEAN *Value ); EFI_DEVICE_PATH* @@ -158,6 +157,16 @@ BdsStartBootOption ( IN CHAR16* BootOption ); +UINTN +GetUnalignedDevicePathSize ( + IN EFI_DEVICE_PATH* DevicePath + ); + +EFI_DEVICE_PATH* +GetAlignedDevicePath ( + IN EFI_DEVICE_PATH* DevicePath + ); + EFI_STATUS GenerateDeviceDescriptionName ( IN EFI_HANDLE Handle, @@ -183,22 +192,22 @@ BootOptionStart ( EFI_STATUS BootOptionCreate ( - IN UINT32 Attributes, - IN CHAR16* BootDescription, + IN UINT32 Attributes, + IN CHAR16* BootDescription, IN EFI_DEVICE_PATH_PROTOCOL* DevicePath, - IN BDS_LOADER_TYPE BootType, - IN CHAR8* BootArguments, - OUT BDS_LOAD_OPTION **BdsLoadOption + IN UINT8* OptionalData, + IN UINTN OptionalDataSize, + OUT BDS_LOAD_OPTION** BdsLoadOption ); EFI_STATUS BootOptionUpdate ( - IN BDS_LOAD_OPTION *BdsLoadOption, - IN UINT32 Attributes, - IN CHAR16* BootDescription, + IN BDS_LOAD_OPTION* BdsLoadOption, + IN UINT32 Attributes, + IN CHAR16* BootDescription, IN EFI_DEVICE_PATH_PROTOCOL* DevicePath, - IN BDS_LOADER_TYPE BootType, - IN CHAR8* BootArguments + IN UINT8* OptionalData, + IN UINTN OptionalDataSize ); EFI_STATUS @@ -211,4 +220,58 @@ BootMenuMain ( VOID ); +BOOLEAN +IsUnicodeString ( + IN VOID* String + ); + +/* + * Try to detect if the given string is an ASCII or Unicode string + * + * There are actually few limitation to this function but it is mainly to give + * a user friendly output. + * + * Some limitations: + * - it only supports unicode string that use ASCII character (< 0x100) + * - single character ASCII strings are interpreted as Unicode string + * - string cannot be longer than 2 x BOOT_DEVICE_OPTION_MAX (600 bytes) + * + * @param String Buffer that might contain a Unicode or Ascii string + * @param IsUnicode If not NULL this boolean value returns if the string is an + * ASCII or Unicode string. + */ +BOOLEAN +IsPrintableString ( + IN VOID* String, + OUT BOOLEAN *IsUnicode + ); + +/** + An empty function to pass error checking of CreateEventEx (). + + @param Event Event whose notification function is being invoked. + @param Context Pointer to the notification function's context, + which is implementation-dependent. + +**/ +VOID +EFIAPI +EmptyCallbackFunction ( + IN EFI_EVENT Event, + IN VOID *Context + ); + +/** + * This function check if the DevicePath defines an EFI binary + * + * This function is used when the BDS support Linux loader to + * detect if the binary is an EFI application or potentially a + * Linux kernel. + */ +EFI_STATUS +IsEfiBinary ( + IN EFI_DEVICE_PATH* DevicePath, + OUT BOOLEAN *EfiBinary + ); + #endif /* _BDSINTERNAL_H_ */