Changes for V4 ============== 1) Remove Unicode character from C source file 2) Move delete of QuarkSocPkg\QuarkNorthCluster\Binary\QuarkMicrocode from QuarkPlatformPkg commit to QuarkSocPkg commit Changes for V2 ============== 1) Sync with new APIs in SmmCpuFeaturesLib class 2) Use new generic PCI serial driver PciSioSerialDxe in MdeModulePkg 3) Remove PCI serial driver from QuarkSocPkg 4) Apply optimizations to MtrrLib from MtrrLib in UefiCpuPkg 5) Convert all UNI files to utf-8 6) Replace tabs with spaces and remove trailing spaces 7) Add License.txt Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Michael Kinney <michael.d.kinney@intel.com> Acked-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19286 6f19259b-4bc3-4df7-8a09-765794883524
205 lines
9.1 KiB
C
205 lines
9.1 KiB
C
/** @file
|
|
The header file legacy region initialization in QNC DXE component.
|
|
|
|
Copyright (c) 2013-2015 Intel Corporation.
|
|
|
|
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 _LEGACY_REGION_H_
|
|
#define _LEGACY_REGION_H_
|
|
#include "CommonHeader.h"
|
|
|
|
#include <IndustryStandard/Pci.h>
|
|
|
|
#define LEGACY_REGION_INSTANCE_SIGNATURE SIGNATURE_32('R','E','G','N')
|
|
|
|
typedef struct {
|
|
UINT32 Signature;
|
|
|
|
EFI_HANDLE Handle;
|
|
EFI_LEGACY_REGION2_PROTOCOL LegacyRegion2;
|
|
EFI_HANDLE ImageHandle;
|
|
|
|
//
|
|
// Protocol for PAM register access
|
|
//
|
|
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
|
|
} LEGACY_REGION_INSTANCE;
|
|
|
|
#define LEGACY_REGION_INSTANCE_FROM_THIS(this) \
|
|
CR(this, LEGACY_REGION_INSTANCE, LegacyRegion2, LEGACY_REGION_INSTANCE_SIGNATURE)
|
|
|
|
|
|
EFI_STATUS
|
|
LegacyRegionManipluateRegion (
|
|
IN LEGACY_REGION_INSTANCE *Private
|
|
);
|
|
|
|
EFI_STATUS
|
|
LegacyRegionInit (
|
|
VOID
|
|
);
|
|
|
|
/**
|
|
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).
|
|
|
|
@param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL instance.
|
|
@param Start[in] The beginning of the physical address of the region whose attributes
|
|
should be modified.
|
|
@param 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.
|
|
@param 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.
|
|
@param On[in] Decode / Non-Decode flag.
|
|
|
|
@retval EFI_SUCCESS The region's attributes were successfully modified.
|
|
@retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
|
|
|
|
**/
|
|
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 disallow memory writes in a region.
|
|
|
|
This function changes the attributes of a memory range to not allow writes.
|
|
|
|
@param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL instance.
|
|
@param Start[in] The beginning of the physical address of the region whose
|
|
attributes should be modified.
|
|
@param 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.
|
|
@param 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.
|
|
|
|
@retval EFI_SUCCESS The region's attributes were successfully modified.
|
|
@retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
|
|
|
|
**/
|
|
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 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.
|
|
|
|
@param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL instance.
|
|
@param Start[in] The beginning of the physical address of the region whose
|
|
attributes should be modified.
|
|
@param 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.
|
|
@param 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.
|
|
|
|
@retval EFI_SUCCESS The region's attributes were successfully modified.
|
|
@retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
|
|
@retval EFI_UNSUPPORTED The chipset does not support locking the configuration registers in
|
|
a way that will not affect memory regions outside the legacy memory
|
|
region.
|
|
|
|
**/
|
|
EFI_STATUS
|
|
EFIAPI
|
|
LegacyRegion2BootLock (
|
|
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.
|
|
|
|
@param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL instance.
|
|
@param Start[in] The beginning of the physical address of the region whose
|
|
attributes should be modified.
|
|
@param 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.
|
|
@param 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.
|
|
|
|
@retval EFI_SUCCESS The region's attributes were successfully modified.
|
|
@retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
|
|
|
|
**/
|
|
EFI_STATUS
|
|
EFIAPI
|
|
LegacyRegion2Unlock (
|
|
IN EFI_LEGACY_REGION2_PROTOCOL *This,
|
|
IN UINT32 Start,
|
|
IN UINT32 Length,
|
|
OUT UINT32 *Granularity
|
|
);
|
|
|
|
/**
|
|
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.
|
|
|
|
@param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL instance.
|
|
@param DescriptorCount[out] The number of region descriptor entries returned in the Descriptor
|
|
buffer.
|
|
@param 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.
|
|
|
|
@retval EFI_SUCCESS The region's attributes were successfully modified.
|
|
@retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.
|
|
|
|
**/
|
|
EFI_STATUS
|
|
EFIAPI
|
|
LegacyRegionGetInfo (
|
|
IN EFI_LEGACY_REGION2_PROTOCOL *This,
|
|
OUT UINT32 *DescriptorCount,
|
|
OUT EFI_LEGACY_REGION_DESCRIPTOR **Descriptor
|
|
);
|
|
|
|
#endif //_QNC_LEGACY_REGION_H_
|