diff options
author | raywu <raywu0301@gmail.com> | 2018-06-15 00:00:50 +0800 |
---|---|---|
committer | raywu <raywu0301@gmail.com> | 2018-06-15 00:00:50 +0800 |
commit | b7c51c9cf4864df6aabb99a1ae843becd577237c (patch) | |
tree | eebe9b0d0ca03062955223097e57da84dd618b9a /ReferenceCode/ME/ActiveManagement/AmtBootOptions | |
download | zprj-master.tar.xz |
Diffstat (limited to 'ReferenceCode/ME/ActiveManagement/AmtBootOptions')
9 files changed, 1101 insertions, 0 deletions
diff --git a/ReferenceCode/ME/ActiveManagement/AmtBootOptions/AmtBootOptions.cif b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/AmtBootOptions.cif new file mode 100644 index 0000000..a1c7a9f --- /dev/null +++ b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/AmtBootOptions.cif @@ -0,0 +1,10 @@ +<component> + name = "AmtBootOptions" + category = ModulePart + LocalRoot = "ReferenceCode\ME\ActiveManagement\AmtBootOptions\" + RefName = "AmtBootOptions" +[files] +"AmtBootOptions.sdl" +[parts] +"AmtDxe" +<endComponent> diff --git a/ReferenceCode/ME/ActiveManagement/AmtBootOptions/AmtBootOptions.sdl b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/AmtBootOptions.sdl new file mode 100644 index 0000000..86d7fc9 --- /dev/null +++ b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/AmtBootOptions.sdl @@ -0,0 +1,21 @@ +TOKEN + Name = AmtBootOptions_SUPPORT + Value = 1 + TokenType = Boolean + TargetEQU = Yes + TargetMAK = Yes + Master = Yes + Help = "Main switch to enable AMT support in Project" +End + +PATH + Name = "AmtBootOptions_SOURCE" + Help = "AMT Driver files source directory" +End + +ELINK + Name = "/I$(AmtBootOptions_SOURCE)\Include" + Parent = "ME_INCLUDES" + InvokeOrder = AfterParent +End + diff --git a/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/AMTDxe.cif b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/AMTDxe.cif new file mode 100644 index 0000000..295ac90 --- /dev/null +++ b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/AMTDxe.cif @@ -0,0 +1,13 @@ +<component> + name = "AMTDxe" + category = ModulePart + LocalRoot = "ReferenceCode\ME\ActiveManagement\AmtBootOptions\Dxe\" + RefName = "AMTDxe" +[files] +"AMTDxe.sdl" +"AMTDxe.mak" +"ActiveManagement.c" +"ActiveManagement.dxs" +"ActiveManagement.h" +"ActiveManagement.inf" +<endComponent> diff --git a/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/AMTDxe.mak b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/AMTDxe.mak new file mode 100644 index 0000000..981a295 --- /dev/null +++ b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/AMTDxe.mak @@ -0,0 +1,58 @@ +# MAK file for the eModule:AMTDxe + +all : AMTDxe + + +AMTDxe : $(BUILD_DIR)\AMTDxe.mak AMTDxeBin + +$(BUILD_DIR)\AMTDxe.mak : $(AMTDxe_DIR)\$(@B).cif $(AMTDxe_DIR)\$(@B).mak $(BUILD_RULES) + $(CIF2MAK) $(AMTDxe_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS) + + +AMTDxe_INCLUDES=\ + $(ME_INCLUDES)\ + $(EdkIIGlueLib_INCLUDES)\ + $(INTEL_PCH_INCLUDES) + + +AMTDxe_DEFINES = $(MY_DEFINES)\ + /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=ActiveManagementEntryPoint"\ + /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \ + /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \ + /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\ + /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \ + + +AMTDxe_LIB_LINKS =\ + $(EDKPROTOCOLLIB)\ + $(ProtocolLib_LIB)\ + $(EFISCRIPTLIB)\ + $(AmtLibDxe_LIB)\ + $(MeLibDxe_LIB)\ + $(MeChipsetDxeLib_LIB)\ + $(EDKFRAMEWORKPROTOCOLLIB)\ + $(EdkIIGlueBaseLib_LIB)\ +!IF "$(x64_BUILD)"=="1" + $(EdkIIGlueBaseLibX64_LIB)\ +!ELSE + $(EdkIIGlueBaseLibIA32_LIB)\ +!ENDIF + $(EdkIIGlueDxeReportStatusCodeLib_LIB)\ + $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\ + $(EdkIIGlueUefiBootServicesTableLib_LIB)\ + $(EdkIIGlueBasePciLibPciExpress_LIB)\ + $(PchPlatformDxeLib_LIB) + + +AMTDxeBin : $(AMTDxe_LIB_LINKS) $(MeDxe_LIB_LINKS) + $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\ + /f $(BUILD_DIR)\AMTDxe.mak all\ + "MY_INCLUDES=$(AMTDxe_INCLUDES)"\ + "MY_DEFINES=$(AMTDxe_DEFINES)"\ + GUID=D739F969-FB2D-4bc2-AFE7-081327D3FEDE \ + ENTRY_POINT=_ModuleEntryPoint \ + TYPE=BS_DRIVER \ + EDKIIModule=DXEDRIVER\ + DEPEX1=$(AMTDxe_DIR)\ActiveManagement.dxs \ + DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \ + COMPRESS=1\ diff --git a/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/AMTDxe.sdl b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/AMTDxe.sdl new file mode 100644 index 0000000..be1bfc0 --- /dev/null +++ b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/AMTDxe.sdl @@ -0,0 +1,29 @@ +TOKEN + Name = "AMTDxe_SUPPORT" + Value = "1" + TokenType = Boolean + TargetEQU = Yes + TargetMAK = Yes + Master = Yes + Help = "Main switch to enable AMT Dxe support in Project" +End +MODULE + Help = "Includes AMTDxe.mak to Project" + File = "AMTDxe.mak" +End + +PATH + Name = "AMTDxe_DIR" + Help = "AMT Driver files source directory" +End + +PATH + Name = "AMTDxe_SOURCE" + Help = "AMT Driver files source directory" +End + +ELINK + Name = "$(BUILD_DIR)\AMTDxe.ffs" + Parent = "FV_MAIN" + InvokeOrder = AfterParent +End diff --git a/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/ActiveManagement.c b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/ActiveManagement.c new file mode 100644 index 0000000..681bb6b --- /dev/null +++ b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/ActiveManagement.c @@ -0,0 +1,553 @@ +/** @file + Defines and prototypes for the ActiveManagement driver. + This driver implements the ActiveManagement protocol for iAMT. + It provides some functions to get Boot Options from ASF. + +@copyright + Copyright (c) 2004 - 2012 Intel Corporation. All rights + reserved This software and associated documentation (if any) + is furnished under a license and may only be used or copied in + accordance with the terms of the license. Except as permitted + by such license, no part of this software or documentation may + be reproduced, stored in a retrieval system, or transmitted in + any form or by any means without the express written consent + of Intel Corporation. + + This file contains an 'Intel Peripheral Driver' and uniquely + identified as "Intel Reference Module" and is + licensed for Intel CPUs and chipsets under the terms of your + license agreement with Intel or your vendor. This file may + be modified by the user, subject to additional terms of the + license agreement + +**/ + +// +// External include files do NOT need to be explicitly specified in real EDKII +// environment +// +#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000) +#include "EdkIIGlueDxe.h" +#include "ActiveManagement.h" +#include "MeLib.h" +#include "MeAccess.h" +#endif +// +// Global variables +// +EFI_ASF_BOOT_OPTIONS *mAsfBootOptions; + +ACTIVE_MANAGEMENT_INSTANCE ActiveManagementInstance = { + ACTIVE_MANAGEMENT_PRIVATE_DATA_SIGNATURE, + NULL, + { + (EFI_ACTIVE_MANAGEMENT_BOOT_OPTIONS_STATE) GetIderState, + (EFI_ACTIVE_MANAGEMENT_BOOT_OPTIONS_STATE) GetEnforceSecureBootState, + (EFI_ACTIVE_MANAGEMENT_BOOT_OPTIONS_STATE) GetSolState, + (EFI_ACTIVE_MANAGEMENT_BOOT_OPTIONS_STATE) GetRemoteFlashState, + (EFI_ACTIVE_MANAGEMENT_BOOT_OPTIONS_STATE) GetBiosSetupState, + (EFI_ACTIVE_MANAGEMENT_BOOT_OPTIONS_STATE) GetBiosPauseState, + (EFI_ACTIVE_MANAGEMENT_BOOT_OPTIONS_STATE) GetConsoleLockState, + (EFI_ACTIVE_MANAGEMENT_BOOT_OPTIONS_STATE) GetKvmState, + (EFI_ACTIVE_MANAGEMENT_IDER_BOOT_DEVICE_SELECTED) GetIderBootDeviceSelectd, + (EFI_ACTIVE_MANAGEMENT_ASF_BOOT_OPTIONS_GET) GetAsfBootOptions, + (EFI_ACTIVE_MANAGEMENT_BOOT_OPTIONS_STATE) GetProgressMsgRequest + }, + NULL +}; + +// +// Function implementations +// + +/** + Check if ASF boot options is present. + + @param[in] None. + + @retval True ASF boot option is present. + @retval False ASF boot option is not present +**/ +BOOLEAN +IsBootOptionsPresent ( + VOID + ) +{ + return mAsfBootOptions->SubCommand == ASF_BOOT_OPTIONS_PRESENT; +} + +/** + Check if LANA ID of ASF boot options is Industry ID. + + @param[in] None. + + @retval True IANA ID of ASF boot options is Industry ID. + @retval False IANA ID of ASF boot options is not Industry ID. +**/ +BOOLEAN +IsIndustryIanaId ( + VOID + ) +{ + volatile BOOLEAN RetVal; + + RetVal = FALSE; + if (IsBootOptionsPresent ()) { + if (mAsfBootOptions->IanaId == ASF_INDUSTRY_CONVERTED_IANA) { + RetVal = TRUE; + } + } + + return RetVal; +} + +/** + Check if LANA ID of ASF boot options is Intel ID. + + @param[in] None. + + @retval True IANA ID of ASF boot options is Intel ID. + @retval False IANA ID of ASF boot options is not Intel ID. +**/ +BOOLEAN +IsIntelIanaId ( + VOID + ) +{ + volatile BOOLEAN RetVal; + + RetVal = FALSE; + + if (IsBootOptionsPresent ()) { + if (mAsfBootOptions->IanaId == ASF_INTEL_CONVERTED_IANA) { + RetVal = TRUE; + } + } + + return RetVal; +} + +/** + Check if it is Intel ASF boot options. + + @param[in] None. + + @retval True It is Intel ASF boot options. + @retval False It is not Intel ASF boot options. +**/ +BOOLEAN +IsIntelAmtBootOptions ( + VOID + ) +{ + BOOLEAN RetVal; + + RetVal = FALSE; + + if (IsIntelIanaId ()) { + if (mAsfBootOptions->SpecialCommand == ASF_INTEL_OEM_CMD) { + RetVal = TRUE; + } + } + + return RetVal; +} + +/** + Check the Special Command Parameter of Intel ASF boot options + + @param[in] Options Special Command Parameter bit we want to check + Bit 0: Set if IDER is to be used on the next boot. Parameter 2 is set + to the driver number to be used. + Bit 1: Set if Secure Boot is enforced over IDER + Bit 2: Set if the BIOS is to be re-flashed on the next boot + Bit 3: Set if the BIOS is to boot into the BIOS set-up screen. + Bit 4: Boot into BIOS Pause on the next boot is supported + Bit 5: Set if the BIOS is to participate in KVM session + @param[in] CurrentState Return the state of result + True - Special Command Parameter bit in Options is enabled. + False - Special Command Parameter bit in Options is disabled. + + @retval EFI_SUCCESS The function completed successfully. +**/ +EFI_STATUS +GetSpecialParamState ( + IN UINT16 Options, + IN OUT BOOLEAN *CurrentState + ) +{ + *CurrentState = FALSE; + if (IsIntelAmtBootOptions ()) { + if ((mAsfBootOptions->SpecialCommandParam & Options) == Options) { + *CurrentState = TRUE; + } + } + + return EFI_SUCCESS; +} + +/** + Check the OEM Parameter of Intel ASF boot options + + @param[in] Options OEM Parameter bit we want to check + Bit 0: Set if SOL is to be used on the next boot. + @param[in] CurrentState Return the state of result + True : OEM Parameter bit in Options is enabled. + False : OEM Parameter bit in Options is disabled. + + @retval EFI_SUCCESS The function completed successfully. +**/ +EFI_STATUS +GetOemParamatersState ( + IN UINT16 Options, + IN OUT BOOLEAN *CurrentState + ) +{ + *CurrentState = FALSE; + if (IsIntelAmtBootOptions ()) { + if ((mAsfBootOptions->OemParameters & Options) == Options) { + *CurrentState = TRUE; + } + } + + return EFI_SUCCESS; +} + +/** + Check the OEM Parameter of Intel ASF boot options + + @param[in] Options OEM Parameter bit we want to check + Bit 0: Set if SOL is to be used on the next boot. + @param[in] CurrentState Return the state of result + True : OEM Parameter bit in Options is enabled. + False : OEM Parameter bit in Options is disabled. + + @retval EFI_SUCCESS The function completed successfully. +**/ +EFI_STATUS +GetBootOptionsMaskState ( + IN UINT16 Options, + IN OUT BOOLEAN *CurrentState + ) +{ + *CurrentState = FALSE; + if (IsBootOptionsPresent ()) { + if ((mAsfBootOptions->BootOptions & Options) == Options) { + *CurrentState = TRUE; + } + } + + return EFI_SUCCESS; +} + +/** + This will return IDE Redirection Boot Option. + True if the option is enabled. + + @param[in] This The address of protocol + @param[in] CurrentState Return the state of IDE Redireciton Boot Opiton + + @retval EFI_SUCCESS The function completed successfully. +**/ +EFI_STATUS +EFIAPI +GetIderState ( + IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This, + IN OUT BOOLEAN *CurrentState + ) +{ + GetSpecialParamState (USE_IDER, CurrentState); + return EFI_SUCCESS; +} + +/** + This will return IDE Redirection boot device to boot + + @param[in] This The address of protocol + @param[in] IdeBootDevice Return the boot device number to boot + Bits 0-1: If IDER boot is selected in Perimeter 1 then Bits 1,2 define the drive on the IDER controller to be used as the boot driver. + Bit 1 Bit0 + 0 0 Primary Master Drive + 0 1 Primary Slave Drive + 1 0 Secondary Master Drive + 1 1 Secondary Slave Drive + Bits 2-7: Reserved set to 0 + + @retval EFI_SUCCESS The function completed successfully. +**/ +EFI_STATUS +EFIAPI +GetIderBootDeviceSelectd ( + IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This, + IN OUT UINT8 *IdeBootDevice + ) +{ + *IdeBootDevice = (UINT8) ((mAsfBootOptions->SpecialCommandParam & IDER_BOOT_DEVICE_MASK) >> IDER_BOOT_DEVICE_SHIFT); + return EFI_SUCCESS; +} + +/** + This will return Enforce Secure Boot over IDER Boot Option. + True if the option is enabled. + + @param[in] This The address of protocol + @param[in] CurrentState Return the state of Enforce Secure Boot over IDER Boot Option + + @retval EFI_SUCCESS The function completed successfully. +**/ +EFI_STATUS +EFIAPI +GetEnforceSecureBootState ( + IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This, + IN OUT BOOLEAN *CurrentState + ) +{ + GetSpecialParamState (ENFORCE_SECURE_BOOT, CurrentState); + return EFI_SUCCESS; +} + +/** + This will return Serial-over-Lan Boot Option. + True if the option is enabled. + + @param[in] This The address of protocol + @param[in] CurrentState Return the state of Serial-over-Lan Boot Opiton + + @retval EFI_SUCCESS The function completed successfully. +**/ +EFI_STATUS +EFIAPI +GetSolState ( + IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This, + IN OUT BOOLEAN *CurrentState + ) +{ + GetOemParamatersState (USE_SOL, CurrentState); + return EFI_SUCCESS; +} + +/** + This will return Remote Flash Boot Option. + True if the option is enabled. + + @param[in] This The address of protocol + @param[in] CurrentState Return the state of Remote Flash Boot Opiton + + @retval EFI_SUCCESS The function completed successfully. +**/ +EFI_STATUS +EFIAPI +GetRemoteFlashState ( + IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This, + IN OUT BOOLEAN *CurrentState + ) +{ + GetSpecialParamState (REFLASH_BIOS, CurrentState); + return EFI_SUCCESS; +} + +/** + This will return BIOS Setup Boot Option. + True if the option is enabled. + + @param[in] This The address of protocol + @param[in] CurrentState Return the state of BIOS Setup Boot Opiton + + @retval EFI_SUCCESS The function completed successfully. +**/ +EFI_STATUS +EFIAPI +GetBiosSetupState ( + IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This, + IN OUT BOOLEAN *CurrentState + ) +{ + GetSpecialParamState (BIOS_SETUP, CurrentState); + return EFI_SUCCESS; +} + +/** + This will return BIOS Pause Boot Option. + True if the option is enabled. + + @param[in] This The address of protocol + @param[in] CurrentState Return the state of BIOS Pause Boot Opiton + + @retval EFI_SUCCESS The function completed successfully. +**/ +EFI_STATUS +EFIAPI +GetBiosPauseState ( + IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This, + IN OUT BOOLEAN *CurrentState + ) +{ + GetSpecialParamState (BIOS_PAUSE, CurrentState); + return EFI_SUCCESS; +} + +/** + This will return Console Lock Boot Option. + True if the option is enabled. + + @param[in] This The address of protocol + @param[in] CurrentState Return the state of BIOS Pause Boot Opiton + + @retval EFI_SUCCESS The function completed successfully. +**/ +EFI_STATUS +EFIAPI +GetConsoleLockState ( + IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This, + IN OUT BOOLEAN *CurrentState + ) +{ + GetBootOptionsMaskState (LOCK_KEYBOARD, CurrentState); + return EFI_SUCCESS; +} + +/** + This will return KVM Boot Option. + True if the option is enabled. + + @param[in] This The address of protocol + @param[in] CurrentState Return the state of KVM Boot Opiton + + @retval EFI_SUCCESS The function completed successfully. +**/ +EFI_STATUS +EFIAPI +GetKvmState ( + IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This, + IN OUT BOOLEAN *CurrentState + ) +{ + GetSpecialParamState (USE_KVM, CurrentState); + return EFI_SUCCESS; +} + +/** + Return current ASF Boot Options + + @param[in] This Pointer to the EFI_ACTIVE_MANAGEMENT_PROTOCOL instance. + @param[in] AsfBootOptions ASF Boot Options + + @retval EFI_SUCCESS Boot options updated +**/ +EFI_STATUS +EFIAPI +GetAsfBootOptions ( + IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This, + IN OUT EFI_ASF_BOOT_OPTIONS **AsfBootOptions + ) +{ + *AsfBootOptions = mAsfBootOptions; + return EFI_SUCCESS; +} + +/** + Disable these two driver of Sol & Ider + + @param[in] None +**/ +VOID +SolIderDisable ( + VOID + ) +{ + IderDisable (); + SolDisable (); +} + +/** + Disable Usbr + + @param[in] None +**/ +VOID +UsbrDisable ( + VOID + ) +{ + Usbr1Disable (); + Usbr2Disable (); +} + +/** + This will return progress event Option. + True if the option is enabled. + + @param[in] This The address of protocol + @param[in] CurrentState Return the state of progress event Opiton + + @retval EFI_SUCCESS The function completed successfully. +**/ +EFI_STATUS +EFIAPI +GetProgressMsgRequest ( + IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This, + IN OUT BOOLEAN *CurrentState + ) +{ + GetBootOptionsMaskState (FORCE_PROGRESS_EVENTS, CurrentState); + return EFI_SUCCESS; +} + +/** + Entry point for the Active Management Driver. + + @param[in] ImageHandle Image handle of this driver. + @param[in] SystemTable Global system service table. + + @retval EFI_SUCCESS Initialization complete. + @exception EFI_UNSUPPORTED The chipset is unsupported by this driver. + @retval EFI_OUT_OF_RESOURCES Do not have enough resources to initialize the driver. + @retval EFI_DEVICE_ERROR Device error, driver exits abnormally. +**/ +EFI_STATUS +EFIAPI +ActiveManagementEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + /// + /// Check policy if AMT is supported + /// + if (!AmtSupported () || !AsfSupported ()) { + SolIderDisable (); + UsbrDisable (); + return EFI_UNSUPPORTED; + } + /// + /// Get Protocol for ASF + /// + Status = gBS->LocateProtocol ( + &gEfiAlertStandardFormatProtocolGuid, + NULL, + (VOID **) &(ActiveManagementInstance.Asf) + ); + if (EFI_ERROR (Status)) { + return EFI_UNSUPPORTED; + } + /// + /// Get ASF Boot Options + /// + Status = ActiveManagementInstance.Asf->GetBootOptions (ActiveManagementInstance.Asf, &mAsfBootOptions); + if (EFI_ERROR (Status)) { + return EFI_UNSUPPORTED; + } + /// + /// Install the EFI_ACTIVE_MANAGEMENT_PROTOCOL interface + /// + Status = gBS->InstallMultipleProtocolInterfaces ( + &(ActiveManagementInstance.Handle), + &gEfiActiveManagementProtocolGuid, + &(ActiveManagementInstance.ActiveManagementProtocol), + NULL + ); + + return Status; +} diff --git a/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/ActiveManagement.dxs b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/ActiveManagement.dxs new file mode 100644 index 0000000..6c5fd38 --- /dev/null +++ b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/ActiveManagement.dxs @@ -0,0 +1,45 @@ +/** @file + Dependency expression source file. + +@copyright + Copyright (c) 2005 - 2012 Intel Corporation. All rights reserved + This software and associated documentation (if any) is furnished + under a license and may only be used or copied in accordance + with the terms of the license. Except as permitted by such + license, no part of this software or documentation may be + reproduced, stored in a retrieval system, or transmitted in any + form or by any means without the express written consent of + Intel Corporation. + + This file contains a 'Sample Driver' and is licensed as such + under the terms of your license agreement with Intel or your + vendor. This file may be modified by the user, subject to + the additional terms of the license agreement + +**/ + + +// +// Common for R8 and R9 codebase +// +#include "AutoGen.h" +#include "DxeDepex.h" + +// +// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase; +// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version +// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase. +// +#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB) +#include "EfiDepex.h" + +#include EFI_PROTOCOL_DEFINITION (AlertStandardFormat) +#include EFI_PROTOCOL_DEFINITION (AmtPlatformPolicy) +#include EFI_PROTOCOL_DEFINITION (MePlatformPolicy) +#endif + +DEPENDENCY_START + EFI_ALERT_STANDARD_FORMAT_PROTOCOL_GUID AND + DXE_PLATFORM_AMT_POLICY_GUID AND + DXE_PLATFORM_ME_POLICY_GUID +DEPENDENCY_END diff --git a/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/ActiveManagement.h b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/ActiveManagement.h new file mode 100644 index 0000000..72bb113 --- /dev/null +++ b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/ActiveManagement.h @@ -0,0 +1,272 @@ +/** @file + Header file for the Active Management Driver. + +@copyright + Copyright (c) 2004 - 2012 Intel Corporation. All rights + reserved This software and associated documentation (if any) + is furnished under a license and may only be used or copied in + accordance with the terms of the license. Except as permitted + by such license, no part of this software or documentation may + be reproduced, stored in a retrieval system, or transmitted in + any form or by any means without the express written consent + of Intel Corporation. + + This file contains an 'Intel Peripheral Driver' and uniquely + identified as "Intel Reference Module" and is + licensed for Intel CPUs and chipsets under the terms of your + license agreement with Intel or your vendor. This file may + be modified by the user, subject to additional terms of the + license agreement + +**/ +#ifndef _ACTIVE_MANAGEMENT_H_ +#define _ACTIVE_MANAGEMENT_H_ +#include "Amt.h" +#include "AmtLib.h" + +// +// Used during initialization +// +#include EFI_PROTOCOL_CONSUMER (AlertStandardFormat) + +// +// Driver Produced Protocols +// +#include EFI_PROTOCOL_PRODUCER (ActiveManagement) + +// +// Private data structure definitions for the driver +// +#define ACTIVE_MANAGEMENT_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('A', 'M', 'T', 'P') + +typedef struct { + UINTN Signature; + EFI_HANDLE Handle; + EFI_ACTIVE_MANAGEMENT_PROTOCOL ActiveManagementProtocol; + EFI_ALERT_STANDARD_FORMAT_PROTOCOL *Asf; +} ACTIVE_MANAGEMENT_INSTANCE; + +#define ACTIVE_MANAGEMENT_INSTANCE_FROM_ACTIVE_MANAGEMENT_PROTOCOL(a) \ + CR ( \ + a, \ + ACTIVE_MANAGEMENT_INSTANCE, \ + ActiveManagementProtocol, \ + ACTIVE_MANAGEMENT_PRIVATE_DATA_SIGNATURE \ + ) + +// +// Function prototypes used by the AMT protocol. +// + +/** + This will return IDE Redirection Boot Option. + True if the option is enabled. + + @param[in] This The address of protocol + @param[in] CurrentState Return the state of IDE Redireciton Boot Opiton + + @retval EFI_SUCCESS The function completed successfully. +**/ +EFI_STATUS +EFIAPI +GetIderState ( + IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This, + IN OUT BOOLEAN *CurrentState + ) +; + +/** + This will return IDE Redirection boot device to boot + + @param[in] This The address of protocol + @param[in] IdeBootDevice Return the boot device number to boot + Bits 0-1: If IDER boot is selected in Perimeter 1 then Bits 1,2 define the drive on the IDER controller to be used as the boot driver. + Bit 1 Bit0 + 0 0 Primary Master Drive + 0 1 Primary Slave Drive + 1 0 Secondary Master Drive + 1 1 Secondary Slave Drive + Bits 2-7: Reserved set to 0 + + @retval EFI_SUCCESS The function completed successfully. +**/ +EFI_STATUS +EFIAPI +GetIderBootDeviceSelectd ( + IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This, + IN OUT UINT8 *IdeBootDevice + ) +; + +/** + This will return Enforce Secure Boot over IDER Boot Option. + True if the option is enabled. + + @param[in] This The address of protocol + @param[in] CurrentState Return the state of Enforce Secure Boot over IDER Boot Option + + @retval EFI_SUCCESS The function completed successfully. +**/ +EFI_STATUS +EFIAPI +GetEnforceSecureBootState ( + IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This, + IN OUT BOOLEAN *CurrentState + ) +; + +/** + This will return Serial-over-Lan Boot Option. + True if the option is enabled. + + @param[in] This The address of protocol + @param[in] CurrentState Return the state of Serial-over-Lan Boot Opiton + + @retval EFI_SUCCESS The function completed successfully. +**/ +EFI_STATUS +EFIAPI +GetSolState ( + IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This, + IN OUT BOOLEAN *CurrentState + ) +; + +/** + This will return Remote Flash Boot Option. + True if the option is enabled. + + @param[in] This The address of protocol + @param[in] CurrentState Return the state of Remote Flash Boot Opiton + + @retval EFI_SUCCESS The function completed successfully. +**/ +EFI_STATUS +EFIAPI +GetRemoteFlashState ( + IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This, + IN OUT BOOLEAN *CurrentState + ) +; + +/** + This will return BIOS Setup Boot Option. + True if the option is enabled. + + @param[in] This The address of protocol + @param[in] CurrentState Return the state of BIOS Setup Boot Opiton + + @retval EFI_SUCCESS The function completed successfully. +**/ +EFI_STATUS +EFIAPI +GetBiosSetupState ( + IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This, + IN OUT BOOLEAN *CurrentState + ) +; + +/** + This will return BIOS Pause Boot Option. + True if the option is enabled. + + @param[in] This The address of protocol + @param[in] CurrentState Return the state of BIOS Pause Boot Opiton + + @retval EFI_SUCCESS The function completed successfully. +**/ +EFI_STATUS +EFIAPI +GetBiosPauseState ( + IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This, + IN OUT BOOLEAN *CurrentState + ) +; + +/** + This will return Console Lock Boot Option. + True if the option is enabled. + + @param[in] This The address of protocol + @param[in] CurrentState Return the state of BIOS Pause Boot Opiton + + @retval EFI_SUCCESS The function completed successfully. +**/ +EFI_STATUS +EFIAPI +GetConsoleLockState ( + IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This, + IN OUT BOOLEAN *CurrentState + ) +; + +/** + This will return KVM Boot Option. + True if the option is enabled. + + @param[in] This The address of protocol + @param[in] CurrentState Return the state of KVM Boot Opiton + + @retval EFI_SUCCESS The function completed successfully. +**/ +EFI_STATUS +EFIAPI +GetKvmState ( + IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This, + IN OUT BOOLEAN *CurrentState + ) +; + +/** + Return current ASF Boot Options + + @param[in] This Pointer to the EFI_ACTIVE_MANAGEMENT_PROTOCOL instance. + @param[in] AsfBootOptions ASF Boot Options + + @retval EFI_SUCCESS Boot options updated +**/ +EFI_STATUS +EFIAPI +GetAsfBootOptions ( + IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This, + IN OUT EFI_ASF_BOOT_OPTIONS **AsfBootOptions + ) +; + +/** + This will return progress event Option. + True if the option is enabled. + + @param[in] This The address of protocol + @param[in] CurrentState Return the state of progress event Opiton + + @retval EFI_SUCCESS The function completed successfully. +**/ +EFI_STATUS +EFIAPI +GetProgressMsgRequest ( + IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This, + IN OUT BOOLEAN *CurrentState + ) +; + +/** + Entry point for the Active Management Driver. + + @param[in] ImageHandle Image handle of this driver. + @param[in] SystemTable Global system service table. + + @retval EFI_SUCCESS Initialization complete. + @exception EFI_UNSUPPORTED The chipset is unsupported by this driver. + @retval EFI_OUT_OF_RESOURCES Do not have enough resources to initialize the driver. + @retval EFI_DEVICE_ERROR Device error, driver exits abnormally. +**/ +EFI_STATUS +EFIAPI +ActiveManagementEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +; + +#endif diff --git a/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/ActiveManagement.inf b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/ActiveManagement.inf new file mode 100644 index 0000000..3dd5fe3 --- /dev/null +++ b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/ActiveManagement.inf @@ -0,0 +1,100 @@ +## @file +# Component description file for the AMT driver. +# +#@copyright +# Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved +# This software and associated documentation (if any) is furnished +# under a license and may only be used or copied in accordance +# with the terms of the license. Except as permitted by such +# license, no part of this software or documentation may be +# reproduced, stored in a retrieval system, or transmitted in any +# form or by any means without the express written consent of +# Intel Corporation. +# +# This file contains a 'Sample Driver' and is licensed as such +# under the terms of your license agreement with Intel or your +# vendor. This file may be modified by the user, subject to +# the additional terms of the license agreement +# + +[defines] +BASE_NAME = ActiveManagement +FILE_GUID = D739F969-FB2D-4bc2-AFE7-081327D3FEDE +COMPONENT_TYPE = BS_DRIVER + +[sources.common] + ActiveManagement.h + ActiveManagement.c + +# +# Edk II Glue Driver Entry Point +# + EdkIIGlueDxeDriverEntryPoint.c + +[includes.common] + $(EDK_SOURCE)/Foundation + $(EDK_SOURCE)/Foundation/Efi + $(EDK_SOURCE)/Foundation/Include + $(EDK_SOURCE)/Foundation/Efi/Include + $(EDK_SOURCE)/Foundation/Framework + $(EDK_SOURCE)/Foundation/Framework/Include + $(EDK_SOURCE)/Foundation/Include/IndustryStandard + $(EDK_SOURCE)/Foundation/Core/Dxe + $(EDK_SOURCE)/Foundation/Library/Dxe/Include + $(EFI_SOURCE)/$(PROJECT_ME_ROOT) + $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Heci/Include + $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Include + $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/AMT/Dxe + $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/AMT/Include + $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Dxe + $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Include + $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include + +# +# Typically the sample code referenced will be available in the code base already +# So keep this include at the end to defer to the source base definition +# and only use the sample code definition if source base does not include these files. +# + $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/SampleCode/Include + +# +# Edk II Glue Library, some hearder are included by R9 header so have to include +# + + $(EFI_SOURCE) + $(EFI_SOURCE)/Framework + $(EDK_SOURCE)/Foundation + $(EDK_SOURCE)/Foundation/Framework + $(EDK_SOURCE)/Foundation/Include/IndustryStandard + $(EDK_SOURCE)/Foundation/Core/Dxe + $(EDK_SOURCE)/Foundation/Include/Pei + $(EDK_SOURCE)/Foundation/Library/Dxe/Include + $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include + +[libraries.common] + AmtLib + MeProtocolLib + MeLib + MeChipsetLib + EdkProtocolLib + EdkFrameworkProtocolLib + EdkIIGlueDxeReportStatusCodeLib + EdkIIGlueDxeDebugLibReportStatusCode + EdkIIGlueUefiBootServicesTableLib + EdkIIGlueUefiRuntimeServicesTableLib + EdkIIGlueBasePciLibPciExpress + EdkIIGlueBasePciExpressLib + +[nmake.common] + IMAGE_ENTRY_POINT = _ModuleEntryPoint + DPX_SOURCE = Activemanagement.dxs +# +# Module Entry Point +# + C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=ActiveManagementEntryPoint + C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \ + -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \ + -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\ + -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \ + -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ + |