TcgConfigImpl.c revision 4fd606d1f5abe38e1f42c38de1d2e895166bd0f4
/** @file
HII Config Access protocol implementation of TCG configuration module.
Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "TcgConfigImpl.h"
{
}
};
{
{
{
(UINT8) (sizeof (VENDOR_DEVICE_PATH)),
}
},
},
{
{
}
}
};
/**
Get current state of TPM device.
@param[in] TcgProtocol Point to EFI_TCG_PROTOCOL instance.
@param[out] TpmEnable Flag to indicate TPM is enabled or not.
@param[out] TpmActivate Flag to indicate TPM is activated or not.
@retval EFI_SUCCESS State is successfully returned.
@retval EFI_DEVICE_ERROR Failed to get TPM response.
@retval Others Other errors as indicated.
**/
)
{
//
// Get TPM Permanent flags (TpmEnable, TpmActivate)
//
sizeof (CmdBuf),
);
if (EFI_ERROR (Status) || (TpmRsp->tag != SwapBytes16 (TPM_TAG_RSP_COMMAND)) || (TpmRsp->returnCode != 0)) {
return EFI_DEVICE_ERROR;
}
TpmPermanentFlags = (TPM_PERMANENT_FLAGS *) &CmdBuf[sizeof (TPM_RSP_COMMAND_HDR) + sizeof (UINT32)];
}
if (TpmActivate != NULL) {
}
}
return EFI_SUCCESS;
}
/**
This function allows a caller to extract the current configuration for one
or more named elements from the target driver.
@param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
@param[in] Request A null-terminated Unicode string in
<ConfigRequest> format.
@param[out] Progress On return, points to a character in the Request
string. Points to the string's null terminator if
request was successful. Points to the most recent
the beginning of the string if the failure is in
successful.
@param[out] Results A null-terminated Unicode string in
<ConfigAltResp> format which has all values filled
in for the names in the Request string. String to
be allocated by the called function.
@retval EFI_SUCCESS The Results is filled with the requested values.
@retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
@retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown name.
@retval EFI_NOT_FOUND Routing data doesn't match any storage in this
driver.
**/
)
{
return EFI_INVALID_PARAMETER;
}
return EFI_NOT_FOUND;
}
Size = 0;
//
// Convert buffer data to <ConfigResp> by helper function BlockToConfig()
//
//
// Read the original value of HideTpm from PrivateData which won't be changed by Setup in this boot.
//
//
// Display current TPM state.
//
return Status;
}
sizeof (State),
L"%s, and %s",
);
}
BufferSize = sizeof (Configuration);
//
// Request has no request element, construct full request string.
// Allocate and fill a buffer large enough to hold the <ConfigHdr> template
// followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a Null-terminator
//
ConfigRequestHdr = HiiConstructConfigHdr (&gTcgConfigFormSetGuid, mTcgStorageName, PrivateData->DriverHandle);
UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64) BufferSize);
}
(UINT8 *) &Configuration,
);
//
// Free the allocated config request string.
//
if (AllocatedRequest) {
}
//
// Set Progress string to the original request string.
//
}
return Status;
}
/**
This function processes the results of changes in configuration.
@param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
@param[in] Configuration A null-terminated Unicode string in <ConfigResp>
format.
@param[out] Progress A pointer to a string filled in with the offset of
the most recent '&' before the first failing
the terminating NULL if all was successful.
@retval EFI_SUCCESS The Results is processed successfully.
@retval EFI_INVALID_PARAMETER Configuration is NULL.
@retval EFI_NOT_FOUND Routing data doesn't match any storage in this
driver.
**/
)
{
return EFI_INVALID_PARAMETER;
}
return EFI_NOT_FOUND;
}
//
// Convert <ConfigResp> to buffer data by helper function ConfigToBlock()
//
BufferSize = sizeof (TCG_CONFIGURATION);
(UINT8 *) &TcgConfiguration,
);
return Status;
}
return EFI_SUCCESS;
}
/**
Save TPM request to variable space.
@param[in] PpRequest Physical Presence request command.
@retval EFI_SUCCESS The operation is finished successfully.
@retval Others Other errors as indicated.
**/
)
{
//
// Save TPM command to variable.
//
DataSize = sizeof (EFI_PHYSICAL_PRESENCE);
NULL,
&DataSize,
);
return Status;
}
);
return Status;
}
return EFI_SUCCESS;
}
/**
This function processes the results of changes in configuration.
@param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
@param[in] Action Specifies the type of action taken by the browser.
@param[in] QuestionId A unique value which is sent to the original
exporting driver so that it can identify the type
of data to expect.
@param[in] Type The type of value for the question.
@param[in] Value A pointer to the data being sent to the original
exporting driver.
@param[out] ActionRequest On return, points to the action requested by the
callback function.
@retval EFI_SUCCESS The callback successfully handled the action.
@retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the
variable and its data.
@retval EFI_DEVICE_ERROR The variable could not be saved.
@retval EFI_UNSUPPORTED The specified Action is not supported by the
callback.
**/
)
{
return EFI_INVALID_PARAMETER;
}
return EFI_UNSUPPORTED;
}
return EFI_SUCCESS;
}
/**
This function publish the TCG configuration Form for TPM device.
@param[in, out] PrivateData Points to TCG configuration private data.
@retval EFI_SUCCESS HII Form is installed for this network device.
@retval EFI_OUT_OF_RESOURCES Not enough resource for HII Form installation.
@retval Others Other errors as indicated.
**/
)
{
DriverHandle = NULL;
);
return Status;
}
//
// Publish the HII package list
//
);
);
return EFI_OUT_OF_RESOURCES;
}
//
// Remove the Hide TPM question from the IFR
//
if (!PcdGetBool (PcdHideTpmSupport)) {
//
// Allocate space for creation of UpdateData Buffer
//
//
// Create Hii Extend Label OpCode as the start opcode
//
StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
//
// Create Hii Extend Label OpCode as the end opcode
//
EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
}
return EFI_SUCCESS;
}
/**
This function removes TCG configuration Form.
@param[in, out] PrivateData Points to TCG configuration private data.
**/
)
{
//
// Uninstall HII package list
//
}
//
// Uninstall HII Config Access Protocol
//
);
}
}