Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Side by Side Diff: firmware/stub/load_firmware_stub.c

Issue 6597018: Add LoadFirmware() support for NvStorage API (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/vboot_reference.git@master
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « firmware/lib/vboot_firmware.c ('k') | utility/load_firmware_test.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 /* Copyright (c) 2010 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 * TEMPORARY stub for calling LoadFirmware() which looks like the old 5 * TEMPORARY stub for calling LoadFirmware() which looks like the old
6 * VerifyFirmwareDriver_f() call. 6 * VerifyFirmwareDriver_f() call.
7 * (Firmware portion) 7 * (Firmware portion)
8 */ 8 */
9 9
10 #include "load_firmware_fw.h" 10 #include "load_firmware_fw.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 int VerifyFirmwareDriver_stub(uint8_t* root_key_blob, 66 int VerifyFirmwareDriver_stub(uint8_t* root_key_blob,
67 uint8_t* verification_headerA, 67 uint8_t* verification_headerA,
68 uint8_t* firmwareA, 68 uint8_t* firmwareA,
69 uint8_t* verification_headerB, 69 uint8_t* verification_headerB,
70 uint8_t* firmwareB) { 70 uint8_t* firmwareB) {
71 71
72 int rv; 72 int rv;
73 73
74 CallerInternal ci; 74 CallerInternal ci;
75 LoadFirmwareParams p; 75 LoadFirmwareParams p;
76 VbNvContext vnc;
77
78 /* TODO: YOU SHOULD CALL LoadFirmwareSetup() AS SOON AS THE TPM
79 * INTERFACE IS AVAILABLE */
80 LoadFirmwareSetup();
76 81
77 /* Copy the firmware volume pointers to our global variables. */ 82 /* Copy the firmware volume pointers to our global variables. */
78 ci.firmwareA = firmwareA; 83 ci.firmwareA = firmwareA;
79 ci.firmwareB = firmwareB; 84 ci.firmwareB = firmwareB;
80 85
81 /* TODO: YOU NEED TO PASS IN THE FIRMWARE VOLUME SIZES SOMEHOW */ 86 /* TODO: YOU NEED TO PASS IN THE FIRMWARE VOLUME SIZES SOMEHOW */
82 ci.firmwareA_size = 0; 87 ci.firmwareA_size = 0;
83 ci.firmwareB_size = 0; 88 ci.firmwareB_size = 0;
84 89
90 /* TODO: YOU NEED TO LOAD vnc.raw[] FROM NON-VOLATILE STORAGE */
91
85 /* Set up the params for LoadFirmware() */ 92 /* Set up the params for LoadFirmware() */
86 p.caller_internal = &ci; 93 p.caller_internal = &ci;
87 p.firmware_root_key_blob = root_key_blob; 94 p.firmware_root_key_blob = root_key_blob;
88 p.verification_block_0 = verification_headerA; 95 p.verification_block_0 = verification_headerA;
89 p.verification_block_1 = verification_headerB; 96 p.verification_block_1 = verification_headerB;
97 p.nv_context = &vnc;
90 98
91 /* Allocate a key blob buffer */ 99 /* Allocate a key blob buffer */
92 p.kernel_sign_key_blob = Malloc(LOAD_FIRMWARE_KEY_BLOB_REC_SIZE); 100 p.kernel_sign_key_blob = Malloc(LOAD_FIRMWARE_KEY_BLOB_REC_SIZE);
93 p.kernel_sign_key_size = LOAD_FIRMWARE_KEY_BLOB_REC_SIZE; 101 p.kernel_sign_key_size = LOAD_FIRMWARE_KEY_BLOB_REC_SIZE;
94 102
95 /* TODO: YOU NEED TO SET THE BOOT FLAGS SOMEHOW */ 103 /* TODO: YOU NEED TO SET THE BOOT FLAGS SOMEHOW */
96 p.boot_flags = 0; 104 p.boot_flags = 0;
97 105
98 /* Call LoadFirmware() */ 106 /* Call LoadFirmware() */
99 rv = LoadFirmware(&p); 107 rv = LoadFirmware(&p);
108
109 if (vnc.raw_changed) {
110 /* TODO: YOU NEED TO SAVE vnc.raw TO NON-VOLATILE STORAGE */
111 }
112
100 if (LOAD_FIRMWARE_SUCCESS == rv) { 113 if (LOAD_FIRMWARE_SUCCESS == rv) {
101 /* TODO: YOU NEED TO KEEP TRACK OF p.kernel_sign_key_blob AND 114 /* TODO: YOU NEED TO KEEP TRACK OF p.kernel_sign_key_blob AND
102 * p.kernel_sign_key_size SO YOU CAN PASS THEM TO LoadKernel(). */ 115 * p.kernel_sign_key_size SO YOU CAN PASS THEM TO LoadKernel(). */
103 116
104 return (0 == p.firmware_index ? BOOT_FIRMWARE_A_CONTINUE : 117 return (0 == p.firmware_index ? BOOT_FIRMWARE_A_CONTINUE :
105 BOOT_FIRMWARE_B_CONTINUE); 118 BOOT_FIRMWARE_B_CONTINUE);
106 119
107 } else { 120 } else {
108 /* Error */ 121 /* Error */
109 return BOOT_FIRMWARE_RECOVERY_CONTINUE; 122 return BOOT_FIRMWARE_RECOVERY_CONTINUE;
110 } 123 }
111 } 124 }
OLDNEW
« no previous file with comments | « firmware/lib/vboot_firmware.c ('k') | utility/load_firmware_test.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698