From b7c51c9cf4864df6aabb99a1ae843becd577237c Mon Sep 17 00:00:00 2001 From: raywu Date: Fri, 15 Jun 2018 00:00:50 +0800 Subject: init. 1AQQW051 --- .../AlertStandardFormat/AlertStandardFormat.c | 32 ++++ .../AlertStandardFormat/AlertStandardFormat.h | 185 +++++++++++++++++++++ 2 files changed, 217 insertions(+) create mode 100644 ReferenceCode/ME/Protocol/AlertStandardFormat/AlertStandardFormat.c create mode 100644 ReferenceCode/ME/Protocol/AlertStandardFormat/AlertStandardFormat.h (limited to 'ReferenceCode/ME/Protocol/AlertStandardFormat') diff --git a/ReferenceCode/ME/Protocol/AlertStandardFormat/AlertStandardFormat.c b/ReferenceCode/ME/Protocol/AlertStandardFormat/AlertStandardFormat.c new file mode 100644 index 0000000..256fed5 --- /dev/null +++ b/ReferenceCode/ME/Protocol/AlertStandardFormat/AlertStandardFormat.c @@ -0,0 +1,32 @@ +/** @file + Definition of Alert Standard Format (ASF) 2.0 + +@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 +**/ + +// +// 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 EFI_PROTOCOL_DEFINITION (AlertStandardFormat) +#endif + +EFI_GUID gEfiAlertStandardFormatProtocolGuid = EFI_ALERT_STANDARD_FORMAT_PROTOCOL_GUID; + +EFI_GUID_STRING + (&gEfiAlertStandardFormatProtocolGuid, "Alert Standard Format Protocol", "Alert Standard Format Protocol"); diff --git a/ReferenceCode/ME/Protocol/AlertStandardFormat/AlertStandardFormat.h b/ReferenceCode/ME/Protocol/AlertStandardFormat/AlertStandardFormat.h new file mode 100644 index 0000000..3d4bf3b --- /dev/null +++ b/ReferenceCode/ME/Protocol/AlertStandardFormat/AlertStandardFormat.h @@ -0,0 +1,185 @@ +/** @file + Definition of Alert Standard Format (ASF) 2.0 + +@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 +**/ +#ifndef __ALERT_STANDARD_FORMAT_PROTOCOL_H__ +#define __ALERT_STANDARD_FORMAT_PROTOCOL_H__ + +/// +/// Alert Standard Format Protocol +/// This protocol provides interfaces to get ASF Boot Options and send ASF messages +/// +#define EFI_ALERT_STANDARD_FORMAT_PROTOCOL_GUID \ + { \ + 0xcc93a70b, 0xec27, 0x49c5, 0x8b, 0x34, 0x13, 0x93, 0x1e, 0xfe, 0xd6, 0xe2 \ + } + +typedef struct _EFI_ALERT_STANDARD_FORMAT_PROTOCOL EFI_ALERT_STANDARD_FORMAT_PROTOCOL; + +#pragma pack(1) +typedef struct { + UINT8 SubCommand; + UINT8 Version; + UINT32 IanaId; + UINT8 SpecialCommand; + UINT16 SpecialCommandParam; + UINT16 BootOptions; + UINT16 OemParameters; +} EFI_ASF_BOOT_OPTIONS; + +typedef struct { + UINT8 SubCommand; + UINT8 Version; + UINT8 EventSensorType; + UINT8 EventType; + UINT8 EventOffset; + UINT8 EventSourceType; + UINT8 EventSeverity; + UINT8 SensorDevice; + UINT8 SensorNumber; + UINT8 Entity; + UINT8 EntityInstance; + UINT8 Data0; + UINT8 Data1; +} EFI_ASF_MESSAGE; + +typedef struct { + UINT8 SubCommand; + UINT8 Version; +} EFI_ASF_CLEAR_BOOT_OPTIONS; +#pragma pack() +// +// Special Command Attributes +// +#define NOP 0x00 +#define FORCE_PXE 0x01 +#define FORCE_HARDDRIVE 0x02 +#define FORCE_SAFEMODE 0x03 +#define FORCE_DIAGNOSTICS 0x04 +#define FORCE_CDDVD 0x05 + +// +// Boot Options Mask +// +#define LOCK_POWER_BUTTON 0x0002 ///< 0000 0000 0000 0010 - bit 1 +#define LOCK_RESET_BUTTON 0x0004 ///< 0000 0000 0000 0200 - bit 2 +#define LOCK_KEYBOARD 0x0020 ///< 0000 0000 0010 0000 - bit 5 +#define LOCK_SLEEP_BUTTON 0x0040 ///< 0000 0000 0100 0000 - bit 6 +#define USER_PASSWORD_BYPASS 0x0800 ///< 0000 1000 0000 0000 - bit 3 +#define FORCE_PROGRESS_EVENTS 0x1000 ///< 0001 0000 0000 0000 - bit 4 +#define FIRMWARE_VERBOSITY_DEFAULT 0x0000 ///< 0000 0000 0000 0000 - bit 6:5 +#define FIRMWARE_VERBOSITY_QUIET 0x2000 ///< 0010 0000 0000 0000 - bit 6:5 +#define FIRMWARE_VERBOSITY_VERBOSE 0x4000 ///< 0100 0000 0000 0000 - bit 6:5 +#define FIRMWARE_VERBOSITY_BLANK 0x6000 ///< 0110 0000 0000 0000 - bit 6:5 +#define CONFIG_DATA_RESET 0x8000 ///< 1000 0000 0000 0000 - bit 7 +#define ASF_BOOT_OPTIONS_PRESENT 0x16 +#define ASF_BOOT_OPTIONS_NOT_PRESENT 0x17 + +#define USE_KVM 0x0020 ///< 0000 0000 0010 0000 - bit 5 +/// +/// ASF Internet Assigned Numbers Authority Manufacturer ID +/// (The firmware sends 0XBE110000 for decimal value 4542) +/// +#define INDUSTRY_IANA_SWAP32(x) ((((x) & 0xff) << 24) | (((x) & 0xff00) << 8) | \ + (((x) & 0xff0000) >> 8) | (((x) & 0xff000000) >> 24)) +#define ASF_INDUSTRY_IANA 0x000011BE +#define ASF_INDUSTRY_CONVERTED_IANA INDUSTRY_IANA_SWAP32 (ASF_INDUSTRY_IANA) ///< 0XBE110000, received from ME FW + +/** + Return the SMBus address used by the ASF driver. + Not applicable in Intel ME/HECI system, need to return EFI_UNSUPPORTED. + + @retval EFI_SUCCESS Address returned + @retval EFI_INVALID_PARAMETER Invalid SMBus address +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_ALERT_STANDARD_FORMAT_PROTOCOL_GET_SMBUSADDR) ( + IN EFI_ALERT_STANDARD_FORMAT_PROTOCOL *This, + OUT UINTN *SmbusDeviceAddress + ) +; + +/** + Set the SMBus address used by the ASF driver. 0 is an invalid address. + Not applicable in Intel ME/HECI system, need to return EFI_UNSUPPORTED. + + @param[in] SmbusAddr SMBus address of the controller + + @retval EFI_SUCCESS Address set + @retval EFI_INVALID_PARAMETER Invalid SMBus address +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_ALERT_STANDARD_FORMAT_PROTOCOL_SET_SMBUSADDR) ( + IN EFI_ALERT_STANDARD_FORMAT_PROTOCOL *This, + IN UINTN SmbusDeviceAddress + ) +; + +/** + Return the ASF Boot Options obtained from the controller. If the + Boot Options parameter is NULL and no boot options have been retrieved, + Query the ASF controller for its boot options. + Get ASF Boot Options through HECI. + + @param[in] AsfBootOptions Pointer to ASF boot options to copy current ASF Boot options + + @retval EFI_SUCCESS Boot options copied + @retval EFI_NOT_READY No boot options +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_ALERT_STANDARD_FORMAT_PROTOCOL_GET_BOOT_OPTIONS) ( + IN EFI_ALERT_STANDARD_FORMAT_PROTOCOL *This, + IN OUT EFI_ASF_BOOT_OPTIONS **AsfBootOptions + ) +; + +/** + Send ASF Message. + Send ASF Message through HECI. + + @param[in] AsfMessage Pointer to ASF message + + @retval EFI_SUCCESS Boot options copied + @retval EFI_INVALID_PARAMETER Invalid pointer + @retval EFI_NOT_READY No controller +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_ALERT_STANDARD_FORMAT_PROTOCOL_SEND_ASF_MESSAGE) ( + IN EFI_ALERT_STANDARD_FORMAT_PROTOCOL *This, + IN EFI_ASF_MESSAGE *AsfMessage + ) +; + +/// +/// Alert Standard Format Protocol +/// This protocol provides interfaces to get ASF Boot Options and send ASF messages +/// HECI protocol is consumed and used to send ASF messages and receive ASF Boot Options +/// +struct _EFI_ALERT_STANDARD_FORMAT_PROTOCOL { + EFI_ALERT_STANDARD_FORMAT_PROTOCOL_GET_SMBUSADDR GetSmbusAddr; + EFI_ALERT_STANDARD_FORMAT_PROTOCOL_SET_SMBUSADDR SetSmbusAddr; + EFI_ALERT_STANDARD_FORMAT_PROTOCOL_GET_BOOT_OPTIONS GetBootOptions; + EFI_ALERT_STANDARD_FORMAT_PROTOCOL_SEND_ASF_MESSAGE SendAsfMessage; +}; + +extern EFI_GUID gEfiAlertStandardFormatProtocolGuid; + +#endif -- cgit v1.2.3