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