OLD | NEW |
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 * 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 | 14 |
14 /* Recommended size of kernel_sign_key_blob in bytes, for | 15 /* Recommended size of kernel_sign_key_blob in bytes, for |
15 * implementations which must preallocate a transfer buffer between | 16 * implementations which must preallocate a transfer buffer between |
16 * boot phases */ | 17 * boot phases */ |
17 #define LOAD_FIRMWARE_KEY_BLOB_REC_SIZE 2104 | 18 #define LOAD_FIRMWARE_KEY_BLOB_REC_SIZE 2104 |
18 | 19 |
19 /* Return codes for LoadFirmware() and S3Resume(). */ | 20 /* Return codes for LoadFirmware() and S3Resume(). */ |
20 #define LOAD_FIRMWARE_SUCCESS 0 /* Success */ | 21 #define LOAD_FIRMWARE_SUCCESS 0 /* Success */ |
21 #define LOAD_FIRMWARE_RECOVERY 1 /* Reboot to recovery mode */ | 22 #define LOAD_FIRMWARE_RECOVERY 1 /* Reboot to recovery mode */ |
22 #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 */ |
(...skipping 12 matching lines...) Expand all Loading... |
35 uint64_t verification_size_1; /* Verification block 1 size in bytes */ | 36 uint64_t verification_size_1; /* Verification block 1 size in bytes */ |
36 void *kernel_sign_key_blob; /* Destination buffer for key to use | 37 void *kernel_sign_key_blob; /* Destination buffer for key to use |
37 * when loading kernel. Pass this | 38 * when loading kernel. Pass this |
38 * data to LoadKernel() in | 39 * data to LoadKernel() in |
39 * LoadKernelParams.header_sign_key_blob. */ | 40 * LoadKernelParams.header_sign_key_blob. */ |
40 uint64_t kernel_sign_key_size; /* Size of kernel signing key blob | 41 uint64_t kernel_sign_key_size; /* Size of kernel signing key blob |
41 * buffer, in bytes. On output, this | 42 * buffer, in bytes. On output, this |
42 * will contain the actual key blob | 43 * will contain the actual key blob |
43 * size placed into the buffer. */ | 44 * size placed into the buffer. */ |
44 uint64_t boot_flags; /* Boot flags */ | 45 uint64_t boot_flags; /* Boot flags */ |
| 46 VbNvContext* nv_context; /* Context for NV storage. nv_context->raw |
| 47 * must be filled before calling |
| 48 * LoadFirmware(). On output, check |
| 49 * nv_context->raw_changed to see if |
| 50 * nv_context->raw has been modified and |
| 51 * needs saving. */ |
45 | 52 |
46 /* Outputs from LoadFirmware(); valid only if LoadFirmware() returns | 53 /* Outputs from LoadFirmware(); valid only if LoadFirmware() returns |
47 * LOAD_FIRMWARE_SUCCESS. */ | 54 * LOAD_FIRMWARE_SUCCESS. */ |
48 uint64_t firmware_index; /* Firmware index to run. */ | 55 uint64_t firmware_index; /* Firmware index to run. */ |
49 | 56 |
50 /* Internal data for LoadFirmware() / UpdateFirmwareBodyHash(). */ | 57 /* Internal data for LoadFirmware() / UpdateFirmwareBodyHash(). */ |
51 void* load_firmware_internal; | 58 void* load_firmware_internal; |
52 | 59 |
53 /* Internal data for caller / GetFirmwareBody(). */ | 60 /* Internal data for caller / GetFirmwareBody(). */ |
54 void* caller_internal; | 61 void* caller_internal; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 * called inside GetFirmwareBody(). */ | 93 * called inside GetFirmwareBody(). */ |
87 void UpdateFirmwareBodyHash(LoadFirmwareParams* params, | 94 void UpdateFirmwareBodyHash(LoadFirmwareParams* params, |
88 uint8_t* data, uint64_t size); | 95 uint8_t* data, uint64_t size); |
89 | 96 |
90 /* Handle S3 resume. | 97 /* Handle S3 resume. |
91 * | 98 * |
92 * Returns LOAD_FIRMWARE_SUCCESS if successful, error code on failure. */ | 99 * Returns LOAD_FIRMWARE_SUCCESS if successful, error code on failure. */ |
93 int S3Resume(void); | 100 int S3Resume(void); |
94 | 101 |
95 #endif /* VBOOT_REFERENCE_LOAD_FIRMWARE_FW_H_ */ | 102 #endif /* VBOOT_REFERENCE_LOAD_FIRMWARE_FW_H_ */ |
OLD | NEW |