From af1a266670d040d2f4083ff309d732d648afba2a Mon Sep 17 00:00:00 2001 From: Angelos Mouzakitis Date: Tue, 10 Oct 2023 14:33:42 +0000 Subject: Add submodule dependency files Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec --- .../DxeFileExplorerProtocol.c | 87 ++++++++++++++++++++++ .../DxeFileExplorerProtocol.inf | 36 +++++++++ .../DxeFileExplorerProtocol.uni | 15 ++++ 3 files changed, 138 insertions(+) create mode 100644 roms/edk2/MdeModulePkg/Library/DxeFileExplorerProtocol/DxeFileExplorerProtocol.c create mode 100644 roms/edk2/MdeModulePkg/Library/DxeFileExplorerProtocol/DxeFileExplorerProtocol.inf create mode 100644 roms/edk2/MdeModulePkg/Library/DxeFileExplorerProtocol/DxeFileExplorerProtocol.uni (limited to 'roms/edk2/MdeModulePkg/Library/DxeFileExplorerProtocol') diff --git a/roms/edk2/MdeModulePkg/Library/DxeFileExplorerProtocol/DxeFileExplorerProtocol.c b/roms/edk2/MdeModulePkg/Library/DxeFileExplorerProtocol/DxeFileExplorerProtocol.c new file mode 100644 index 000000000..2a7837a00 --- /dev/null +++ b/roms/edk2/MdeModulePkg/Library/DxeFileExplorerProtocol/DxeFileExplorerProtocol.c @@ -0,0 +1,87 @@ +/** @file + Instance of file explorer Library based on gEfiFileExplorerProtocolGuid. + + Implement the file explorer library instance by wrap the interface + provided in the file explorer protocol. This protocol is defined as the internal + protocol related to this implementation, not in the public spec. So, this + library instance is only for this code base. + +Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include + +#include + +#include +#include + +EFI_FILE_EXPLORER_PROTOCOL *mProtocol = NULL; + +/** + The constructor function caches the pointer to file explorer protocol. + + The constructor function locates Print2 protocol from protocol database. + It will ASSERT() if that operation fails and it will always return EFI_SUCCESS. + + @param ImageHandle The firmware allocated handle for the EFI image. + @param SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. + +**/ +EFI_STATUS +EFIAPI +FileExplorerConstructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + Status = SystemTable->BootServices->LocateProtocol ( + &gEfiFileExplorerProtocolGuid, + NULL, + (VOID**) &mProtocol + ); + ASSERT_EFI_ERROR (Status); + ASSERT (mProtocol != NULL); + + return Status; +} + +/** + Choose a file in the specified directory. + + If user input NULL for the RootDirectory, will choose file in the system. + + If user input *File != NULL, function will return the allocate device path + info for the choosed file, caller has to free the memory after use it. + + @param RootDirectory Pointer to the root directory. + @param FileType The file type need to choose. + @param ChooseHandler Function pointer to the extra task need to do + after choose one file. + @param File Return the device path for the last time chosed file. + + @retval EFI_SUCESS Choose file success. + @retval EFI_INVALID_PARAMETER Both ChooseHandler and return device path are NULL + One of them must not NULL. + @retval Other errors Choose file failed. +**/ +EFI_STATUS +EFIAPI +ChooseFile ( + IN EFI_DEVICE_PATH_PROTOCOL *RootDirectory, + IN CHAR16 *FileType, OPTIONAL + IN CHOOSE_HANDLER ChooseHandler, OPTIONAL + OUT EFI_DEVICE_PATH_PROTOCOL **File OPTIONAL + ) +{ + return mProtocol->ChooseFile (RootDirectory, FileType, ChooseHandler, File); +} + diff --git a/roms/edk2/MdeModulePkg/Library/DxeFileExplorerProtocol/DxeFileExplorerProtocol.inf b/roms/edk2/MdeModulePkg/Library/DxeFileExplorerProtocol/DxeFileExplorerProtocol.inf new file mode 100644 index 000000000..ddaefca1a --- /dev/null +++ b/roms/edk2/MdeModulePkg/Library/DxeFileExplorerProtocol/DxeFileExplorerProtocol.inf @@ -0,0 +1,36 @@ +## @file +# Library instance that implements File explorer Library class based on protocol gEfiFileExplorerProtocolGuid. +# +# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = DxeFileExplorerProtocol + MODULE_UNI_FILE = DxeFileExplorerProtocol.uni + FILE_GUID = 6806C45F-13C4-4274-B8A3-055EF641A060 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = FileExplorerLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER + CONSTRUCTOR = FileExplorerConstructor + +[Sources] + DxeFileExplorerProtocol.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + +[LibraryClasses] + BaseLib + DebugLib + +[Protocols] + gEfiFileExplorerProtocolGuid ## CONSUMES + +[Depex.common.DXE_DRIVER, Depex.common.DXE_RUNTIME_DRIVER, Depex.common.DXE_SAL_DRIVER, Depex.common.DXE_SMM_DRIVER] + gEfiFileExplorerProtocolGuid diff --git a/roms/edk2/MdeModulePkg/Library/DxeFileExplorerProtocol/DxeFileExplorerProtocol.uni b/roms/edk2/MdeModulePkg/Library/DxeFileExplorerProtocol/DxeFileExplorerProtocol.uni new file mode 100644 index 000000000..762a0a7f3 --- /dev/null +++ b/roms/edk2/MdeModulePkg/Library/DxeFileExplorerProtocol/DxeFileExplorerProtocol.uni @@ -0,0 +1,15 @@ +// /** @file +// Library instance that implements File explorer Library class based on protocol gEfiFileExplorerProtocolGuid. +// +// +// Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.
+// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// **/ + + +#string STR_MODULE_ABSTRACT #language en-US "Implements File explorer Library class based on protocol gEfiFileExplorerProtocolGuid" + +#string STR_MODULE_DESCRIPTION #language en-US "Library instance that implements File explorer Library class based on protocol gEfiFileExplorerProtocolGuid." + -- cgit