]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Library/BdsLib/BdsInternal.h
ArmPkg/BdsLib: Exposed ShutdownUefiBootServices() in the BdsLib interface
[mirror_edk2.git] / ArmPkg / Library / BdsLib / BdsInternal.h
1 /** @file
2 *
3 * Copyright (c) 2011-2015, ARM Limited. All rights reserved.
4 *
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
9 *
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.
12 *
13 **/
14
15 #ifndef __BDS_INTERNAL_H__
16 #define __BDS_INTERNAL_H__
17
18 #include <PiDxe.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>
34
35 #include <Guid/ArmMpCoreInfo.h>
36 #include <Guid/GlobalVariable.h>
37 #include <Guid/FileInfo.h>
38
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>
45
46 #include <Uefi.h>
47
48 /**
49 * Check if the file loader can support this device path.
50 *
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
56 */
57 typedef BOOLEAN (*BDS_FILE_LOADER_SUPPORT) (
58 IN EFI_DEVICE_PATH *DevicePath,
59 IN EFI_HANDLE Handle,
60 IN EFI_DEVICE_PATH *RemainingDevicePath
61 );
62
63 /**
64 * Function to load an image from a given Device Path for a
65 * specific support (FileSystem, TFTP, PXE, ...)
66 *
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
78 */
79 typedef EFI_STATUS (*BDS_FILE_LOADER_LOAD_IMAGE) (
80 IN OUT EFI_DEVICE_PATH **DevicePath,
81 IN EFI_HANDLE Handle,
82 IN EFI_DEVICE_PATH *RemainingDevicePath,
83 IN EFI_ALLOCATE_TYPE Type,
84 IN OUT EFI_PHYSICAL_ADDRESS* Image,
85 OUT UINTN *ImageSize
86 );
87
88 typedef struct {
89 BDS_FILE_LOADER_SUPPORT Support;
90 BDS_FILE_LOADER_LOAD_IMAGE LoadImage;
91 } BDS_FILE_LOADER;
92
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;
98
99 typedef struct {
100 UINT64 FileSize;
101 UINT64 DownloadedNbOfBytes;
102 UINT64 LastReportedNbOfBytes;
103 } BDS_TFTP_CONTEXT;
104
105 // BdsHelper.c
106 EFI_STATUS
107 GetSystemMemoryResources (
108 LIST_ENTRY *ResourceList
109 );
110
111 VOID
112 PrintPerformance (
113 VOID
114 );
115
116 EFI_STATUS
117 BdsLoadImage (
118 IN EFI_DEVICE_PATH *DevicePath,
119 IN EFI_ALLOCATE_TYPE Type,
120 IN OUT EFI_PHYSICAL_ADDRESS* Image,
121 OUT UINTN *FileSize
122 );
123
124 #endif