11#include <Library/BaseMemoryLib.h>
15#include <Library/UefiBootServicesTableLib.h>
35 IN UINT32 *MessageBody,
56 DEBUG ((DEBUG_INFO,
"OCME: No ME protocol loaded, cannot read message\n"));
87 DEBUG ((DEBUG_INFO,
"OCME: No ME protocol loaded, cannot send message\n"));
102 Status =
gBS->LocateProtocol (
108 if (EFI_ERROR (Status)) {
109 DEBUG ((DEBUG_INFO,
"OCME: Falling back to HECI 2 protocol - %r\n", Status));
116 Status =
gBS->LocateProtocol (
123 if (EFI_ERROR (Status)) {
124 DEBUG ((DEBUG_INFO,
"OCME: Failed to find any HECI protocol - %r\n", Status));
156 OUT VOID *MessageData,
157 IN UINT32 ResponseSize
163 Status = EFI_NOT_READY;
168 ZeroMem (MessageData, ResponseSize);
187 if (!EFI_ERROR (Status)) {
198 if (!EFI_ERROR (Status)) {
208 IN OUT VOID *MessageData,
209 IN UINT32 RequestSize,
210 IN UINT32 ResponseSize
229 if (!EFI_ERROR (Status)) {
232 if ( !EFI_ERROR (Status)
235 Status = EFI_PROTOCOL_ERROR;
246 OUT UINT8 *ClientMap,
247 OUT UINT8 *ClientActiveCount
254 UINT8 *ValidAddressesPtr;
255 UINT32 ValidAddresses;
257 *ClientActiveCount = 0;
260 if (EFI_ERROR (Status)) {
276 if (EFI_ERROR (Status)) {
280 ValidAddressesPtr = &
Command.Response.ValidAddresses[0];
282 ValidAddresses = *ValidAddressesPtr;
285 if ((ValidAddresses & (1U << Index2)) != 0) {
286 ClientMap[*ClientActiveCount] = (UINT8)(Index + Index2);
287 ++(*ClientActiveCount);
307 if (EFI_ERROR (Status)) {
316 Command.Request.Address = Address;
326 &
Command.Response.ClientProperties,
342 if (EFI_ERROR (Status)) {
350 Command.Request.MeAddress = Address;
359 DEBUG ((DEBUG_INFO,
"OCME: Connect to client %X code %d - %r\n", Address,
Command.Response.Status, Status));
361 if (EFI_ERROR (Status)) {
365 switch (
Command.Response.Status) {
367 return EFI_NOT_FOUND;
369 return EFI_ALREADY_STARTED;
371 return EFI_OUT_OF_RESOURCES;
373 return EFI_INVALID_PARAMETER;
391 Status = EFI_SUCCESS;
405 if (!EFI_ERROR (Status)) {
421 Status = EFI_SUCCESS;
451 "OCME: Disconnect from client %X code %d - %r\n",
457 if (!EFI_ERROR (Status)) {
467 OUT UINT32 *EpidStatus,
468 OUT UINT32 *EpidGroupId
485 if (!EFI_ERROR (Status)) {
486 *EpidStatus =
Command.Response.Status;
487 *EpidGroupId =
Command.Response.GroupId;
497 OUT BOOLEAN *
SetVar OPTIONAL
520 if (EFI_ERROR (Status)) {
521 DEBUG ((DEBUG_INFO,
"OCME: Failed to send provisioning command - %r\n", Status));
522 return EFI_DEVICE_ERROR;
525 for (Index = 0; Index < 3; ++Index) {
527 if (Status != EFI_TIMEOUT) {
534 "OCME: Finished provisioning command with status %x - %r\n",
535 Command.Response.Header.Status,
539 if (EFI_ERROR (Status)) {
540 return EFI_DEVICE_ERROR;
544 Status = EFI_DEVICE_ERROR;
558 OUT UINT32 *FpfStatus
565 ZeroMem (Request,
sizeof (Request));
569 ZeroMem (Response,
sizeof (Response));
572 if (!EFI_ERROR (Status)) {
573 *FpfStatus = Response[1];
581 OUT UINT32 *FpfStatus
588 ZeroMem (Request,
sizeof (Request));
594 ZeroMem (Response,
sizeof (Response));
597 if (!EFI_ERROR (Status)) {
598 *FpfStatus = Response[1];
UINT8 Command[7]
Actual command for the Command Page.
STATIC EFI_STATUS SetVar(UINTN Line, CHAR8 *Token, BOOLEAN IsIndented, BOOLEAN ContainsVars)
#define HECI_DEFAULT_DEVICE
EFI_GUID gEfiHeci2ProtocolGuid
EFI_GUID gEfiHeciProtocolGuid
#define ME_PAVP_PROVISION_PERFORM_COMMAND
#define ME_PAVP_PROVISION_REQUEST_COMMAND
#define ME_PAVP_PROVISION_PERFORM_PAYLOAD_SIZE
#define EPID_STATUS_PROVISIONED
#define ME_PAVP_PROTOCOL_VERSION
#define EPID_STATUS_FAIL_PROVISION
#define CLIENT_CONNECT_REQUEST
#define HBM_CLIENT_CONNECT_ALREADY_CONNECTED
#define HBM_CLIENT_CONNECT_OUT_OF_RESOURCES
#define HBM_CLIENT_CONNECT_INVALID_PARAMETER
#define CLIENT_DISCONNECT_REQUEST
#define HBM_CLIENT_CONNECT_NOT_FOUND
#define HBM_CLIENT_ADDRESS
#define HOST_ENUMERATION_REQUEST
#define HOST_CLIENT_PROPERTIES_REQUEST
#define HBM_ME_CLIENT_MAX
DMG_SIZE_DEVICE_PATH Size
STATIC_ASSERT(BYTES_PER_PIXEL==sizeof(UINT32), "Non 4-byte pixels are unsupported!")
EFI_STATUS HeciDisconnectFromClients(VOID)
STATIC BOOLEAN mSendingHeciCommand
STATIC EFI_HECI_PROTOCOL * mHeci
STATIC BOOLEAN mSendingHeciCommandPerClient
EFI_STATUS HeciPavpPerformProvisioning(IN EPID_CERTIFICATE *EpidCertificate, IN EPID_GROUP_PUBLIC_KEY *EpidGroupPublicKey, OUT BOOLEAN *SetVar OPTIONAL)
EFI_STATUS HeciPavpRequestProvisioning(OUT UINT32 *EpidStatus, OUT UINT32 *EpidGroupId)
EFI_STATUS HeciReadMessage(IN UINT32 Blocking, IN UINT32 *MessageBody, IN OUT UINT32 *Length)
EFI_STATUS HeciGetResponse(OUT VOID *MessageData, IN UINT32 ResponseSize)
EFI_STATUS HeciLocateProtocol(VOID)
EFI_STATUS HeciConnectToClient(IN UINT8 Address)
STATIC UINT8 mCurrentMeClientAddress
EFI_STATUS HeciFpfGetStatus(OUT UINT32 *FpfStatus)
EFI_STATUS HeciFpfProvision(OUT UINT32 *FpfStatus)
STATIC UINT8 mCurrentMeClientCanReceiveMsg
VOID HeciUpdateReceiveMsgStatus(VOID)
EFI_STATUS HeciSendMessagePerClient(IN VOID *Message, IN UINT32 Size)
EFI_STATUS HeciGetClientMap(OUT UINT8 *ClientMap, OUT UINT8 *ClientActiveCount)
STATIC EFI_HECI2_PROTOCOL * mHeci2
EFI_STATUS HeciSendMessageWithResponse(IN OUT VOID *MessageData, IN UINT32 RequestSize, IN UINT32 ResponseSize)
STATIC UINT8 mCurrentMeClientRequestedReceiveMsg
EFI_STATUS HeciSendMessage(IN UINT32 *Message, IN UINT32 Length, IN UINT8 HostAddress, IN UINT8 MEAddress)
EFI_STATUS HeciGetClientProperties(IN UINT8 Address, OUT HECI_CLIENT_PROPERTIES *Properties)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
EFI_HECI2_READ_MESSAGE ReadMsg
EFI_HECI2_SEND_MESSAGE SendMsg
EFI_HECI_SEND_MESSAGE SendMsg
EFI_HECI_READ_MESSAGE ReadMsg
struct HBM_COMMAND::@63 Fields