+++ /dev/null
-/** @file\r
- Produces the Legacy Region Protocol.\r
-\r
- This generic implementation of the Legacy Region Protocol does not actually\r
- perform any lock/unlock operations. This module may be used on platforms\r
- that do not provide HW locking of the legacy memory regions. It can also\r
- be used as a template driver for implementing the Legacy Region Protocol on\r
- a platform that does support HW locking of the legacy memory regions.\r
-\r
-Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
-SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-#include <PiDxe.h>\r
-#include <Protocol/LegacyRegion.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-\r
-/**\r
- Sets hardware to decode or not decode a region.\r
-\r
- @param This Indicates the EFI_LEGACY_REGION_PROTOCOL instance\r
- @param Start Start of region to decode.\r
- @param Length Size in bytes of the region.\r
- @param On Decode/nondecode flag.\r
-\r
- @retval EFI_SUCCESS Decode range successfully changed.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-LegacyRegionDecode (\r
- IN EFI_LEGACY_REGION_PROTOCOL *This,\r
- IN UINT32 Start,\r
- IN UINT32 Length,\r
- IN BOOLEAN *On\r
- )\r
-{\r
- return EFI_SUCCESS;\r
-}\r
-\r
-/**\r
- Sets a region to read only.\r
-\r
- @param This Indicates the EFI_LEGACY_REGION_PROTOCOL instance\r
- @param Start Start of region to lock.\r
- @param Length Size in bytes of the region.\r
- @param Granularity Lock attribute affects this granularity in bytes.\r
-\r
- @retval EFI_SUCCESS The region was made read only.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-LegacyRegionLock (\r
- IN EFI_LEGACY_REGION_PROTOCOL *This,\r
- IN UINT32 Start,\r
- IN UINT32 Length,\r
- OUT UINT32 *Granularity OPTIONAL\r
- )\r
-{\r
- return EFI_SUCCESS;\r
-}\r
-\r
-/**\r
- Sets a region to read only and ensures that flash is locked from being\r
- inadvertently modified.\r
-\r
- @param This Indicates the EFI_LEGACY_REGION_PROTOCOL instance\r
- @param Start Start of region to lock.\r
- @param Length Size in bytes of the region.\r
- @param Granularity Lock attribute affects this granularity in bytes.\r
-\r
- @retval EFI_SUCCESS The region was made read only and flash is locked.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-LegacyRegionBootLock (\r
- IN EFI_LEGACY_REGION_PROTOCOL *This,\r
- IN UINT32 Start,\r
- IN UINT32 Length,\r
- OUT UINT32 *Granularity OPTIONAL\r
- )\r
-{\r
- return EFI_SUCCESS;\r
-}\r
-\r
-/**\r
- Sets a region to read-write.\r
-\r
- @param This Indicates the EFI_LEGACY_REGION_PROTOCOL instance\r
- @param Start Start of region to lock.\r
- @param Length Size in bytes of the region.\r
- @param Granularity Lock attribute affects this granularity in bytes.\r
-\r
- @retval EFI_SUCCESS The region was successfully made read-write.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-LegacyRegionUnlock (\r
- IN EFI_LEGACY_REGION_PROTOCOL *This,\r
- IN UINT32 Start,\r
- IN UINT32 Length,\r
- OUT UINT32 *Granularity OPTIONAL\r
- )\r
-{\r
- return EFI_SUCCESS;\r
-}\r
-\r
-//\r
-// Module global for the handle the Legacy Region Protocol is installed\r
-//\r
-EFI_HANDLE mLegacyRegionHandle = NULL;\r
-\r
-//\r
-// Module global for the Legacy Region Protocol instance that is installed onto\r
-// mLegacyRegionHandle\r
-//\r
-EFI_LEGACY_REGION_PROTOCOL mLegacyRegion = {\r
- LegacyRegionDecode,\r
- LegacyRegionLock,\r
- LegacyRegionBootLock,\r
- LegacyRegionUnlock\r
-};\r
-\r
-/**\r
- The user Entry Point for module LegacyRegionDxe. The user code starts with this function.\r
-\r
- @param[in] ImageHandle The firmware allocated handle for the EFI image.\r
- @param[in] SystemTable A pointer to the EFI System Table.\r
-\r
- @retval EFI_SUCCESS The entry point is executed successfully.\r
- @retval other Some error occurs when executing this entry point.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-LegacyRegionInstall (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
- )\r
-{\r
- EFI_STATUS Status;\r
-\r
- //\r
- // Make sure the Legacy Region Protocol is not already installed in the system\r
- //\r
- ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiLegacyRegionProtocolGuid);\r
-\r
- //\r
- // Install the protocol on a new handle.\r
- //\r
- Status = gBS->InstallMultipleProtocolInterfaces (\r
- &mLegacyRegionHandle,\r
- &gEfiLegacyRegionProtocolGuid, &mLegacyRegion,\r
- NULL\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- return Status;\r
-}\r