-/** @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 <PiDxe.h>
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiLib.h>
-#include <Library/DevicePathLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/DebugLib.h>
-#include <Library/BdsLib.h>
-#include <Library/BdsUnixLib.h>
-#include <Library/PerformanceLib.h>
-
-#include <Guid/FileInfo.h>
-
-#include <Protocol/DevicePath.h>
-#include <Protocol/DevicePathFromText.h>
-#include <Protocol/SimpleFileSystem.h>
-#include <Protocol/FirmwareVolume2.h>
-#include <Protocol/LoadFile.h>
-#include <Protocol/PxeBaseCode.h>
-
-
-typedef BOOLEAN (*BDS_FILE_LOADER_SUPPORT) (
- IN EFI_DEVICE_PATH *DevicePath,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH *RemainingDevicePath
- );
-
-typedef EFI_STATUS (*BDS_FILE_LOADER_LOAD_IMAGE) (
- IN 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;
-
-
-// BdsHelper.c
-EFI_STATUS
-ShutdownUefiBootServices (
- VOID
- );
-
-EFI_STATUS
-GetSystemMemoryResources (
- LIST_ENTRY *ResourceList
- );
-
-VOID
-PrintPerformance (
- VOID
- );
-EFI_STATUS
-BdsLoadImage (
- IN EFI_DEVICE_PATH *DevicePath,
- IN EFI_ALLOCATE_TYPE Type,
- IN OUT EFI_PHYSICAL_ADDRESS* Image,
- OUT UINTN *FileSize
- );
-
-#endif
+/** @file\r
+*\r
+* Copyright (c) 2011-2015, ARM Limited. All rights reserved.\r
+*\r
+* This program and the accompanying materials\r
+* are licensed and made available under the terms and conditions of the BSD License\r
+* which accompanies this distribution. The full text of the license may be found at\r
+* http://opensource.org/licenses/bsd-license.php\r
+*\r
+* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+*\r
+**/\r
+\r
+#ifndef __BDS_INTERNAL_H__\r
+#define __BDS_INTERNAL_H__\r
+\r
+#include <PiDxe.h>\r
+#include <Library/ArmLib.h>\r
+#include <Library/BaseLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/DxeServicesTableLib.h>\r
+#include <Library/HobLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/UefiLib.h>\r
+#include <Library/DevicePathLib.h>\r
+#include <Library/MemoryAllocationLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/BdsLib.h>\r
+#include <Library/PcdLib.h>\r
+#include <Library/PrintLib.h>\r
+#include <Library/UefiRuntimeServicesTableLib.h>\r
+\r
+#include <Guid/GlobalVariable.h>\r
+#include <Guid/FileInfo.h>\r
+\r
+#include <Protocol/DevicePath.h>\r
+#include <Protocol/DevicePathFromText.h>\r
+#include <Protocol/SimpleFileSystem.h>\r
+#include <Protocol/FirmwareVolume2.h>\r
+#include <Protocol/LoadFile.h>\r
+#include <Protocol/PxeBaseCode.h>\r
+\r
+#include <Uefi.h>\r
+\r
+/**\r
+ * Check if the file loader can support this device path.\r
+ *\r
+ * @param DevicePath EFI Device Path of the image to load.\r
+ * This device path generally comes from the boot entry (ie: Boot####).\r
+ * @param Handle Handle of the driver supporting the device path\r
+ * @param RemainingDevicePath Part of the EFI Device Path that has not been resolved during\r
+ * the Device Path discovery\r
+ */\r
+typedef BOOLEAN (*BDS_FILE_LOADER_SUPPORT) (\r
+ IN EFI_DEVICE_PATH *DevicePath,\r
+ IN EFI_HANDLE Handle,\r
+ IN EFI_DEVICE_PATH *RemainingDevicePath\r
+ );\r
+\r
+/**\r
+ * Function to load an image from a given Device Path for a\r
+ * specific support (FileSystem, TFTP, PXE, ...)\r
+ *\r
+ * @param DevicePath EFI Device Path of the image to load.\r
+ * This device path generally comes from the boot entry (ie: Boot####).\r
+ * This path is also defined as 'OUT' as there are some device paths that\r
+ * might not be completed such as EFI path for removable device. In these\r
+ * cases, it is expected the loader to add \EFI\BOOT\BOOT(ARM|AA64).EFI\r
+ * @param Handle Handle of the driver supporting the device path\r
+ * @param RemainingDevicePath Part of the EFI Device Path that has not been resolved during\r
+ * the Device Path discovery\r
+ * @param Type Define where the image should be loaded (see EFI_ALLOCATE_TYPE definition)\r
+ * @param Image Base Address of the image has been loaded\r
+ * @param ImageSize Size of the image that has been loaded\r
+ */\r
+typedef EFI_STATUS (*BDS_FILE_LOADER_LOAD_IMAGE) (\r
+ IN OUT EFI_DEVICE_PATH **DevicePath,\r
+ IN EFI_HANDLE Handle,\r
+ IN EFI_DEVICE_PATH *RemainingDevicePath,\r
+ IN EFI_ALLOCATE_TYPE Type,\r
+ IN OUT EFI_PHYSICAL_ADDRESS* Image,\r
+ OUT UINTN *ImageSize\r
+ );\r
+\r
+typedef struct {\r
+ BDS_FILE_LOADER_SUPPORT Support;\r
+ BDS_FILE_LOADER_LOAD_IMAGE LoadImage;\r
+} BDS_FILE_LOADER;\r
+\r
+typedef struct _BDS_SYSTEM_MEMORY_RESOURCE {\r
+ LIST_ENTRY Link; // This attribute must be the first entry of this structure (to avoid pointer computation)\r
+ EFI_PHYSICAL_ADDRESS PhysicalStart;\r
+ UINT64 ResourceLength;\r
+} BDS_SYSTEM_MEMORY_RESOURCE;\r
+\r
+typedef struct {\r
+ UINT64 FileSize;\r
+ UINT64 DownloadedNbOfBytes;\r
+ UINT64 LastReportedNbOfBytes;\r
+} BDS_TFTP_CONTEXT;\r
+\r
+EFI_STATUS\r
+BdsLoadImage (\r
+ IN EFI_DEVICE_PATH *DevicePath,\r
+ IN EFI_ALLOCATE_TYPE Type,\r
+ IN OUT EFI_PHYSICAL_ADDRESS* Image,\r
+ OUT UINTN *FileSize\r
+ );\r
+\r
+#endif\r