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/PerformanceLib.h>
32 #include <Library/PrintLib.h>
33 #include <Library/UefiRuntimeServicesTableLib.h>
35 #include <Guid/ArmMpCoreInfo.h>
36 #include <Guid/GlobalVariable.h>
37 #include <Guid/FileInfo.h>
39 #include <Protocol/DevicePath.h>
40 #include <Protocol/DevicePathFromText.h>
41 #include <Protocol/SimpleFileSystem.h>
42 #include <Protocol/FirmwareVolume2.h>
43 #include <Protocol/LoadFile.h>
44 #include <Protocol/PxeBaseCode.h>
49 * Check if the file loader can support this device path.
51 * @param DevicePath EFI Device Path of the image to load.
52 * This device path generally comes from the boot entry (ie: Boot####).
53 * @param Handle Handle of the driver supporting the device path
54 * @param RemainingDevicePath Part of the EFI Device Path that has not been resolved during
55 * the Device Path discovery
57 typedef BOOLEAN (*BDS_FILE_LOADER_SUPPORT
) (
58 IN EFI_DEVICE_PATH
*DevicePath
,
60 IN EFI_DEVICE_PATH
*RemainingDevicePath
64 * Function to load an image from a given Device Path for a
65 * specific support (FileSystem, TFTP, PXE, ...)
67 * @param DevicePath EFI Device Path of the image to load.
68 * This device path generally comes from the boot entry (ie: Boot####).
69 * This path is also defined as 'OUT' as there are some device paths that
70 * might not be completed such as EFI path for removable device. In these
71 * cases, it is expected the loader to add \EFI\BOOT\BOOT(ARM|AA64).EFI
72 * @param Handle Handle of the driver supporting the device path
73 * @param RemainingDevicePath Part of the EFI Device Path that has not been resolved during
74 * the Device Path discovery
75 * @param Type Define where the image should be loaded (see EFI_ALLOCATE_TYPE definition)
76 * @param Image Base Address of the image has been loaded
77 * @param ImageSize Size of the image that has been loaded
79 typedef EFI_STATUS (*BDS_FILE_LOADER_LOAD_IMAGE
) (
80 IN OUT EFI_DEVICE_PATH
**DevicePath
,
82 IN EFI_DEVICE_PATH
*RemainingDevicePath
,
83 IN EFI_ALLOCATE_TYPE Type
,
84 IN OUT EFI_PHYSICAL_ADDRESS
* Image
,
89 BDS_FILE_LOADER_SUPPORT Support
;
90 BDS_FILE_LOADER_LOAD_IMAGE LoadImage
;
93 typedef struct _BDS_SYSTEM_MEMORY_RESOURCE
{
94 LIST_ENTRY Link
; // This attribute must be the first entry of this structure (to avoid pointer computation)
95 EFI_PHYSICAL_ADDRESS PhysicalStart
;
96 UINT64 ResourceLength
;
97 } BDS_SYSTEM_MEMORY_RESOURCE
;
101 UINT64 DownloadedNbOfBytes
;
102 UINT64 LastReportedNbOfBytes
;
107 ShutdownUefiBootServices (
112 GetSystemMemoryResources (
113 LIST_ENTRY
*ResourceList
123 IN EFI_DEVICE_PATH
*DevicePath
,
124 IN EFI_ALLOCATE_TYPE Type
,
125 IN OUT EFI_PHYSICAL_ADDRESS
* Image
,