3 * Copyright (c) 2011-2015, ARM Limited. All rights reserved.
5 * This program and the accompanying materials
6 * are licensed and made available under the terms and conditions of the BSD License
7 * which accompanies this distribution. The full text of the license may be found at
8 * http://opensource.org/licenses/bsd-license.php
10 * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #ifndef __BDS_INTERNAL_H__
16 #define __BDS_INTERNAL_H__
19 #include <Library/ArmLib.h>
20 #include <Library/BaseLib.h>
21 #include <Library/BaseMemoryLib.h>
22 #include <Library/DxeServicesTableLib.h>
23 #include <Library/HobLib.h>
24 #include <Library/UefiBootServicesTableLib.h>
25 #include <Library/UefiLib.h>
26 #include <Library/DevicePathLib.h>
27 #include <Library/MemoryAllocationLib.h>
28 #include <Library/DebugLib.h>
29 #include <Library/BdsLib.h>
30 #include <Library/PcdLib.h>
31 #include <Library/PrintLib.h>
32 #include <Library/UefiRuntimeServicesTableLib.h>
34 #include <Guid/GlobalVariable.h>
35 #include <Guid/FileInfo.h>
37 #include <Protocol/DevicePath.h>
38 #include <Protocol/DevicePathFromText.h>
39 #include <Protocol/SimpleFileSystem.h>
40 #include <Protocol/FirmwareVolume2.h>
41 #include <Protocol/LoadFile.h>
42 #include <Protocol/PxeBaseCode.h>
47 * Check if the file loader can support this device path.
49 * @param DevicePath EFI Device Path of the image to load.
50 * This device path generally comes from the boot entry (ie: Boot####).
51 * @param Handle Handle of the driver supporting the device path
52 * @param RemainingDevicePath Part of the EFI Device Path that has not been resolved during
53 * the Device Path discovery
55 typedef BOOLEAN (*BDS_FILE_LOADER_SUPPORT
) (
56 IN EFI_DEVICE_PATH
*DevicePath
,
58 IN EFI_DEVICE_PATH
*RemainingDevicePath
62 * Function to load an image from a given Device Path for a
63 * specific support (FileSystem, TFTP, PXE, ...)
65 * @param DevicePath EFI Device Path of the image to load.
66 * This device path generally comes from the boot entry (ie: Boot####).
67 * This path is also defined as 'OUT' as there are some device paths that
68 * might not be completed such as EFI path for removable device. In these
69 * cases, it is expected the loader to add \EFI\BOOT\BOOT(ARM|AA64).EFI
70 * @param Handle Handle of the driver supporting the device path
71 * @param RemainingDevicePath Part of the EFI Device Path that has not been resolved during
72 * the Device Path discovery
73 * @param Type Define where the image should be loaded (see EFI_ALLOCATE_TYPE definition)
74 * @param Image Base Address of the image has been loaded
75 * @param ImageSize Size of the image that has been loaded
77 typedef EFI_STATUS (*BDS_FILE_LOADER_LOAD_IMAGE
) (
78 IN OUT EFI_DEVICE_PATH
**DevicePath
,
80 IN EFI_DEVICE_PATH
*RemainingDevicePath
,
81 IN EFI_ALLOCATE_TYPE Type
,
82 IN OUT EFI_PHYSICAL_ADDRESS
* Image
,
87 BDS_FILE_LOADER_SUPPORT Support
;
88 BDS_FILE_LOADER_LOAD_IMAGE LoadImage
;
91 typedef struct _BDS_SYSTEM_MEMORY_RESOURCE
{
92 LIST_ENTRY Link
; // This attribute must be the first entry of this structure (to avoid pointer computation)
93 EFI_PHYSICAL_ADDRESS PhysicalStart
;
94 UINT64 ResourceLength
;
95 } BDS_SYSTEM_MEMORY_RESOURCE
;
99 UINT64 DownloadedNbOfBytes
;
100 UINT64 LastReportedNbOfBytes
;
105 IN EFI_DEVICE_PATH
*DevicePath
,
106 IN EFI_ALLOCATE_TYPE Type
,
107 IN OUT EFI_PHYSICAL_ADDRESS
* Image
,