summaryrefslogtreecommitdiff
path: root/Chipset/NB/SystemAgentWrap/LegacyRegion2
diff options
context:
space:
mode:
Diffstat (limited to 'Chipset/NB/SystemAgentWrap/LegacyRegion2')
-rw-r--r--Chipset/NB/SystemAgentWrap/LegacyRegion2/LegacyRegion2.c263
-rw-r--r--Chipset/NB/SystemAgentWrap/LegacyRegion2/LegacyRegion2.cif11
-rw-r--r--Chipset/NB/SystemAgentWrap/LegacyRegion2/LegacyRegion2.dxs51
-rw-r--r--Chipset/NB/SystemAgentWrap/LegacyRegion2/LegacyRegion2.mak44
-rw-r--r--Chipset/NB/SystemAgentWrap/LegacyRegion2/LegacyRegion2.sdl26
5 files changed, 395 insertions, 0 deletions
diff --git a/Chipset/NB/SystemAgentWrap/LegacyRegion2/LegacyRegion2.c b/Chipset/NB/SystemAgentWrap/LegacyRegion2/LegacyRegion2.c
new file mode 100644
index 0000000..3a5a8b4
--- /dev/null
+++ b/Chipset/NB/SystemAgentWrap/LegacyRegion2/LegacyRegion2.c
@@ -0,0 +1,263 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2012, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
+
+//*************************************************************************
+// $Header: /Alaska/BIN/Chipset/Intel/NorthBridge/Haswell/Intel SystemAgent NB Chipset/SystemAgentWrap/LegacyRegion2/LegacyRegion2.c 1 4/05/12 3:08a Yurenlai $
+//
+// $Date: 4/05/12 3:08a $
+//*************************************************************************
+// Revision History
+// ----------------
+// $Log:
+//
+//*************************************************************************
+//<AMI_FHDR_START>
+//
+// Name: LegacyRegion2.c
+//
+// Description: Legacy Region 2 functions implementation
+//
+//<AMI_FHDR_END>
+//*************************************************************************
+
+#include <efi.h>
+#include <AmiDxeLib.h>
+#include <AmiCspLib.h>
+#include <Protocol\LegacyRegion.h>
+#include <Protocol\LegacyRegion2.h>
+
+EFI_LEGACY_REGION_PROTOCOL *gLegacyRegionProtocol = NULL;
+
+//*************************************************************************
+//<AMI_PHDR_START>
+//
+// Procedure: LegacyRegionDecode
+//
+// Description: Program chipset to allow decoding of 0xc0000 - 0xfffff.
+//
+// Input:
+// IN EFI_LEGACY_REGION_PROTOCOL *This,
+// IN UINT32 Start,
+// IN UINT32 Length,
+// OUT UINT32 *Granularity,
+// IN BOOLEAN *On
+//
+// Output:
+// Status of the operation
+//
+//<AMI_PHDR_END>
+//*************************************************************************
+EFI_STATUS LegacyRegionDecode(
+ IN EFI_LEGACY_REGION2_PROTOCOL *This,
+ IN UINT32 Start,
+ IN UINT32 Length,
+ OUT UINT32 *Granularity,
+ IN BOOLEAN *On
+)
+{
+ return gLegacyRegionProtocol->Decode( gLegacyRegionProtocol, Start, Length, On);
+}
+
+//*************************************************************************
+//<AMI_PHDR_START>
+//
+// Procedure: LegacyRegionLock
+//
+// Description: To disallow writes to memory 0xc0000 - 0xfffff.
+//
+// Input:
+// IN EFI_LEGACY_REGION_PROTOCOL *This,
+// IN UINT32 Start,
+// IN UINT32 Length,
+// OUT UINT32 *Granularity OPTIONAL
+//
+// Output:
+// Status of the operation
+//
+//<AMI_PHDR_END>
+//*************************************************************************
+EFI_STATUS LegacyRegionLock(
+ IN EFI_LEGACY_REGION2_PROTOCOL *This,
+ IN UINT32 Start,
+ IN UINT32 Length,
+ OUT UINT32 *Granularity OPTIONAL
+)
+{
+ return gLegacyRegionProtocol->Lock( gLegacyRegionProtocol, Start, Length, Granularity);
+}
+
+//*************************************************************************
+//<AMI_PHDR_START>
+//
+// Procedure: LegacyRegionBootLock
+//
+// Description: To permanently disallow writes to memory 0xc0000 - 0xffff.
+//
+// Input:
+// IN EFI_LEGACY_REGION_PROTOCOL *This,
+// IN UINT32 Start,
+// IN UINT32 Length,
+// OUT UINT32 *Granularity OPTIONAL
+//
+// Output:
+// Status of the operation
+//
+//<AMI_PHDR_END>
+//*************************************************************************
+EFI_STATUS LegacyRegionBootLock(
+ IN EFI_LEGACY_REGION2_PROTOCOL *This,
+ IN UINT32 Start,
+ IN UINT32 Length,
+ OUT UINT32 *Granularity OPTIONAL
+)
+{
+ return gLegacyRegionProtocol->BootLock( gLegacyRegionProtocol, Start, Length, Granularity);
+}
+
+//*************************************************************************
+//<AMI_PHDR_START>
+//
+// Procedure: LegacyRegionUnlock
+//
+// Description: To allow read/write of memory 0xc0000-0xfffff.
+//
+// Input:
+// IN EFI_LEGACY_REGION_PROTOCOL *This,
+// IN UINT32 Start,
+// IN UINT32 Length,
+// OUT UINT32 *Granularity OPTIONAL
+//
+// Output:
+// Status of the operation
+//
+//<AMI_PHDR_END>
+//*************************************************************************
+EFI_STATUS LegacyRegionUnlock(
+ IN EFI_LEGACY_REGION2_PROTOCOL *This,
+ IN UINT32 Start,
+ IN UINT32 Length,
+ OUT UINT32 *Granularity OPTIONAL
+)
+{
+ return gLegacyRegionProtocol->UnLock(gLegacyRegionProtocol, Start, Length, Granularity);
+}
+
+//*************************************************************************
+//<AMI_PHDR_START>
+//
+// Procedure: GetLegacyRegionInfo
+//
+// Description:
+// 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.
+//
+// Input:
+// IN EFI_LEGACY_REGION_PROTOCOL *This
+// -- Indicates the EFI_LEGACY_REGION_PROTOCOL instance.
+//
+// Output:
+// EFI_UNSUPPORTED - This function is not supported
+// EFI_SUCCESS - The following information structure is returned:
+// OUT UINT32 *DescriptorCount
+// -- The number of region descriptor entries returned in the Descriptor
+// buffer. See EFI_LEGACY_REGION_DESCRIPTOR definition for reference.
+// OUT EFI_LEGACY_REGION_DESCRIPTOR **Descriptor
+// -- 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.
+//
+//<AMI_PHDR_END>
+//*************************************************************************
+EFI_STATUS GetLegacyRegionInfo(
+ IN EFI_LEGACY_REGION2_PROTOCOL *This,
+ OUT UINT32 *DescriptorCount,
+ OUT EFI_LEGACY_REGION_DESCRIPTOR **Descriptor
+)
+{
+ return EFI_UNSUPPORTED; // Note: to support this function there is a need
+ // to update NB template.
+}
+
+EFI_LEGACY_REGION2_PROTOCOL gLegacyRegion2Protocol =
+{
+ LegacyRegionDecode, LegacyRegionLock,
+ LegacyRegionBootLock, LegacyRegionUnlock,
+ GetLegacyRegionInfo
+};
+
+//*************************************************************************
+//<AMI_PHDR_START>
+//
+// Procedure: InitializeLegacyRegion2
+//
+// Description: Install the legacy region 2 protocol.
+//
+// Input:
+// IN EFI_HANDLE ImageHandle,
+// IN EFI_SYSTEM_TABLE *SystemTable
+//
+// Output:
+// Status of the operation
+//
+// Notes:
+// Here is the control flow of this function:
+// 1. Get root bridge io protocol.
+// 2. Install legacy region protocol.
+//
+//<AMI_PHDR_END>
+//*************************************************************************
+EFI_STATUS InitializeLegacyRegion2(
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ InitAmiLib(ImageHandle, SystemTable);
+
+ Status = pBS->LocateProtocol(
+ &gEfiLegacyRegionProtocolGuid,
+ NULL,
+ &gLegacyRegionProtocol);
+
+ if(!EFI_ERROR(Status)) {
+
+ Status = pBS->InstallProtocolInterface (
+ &ImageHandle,
+ &gEfiLegacyRegion2ProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &gLegacyRegion2Protocol
+ );
+ }
+
+ return Status;
+
+}
+
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2012, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
diff --git a/Chipset/NB/SystemAgentWrap/LegacyRegion2/LegacyRegion2.cif b/Chipset/NB/SystemAgentWrap/LegacyRegion2/LegacyRegion2.cif
new file mode 100644
index 0000000..429cfe6
--- /dev/null
+++ b/Chipset/NB/SystemAgentWrap/LegacyRegion2/LegacyRegion2.cif
@@ -0,0 +1,11 @@
+<component>
+ name = "LegacyRegion2"
+ category = ModulePart
+ LocalRoot = "Chipset\NB\SystemAgentWrap\LegacyRegion2\"
+ RefName = "LegacyRegion2"
+[files]
+"LegacyRegion2.sdl"
+"LegacyRegion2.mak"
+"LegacyRegion2.dxs"
+"LegacyRegion2.c"
+<endComponent>
diff --git a/Chipset/NB/SystemAgentWrap/LegacyRegion2/LegacyRegion2.dxs b/Chipset/NB/SystemAgentWrap/LegacyRegion2/LegacyRegion2.dxs
new file mode 100644
index 0000000..1e5b3e0
--- /dev/null
+++ b/Chipset/NB/SystemAgentWrap/LegacyRegion2/LegacyRegion2.dxs
@@ -0,0 +1,51 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2012, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
+
+//*************************************************************************
+// $Header: /Alaska/BIN/Chipset/Intel/NorthBridge/Haswell/Intel SystemAgent NB Chipset/SystemAgentWrap/LegacyRegion2/LegacyRegion2.dxs 1 4/05/12 3:08a Yurenlai $
+//
+// $Date: 4/05/12 3:08a $
+//*************************************************************************
+// Revision History
+// ----------------
+// $Log:
+//
+//*************************************************************************
+//<AMI_FHDR_START>
+//
+// Name: LegacyRegion2.dxs
+//
+// Description: Legacy Region 2 dependency file
+//
+//<AMI_FHDR_END>
+//*************************************************************************
+#include <protocol\LegacyRegion.h>
+
+DEPENDENCY_START
+ EFI_LEGACY_REGION_PROTOCOL_GUID
+DEPENDENCY_END
+
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2012, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
diff --git a/Chipset/NB/SystemAgentWrap/LegacyRegion2/LegacyRegion2.mak b/Chipset/NB/SystemAgentWrap/LegacyRegion2/LegacyRegion2.mak
new file mode 100644
index 0000000..da09a37
--- /dev/null
+++ b/Chipset/NB/SystemAgentWrap/LegacyRegion2/LegacyRegion2.mak
@@ -0,0 +1,44 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+all : LegacyRegion2
+
+LegacyRegion2 : $(BUILD_DIR)\LegacyRegion2.mak LegacyRegion2Bin
+
+$(BUILD_DIR)\LegacyRegion2.mak : $(LEGACY_REGION2_DIR)\$(@B).cif $(LEGACY_REGION2_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(LEGACY_REGION2_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+LegacyRegion2Bin : $(AMIDXELIB) $(AMICSPLib)
+ $(MAKE) /$(MAKEFLAGS) $(BUILD_DEFAULTS)\
+ /f $(BUILD_DIR)\LegacyRegion2.mak all\
+ GUID=FE6F8ACD-55A6-4c6b-B448-64E659DE94B3 \
+ ENTRY_POINT=InitializeLegacyRegion2 \
+ DEPEX1=$(LEGACY_REGION2_DIR)\LegacyRegion2.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ TYPE=BS_DRIVER \
+ COMPRESS=1\
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/Chipset/NB/SystemAgentWrap/LegacyRegion2/LegacyRegion2.sdl b/Chipset/NB/SystemAgentWrap/LegacyRegion2/LegacyRegion2.sdl
new file mode 100644
index 0000000..2f6de11
--- /dev/null
+++ b/Chipset/NB/SystemAgentWrap/LegacyRegion2/LegacyRegion2.sdl
@@ -0,0 +1,26 @@
+TOKEN
+ Name = "LegacyRegion2_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable LegacyRegion2 support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Token = "CSM_SUPPORT" "=" "1"
+End
+
+PATH
+ Name = "LEGACY_REGION2_DIR"
+End
+
+MODULE
+ Help = "Includes LegacyRegion.mak to Project"
+ File = "LegacyRegion2.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\LegacyRegion2.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+