| OLD | NEW |
| 1 /* Copyright (c) 2011 The Chromium OS Authors. All rights reserved. | 1 /* Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
| 2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
| 4 * | 4 * |
| 5 * High-level firmware API for loading and verifying rewritable firmware. | 5 * High-level firmware API for loading and verifying rewritable firmware. |
| 6 * (Firmware portion) | 6 * (Firmware portion) |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "gbb_header.h" | 9 #include "gbb_header.h" |
| 10 #include "load_firmware_fw.h" | 10 #include "load_firmware_fw.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 shared->fw_version_tpm_start = tpm_version; | 127 shared->fw_version_tpm_start = tpm_version; |
| 128 shared->fw_version_tpm = tpm_version; | 128 shared->fw_version_tpm = tpm_version; |
| 129 VBPERFEND("VB_TPMI"); | 129 VBPERFEND("VB_TPMI"); |
| 130 | 130 |
| 131 /* Read try-b count and decrement if necessary */ | 131 /* Read try-b count and decrement if necessary */ |
| 132 VbNvGet(vnc, VBNV_TRY_B_COUNT, &try_b_count); | 132 VbNvGet(vnc, VBNV_TRY_B_COUNT, &try_b_count); |
| 133 if (0 != try_b_count) { | 133 if (0 != try_b_count) { |
| 134 VbNvSet(vnc, VBNV_TRY_B_COUNT, try_b_count - 1); | 134 VbNvSet(vnc, VBNV_TRY_B_COUNT, try_b_count - 1); |
| 135 shared->flags |= VBSD_FWB_TRIED; | 135 shared->flags |= VBSD_FWB_TRIED; |
| 136 } | 136 } |
| 137 VbNvSet(vnc, VBNV_TRIED_FIRMWARE_B, try_b_count ? 1 : 0); | |
| 138 | 137 |
| 139 /* Allocate our internal data */ | 138 /* Allocate our internal data */ |
| 140 lfi = (VbLoadFirmwareInternal*)Malloc(sizeof(VbLoadFirmwareInternal)); | 139 lfi = (VbLoadFirmwareInternal*)Malloc(sizeof(VbLoadFirmwareInternal)); |
| 141 if (!lfi) | 140 if (!lfi) |
| 142 return LOAD_FIRMWARE_RECOVERY; | 141 return LOAD_FIRMWARE_RECOVERY; |
| 143 | 142 |
| 144 params->load_firmware_internal = (uint8_t*)lfi; | 143 params->load_firmware_internal = (uint8_t*)lfi; |
| 145 | 144 |
| 146 /* Loop over indices */ | 145 /* Loop over indices */ |
| 147 for (i = 0; i < 2; i++) { | 146 for (i = 0; i < 2; i++) { |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 uint32_t status = RollbackS3Resume(); | 397 uint32_t status = RollbackS3Resume(); |
| 399 | 398 |
| 400 /* If we can't resume, just do a full reboot. No need to go to recovery | 399 /* If we can't resume, just do a full reboot. No need to go to recovery |
| 401 * mode here, since if the TPM is really broken we'll catch it on the | 400 * mode here, since if the TPM is really broken we'll catch it on the |
| 402 * next boot. */ | 401 * next boot. */ |
| 403 if (status == TPM_SUCCESS) | 402 if (status == TPM_SUCCESS) |
| 404 return LOAD_FIRMWARE_SUCCESS; | 403 return LOAD_FIRMWARE_SUCCESS; |
| 405 else | 404 else |
| 406 return LOAD_FIRMWARE_REBOOT; | 405 return LOAD_FIRMWARE_REBOOT; |
| 407 } | 406 } |
| OLD | NEW |