summaryrefslogtreecommitdiff
path: root/Core/EM/OFBD/OEMOAHandle
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 /Core/EM/OFBD/OEMOAHandle
downloadzprj-master.tar.xz
init. 1AQQW051HEADmaster
Diffstat (limited to 'Core/EM/OFBD/OEMOAHandle')
-rw-r--r--Core/EM/OFBD/OEMOAHandle/OEMOAHandle.c233
-rw-r--r--Core/EM/OFBD/OEMOAHandle/OEMOAHandle.cif11
-rw-r--r--Core/EM/OFBD/OEMOAHandle/OEMOAHandle.h64
-rw-r--r--Core/EM/OFBD/OEMOAHandle/OEMOAHandle.mak68
-rw-r--r--Core/EM/OFBD/OEMOAHandle/OEMOAHandle.sdl56
5 files changed, 432 insertions, 0 deletions
diff --git a/Core/EM/OFBD/OEMOAHandle/OEMOAHandle.c b/Core/EM/OFBD/OEMOAHandle/OEMOAHandle.c
new file mode 100644
index 0000000..f995c2e
--- /dev/null
+++ b/Core/EM/OFBD/OEMOAHandle/OEMOAHandle.c
@@ -0,0 +1,233 @@
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2011, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
+
+//**********************************************************************
+// $Header: /Alaska/SOURCE/Modules/OFBD/OEMOAHandle/OEMOAHandle.c 1 10/24/11 3:03a Terrylin $
+//
+// $Revision: 1 $
+//
+// $Date: 10/24/11 3:03a $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/OFBD/OEMOAHandle/OEMOAHandle.c $
+//
+// 1 10/24/11 3:03a Terrylin
+// Add for EIP 66385
+//
+//**********************************************************************
+//<AMI_FHDR_START>
+//
+// Name: OemOAHandle.c
+//
+// Description:
+//
+// This function is used for OEM can receive the OA data, and then decide what to do.
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#include "Efi.h"
+#include <Protocol\SmiFlash.h>
+#include <AmiLib.h>
+#include <AmiDxeLib.h>
+#include "OemOAHandle.h"
+#include "..\OFBD.h"
+
+//#define CONVERT_TO_STRING(a) #a
+#define STR(a) CONVERT_TO_STRING(a)
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: OFBDOemOADataHandle
+//
+// Description: OFBD Oem OA Data Handle
+//
+// Input:
+// IN OUT OFBD_HDR *pOFBDHdr
+// Output:
+// EFI_STATUS
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+EFI_STATUS
+OFBDOemOADataHandle(
+ IN OUT OFBD_HDR *pOFBDHdr)
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+
+#if OEM_OA_DATA_HANDLE_SAMPLE_TEST
+
+ char *TestOemOAStr = " [DBG] OA function is called !!";
+
+ UINT8 *pOFBDTblEnd;
+ OFBD_TC_5A_OA_HANDLE_STRUCT *OAStructPtr;
+
+ pOFBDTblEnd = (UINT8 *)((UINT8 *)pOFBDHdr + (pOFBDHdr->OFBD_Size));
+ OAStructPtr = (OFBD_TC_5A_OA_HANDLE_STRUCT *)((UINT8 *)pOFBDHdr + pOFBDHdr->OFBD_HDR_SIZE + sizeof(OFBD_EXT_HDR));
+
+ //
+ // OA Structure Description:
+ //
+ /*
+ UINT8 dbOASts; // Bit 0: Notification BIOS, utility is now ready to update the OA data. - OFBD_TC_OA_UPDATE_NOTIFY
+ // Bit 1~7: Reserved
+
+ UINT8 dbErrorID; // 0~255 : Filled by O.E.M.
+
+ UINT16 dwRetSts; // Bit 0: OA data is invalid, tell the utility stop the flash procedure - OFBD_RS_OA_DATA_IS_INVALID
+ // Bit 1: OA data has been modified, tell the utility use the new data to update - OFBD_RS_OA_DATA_IS_MODIFIED
+ // Bit 2: BIOS has updated the OA, so tell the utility doesn't to update - OFBD_RS_OA_UPDATE_SKIPPED
+ // Bit 3: BIOS doesn't allow the OA update, tell the utility stop the flash procedure - OFBD_RS_OA_UPDATE_DECLINED
+ // Bit 4~14: Reserved
+ // Bit 15: Use dbErrorID field for utility return OEM specific error code, when this Bit is set to 1. - OFBD_RS_OA_USE_OEM_ERROR_ID
+ UINT32 ddOABlockAddr; // OA Block Address of BIOS ROM (For NCB mode to use)
+ UINT64 ddOADataBuffer; // OA Data Buffer
+ UINT32 dwOADataSize; // OA Data Buffer Size
+ */
+
+ //
+ // Please add your code here +>>>
+ //
+ if (OAStructPtr->dbOASts == OFBD_TC_OA_UPDATE_NOTIFY)
+ {
+ //
+ // Please set the dwRetSts for utility to know the process is success or fail
+ //
+
+ //
+ // Case 1: OA Data is invalid
+ //
+
+ // OAStructPtr->dwRetSts = OFBD_RS_OA_DATA_IS_INVALID;
+
+
+ //
+ // Case 2: OA Data has been modified, tell the utility use the new data to update
+ //
+
+ // OAStructPtr->dwRetSts = OFBD_RS_OA_DATA_IS_MODIFIED;
+
+
+ //
+ // Case 3: BIOS has updated the OA, so tell the utility doesn't to update
+ //
+
+ // OAStructPtr->dwRetSts = OFBD_RS_OA_UPDATE_SKIPPED;
+
+
+ //
+ // Case 4: BIOS doesn't allow the OA update, tell the utility stop the flash procedure
+ //
+
+ // OAStructPtr->dwRetSts = OFBD_RS_OA_UPDATE_DECLINED;
+
+
+ //
+ // Case X: OEM want to use their error code definition for /A update command status
+ //
+
+
+ // Step 1: Set Bit 15 to 1
+ //
+ // OAStructPtr->dwRetSts = OFBD_RS_OA_USE_OEM_ERROR_ID;
+ //
+ // Step 2: Use dbErrorID field for utility return OEM specific error code
+ //
+ // OAStructPtr->dbErrorID = 0~255;
+
+
+ //
+ // Tell the utility to show the OEM message, if needed. +>>>
+ //
+ pOFBDHdr->OFBD_RS |= OFBD_RS_DIS_OEMSTR;
+ Strcpy((char *)pOFBDTblEnd, TestOemOAStr);
+ //
+ // <<<+
+ //
+
+ }
+
+ //
+ // Please add your code here <<<+
+ //
+
+#endif // #ifdef OEM_OA_DATA_HANDLE_SAMPLE_TEST
+
+ return(Status);
+}
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------------
+// Procedure: OemOAHandleEntry
+//
+// Description: OFBD Oem OA Data Handle Entry Point
+//
+// Input:
+// IN VOID *Buffer
+// IN OUT UINT8 *pOFBDDataHandled
+// Output:
+// VOID
+//
+//----------------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID OemOAHandleEntry (
+ IN VOID *Buffer,
+ IN OUT UINT8 *pOFBDDataHandled )
+{
+ OFBD_HDR *pOFBDHdr;
+ OFBD_EXT_HDR *pOFBDExtHdr;
+ VOID *pOFBDTblEnd;
+ OFBD_TC_5A_OA_HANDLE_STRUCT *OAStructPtr;
+
+ if(*pOFBDDataHandled == 0)
+ {
+ pOFBDHdr = (OFBD_HDR *)Buffer;
+ pOFBDExtHdr = (OFBD_EXT_HDR *)((UINT8 *)Buffer + (pOFBDHdr->OFBD_HDR_SIZE));
+ OAStructPtr = (OFBD_TC_5A_OA_HANDLE_STRUCT *)((UINT8 *)pOFBDExtHdr + sizeof(OFBD_EXT_HDR));
+ pOFBDTblEnd = (VOID *)((UINT8 *)Buffer + (pOFBDHdr->OFBD_Size));
+
+ if(pOFBDHdr->OFBD_FS & OFBD_FS_OA)
+ {
+ //Check Type Code ID
+ if(pOFBDExtHdr->TypeCodeID == OFBD_EXT_TC_OA_HANDLE)
+ {
+ if(OFBDOemOADataHandle(pOFBDHdr) == EFI_SUCCESS)
+ {
+ //Oem OA Data Handled.
+ *pOFBDDataHandled = 0xFF;
+ return;
+ }
+ }
+ //Error occured
+ *pOFBDDataHandled = 0xFE;
+ return;
+ }
+ }
+
+ return;
+}
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2011, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/Core/EM/OFBD/OEMOAHandle/OEMOAHandle.cif b/Core/EM/OFBD/OEMOAHandle/OEMOAHandle.cif
new file mode 100644
index 0000000..07aadc1
--- /dev/null
+++ b/Core/EM/OFBD/OEMOAHandle/OEMOAHandle.cif
@@ -0,0 +1,11 @@
+<component>
+ name = "OEM OA Data Handle"
+ category = ModulePart
+ LocalRoot = "Core\EM\OFBD\OEMOAHandle\"
+ RefName = "OFBD_OA_DATA_HANDLE"
+[files]
+"OEMOAHandle.sdl"
+"OEMOAHandle.mak"
+"OEMOAHandle.h"
+"OEMOAHandle.c"
+<endComponent>
diff --git a/Core/EM/OFBD/OEMOAHandle/OEMOAHandle.h b/Core/EM/OFBD/OEMOAHandle/OEMOAHandle.h
new file mode 100644
index 0000000..a816d2c
--- /dev/null
+++ b/Core/EM/OFBD/OEMOAHandle/OEMOAHandle.h
@@ -0,0 +1,64 @@
+//**********************************************************************//
+//**********************************************************************//
+//** **//
+//** (C)Copyright 1985-2011, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//**********************************************************************//
+//**********************************************************************//
+
+//**********************************************************************
+// $Header: /Alaska/SOURCE/Modules/OFBD/OEMOAHandle/OEMOAHandle.h 1 10/24/11 3:02a Terrylin $
+//
+// $Revision: 1 $
+//
+// $Date: 10/24/11 3:02a $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/OFBD/OEMOAHandle/OEMOAHandle.h $
+//
+// 1 10/24/11 3:02a Terrylin
+// Add for EIP 66385
+//
+//**********************************************************************
+//<AMI_FHDR_START>
+//
+// Name: OemOAHandle.h
+//
+// Description: Header file for the OemOAHandle
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+#ifndef _EFI_OEMOAHANDLE_H_
+#define _EFI_OEMOAHANDLE_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define RETURN_ERR 1
+
+/****** DO NOT WRITE BELOW THIS LINE *******/
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+//**********************************************************************//
+//**********************************************************************//
+//** **//
+//** (C)Copyright 1985-2011, American Megatrends, Inc. **//
+//** **//
+//** All Rights Reserved. **//
+//** **//
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **//
+//** **//
+//** Phone: (770)-246-8600 **//
+//** **//
+//**********************************************************************//
+//**********************************************************************//
diff --git a/Core/EM/OFBD/OEMOAHandle/OEMOAHandle.mak b/Core/EM/OFBD/OEMOAHandle/OEMOAHandle.mak
new file mode 100644
index 0000000..54563e0
--- /dev/null
+++ b/Core/EM/OFBD/OEMOAHandle/OEMOAHandle.mak
@@ -0,0 +1,68 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+# $Header: /Alaska/SOURCE/Modules/OFBD/OEMOAHandle/OEMOAHandle.mak 1 10/24/11 3:02a Terrylin $
+#
+# $Revision: 1 $
+#
+# $Date: 10/24/11 3:02a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/OFBD/OEMOAHandle/OEMOAHandle.mak $
+#
+# 1 10/24/11 3:02a Terrylin
+# Add for EIP 66385
+#
+#*************************************************************************
+#<AMI_FHDR_START>
+#
+# Name: OemOAHandle.mak
+#
+# Description: Make file for the OemOAHandle.obj
+#
+#<AMI_FHDR_END>
+#*************************************************************************
+all : OEMOAHANDLE
+
+OEMOAHANDLE : $(BUILD_DIR)\OEMOAHANDLE.mak OEMOAHANDLEBin
+
+$(BUILD_DIR)\OEMOAHANDLE.mak : $(OFBD_OEM_OA_HANDLE_DIR)\$(@B).cif $(OFBD_OEM_OA_HANDLE_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(OFBD_OEM_OA_HANDLE_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+OEMOAHANDLEBin :
+ @set INCLUDE=%%INCLUDE%%
+ $(MAKE) /$(MAKEFLAGS) $(BUILD_DEFAULTS)\
+ /f $(BUILD_DIR)\OEMOAHANDLE.mak all\
+ NAME=OEMOAHANDLE \
+ TYPE=LIBRARY LIBRARY_NAME=$(OEMOAHANDLELIB)
+
+$(OEMOAHANDLELIB) : OEMOAHANDLE
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+
diff --git a/Core/EM/OFBD/OEMOAHandle/OEMOAHandle.sdl b/Core/EM/OFBD/OEMOAHandle/OEMOAHandle.sdl
new file mode 100644
index 0000000..7e8a474
--- /dev/null
+++ b/Core/EM/OFBD/OEMOAHandle/OEMOAHandle.sdl
@@ -0,0 +1,56 @@
+TOKEN
+ Name = "OEM_OA_DATA_HANDLE_SUPPORT"
+ Value = "0"
+ Help = "Main switch to enable OEM OA Data Handle support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+End
+
+TOKEN
+ Name = "OEMOAHANDLELIB"
+ Value = "$(BUILD_DIR)\OEMOAHANDLE.lib"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+TOKEN
+ Name = "[OEM OA Data Handle Sample Code Section]"
+ Help = "See detail description in each token's help box."
+ TokenType = Expression
+ Lock = Yes
+End
+
+TOKEN
+ Name = "OEM_OA_DATA_HANDLE_SAMPLE_TEST"
+ Value = "1"
+ Help = "Test OEM OA Data Handle Function"
+ TokenType = Boolean
+ TargetMAK = Yes
+ TargetH = Yes
+ Token = "OEM_OA_DATA_HANDLE_SUPPORT" "=" "1"
+End
+
+PATH
+ Name = "OFBD_OEM_OA_HANDLE_DIR"
+End
+
+MODULE
+ Help = "Includes OemOAHandle.mak to Project"
+ File = "OemOAHandle.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\OEMOAHANDLE.lib"
+ Parent = "OFBDLISTLIB"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "OemOAHandleEntry,"
+ Parent = "OFBDPartsList"
+ Token = "OEM_OA_DATA_HANDLE_SUPPORT" "=" "1"
+ InvokeOrder = AfterParent
+End
+