OLD | NEW |
1 /* Copyright (c) 2010-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 #ifndef VBOOT_REFERENCE_LOAD_FIRMWARE_FW_H_ | 9 #ifndef VBOOT_REFERENCE_LOAD_FIRMWARE_FW_H_ |
10 #define VBOOT_REFERENCE_LOAD_FIRMWARE_FW_H_ | 10 #define VBOOT_REFERENCE_LOAD_FIRMWARE_FW_H_ |
11 | 11 |
12 #include "sysincludes.h" | 12 #include "sysincludes.h" |
13 #include "vboot_nvstorage.h" | 13 #include "vboot_nvstorage.h" |
14 | 14 |
15 /* Recommended size of kernel_sign_key_blob in bytes, for | 15 /* Recommended size of shared_data_blob in bytes. */ |
16 * implementations which must preallocate a transfer buffer between | 16 #define LOAD_FIRMWARE_SHARED_DATA_REC_SIZE 16384 |
17 * boot phases */ | |
18 #define LOAD_FIRMWARE_KEY_BLOB_REC_SIZE 2104 | |
19 | 17 |
20 /* Return codes for LoadFirmware() and S3Resume(). */ | 18 /* Return codes for LoadFirmware() and S3Resume(). */ |
21 #define LOAD_FIRMWARE_SUCCESS 0 /* Success */ | 19 #define LOAD_FIRMWARE_SUCCESS 0 /* Success */ |
22 #define LOAD_FIRMWARE_RECOVERY 1 /* Reboot to recovery mode. The specific | 20 #define LOAD_FIRMWARE_RECOVERY 1 /* Reboot to recovery mode. The specific |
23 * recovery reason has been set in | 21 * recovery reason has been set in |
24 * VbNvContext (VBNV_RECOVERY_REQUEST). */ | 22 * VbNvContext (VBNV_RECOVERY_REQUEST). */ |
25 #define LOAD_FIRMWARE_REBOOT 2 /* Reboot to same mode as current boot */ | 23 #define LOAD_FIRMWARE_REBOOT 2 /* Reboot to same mode as current boot */ |
26 | 24 |
27 /* Boot flags for LoadFirmware().boot_flags */ | 25 /* Boot flags for LoadFirmware().boot_flags */ |
28 #define BOOT_FLAG_DEVELOPER UINT64_C(0x01) /* Developer switch is on */ | 26 #define BOOT_FLAG_DEVELOPER UINT64_C(0x01) /* Developer switch is on */ |
29 | 27 |
30 typedef struct LoadFirmwareParams { | 28 typedef struct LoadFirmwareParams { |
31 /* Inputs to LoadFirmware() */ | 29 /* Inputs to LoadFirmware() */ |
32 void *firmware_root_key_blob; /* Key used to sign firmware header */ | 30 void* gbb_data; /* Pointer to GBB data */ |
33 void *verification_block_0; /* Key block + preamble for firmware 0 */ | 31 uint64_t gbb_size; /* Size of GBB data in bytes */ |
34 void *verification_block_1; /* Key block + preamble for firmware 1 */ | 32 void* verification_block_0; /* Key block + preamble for firmware 0 */ |
| 33 void* verification_block_1; /* Key block + preamble for firmware 1 */ |
35 uint64_t verification_size_0; /* Verification block 0 size in bytes */ | 34 uint64_t verification_size_0; /* Verification block 0 size in bytes */ |
36 uint64_t verification_size_1; /* Verification block 1 size in bytes */ | 35 uint64_t verification_size_1; /* Verification block 1 size in bytes */ |
37 void *kernel_sign_key_blob; /* Destination buffer for key to use | 36 void* shared_data_blob; /* Destination buffer for data shared between |
38 * when loading kernel. Pass this | 37 * LoadFirmware() and LoadKernel(). Pass this |
39 * data to LoadKernel() in | 38 * data to LoadKernel() in |
40 * LoadKernelParams.header_sign_key_blob. */ | 39 * LoadKernelParams.shared_data_blob. */ |
41 uint64_t kernel_sign_key_size; /* Size of kernel signing key blob | 40 uint64_t shared_data_size; /* Size of shared data blob buffer, in bytes. |
42 * buffer, in bytes. On output, this | 41 * On output, this will contain the actual |
43 * will contain the actual key blob | 42 * data size placed into the buffer. Caller |
44 * size placed into the buffer. */ | 43 * need only pass this much data to |
| 44 * LoadKernel().*/ |
45 uint64_t boot_flags; /* Boot flags */ | 45 uint64_t boot_flags; /* Boot flags */ |
46 VbNvContext* nv_context; /* Context for NV storage. nv_context->raw | 46 VbNvContext* nv_context; /* Context for NV storage. nv_context->raw |
47 * must be filled before calling | 47 * must be filled before calling |
48 * LoadFirmware(). On output, check | 48 * LoadFirmware(). On output, check |
49 * nv_context->raw_changed to see if | 49 * nv_context->raw_changed to see if |
50 * nv_context->raw has been modified and | 50 * nv_context->raw has been modified and |
51 * needs saving. */ | 51 * needs saving. */ |
52 | 52 |
53 /* Outputs from LoadFirmware(); valid only if LoadFirmware() returns | 53 /* Outputs from LoadFirmware(); valid only if LoadFirmware() returns |
54 * LOAD_FIRMWARE_SUCCESS. */ | 54 * LOAD_FIRMWARE_SUCCESS. */ |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 * called inside GetFirmwareBody(). */ | 99 * called inside GetFirmwareBody(). */ |
100 void UpdateFirmwareBodyHash(LoadFirmwareParams* params, | 100 void UpdateFirmwareBodyHash(LoadFirmwareParams* params, |
101 uint8_t* data, uint64_t size); | 101 uint8_t* data, uint64_t size); |
102 | 102 |
103 /* Handle S3 resume. | 103 /* Handle S3 resume. |
104 * | 104 * |
105 * Returns LOAD_FIRMWARE_SUCCESS if successful, error code on failure. */ | 105 * Returns LOAD_FIRMWARE_SUCCESS if successful, error code on failure. */ |
106 int S3Resume(void); | 106 int S3Resume(void); |
107 | 107 |
108 #endif /* VBOOT_REFERENCE_LOAD_FIRMWARE_FW_H_ */ | 108 #endif /* VBOOT_REFERENCE_LOAD_FIRMWARE_FW_H_ */ |
OLD | NEW |