diff options
Diffstat (limited to 'Core/EM/OFBD/OEMSETUP')
-rw-r--r-- | Core/EM/OFBD/OEMSETUP/OEMSETUP.c | 361 | ||||
-rw-r--r-- | Core/EM/OFBD/OEMSETUP/OEMSETUP.cif | 11 | ||||
-rw-r--r-- | Core/EM/OFBD/OEMSETUP/OEMSETUP.h | 74 | ||||
-rw-r--r-- | Core/EM/OFBD/OEMSETUP/OEMSETUP.mak | 87 | ||||
-rw-r--r-- | Core/EM/OFBD/OEMSETUP/OEMSETUP.sdl | 71 |
5 files changed, 604 insertions, 0 deletions
diff --git a/Core/EM/OFBD/OEMSETUP/OEMSETUP.c b/Core/EM/OFBD/OEMSETUP/OEMSETUP.c new file mode 100644 index 0000000..398c8ab --- /dev/null +++ b/Core/EM/OFBD/OEMSETUP/OEMSETUP.c @@ -0,0 +1,361 @@ +//********************************************************************** +//********************************************************************** +//** ** +//** (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/OEMSETUP/OEMSETUP.c 3 3/16/11 10:33p Terrylin $ +// +// $Revision: 3 $ +// +// $Date: 3/16/11 10:33p $ +//********************************************************************** +// Revision History +// ---------------- +// $Log: /Alaska/SOURCE/Modules/OFBD/OEMSETUP/OEMSETUP.c $ +// +// 3 3/16/11 10:33p Terrylin +// [TAG] EIP51285 +// [Category] Improvement +// [Description] Fill the description for user more clearly. +// [Files] OEMSETUP.mak +// OEMSETUP.h +// OEMSETUP.c +// +// 2 5/06/10 2:12a Lawrencechang +// Add the DMI store/restore function sample code. +// +// 1 4/13/09 5:47a Lawrencechang +// Initial check-in. +// +// 1 3/25/05 5:37p Markw +// +//********************************************************************** +//<AMI_FHDR_START> +// +// Name: OEMSETUP.c +// +// Description: +// Basically this function is not always necessary for all projects, because there is a more direct method to achieve +// the same target. Two E-Links exposed by SMIFlash module, SMIFlashPreUpdateList and SMIFlashEndUpdateList, are made +// for doing the same thing as this OFBD module. +// +// We prefer you make use of E-Links than this OFBD module. The only advantage of this OFBD module is you don't have +// to link your code with SMIFlash module.If DMI data is stored in the NVRAM, you have two ways to preserve DMI data +// when updating NVRAM. +// +// 1. Controlled by SMBIOS module: SMBIOS module can set SMBIOS_PRESERVE_NVRAM token to preserves DMI data through +// e-Link PreserveDmiEditData and RestoreDmiEditData. +// +// 2. Controlled By Flash utility: AFU will call into OEMSETUP.c only when user issues /r or /sp command. When +// SMBIOS_PRESERVE_NVRAM token is disable, OEM enginner can set OEMSETUP_SUPPORT token to handle the duty of DMI data +// preservation through OEM NVRAM/Setup Variable Preserve module. Thus user can decide to clear DMI data or not. +// In this case, /n parameter will clear NVRAM, and /r parameter is required to preserve DMI data in NVRAM. When /n is +// triggered, without /r all DMI data in NVRAM will be cleared. +// +//<AMI_FHDR_END> +//********************************************************************** +#include "Efi.h" +#include "token.h" +#include <AmiLib.h> +#include <AmiDxeLib.h> +#include "OEMSETUP.h" +#include "..\OFBD.h" + +// EIP 37169 -> +#if (SMBIOS_DMIEDIT_DATA_LOC == 2) && (SMBIOS_PRESERVE_NVRAM != 1) +VOID PreserveDmiEditData (VOID); +VOID RestoreDmiEditData (VOID); +#endif +// <- EIP 37169 + + +//<AMI_PHDR_START> +//---------------------------------------------------------------------------- +// Procedure: OFBDSETUPSupportHandle +// +// Description: OFBD SETUP Store/Restore Support Handle +// +// Input: +// IN OUT OFBD_HDR *pOFBDHdr +// Output: +// EFI_STATUS +// +//---------------------------------------------------------------------------- +//<AMI_PHDR_END> +EFI_STATUS +OFBDSETUPSupportHandle( + IN OUT OFBD_HDR *pOFBDHdr) +{ + EFI_STATUS Status = EFI_SUCCESS; + +#if OEM_SETUP_SAMPLE_TEST + OFBD_TC_56_SETUP_STRUCT *SETUPStructPtr; + SETUPStructPtr = (OFBD_TC_56_SETUP_STRUCT *)((UINT8 *)pOFBDHdr + pOFBDHdr->OFBD_HDR_SIZE + sizeof(OFBD_EXT_HDR)); + SETUPStructPtr->dbRetSts = OFBD_TC_SETUP_OK; +#endif + + return(Status); +} + +//<AMI_PHDR_START> +//---------------------------------------------------------------------------- +// Procedure: OFBDSETUPStoreHandle +// +// Description: OFBD SETUP Store Handle +// +// Input: +// IN OUT OFBD_HDR *pOFBDHdr +// Output: +// EFI_STATUS +// +//---------------------------------------------------------------------------- +//<AMI_PHDR_END> +EFI_STATUS +OFBDSETUPStoreHandle( + IN OUT OFBD_HDR *pOFBDHdr) +{ + EFI_STATUS Status = EFI_SUCCESS; + +#if OEM_SETUP_SAMPLE_TEST || OEM_DMI_SAMPLE_TEST + OFBD_TC_56_SETUP_STRUCT *SETUPStructPtr; + SETUPStructPtr = (OFBD_TC_56_SETUP_STRUCT *)((UINT8 *)pOFBDHdr + pOFBDHdr->OFBD_HDR_SIZE + sizeof(OFBD_EXT_HDR)); + + //OEM add ... + + if (!EFI_ERROR(Status)) + SETUPStructPtr->dbRetSts = OFBD_TC_SETUP_OK; + else + SETUPStructPtr->dbRetSts = OFBD_TC_SETUP_STORE_ERROR; +#endif + + return(Status); +} + +//<AMI_PHDR_START> +//---------------------------------------------------------------------------- +// Procedure: OFBDSETUPRestoreHandle +// +// Description: OFBD SETUP Restore Handle +// +// Input: +// IN OUT OFBD_HDR *pOFBDHdr +// Output: +// EFI_STATUS +// +//---------------------------------------------------------------------------- +//<AMI_PHDR_END> +EFI_STATUS +OFBDSETUPRestoreHandle( + IN OUT OFBD_HDR *pOFBDHdr) +{ + EFI_STATUS Status = EFI_SUCCESS; + +#if OEM_SETUP_SAMPLE_TEST + OFBD_TC_56_SETUP_STRUCT *SETUPStructPtr; + SETUPStructPtr = (OFBD_TC_56_SETUP_STRUCT *)((UINT8 *)pOFBDHdr + pOFBDHdr->OFBD_HDR_SIZE + sizeof(OFBD_EXT_HDR)); + + //OEM add ... + + if (!EFI_ERROR(Status)) + SETUPStructPtr->dbRetSts = OFBD_TC_SETUP_OK; + else + SETUPStructPtr->dbRetSts = OFBD_TC_SETUP_RESTORE_ERROR; +#endif + + return(Status); +} + +//<AMI_PHDR_START> +//---------------------------------------------------------------------------- +// Procedure: OFBDDMIStoreHandle +// +// Description: OFBD DMI Data Store Handle +// +// Input: +// IN OUT OFBD_HDR *pOFBDHdr +// Output: +// EFI_STATUS +// +//---------------------------------------------------------------------------- +//<AMI_PHDR_END> +EFI_STATUS +OFBDDMIStoreHandle( + IN OUT OFBD_HDR *pOFBDHdr) +{ + EFI_STATUS Status = EFI_SUCCESS; + +#if OEM_DMI_SAMPLE_TEST + OFBD_TC_56_SETUP_STRUCT *SETUPStructPtr; + SETUPStructPtr = (OFBD_TC_56_SETUP_STRUCT *)((UINT8 *)pOFBDHdr + pOFBDHdr->OFBD_HDR_SIZE + sizeof(OFBD_EXT_HDR)); + + // OEM add ... + // Store the DMI data +// EIP 37169 -> +#if (SMBIOS_DMIEDIT_DATA_LOC == 2) && (SMBIOS_PRESERVE_NVRAM != 1) + PreserveDmiEditData (); +#endif +// <- EIP 37169 + + if (!EFI_ERROR(Status)) + SETUPStructPtr->dbRetSts = OFBD_TC_SETUP_OK; + else + SETUPStructPtr->dbRetSts = OFBD_TC_DMI_STORE_ERROR; +#endif + + return(Status); +} + +//<AMI_PHDR_START> +//---------------------------------------------------------------------------- +// Procedure: OFBDDMIRestoreHandle +// +// Description: OFBD DMI Data Restore Handle +// +// Input: +// IN OUT OFBD_HDR *pOFBDHdr +// Output: +// EFI_STATUS +// +//---------------------------------------------------------------------------- +//<AMI_PHDR_END> +EFI_STATUS +OFBDDMIRestoreHandle( + IN OUT OFBD_HDR *pOFBDHdr) +{ + EFI_STATUS Status = EFI_SUCCESS; + +#if OEM_DMI_SAMPLE_TEST + OFBD_TC_56_SETUP_STRUCT *SETUPStructPtr; + SETUPStructPtr = (OFBD_TC_56_SETUP_STRUCT *)((UINT8 *)pOFBDHdr + pOFBDHdr->OFBD_HDR_SIZE + sizeof(OFBD_EXT_HDR)); + + // OEM add ... + // Restore the DMI data +// EIP 37169 -> +#if (SMBIOS_DMIEDIT_DATA_LOC == 2) && (SMBIOS_PRESERVE_NVRAM != 1) + RestoreDmiEditData (); +#endif +// <- EIP 37169 + + if (!EFI_ERROR(Status)) + SETUPStructPtr->dbRetSts = OFBD_TC_SETUP_OK; + else + SETUPStructPtr->dbRetSts = OFBD_TC_DMI_RESTORE_ERROR; +#endif + + return(Status); +} + +//<AMI_PHDR_START> +//---------------------------------------------------------------------------- +// Procedure: OEMSETUPEntry +// +// Description: OFBD NVRAM/SETUP Store/Restore Entry point +// +// Input: +// IN VOID *Buffer +// IN OUT UINT8 *pOFBDDataHandled +// Output: +// VOID +// +//---------------------------------------------------------------------------- +//<AMI_PHDR_END> +VOID OEMSETUPEntry ( + IN VOID *Buffer, + IN OUT UINT8 *pOFBDDataHandled ) +{ + OFBD_HDR *pOFBDHdr; + OFBD_EXT_HDR *pOFBDExtHdr; + VOID *pOFBDTblEnd; + OFBD_TC_56_SETUP_STRUCT *SETUPStructPtr; + + if(*pOFBDDataHandled == 0) + { + pOFBDHdr = (OFBD_HDR *)Buffer; + pOFBDExtHdr = (OFBD_EXT_HDR *)((UINT8 *)Buffer + (pOFBDHdr->OFBD_HDR_SIZE)); + SETUPStructPtr = (OFBD_TC_56_SETUP_STRUCT *)((UINT8 *)pOFBDExtHdr + sizeof(OFBD_EXT_HDR)); + pOFBDTblEnd = (VOID *)((UINT8 *)Buffer + (pOFBDHdr->OFBD_Size)); + + if(pOFBDHdr->OFBD_FS & OFBD_FS_SETUP) + { + //Check Type Code ID + if(pOFBDExtHdr->TypeCodeID == OFBD_EXT_TC_SETUP) + { + //IoWrite32(0x300, *(UINT32 *)((UINT8 *)pOFBDTblEnd -4)); //debug + if(SETUPStructPtr->dbGetSts == OFBD_TC_SETUP_SUPPORT) + { + if(OFBDSETUPSupportHandle(pOFBDHdr) == EFI_SUCCESS) + { + //OEM SETUP SUPPORT Handled. + *pOFBDDataHandled = 0xFF; + return; + } + } + else if(SETUPStructPtr->dbGetSts == OFBD_TC_SETUP_STORE) + { + if(OFBDSETUPStoreHandle(pOFBDHdr) == EFI_SUCCESS) + { + //OEM SETUP STORE Handled. + *pOFBDDataHandled = 0xFF; + return; + } + } + else if(SETUPStructPtr->dbGetSts == OFBD_TC_SETUP_RESTORE) + { + if(OFBDSETUPRestoreHandle(pOFBDHdr) == EFI_SUCCESS) + { + //OEM SETUP RESTORE Handled. + *pOFBDDataHandled = 0xFF; + return; + } + } + else if(SETUPStructPtr->dbGetSts == OFBD_TC_DMI_STORE) + { + if(OFBDDMIStoreHandle(pOFBDHdr) == EFI_SUCCESS) + { + //OEM DMI STORE Handled. + *pOFBDDataHandled = 0xFF; + return; + } + } + else if(SETUPStructPtr->dbGetSts == OFBD_TC_DMI_RESTORE) + { + if(OFBDDMIRestoreHandle(pOFBDHdr) == EFI_SUCCESS) + { + //OEM DMI RESTORE 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/OEMSETUP/OEMSETUP.cif b/Core/EM/OFBD/OEMSETUP/OEMSETUP.cif new file mode 100644 index 0000000..712b31a --- /dev/null +++ b/Core/EM/OFBD/OEMSETUP/OEMSETUP.cif @@ -0,0 +1,11 @@ +<component> + name = "OEM NVRAM/Setup Variable Preserve" + category = ModulePart + LocalRoot = "Core\EM\OFBD\OEMSETUP\" + RefName = "OFBD_OEMSETUP" +[files] +"OEMSETUP.sdl" +"OEMSETUP.mak" +"OEMSETUP.h" +"OEMSETUP.c" +<endComponent> diff --git a/Core/EM/OFBD/OEMSETUP/OEMSETUP.h b/Core/EM/OFBD/OEMSETUP/OEMSETUP.h new file mode 100644 index 0000000..3ab063a --- /dev/null +++ b/Core/EM/OFBD/OEMSETUP/OEMSETUP.h @@ -0,0 +1,74 @@ +//**********************************************************************// +//**********************************************************************// +//** **// +//** (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/OEMSETUP/OEMSETUP.h 2 3/16/11 10:33p Terrylin $ +// +// $Revision: 2 $ +// +// $Date: 3/16/11 10:33p $ +//********************************************************************** +// Revision History +// ---------------- +// $Log: /Alaska/SOURCE/Modules/OFBD/OEMSETUP/OEMSETUP.h $ +// +// 2 3/16/11 10:33p Terrylin +// [TAG] EIP51285 +// [Category] Improvement +// [Description] Fill the description for user more clearly. +// [Files] OEMSETUP.mak +// OEMSETUP.h +// OEMSETUP.c +// +// 1 4/13/09 5:47a Lawrencechang +// Initial check-in. +// +// 1 3/13/06 1:16a Felixp +// +//********************************************************************** +//<AMI_FHDR_START> +// +// Name: OEMSETUP.h +// +// Description: Header file for the OEMSETUP +// +//<AMI_FHDR_END> +//********************************************************************** +#ifndef _EFI_OEMSETUP_H_ +#define _EFI_OEMSETUP_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/OEMSETUP/OEMSETUP.mak b/Core/EM/OFBD/OEMSETUP/OEMSETUP.mak new file mode 100644 index 0000000..5a84667 --- /dev/null +++ b/Core/EM/OFBD/OEMSETUP/OEMSETUP.mak @@ -0,0 +1,87 @@ +#************************************************************************* +#************************************************************************* +#** ** +#** (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/OEMSETUP/OEMSETUP.mak 3 3/16/11 10:33p Terrylin $ +# +# $Revision: 3 $ +# +# $Date: 3/16/11 10:33p $ +#************************************************************************* +# Revision History +# ---------------- +# $Log: /Alaska/SOURCE/Modules/OFBD/OEMSETUP/OEMSETUP.mak $ +# +# 3 3/16/11 10:33p Terrylin +# [TAG] EIP51285 +# [Category] Improvement +# [Description] Fill the description for user more clearly. +# [Files] OEMSETUP.mak +# OEMSETUP.h +# OEMSETUP.c +# +# 2 5/06/10 2:15a Lawrencechang +# Add a different rule for storing DMI in NVRAM. +# +# 1 4/13/09 5:47a Lawrencechang +# Initial check-in. +# +# 1 3/18/07 5:23p Felixp +# +#************************************************************************* +#<AMI_FHDR_START> +# +# Name: OEMSETUP.mak +# +# Description: Make file for the OEMSETUP.obj +# +#<AMI_FHDR_END> +#************************************************************************* +all : OEMSETUP + +OEMSETUP : $(BUILD_DIR)\OEMSETUP.mak OEMSETUPBin + +$(BUILD_DIR)\OEMSETUP.mak : $(OFBD_OEMSETUP_DIR)\$(@B).cif $(OFBD_OEMSETUP_DIR)\$(@B).mak $(BUILD_RULES) + $(CIF2MAK) $(OFBD_OEMSETUP_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS) + +# EIP 37169 +!IF "$(SMBIOS_DMIEDIT_DATA_LOC)"=="2" && "$(SMBIOS_PRESERVE_NVRAM)"!="1" +$(BUILD_DIR)\$(SMBIOS_DMIEDIT_DIR)\SmbiosNvramFunc.obj : $(SMBIOS_DMIEDIT_DIR)\SmbiosNvramFunc.c + mkdir $(BUILD_DIR)\$(SMBIOS_DMIEDIT_DIR) + $(CC) $(CFLAGS:/W4=/W3) /Fo$(BUILD_DIR)\$(SMBIOS_DMIEDIT_DIR)\ $(SMBIOS_DMIEDIT_DIR)\SmbiosNvramFunc.c + +OEMSETUPBin : $(BUILD_DIR)\$(SMBIOS_DMIEDIT_DIR)\SmbiosNvramFunc.obj +!ELSE +OEMSETUPBin : +!ENDIF + @set INCLUDE=%%INCLUDE%% + $(MAKE) /$(MAKEFLAGS) $(BUILD_DEFAULTS)\ + /f $(BUILD_DIR)\OEMSETUP.mak all\ + NAME=OEMSETUP \ + TYPE=LIBRARY LIBRARY_NAME=$(OEMSETUPLIB) + +$(OEMSETUPLIB) : OEMSETUP +#************************************************************************* +#************************************************************************* +#** ** +#** (C)Copyright 1985-2011, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#************************************************************************* +#*************************************************************************
\ No newline at end of file diff --git a/Core/EM/OFBD/OEMSETUP/OEMSETUP.sdl b/Core/EM/OFBD/OEMSETUP/OEMSETUP.sdl new file mode 100644 index 0000000..a8d09d4 --- /dev/null +++ b/Core/EM/OFBD/OEMSETUP/OEMSETUP.sdl @@ -0,0 +1,71 @@ +TOKEN + Name = "OEMSETUP_SUPPORT" + Value = "1" + Help = "Main switch to enable OEM SETUP Preserve support in Project" + TokenType = Boolean + TargetEQU = Yes + TargetMAK = Yes + Master = Yes +End + +TOKEN + Name = "OEMSETUPLIB" + Value = "$(BUILD_DIR)\OEMSETUP.lib" + TokenType = Expression + TargetMAK = Yes +End + +TOKEN + Name = "[OFBD OEM SETUP Preserve]" + Help = "See detail description in each token's help box." + TokenType = Expression + Lock = Yes +End + +TOKEN + Name = "OEM_SETUP_SAMPLE_TEST" + Value = "1" + Help = "Test BIOS Setting preserve Function" + TokenType = Boolean + TargetMAK = Yes + TargetH = Yes +End + +TOKEN + Name = "[OFBD OEM DMI Data Preserve]" + Help = "See detail description in each token's help box." + TokenType = Expression + Lock = Yes +End + +TOKEN + Name = "OEM_DMI_SAMPLE_TEST" + Value = "1" + Help = "Test BIOS DMI Data preserve Function" + TokenType = Boolean + TargetMAK = Yes + TargetH = Yes +End + +PATH + Name = "OFBD_OEMSETUP_DIR" +End + +MODULE + Help = "Includes OEMSETUP.mak to Project" + File = "OEMSETUP.mak" +End + +ELINK + Name = "$(BUILD_DIR)\OEMSETUP.lib" + Parent = "OFBDLISTLIB" + InvokeOrder = AfterParent +End + +ELINK + Name = "OEMSETUPEntry," + Parent = "OFBDPartsList" + Token = "OEMSETUP_SUPPORT" "=" "1" + InvokeOrder = AfterParent +End + |