/** 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. **/ EFI_STATUS EFIAPI TrEECallback ( IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN EFI_BROWSER_ACTION Action, IN EFI_QUESTION_ID QuestionId, IN UINT8 Type, IN EFI_IFR_TYPE_VALUE *Value, OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest ) { if ((This == NULL) || (Value == NULL) || (ActionRequest == NULL)) { return EFI_INVALID_PARAMETER; } if (Action == EFI_BROWSER_ACTION_CHANGED) { if (QuestionId == KEY_TPM_DEVICE) { return EFI_SUCCESS; } if (QuestionId == KEY_TPM2_OPERATION) { return SaveTrEEPpRequest (Value->u8); } } return EFI_UNSUPPORTED; }
/** 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 name/value pair (or the beginning of the string if the failure is in the first name/value pair) or 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. **/ EFI_STATUS EFIAPI TrEERouteConfig ( IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Configuration, OUT EFI_STRING *Progress ) { EFI_STATUS Status; UINTN BufferSize; TREE_CONFIGURATION TrEEConfiguration; if (Configuration == NULL || Progress == NULL) { return EFI_INVALID_PARAMETER; } *Progress = Configuration; if (!HiiIsConfigHdrMatch (Configuration, &gTrEEConfigFormSetGuid, TREE_STORAGE_NAME)) { return EFI_NOT_FOUND; } BufferSize = sizeof (TrEEConfiguration); Status = gRT->GetVariable ( TREE_STORAGE_NAME, &gTrEEConfigFormSetGuid, NULL, &BufferSize, &TrEEConfiguration ); ASSERT_EFI_ERROR (Status); // // Convert <ConfigResp> to buffer data by helper function ConfigToBlock() // BufferSize = sizeof (TREE_CONFIGURATION); Status = gHiiConfigRouting->ConfigToBlock ( gHiiConfigRouting, Configuration, (UINT8 *) &TrEEConfiguration, &BufferSize, Progress ); if (EFI_ERROR (Status)) { return Status; } // // Save to variable so platform driver can get it. // Status = gRT->SetVariable ( TREE_STORAGE_NAME, &gTrEEConfigFormSetGuid, EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, sizeof(TrEEConfiguration), &TrEEConfiguration ); SaveTrEEPpRequest (TrEEConfiguration.Tpm2Operation ); return Status; }