feat: [ADL/RLL] API for getting extended support period info

HECI interface for getting extended support license period.
Efi test is added to call the EPS API for validation.

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
This commit is contained in:
Subash Lakkimsetti 2023-05-26 11:55:14 -07:00
parent 799efaddac
commit 243976f438
3 changed files with 128 additions and 0 deletions

View File

@ -129,4 +129,19 @@ HeciGetFipsMode (
OUT GET_FIPS_MODE_DATA *GetFipsModeData
);
/**
Get EPS (Extended Period State) information
@retval EFI_UNSUPPORTED Current ME mode doesn't support this function
@retval EFI_SUCCESS Command succeeded
@retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
@retval EFI_TIMEOUT HECI does not return the buffer before timeout
@retval EFI_BUFFER_TOO_SMALL Message Buffer is too small for the Acknowledge
**/
EFI_STATUS
EFIAPI
HeciGetEpsState (
OUT EPS_GET_STATE_INFO *GetEpsStateInfo
);
#endif

View File

@ -721,3 +721,72 @@ HeciGetFipsMode (
return Status;
}
/**
Get EPS (Extended Period State) information
@retval EFI_UNSUPPORTED Current ME mode doesn't support this function
@retval EFI_SUCCESS Command succeeded
@retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
@retval EFI_TIMEOUT HECI does not return the buffer before timeout
@retval EFI_BUFFER_TOO_SMALL Message Buffer is too small for the Acknowledge
**/
EFI_STATUS
EFIAPI
HeciGetEpsState (
OUT EPS_GET_STATE_INFO *GetEpsStateInfo
)
{
EPS_GET_STATE_BUFFER GetEpsState;
UINT32 Length;
UINT32 RecvLength;
EFI_STATUS Status;
UINT32 MeMode;
Status = HeciGetMeMode (&MeMode);
if (EFI_ERROR (Status) || (MeMode != ME_MODE_NORMAL)) {
return EFI_UNSUPPORTED;
}
GetEpsState.Request.MkhiHeader.Data = 0;
GetEpsState.Request.MkhiHeader.Fields.GroupId = MKHI_EPS_GROUP_ID;
GetEpsState.Request.MkhiHeader.Fields.Command = EPS_GET_STATE_CMD;
Length = sizeof (EPS_GET_STATE);
RecvLength = sizeof (EPS_GET_STATE_ACK);
///
/// Send Get EPS state Mode Request to ME
///
Status = HeciSendwAck (
HECI1_DEVICE,
(UINT32 *) &GetEpsState,
Length,
&RecvLength,
BIOS_FIXED_HOST_ADDR,
HECI_MKHI_MESSAGE_ADDR
);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "HeciGetEpsState: Message failed! EFI_STATUS = %r\n", Status));
return Status;
}
if ((GetEpsState.Response.MkhiHeader.Fields.Command == EPS_GET_STATE_CMD) &&
(GetEpsState.Response.MkhiHeader.Fields.IsResponse == 1) &&
(GetEpsState.Response.MkhiHeader.Fields.Result == MkhiStatusSuccess)) {
*GetEpsStateInfo = GetEpsState.Response.eps_info;
DEBUG ((DEBUG_INFO, "delivery_method =%d\n", GetEpsStateInfo->delivery_method));
DEBUG ((DEBUG_INFO, "license_requested =%d\n", GetEpsStateInfo->license_requested));
DEBUG ((DEBUG_INFO, "license_installed =%d\n", GetEpsStateInfo->license_installed));
DEBUG ((DEBUG_INFO, "license_permits =%d\n", GetEpsStateInfo->license_permits));
} else {
DEBUG ((DEBUG_INFO, "Error in EPS Info population \n"));
return EFI_DEVICE_ERROR;
}
return Status;
}

View File

@ -61,6 +61,15 @@
#define GEN_SET_FIPS_MODE_CMD 0x20
#define GEN_GET_FIPS_MODE_CMD 0x21
///
/// DEFINES FOR EPS_GROUP command
///
#define MKHI_EPS_GROUP_ID 0x21
#define EPS_SET_STATE_CMD 0x1
#define EPS_GET_STATE_CMD 0x2
#define EPS_GET_PLATFORM_ID_STATE_CMD 0x3
#define EPS_INSTALL_LICENSE_CMD 0x4
#pragma pack(1)
//
@ -348,6 +357,41 @@ typedef union {
OEM_KEY_STATUS_ACK Response;
} OEM_KEY_STATUS_BUFFER;
///
/// Get Extended Period State (EPS) info
///
typedef struct
{
MKHI_MESSAGE_HEADER MkhiHeader;
} EPS_GET_STATE;
typedef enum
{
EPS_DELIVERY_METHOD_NOT_SET = 0,
EPS_DELIVERY_METHOD_MANAGED = 1,
EPS_DELIVERY_METHOD_AUTO = 2,
} EPS_DELIVERY_METHOD;
typedef struct
{
EPS_DELIVERY_METHOD delivery_method;
UINT8 license_requested;
UINT8 license_installed;
UINT8 license_permits;
UINT8 reserved;
} EPS_GET_STATE_INFO;
typedef struct
{
MKHI_MESSAGE_HEADER MkhiHeader;
EPS_GET_STATE_INFO eps_info;
} EPS_GET_STATE_ACK;
typedef union {
EPS_GET_STATE Request;
EPS_GET_STATE_ACK Response;
} EPS_GET_STATE_BUFFER;
#pragma pack()
#endif // _MKHI_MSGS_COMMON_H_