]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Library/BdsLib/BdsInternal.h
ArmPkg/BdsLib: Remove Linux loader from BdsLib
[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/PrintLib.h>
32 #include <Library/UefiRuntimeServicesTableLib.h>
33
34 #include <Guid/GlobalVariable.h>
35 #include <Guid/FileInfo.h>
36
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>
43
44 #include <Uefi.h>
45
46 /**
47 * Check if the file loader can support this device path.
48 *
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
54 */
55 typedef BOOLEAN (*BDS_FILE_LOADER_SUPPORT) (
56 IN EFI_DEVICE_PATH *DevicePath,
57 IN EFI_HANDLE Handle,
58 IN EFI_DEVICE_PATH *RemainingDevicePath
59 );
60
61 /**
62 * Function to load an image from a given Device Path for a
63 * specific support (FileSystem, TFTP, PXE, ...)
64 *
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
76 */
77 typedef EFI_STATUS (*BDS_FILE_LOADER_LOAD_IMAGE) (
78 IN OUT EFI_DEVICE_PATH **DevicePath,
79 IN EFI_HANDLE Handle,
80 IN EFI_DEVICE_PATH *RemainingDevicePath,
81 IN EFI_ALLOCATE_TYPE Type,
82 IN OUT EFI_PHYSICAL_ADDRESS* Image,
83 OUT UINTN *ImageSize
84 );
85
86 typedef struct {
87 BDS_FILE_LOADER_SUPPORT Support;
88 BDS_FILE_LOADER_LOAD_IMAGE LoadImage;
89 } BDS_FILE_LOADER;
90
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;
96
97 typedef struct {
98 UINT64 FileSize;
99 UINT64 DownloadedNbOfBytes;
100 UINT64 LastReportedNbOfBytes;
101 } BDS_TFTP_CONTEXT;
102
103 EFI_STATUS
104 BdsLoadImage (
105 IN EFI_DEVICE_PATH *DevicePath,
106 IN EFI_ALLOCATE_TYPE Type,
107 IN OUT EFI_PHYSICAL_ADDRESS* Image,
108 OUT UINTN *FileSize
109 );
110
111 #endif