mirror of
				https://gitlab.com/qemu-project/edk2.git
				synced 2025-10-30 07:56:39 +08:00 
			
		
		
		
	EmbeddedPkg: Retire EfiResetSystemLib and ResetRuntimeDxe
Retire the ancient reset runtime DXE in EmbeddedPkg, and the associated EfiResetSystemLib library class and template implementation. These are incomplete and have been superseded by a generic implementation in MdeModulePkg. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
This commit is contained in:
		 Ard Biesheuvel
					Ard Biesheuvel
				
			
				
					committed by
					
						![mergify[bot]](/assets/img/avatar_default.png) mergify[bot]
						mergify[bot]
					
				
			
			
				
	
			
			
			![mergify[bot]](/assets/img/avatar_default.png) mergify[bot]
						mergify[bot]
					
				
			
						parent
						
							f9b021f84f
						
					
				
				
					commit
					02f7ecbbb2
				
			| @ -33,7 +33,6 @@ | ||||
| [LibraryClasses.common] | ||||
|   PrePiLib|Include/Library/PrePiLib.h | ||||
|   RealTimeClockLib|Include/Library/RealTimeClockLib.h | ||||
|   EfiResetSystemLib|Include/Library/EfiResetSystemLib.h | ||||
|   GdbSerialLib|Include/Library/GdbSerialLib.h | ||||
|   DebugAgentTimerLib|Include/Library/DebugAgentTimerLib.h | ||||
|   NorFlashInfoLib|Include/Library/NorFlashInfoLib.h | ||||
|  | ||||
| @ -66,7 +66,6 @@ | ||||
|  | ||||
|   SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf | ||||
|   RealTimeClockLib|EmbeddedPkg/Library/TemplateRealTimeClockLib/TemplateRealTimeClockLib.inf | ||||
|   EfiResetSystemLib|EmbeddedPkg/Library/TemplateResetSystemLib/TemplateResetSystemLib.inf | ||||
|   GdbSerialLib|EmbeddedPkg/Library/GdbSerialLib/GdbSerialLib.inf | ||||
|  | ||||
|  | ||||
| @ -211,7 +210,6 @@ | ||||
|   EmbeddedPkg/Library/GdbSerialLib/GdbSerialLib.inf | ||||
|   EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf | ||||
|   EmbeddedPkg/Library/PrePiLib/PrePiLib.inf | ||||
|   EmbeddedPkg/Library/TemplateResetSystemLib/TemplateResetSystemLib.inf | ||||
|   EmbeddedPkg/Library/TemplateRealTimeClockLib/TemplateRealTimeClockLib.inf | ||||
|   EmbeddedPkg/Library/CoherentDmaLib/CoherentDmaLib.inf | ||||
|   EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.inf | ||||
| @ -220,7 +218,6 @@ | ||||
|  | ||||
|   EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf | ||||
|   EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf | ||||
|   EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf | ||||
|   EmbeddedPkg/SimpleTextInOutSerial/SimpleTextInOutSerial.inf | ||||
|   EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf { | ||||
|     <LibraryClasses> | ||||
|  | ||||
| @ -1,48 +0,0 @@ | ||||
| /** @file | ||||
|  | ||||
|   Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR> | ||||
|  | ||||
|   SPDX-License-Identifier: BSD-2-Clause-Patent | ||||
|  | ||||
| **/ | ||||
|  | ||||
| #ifndef __EFI_RESET_SYSTEM_LIB_H___ | ||||
| #define __EFI_RESET_SYSTEM_LIB_H___ | ||||
|  | ||||
| /** | ||||
|   Resets the entire platform. | ||||
|  | ||||
|   @param  ResetType             The type of reset to perform. | ||||
|   @param  ResetStatus           The status code for the reset. | ||||
|   @param  DataSize              The size, in bytes, of WatchdogData. | ||||
|   @param  ResetData             For a ResetType of EfiResetCold, EfiResetWarm, or | ||||
|                                 EfiResetShutdown the data buffer starts with a Null-terminated | ||||
|                                 Unicode string, optionally followed by additional binary data. | ||||
|  | ||||
| **/ | ||||
| EFI_STATUS | ||||
| EFIAPI | ||||
| LibResetSystem ( | ||||
|   IN EFI_RESET_TYPE  ResetType, | ||||
|   IN EFI_STATUS      ResetStatus, | ||||
|   IN UINTN           DataSize, | ||||
|   IN CHAR16          *ResetData OPTIONAL | ||||
|   ); | ||||
|  | ||||
| /** | ||||
|   Initialize any infrastructure required for LibResetSystem () to function. | ||||
|  | ||||
|   @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 | ||||
| LibInitializeResetSystem ( | ||||
|   IN EFI_HANDLE        ImageHandle, | ||||
|   IN EFI_SYSTEM_TABLE  *SystemTable | ||||
|   ); | ||||
|  | ||||
| #endif | ||||
| @ -1,91 +0,0 @@ | ||||
| /** @file | ||||
|   Template library implementation to support ResetSystem Runtime call. | ||||
|  | ||||
|   Fill in the templates with what ever makes you system reset. | ||||
|  | ||||
|  | ||||
|   Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR> | ||||
|  | ||||
|   SPDX-License-Identifier: BSD-2-Clause-Patent | ||||
|  | ||||
| **/ | ||||
|  | ||||
| #include <PiDxe.h> | ||||
|  | ||||
| #include <Library/BaseLib.h> | ||||
| #include <Library/IoLib.h> | ||||
| #include <Library/EfiResetSystemLib.h> | ||||
|  | ||||
| /** | ||||
|   Resets the entire platform. | ||||
|  | ||||
|   @param  ResetType             The type of reset to perform. | ||||
|   @param  ResetStatus           The status code for the reset. | ||||
|   @param  DataSize              The size, in bytes, of WatchdogData. | ||||
|   @param  ResetData             For a ResetType of EfiResetCold, EfiResetWarm, or | ||||
|                                 EfiResetShutdown the data buffer starts with a Null-terminated | ||||
|                                 Unicode string, optionally followed by additional binary data. | ||||
|  | ||||
| **/ | ||||
| EFI_STATUS | ||||
| EFIAPI | ||||
| LibResetSystem ( | ||||
|   IN EFI_RESET_TYPE  ResetType, | ||||
|   IN EFI_STATUS      ResetStatus, | ||||
|   IN UINTN           DataSize, | ||||
|   IN CHAR16          *ResetData OPTIONAL | ||||
|   ) | ||||
| { | ||||
|   UINTN  Address; | ||||
|   UINT8  Data; | ||||
|  | ||||
|   switch (ResetType) { | ||||
|     case EfiResetCold: | ||||
|       // system power cycle | ||||
|  | ||||
|       // Example using IoLib functions to do IO. | ||||
|       Address = 0x12345678; | ||||
|       Data    = MmioRead8 (Address); | ||||
|       MmioWrite8 (Address, Data | 0x01); | ||||
|  | ||||
|       // Note this is a bad example asa MmioOr8 (Address, 0x01) does the same thing | ||||
|       break; | ||||
|  | ||||
|     case EfiResetWarm: | ||||
|       // not a full power cycle, maybe memory stays around. | ||||
|       // if not support do the same thing as EfiResetCold. | ||||
|       break; | ||||
|  | ||||
|     case EfiResetShutdown: | ||||
|       // turn off the system. | ||||
|       // if not support do the same thing as EfiResetCold. | ||||
|       break; | ||||
|  | ||||
|     default: | ||||
|       return EFI_INVALID_PARAMETER; | ||||
|   } | ||||
|  | ||||
|   // | ||||
|   // If we reset, we would not have returned... | ||||
|   // | ||||
|   return EFI_DEVICE_ERROR; | ||||
| } | ||||
|  | ||||
| /** | ||||
|   Initialize any infrastructure required for LibResetSystem () to function. | ||||
|  | ||||
|   @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 | ||||
| LibInitializeResetSystem ( | ||||
|   IN EFI_HANDLE        ImageHandle, | ||||
|   IN EFI_SYSTEM_TABLE  *SystemTable | ||||
|   ) | ||||
| { | ||||
|   return EFI_SUCCESS; | ||||
| } | ||||
| @ -1,30 +0,0 @@ | ||||
| #/** @file | ||||
| # Memory Status Code Library for UEFI drivers | ||||
| # | ||||
| # Lib to provide memory journal status code reporting Routines | ||||
| # Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> | ||||
| # | ||||
| #  SPDX-License-Identifier: BSD-2-Clause-Patent | ||||
| # | ||||
| # | ||||
| #**/ | ||||
|  | ||||
| [Defines] | ||||
|   INF_VERSION                    = 0x00010005 | ||||
|   BASE_NAME                      = TemplateResetSystemLib | ||||
|   FILE_GUID                      = 40BAFDE5-4CC8-4FBE-A8BA-071890076E50 | ||||
|   MODULE_TYPE                    = BASE | ||||
|   VERSION_STRING                 = 1.0 | ||||
|   LIBRARY_CLASS                  = EfiResetSystemLib | ||||
|  | ||||
|  | ||||
| [Sources.common] | ||||
|   ResetSystemLib.c | ||||
|  | ||||
| [Packages] | ||||
|   MdePkg/MdePkg.dec | ||||
|   EmbeddedPkg/EmbeddedPkg.dec | ||||
|  | ||||
| [LibraryClasses] | ||||
|   IoLib | ||||
|   DebugLib | ||||
| @ -1,45 +0,0 @@ | ||||
| #/** @file | ||||
| # Reset Architectural Protocol Driver as defined in PI | ||||
| # | ||||
| # This Reset module simulates system reset by process exit on NT. | ||||
| # Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved.<BR> | ||||
| # | ||||
| #  SPDX-License-Identifier: BSD-2-Clause-Patent | ||||
| # | ||||
| # | ||||
| #**/ | ||||
|  | ||||
| [Defines] | ||||
|   INF_VERSION                    = 0x00010005 | ||||
|   BASE_NAME                      = Reset | ||||
|   FILE_GUID                      = 16036A73-E8EF-46D0-953C-9B8E96527D13 | ||||
|   MODULE_TYPE                    = DXE_RUNTIME_DRIVER | ||||
|   VERSION_STRING                 = 1.0 | ||||
|  | ||||
|   ENTRY_POINT                    = InitializeReset | ||||
|  | ||||
| # | ||||
| # The following information is for reference only and not required by the build tools. | ||||
| # | ||||
| #  VALID_ARCHITECTURES           = IA32 | ||||
| # | ||||
|  | ||||
| [Sources.common] | ||||
|   reset.c | ||||
|  | ||||
| [Packages] | ||||
|   MdePkg/MdePkg.dec | ||||
|   EmbeddedPkg/EmbeddedPkg.dec | ||||
|  | ||||
| [LibraryClasses] | ||||
|   UefiBootServicesTableLib | ||||
|   UefiDriverEntryPoint | ||||
|   DebugLib | ||||
|   EfiResetSystemLib | ||||
|  | ||||
| [Protocols] | ||||
|   gEfiResetArchProtocolGuid                     # PROTOCOL ALWAYS_PRODUCED | ||||
|  | ||||
| [Depex] | ||||
|   TRUE | ||||
|  | ||||
| @ -1,64 +0,0 @@ | ||||
| /** @file | ||||
|  | ||||
|   Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR> | ||||
|  | ||||
|   SPDX-License-Identifier: BSD-2-Clause-Patent | ||||
|  | ||||
| **/ | ||||
|  | ||||
| #include <PiDxe.h> | ||||
| #include <Protocol/Reset.h> | ||||
| #include <Library/DebugLib.h> | ||||
| #include <Library/UefiDriverEntryPoint.h> | ||||
| #include <Library/UefiBootServicesTableLib.h> | ||||
| #include <Library/EfiResetSystemLib.h> | ||||
|  | ||||
| /** | ||||
|   Resets the entire platform. | ||||
|  | ||||
|   @param  ResetType             The type of reset to perform. | ||||
|   @param  ResetStatus           The status code for the reset. | ||||
|   @param  DataSize              The size, in bytes, of WatchdogData. | ||||
|   @param  ResetData             For a ResetType of EfiResetCold, EfiResetWarm, or | ||||
|                                 EfiResetShutdown the data buffer starts with a Null-terminated | ||||
|                                 Unicode string, optionally followed by additional binary data. | ||||
|  | ||||
| **/ | ||||
| VOID | ||||
| EFIAPI | ||||
| ResetSystemViaLib ( | ||||
|   IN EFI_RESET_TYPE  ResetType, | ||||
|   IN EFI_STATUS      ResetStatus, | ||||
|   IN UINTN           DataSize, | ||||
|   IN VOID            *ResetData OPTIONAL | ||||
|   ) | ||||
| { | ||||
|   LibResetSystem (ResetType, ResetStatus, DataSize, ResetData); | ||||
|   return; | ||||
| } | ||||
|  | ||||
| EFI_STATUS | ||||
| EFIAPI | ||||
| InitializeReset ( | ||||
|   IN EFI_HANDLE        ImageHandle, | ||||
|   IN EFI_SYSTEM_TABLE  *SystemTable | ||||
|   ) | ||||
| { | ||||
|   EFI_STATUS  Status; | ||||
|   EFI_HANDLE  Handle; | ||||
|  | ||||
|   LibInitializeResetSystem (ImageHandle, SystemTable); | ||||
|  | ||||
|   SystemTable->RuntimeServices->ResetSystem = ResetSystemViaLib; | ||||
|  | ||||
|   Handle = NULL; | ||||
|   Status = gBS->InstallMultipleProtocolInterfaces ( | ||||
|                   &Handle, | ||||
|                   &gEfiResetArchProtocolGuid, | ||||
|                   NULL, | ||||
|                   NULL | ||||
|                   ); | ||||
|   ASSERT_EFI_ERROR (Status); | ||||
|  | ||||
|   return Status; | ||||
| } | ||||
		Reference in New Issue
	
	Block a user