X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ArmPkg%2FLibrary%2FBdsLib%2FBdsInternal.h;h=f70aae603d69f3ea0c473cb1e38e5d2f20b5681e;hb=c75d3eb6be41867cc3bfea9f567bf20cdead8966;hp=07f722e03fdd65a515a12ad94dd6f853fcf924b1;hpb=1bfda055dfbc52678655ab2ded721f9f7c0cd496;p=mirror_edk2.git diff --git a/ArmPkg/Library/BdsLib/BdsInternal.h b/ArmPkg/Library/BdsLib/BdsInternal.h index 07f722e03f..f70aae603d 100644 --- a/ArmPkg/Library/BdsLib/BdsInternal.h +++ b/ArmPkg/Library/BdsLib/BdsInternal.h @@ -1,136 +1,111 @@ -/** @file -* -* Copyright (c) 2011, 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 -* which accompanies this distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ - -#ifndef __BDS_INTERNAL_H__ -#define __BDS_INTERNAL_H__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include - - -typedef enum { BDS_FILETYPE_MEM, BDS_FILETYPE_FS, BDS_FILETYPE_FV } BDS_FILE_TYPE; - -typedef struct { - UINT32 MemoryType; - EFI_PHYSICAL_ADDRESS StartingAddress; - EFI_PHYSICAL_ADDRESS EndingAddress; -} BDS_MEM_FILE; - -typedef struct { - EFI_FILE_PROTOCOL *Handle; -} BDS_FS_FILE; - -typedef struct { - EFI_FIRMWARE_VOLUME2_PROTOCOL *FvProtocol; - EFI_FV_FILETYPE FileType; - EFI_GUID Guid; -} BDS_FV_FILE; - -typedef struct _BDS_FILE { - CHAR16* FilePath; - EFI_DEVICE_PATH_PROTOCOL *DevicePath; - BDS_FILE_TYPE Type; - union { - BDS_MEM_FILE Mem; - BDS_FS_FILE Fs; - BDS_FV_FILE Fv; - } File; -} BDS_FILE; - -typedef struct _BDS_SYSTEM_MEMORY_RESOURCE { - LIST_ENTRY Link; // This attribute must be the first entry of this structure (to avoid pointer computation) - EFI_PHYSICAL_ADDRESS PhysicalStart; - UINT64 ResourceLength; -} BDS_SYSTEM_MEMORY_RESOURCE; - - -// BdsHelper.c -EFI_STATUS -ShutdownUefiBootServices( VOID ); - -EFI_STATUS -GetSystemMemoryResources (LIST_ENTRY *ResourceList); - -// BdsFilePath.c -EFI_STATUS BdsLoadDevicePath( - IN EFI_DEVICE_PATH_PROTOCOL* DevicePath, - OUT EFI_HANDLE *Handle -); - -EFI_STATUS BdsLoadFilePath( - IN CONST CHAR16 *DeviceFilePath, - OUT BDS_FILE *File -); - -EFI_STATUS BdsCopyRawFileToRuntimeMemory( - IN BDS_FILE *File, - OUT VOID **FileImage, - OUT UINTN *FileSize -); - -// BdsFilePathFs.c -EFI_STATUS BdsLoadFileFromSimpleFileSystem( - IN EFI_HANDLE Handle, - IN CHAR16 *FilePath, - OUT BDS_FILE *File -); - -EFI_STATUS BdsCopyRawFileToRuntimeMemoryFS( - IN EFI_FILE_PROTOCOL *File, - OUT VOID **FileImage, - OUT UINTN *FileSize -); - -// BdsFilePathFv.c -EFI_STATUS BdsLoadFileFromFirmwareVolume( - IN EFI_HANDLE FvHandle, - IN CHAR16 *FilePath, - IN EFI_FV_FILETYPE FileTypeFilter, - OUT BDS_FILE *File -); - -EFI_STATUS BdsCopyRawFileToRuntimeMemoryFV( - IN BDS_FV_FILE *FvFile, - OUT VOID **FileImage, - OUT UINTN *FileSize -); - -// BdsFilePathMem.c -EFI_STATUS BdsLoadFileFromMemMap ( - IN EFI_HANDLE Handle, - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, - OUT BDS_FILE *File -); - -EFI_STATUS BdsCopyRawFileToRuntimeMemoryMemMap( - IN BDS_MEM_FILE *MemFile, - OUT VOID **FileImage, - OUT UINTN *FileSize -); - -#endif +/** @file +* +* 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 +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#ifndef __BDS_INTERNAL_H__ +#define __BDS_INTERNAL_H__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +/** + * Check if the file loader can support this device path. + * + * @param DevicePath EFI Device Path of the image to load. + * This device path generally comes from the boot entry (ie: Boot####). + * @param Handle Handle of the driver supporting the device path + * @param RemainingDevicePath Part of the EFI Device Path that has not been resolved during + * the Device Path discovery + */ +typedef BOOLEAN (*BDS_FILE_LOADER_SUPPORT) ( + IN EFI_DEVICE_PATH *DevicePath, + IN EFI_HANDLE Handle, + IN EFI_DEVICE_PATH *RemainingDevicePath + ); + +/** + * Function to load an image from a given Device Path for a + * specific support (FileSystem, TFTP, PXE, ...) + * + * @param DevicePath EFI Device Path of the image to load. + * This device path generally comes from the boot entry (ie: Boot####). + * This path is also defined as 'OUT' as there are some device paths that + * might not be completed such as EFI path for removable device. In these + * cases, it is expected the loader to add \EFI\BOOT\BOOT(ARM|AA64).EFI + * @param Handle Handle of the driver supporting the device path + * @param RemainingDevicePath Part of the EFI Device Path that has not been resolved during + * the Device Path discovery + * @param Type Define where the image should be loaded (see EFI_ALLOCATE_TYPE definition) + * @param Image Base Address of the image has been loaded + * @param ImageSize Size of the image that has been loaded + */ +typedef EFI_STATUS (*BDS_FILE_LOADER_LOAD_IMAGE) ( + IN OUT EFI_DEVICE_PATH **DevicePath, + IN EFI_HANDLE Handle, + IN EFI_DEVICE_PATH *RemainingDevicePath, + IN EFI_ALLOCATE_TYPE Type, + IN OUT EFI_PHYSICAL_ADDRESS* Image, + OUT UINTN *ImageSize + ); + +typedef struct { + BDS_FILE_LOADER_SUPPORT Support; + BDS_FILE_LOADER_LOAD_IMAGE LoadImage; +} BDS_FILE_LOADER; + +typedef struct _BDS_SYSTEM_MEMORY_RESOURCE { + LIST_ENTRY Link; // This attribute must be the first entry of this structure (to avoid pointer computation) + EFI_PHYSICAL_ADDRESS PhysicalStart; + UINT64 ResourceLength; +} BDS_SYSTEM_MEMORY_RESOURCE; + +typedef struct { + UINT64 FileSize; + UINT64 DownloadedNbOfBytes; + UINT64 LastReportedNbOfBytes; +} BDS_TFTP_CONTEXT; + +EFI_STATUS +BdsLoadImage ( + IN EFI_DEVICE_PATH *DevicePath, + IN EFI_ALLOCATE_TYPE Type, + IN OUT EFI_PHYSICAL_ADDRESS* Image, + OUT UINTN *FileSize + ); + +#endif