summaryrefslogtreecommitdiff
path: root/Board/EM/FIT/Smm
diff options
context:
space:
mode:
authorraywu <raywu0301@gmail.com>2018-06-15 00:00:50 +0800
committerraywu <raywu0301@gmail.com>2018-06-15 00:00:50 +0800
commitb7c51c9cf4864df6aabb99a1ae843becd577237c (patch)
treeeebe9b0d0ca03062955223097e57da84dd618b9a /Board/EM/FIT/Smm
downloadzprj-b7c51c9cf4864df6aabb99a1ae843becd577237c.tar.xz
init. 1AQQW051HEADmaster
Diffstat (limited to 'Board/EM/FIT/Smm')
-rw-r--r--Board/EM/FIT/Smm/FitHook.c113
-rw-r--r--Board/EM/FIT/Smm/FitHook.cif12
-rw-r--r--Board/EM/FIT/Smm/FitHook.mak77
-rw-r--r--Board/EM/FIT/Smm/FitHook.sdl94
4 files changed, 296 insertions, 0 deletions
diff --git a/Board/EM/FIT/Smm/FitHook.c b/Board/EM/FIT/Smm/FitHook.c
new file mode 100644
index 0000000..303b640
--- /dev/null
+++ b/Board/EM/FIT/Smm/FitHook.c
@@ -0,0 +1,113 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2013, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
+
+//*****************************************************************************
+// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/FIT/Smm/FitHook.c 1 7/03/13 10:06p Bensonlai $
+//
+// $Revision: 1 $
+//
+// $Date: 7/03/13 10:06p $
+//*****************************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/FIT/Smm/FitHook.c $
+//
+// 1 7/03/13 10:06p Bensonlai
+// [TAG] EIP128151
+// [Category] Improvement
+// [Description] Implement an option(/b) to flash FV_DATA region uisng
+// AFU flash utility.
+// [Files] FitHook.cif
+// FitHook.c
+// FitHook.sdl
+// FitHook.mak
+//
+//*****************************************************************************
+//<AMI_FHDR_START>
+//
+// Name: FitHook.c
+//
+// Description: SW SMI hook.
+//
+//<AMI_FHDR_END>
+//*****************************************************************************
+
+#include <AmiDxeLib.h>
+#include <Protocol/SmiFlash.h>
+#include "token.h"
+
+#define FLASH_DEVICE_BASE_ADDRESS (0xFFFFFFFF-FLASH_SIZE+1)
+#define FV_DATA_BLOCK_ADDRESS (FV_DATA_BASE-FLASH_DEVICE_BASE_ADDRESS)
+#define FV_DATA_BLOCK_END (FV_DATA_BLOCK_ADDRESS+FV_DATA_SIZE)
+#define FV_DATA_TABLE_OFFSET (0xFFFFFFFF-FV_DATA_BASE+1)
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+//
+// Procedure: AppendFvDataToAFU_UpdateBlockTypeId
+//
+// Description: This function is SW SMI hook that sets Flash Block Description
+// type for AMI AFU utility. (EIP#58139)
+//
+// Input:
+// SwSmiNum - SW SMI value number
+// Buffer - Flash descriptor address
+//
+// Output: VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+
+VOID AppendFvDataToAFU_UpdateBlockTypeId (
+ IN UINT8 SwSmiNum,
+ IN UINT64 Buffer )
+{
+ BLOCK_DESC *BlockDesc;
+ UINTN i;
+
+ // return if SW SMI value is not "Get Flash Info"
+ if (SwSmiNum != SMIFLASH_GET_FLASH_INFO)
+ return;
+
+ BlockDesc = (BLOCK_DESC*)&((INFO_BLOCK*)Buffer)->Blocks;
+
+ for (i = 0; i < ((INFO_BLOCK*)Buffer)->TotalBlocks; i++) {
+
+ TRACE((TRACE_ALWAYS,"AppendFvDataToAFU_UpdateBlockTypeId: %08X(%08X), Block %08X\n", FV_DATA_BLOCK_ADDRESS, FV_DATA_BLOCK_END, BlockDesc[i].StartAddress));
+
+ if (BlockDesc[i].StartAddress < FV_DATA_BLOCK_ADDRESS)
+ continue;
+
+ if (BlockDesc[i].StartAddress >= FV_DATA_BLOCK_END)
+ continue;
+
+ TRACE((TRACE_ALWAYS,"AppendFvDataToAFU_UpdateBlockTypeId: Found Blocks %08X\n",BlockDesc[i].StartAddress));
+
+ BlockDesc[i].Type = BOOT_BLOCK;
+ }
+}
+
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2013, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
diff --git a/Board/EM/FIT/Smm/FitHook.cif b/Board/EM/FIT/Smm/FitHook.cif
new file mode 100644
index 0000000..50c2dc7
--- /dev/null
+++ b/Board/EM/FIT/Smm/FitHook.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "FitHook"
+ category = ModulePart
+ LocalRoot = "Board\EM\FIT\Smm"
+ RefName = "FitHook"
+
+[files]
+"FitHook.c"
+"FitHook.sdl"
+"FitHook.mak"
+
+<endComponent>
diff --git a/Board/EM/FIT/Smm/FitHook.mak b/Board/EM/FIT/Smm/FitHook.mak
new file mode 100644
index 0000000..78b432e
--- /dev/null
+++ b/Board/EM/FIT/Smm/FitHook.mak
@@ -0,0 +1,77 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2013, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/FIT/Smm/FitHook.mak 1 7/03/13 10:06p Bensonlai $
+#
+# $Revision: 1 $
+#
+# $Date: 7/03/13 10:06p $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/FIT/Smm/FitHook.mak $
+#
+# 1 7/03/13 10:06p Bensonlai
+# [TAG] EIP128151
+# [Category] Improvement
+# [Description] Implement an option(/b) to flash FV_DATA region uisng
+# AFU flash utility.
+# [Files] FitHook.cif
+# FitHook.c
+# FitHook.sdl
+# FitHook.mak
+#
+#*************************************************************************
+#<AMI_FHDR_START>
+#
+# Name: FitHook.mak
+#
+# Description: Make file for FitHook eModule.
+#
+#<AMI_FHDR_END>
+#*************************************************************************
+
+all : FitHook
+
+FitHook : $(BUILD_DIR)\FitHook.mak FitHookBin
+
+$(BUILD_DIR)\FitHook.mak : $(FIT_HOOK_PATH)\$(@B).cif $(FIT_HOOK_PATH)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(FIT_HOOK_PATH)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+FitHookObjs = $(BUILD_DIR)\$(FIT_HOOK_PATH)\FitHook.obj
+
+FitHookBin : $(AMIDXELIB)
+ $(MAKE) /$(MAKEFLAGS) $(BUILD_DEFAULTS)\
+ /f $(BUILD_DIR)\FitHook.mak all\
+ "CFLAGS=$(CFLAGS:/W4=/W3) /I$(OFBD_DIR)" \
+ OBJECTS="$(FitHookObjs)" \
+ NAME=FitHook \
+ TYPE=LIBRARY LIBRARY_NAME=$(FIT_HOOK_LIB)
+
+$(FIT_HOOK_LIB) : FitHook
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2013, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/Board/EM/FIT/Smm/FitHook.sdl b/Board/EM/FIT/Smm/FitHook.sdl
new file mode 100644
index 0000000..d8af9f7
--- /dev/null
+++ b/Board/EM/FIT/Smm/FitHook.sdl
@@ -0,0 +1,94 @@
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2013, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Pkwy, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#**********************************************************************
+# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/FIT/Smm/FitHook.sdl 2 7/26/13 1:18a Bensonlai $
+#
+# $Revision: 2 $
+#
+# $Date: 7/26/13 1:18a $
+#
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/FIT/Smm/FitHook.sdl $
+#
+# 2 7/26/13 1:18a Bensonlai
+#
+# 1 7/03/13 10:06p Bensonlai
+# [TAG] EIP128151
+# [Category] Improvement
+# [Description] Implement an option(/b) to flash FV_DATA region uisng
+# AFU flash utility.
+# [Files] FitHook.cif
+# FitHook.c
+# FitHook.sdl
+# FitHook.mak
+#
+#**********************************************************************
+#<AMI_FHDR_START>
+#
+# Name: FitHook.sdl
+#
+# Description: SDL file for FitHook
+#
+#<AMI_FHDR_END>
+#**********************************************************************
+
+TOKEN
+ Name = "FIT_HOOK_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Help = "Main switch to enable FitHook support in Project"
+End
+
+MODULE
+ Help = "Includes FitHook.mak to Project"
+ File = "FitHook.mak"
+End
+
+PATH
+ Name = "FIT_HOOK_PATH"
+End
+
+ELINK
+ Name = "AppendFvDataToAFU_UpdateBlockTypeId,"
+ Parent = "SMIFlashEndHandlerList"
+ InvokeOrder = AfterParent
+End
+
+TOKEN
+ Name = "FIT_HOOK_LIB"
+ Value = "$(BUILD_DIR)\FitHook.lib"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\FitHook.lib"
+ Parent = "PRESERVE_LIB"
+ InvokeOrder = AfterParent
+End
+
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2013, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Pkwy, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************