TianoCore EDK2 master
Loading...
Searching...
No Matches
LegacyRegion2.c File Reference
#include <LegacyRegion2.h>

Go to the source code of this file.

Functions

EFI_STATUS EFIAPI LegacyRegion2Decode (IN EFI_LEGACY_REGION2_PROTOCOL *This, IN UINT32 Start, IN UINT32 Length, OUT UINT32 *Granularity, IN BOOLEAN *On)
 
EFI_STATUS EFIAPI LegacyRegion2Lock (IN EFI_LEGACY_REGION2_PROTOCOL *This, IN UINT32 Start, IN UINT32 Length, OUT UINT32 *Granularity)
 
EFI_STATUS EFIAPI LegacyRegion2BootLock (IN EFI_LEGACY_REGION2_PROTOCOL *This, IN UINT32 Start, IN UINT32 Length, OUT UINT32 *Granularity)
 
EFI_STATUS EFIAPI LegacyRegion2Unlock (IN EFI_LEGACY_REGION2_PROTOCOL *This, IN UINT32 Start, IN UINT32 Length, OUT UINT32 *Granularity)
 
EFI_STATUS EFIAPI LegacyRegionGetInfo (IN EFI_LEGACY_REGION2_PROTOCOL *This, OUT UINT32 *DescriptorCount, OUT EFI_LEGACY_REGION_DESCRIPTOR **Descriptor)
 
EFI_STATUS EFIAPI LegacyRegion2Install (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 

Variables

EFI_HANDLE mLegacyRegion2Handle = NULL
 
EFI_LEGACY_REGION2_PROTOCOL mLegacyRegion2
 

Detailed Description

Dummy implementation of Legacy Region 2 Protocol.

This generic implementation of the Legacy Region 2 Protocol does not actually perform any lock/unlock operations. This module may be used on platforms that do not provide HW locking of the legacy memory regions. It can also be used as a template driver for implementing the Legacy Region 2 Protocol on a platform that does support HW locking of the legacy memory regions.

Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file LegacyRegion2.c.

Function Documentation

◆ LegacyRegion2BootLock()

EFI_STATUS EFIAPI LegacyRegion2BootLock ( IN EFI_LEGACY_REGION2_PROTOCOL This,
IN UINT32  Start,
IN UINT32  Length,
OUT UINT32 *  Granularity 
)

Modify the hardware to disallow memory attribute changes in a region.

This function makes the attributes of a region read only. Once a region is boot-locked with this function, the read and write attributes of that region cannot be changed until a power cycle has reset the boot-lock attribute. Calls to Decode(), Lock() and Unlock() will have no effect.

Parameters
This[in]Indicates the EFI_LEGACY_REGION_PROTOCOL instance.
Start[in]The beginning of the physical address of the region whose attributes should be modified.
Length[in]The number of bytes of memory whose attributes should be modified. The actual number of bytes modified may be greater than the number specified.
Granularity[out]The number of bytes in the last region affected. This may be less than the total number of bytes affected if the starting address was not aligned to a region's starting address or if the length was greater than the number of bytes in the first region.
Return values
EFI_SUCCESSThe region's attributes were successfully modified.
EFI_INVALID_PARAMETERIf Start or Length describe an address not in the Legacy Region.
EFI_UNSUPPORTEDThe chipset does not support locking the configuration registers in a way that will not affect memory regions outside the legacy memory region.

Definition at line 135 of file LegacyRegion2.c.

◆ LegacyRegion2Decode()

EFI_STATUS EFIAPI LegacyRegion2Decode ( IN EFI_LEGACY_REGION2_PROTOCOL This,
IN UINT32  Start,
IN UINT32  Length,
OUT UINT32 *  Granularity,
IN BOOLEAN *  On 
)

Modify the hardware to allow (decode) or disallow (not decode) memory reads in a region.

If the On parameter evaluates to TRUE, this function enables memory reads in the address range Start to (Start + Length - 1). If the On parameter evaluates to FALSE, this function disables memory reads in the address range Start to (Start + Length - 1).

Parameters
This[in]Indicates the EFI_LEGACY_REGION_PROTOCOL instance.
Start[in]The beginning of the physical address of the region whose attributes should be modified.
Length[in]The number of bytes of memory whose attributes should be modified. The actual number of bytes modified may be greater than the number specified.
Granularity[out]The number of bytes in the last region affected. This may be less than the total number of bytes affected if the starting address was not aligned to a region's starting address or if the length was greater than the number of bytes in the first region.
On[in]Decode / Non-Decode flag.
Return values
EFI_SUCCESSThe region's attributes were successfully modified.
EFI_INVALID_PARAMETERIf Start or Length describe an address not in the Legacy Region.

Definition at line 53 of file LegacyRegion2.c.

◆ LegacyRegion2Install()

EFI_STATUS EFIAPI LegacyRegion2Install ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

The user Entry Point for module LegacyRegionDxe. The user code starts with this function.

Parameters
[in]ImageHandleThe firmware allocated handle for the EFI image.
[in]SystemTableA pointer to the EFI System Table.
Return values
EFI_SUCCESSThe entry point is executed successfully.

Definition at line 228 of file LegacyRegion2.c.

◆ LegacyRegion2Lock()

EFI_STATUS EFIAPI LegacyRegion2Lock ( IN EFI_LEGACY_REGION2_PROTOCOL This,
IN UINT32  Start,
IN UINT32  Length,
OUT UINT32 *  Granularity 
)

Modify the hardware to disallow memory writes in a region.

This function changes the attributes of a memory range to not allow writes.

Parameters
This[in]Indicates the EFI_LEGACY_REGION_PROTOCOL instance.
Start[in]The beginning of the physical address of the region whose attributes should be modified.
Length[in]The number of bytes of memory whose attributes should be modified. The actual number of bytes modified may be greater than the number specified.
Granularity[out]The number of bytes in the last region affected. This may be less than the total number of bytes affected if the starting address was not aligned to a region's starting address or if the length was greater than the number of bytes in the first region.
Return values
EFI_SUCCESSThe region's attributes were successfully modified.
EFI_INVALID_PARAMETERIf Start or Length describe an address not in the Legacy Region.

Definition at line 92 of file LegacyRegion2.c.

◆ LegacyRegion2Unlock()

EFI_STATUS EFIAPI LegacyRegion2Unlock ( IN EFI_LEGACY_REGION2_PROTOCOL This,
IN UINT32  Start,
IN UINT32  Length,
OUT UINT32 *  Granularity 
)

Modify the hardware to allow memory writes in a region.

This function changes the attributes of a memory range to allow writes.

Parameters
This[in]Indicates the EFI_LEGACY_REGION_PROTOCOL instance.
Start[in]The beginning of the physical address of the region whose attributes should be modified.
Length[in]The number of bytes of memory whose attributes should be modified. The actual number of bytes modified may be greater than the number specified.
Granularity[out]The number of bytes in the last region affected. This may be less than the total number of bytes affected if the starting address was not aligned to a region's starting address or if the length was greater than the number of bytes in the first region.
Return values
EFI_SUCCESSThe region's attributes were successfully modified.
EFI_INVALID_PARAMETERIf Start or Length describe an address not in the Legacy Region.

Definition at line 171 of file LegacyRegion2.c.

◆ LegacyRegionGetInfo()

EFI_STATUS EFIAPI LegacyRegionGetInfo ( IN EFI_LEGACY_REGION2_PROTOCOL This,
OUT UINT32 *  DescriptorCount,
OUT EFI_LEGACY_REGION_DESCRIPTOR **  Descriptor 
)

Get region information for the attributes of the Legacy Region.

This function is used to discover the granularity of the attributes for the memory in the legacy region. Each attribute may have a different granularity and the granularity may not be the same for all memory ranges in the legacy region.

Parameters
This[in]Indicates the EFI_LEGACY_REGION2_PROTOCOL instance.
DescriptorCount[out]The number of region descriptor entries returned in the Descriptor buffer.
Descriptor[out]A pointer to a pointer used to return a buffer where the legacy region information is deposited. This buffer will contain a list of DescriptorCount number of region descriptors. This function will provide the memory for the buffer.
Return values
EFI_SUCCESSThe information structure was returned.
EFI_UNSUPPORTEDThis function is not supported.

Definition at line 208 of file LegacyRegion2.c.

Variable Documentation

◆ mLegacyRegion2

Initial value:
= {
}
EFI_STATUS EFIAPI LegacyRegion2Lock(IN EFI_LEGACY_REGION2_PROTOCOL *This, IN UINT32 Start, IN UINT32 Length, OUT UINT32 *Granularity)
Definition: LegacyRegion2.c:92
EFI_STATUS EFIAPI LegacyRegion2Unlock(IN EFI_LEGACY_REGION2_PROTOCOL *This, IN UINT32 Start, IN UINT32 Length, OUT UINT32 *Granularity)
EFI_STATUS EFIAPI LegacyRegion2BootLock(IN EFI_LEGACY_REGION2_PROTOCOL *This, IN UINT32 Start, IN UINT32 Length, OUT UINT32 *Granularity)
EFI_STATUS EFIAPI LegacyRegionGetInfo(IN EFI_LEGACY_REGION2_PROTOCOL *This, OUT UINT32 *DescriptorCount, OUT EFI_LEGACY_REGION_DESCRIPTOR **Descriptor)
EFI_STATUS EFIAPI LegacyRegion2Decode(IN EFI_LEGACY_REGION2_PROTOCOL *This, IN UINT32 Start, IN UINT32 Length, OUT UINT32 *Granularity, IN BOOLEAN *On)
Definition: LegacyRegion2.c:53

Definition at line 19 of file LegacyRegion2.c.

◆ mLegacyRegion2Handle

EFI_HANDLE mLegacyRegion2Handle = NULL

Definition at line 17 of file LegacyRegion2.c.