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 * Data structure definitions for verified boot, for on-disk / in-eeprom | 5 * Data structure definitions for verified boot, for on-disk / in-eeprom |
6 * data. | 6 * data. |
7 */ | 7 */ |
8 | 8 |
9 #ifndef VBOOT_REFERENCE_VBOOT_STRUCT_H_ | 9 #ifndef VBOOT_REFERENCE_VBOOT_STRUCT_H_ |
10 #define VBOOT_REFERENCE_VBOOT_STRUCT_H_ | 10 #define VBOOT_REFERENCE_VBOOT_STRUCT_H_ |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
196 | 196 |
197 | 197 |
198 /* Information about a single kernel partition check in LoadKernel() */ | 198 /* Information about a single kernel partition check in LoadKernel() */ |
199 typedef struct VbSharedDataKernelPart { | 199 typedef struct VbSharedDataKernelPart { |
200 uint64_t sector_start; /* Start sector of partition */ | 200 uint64_t sector_start; /* Start sector of partition */ |
201 uint64_t sector_count; /* Sector count of partition */ | 201 uint64_t sector_count; /* Sector count of partition */ |
202 uint32_t combined_version; /* Combined key+kernel version */ | 202 uint32_t combined_version; /* Combined key+kernel version */ |
203 uint8_t gpt_index; /* Index of partition in GPT */ | 203 uint8_t gpt_index; /* Index of partition in GPT */ |
204 uint8_t check_result; /* Check result; see VBSD_LKP_CHECK_* */ | 204 uint8_t check_result; /* Check result; see VBSD_LKP_CHECK_* */ |
205 uint8_t flags; /* Flags (see VBSD_LKP_FLAG_* */ | 205 uint8_t flags; /* Flags (see VBSD_LKP_FLAG_* */ |
206 uint8_t reserved0; /* Reserved */ | |
stefanreinauer
2011/03/18 21:39:46
maybe a comment that this is for padding would be
| |
206 } VbSharedDataKernelPart; | 207 } VbSharedDataKernelPart; |
207 | 208 |
208 /* Number of kernel partitions to track per call. Must be power of 2. */ | 209 /* Number of kernel partitions to track per call. Must be power of 2. */ |
209 #define VBSD_MAX_KERNEL_PARTS 8 | 210 #define VBSD_MAX_KERNEL_PARTS 8 |
210 | 211 |
211 /* Flags for VbSharedDataKernelCall.flags */ | 212 /* Flags for VbSharedDataKernelCall.flags */ |
212 /* Error initializing TPM in recovery mode */ | 213 /* Error initializing TPM in recovery mode */ |
213 #define VBSD_LK_FLAG_REC_TPM_INIT_ERROR 0x00000001 | 214 #define VBSD_LK_FLAG_REC_TPM_INIT_ERROR 0x00000001 |
214 | 215 |
215 /* Result codes for VbSharedDataKernelCall.check_result */ | 216 /* Result codes for VbSharedDataKernelCall.check_result */ |
(...skipping 11 matching lines...) Expand all Loading... | |
227 * LoadKernelParams.boot_flags */ | 228 * LoadKernelParams.boot_flags */ |
228 uint32_t flags; /* Debug flags; see VBSD_LK_FLAG_* */ | 229 uint32_t flags; /* Debug flags; see VBSD_LK_FLAG_* */ |
229 uint64_t sector_count; /* Number of sectors on drive */ | 230 uint64_t sector_count; /* Number of sectors on drive */ |
230 uint32_t sector_size; /* Sector size in bytes */ | 231 uint32_t sector_size; /* Sector size in bytes */ |
231 uint8_t check_result; /* Check result; see VBSD_LKC_CHECK_* */ | 232 uint8_t check_result; /* Check result; see VBSD_LKC_CHECK_* */ |
232 uint8_t boot_mode; /* Boot mode for LoadKernel(); see | 233 uint8_t boot_mode; /* Boot mode for LoadKernel(); see |
233 * VBSD_LK_BOOT_MODE_* constants */ | 234 * VBSD_LK_BOOT_MODE_* constants */ |
234 uint8_t test_error_num; /* Test error number, if non-zero */ | 235 uint8_t test_error_num; /* Test error number, if non-zero */ |
235 uint8_t return_code; /* Return code from LoadKernel() */ | 236 uint8_t return_code; /* Return code from LoadKernel() */ |
236 uint8_t kernel_parts_found; /* Number of kernel partitions found */ | 237 uint8_t kernel_parts_found; /* Number of kernel partitions found */ |
238 uint8_t reserved0[7]; /* Reserved */ | |
stefanreinauer
2011/03/18 21:39:46
ditto
| |
237 VbSharedDataKernelPart parts[VBSD_MAX_KERNEL_PARTS]; /* Data on kernels */ | 239 VbSharedDataKernelPart parts[VBSD_MAX_KERNEL_PARTS]; /* Data on kernels */ |
238 } VbSharedDataKernelCall; | 240 } VbSharedDataKernelCall; |
239 | 241 |
240 /* Number of kernel calls to track. Must be power of 2. */ | 242 /* Number of kernel calls to track. Must be power of 2. */ |
241 #define VBSD_MAX_KERNEL_CALLS 4 | 243 #define VBSD_MAX_KERNEL_CALLS 4 |
242 | 244 |
243 /* Data shared between LoadFirmware(), LoadKernel(), and OS. | 245 /* Data shared between LoadFirmware(), LoadKernel(), and OS. |
244 * | 246 * |
245 * The boot process is: | 247 * The boot process is: |
246 * 1) Caller allocates buffer, at least VB_SHARED_DATA_MIN bytes, ideally | 248 * 1) Caller allocates buffer, at least VB_SHARED_DATA_MIN bytes, ideally |
247 * VB_SHARED_DATA_REC_SIZE bytes. | 249 * VB_SHARED_DATA_REC_SIZE bytes. |
248 * 2) If non-recovery boot, this is passed to LoadFirmware(), which | 250 * 2) If non-recovery boot, this is passed to LoadFirmware(), which |
249 * initializes the buffer, adding this header and some data. | 251 * initializes the buffer, adding this header and some data. |
250 * 3) Buffer is passed to LoadKernel(). If this is a recovery boot, | 252 * 3) Buffer is passed to LoadKernel(). If this is a recovery boot, |
251 * LoadKernel() initializes the buffer, adding this header. Regardless | 253 * LoadKernel() initializes the buffer, adding this header. Regardless |
252 * of boot type, LoadKernel() adds some data to the buffer. | 254 * of boot type, LoadKernel() adds some data to the buffer. |
253 * 4) Caller makes data available to the OS in a platform-dependent manner. | 255 * 4) Caller makes data available to the OS in a platform-dependent manner. |
254 * For example, via ACPI or ATAGs. */ | 256 * For example, via ACPI or ATAGs. */ |
255 typedef struct VbSharedDataHeader { | 257 typedef struct VbSharedDataHeader { |
256 /* Fields present in version 1 */ | 258 /* Fields present in version 1 */ |
257 uint32_t magic; /* Magic number for struct | 259 uint32_t magic; /* Magic number for struct |
258 * (VB_SHARED_DATA_MAGIC) */ | 260 * (VB_SHARED_DATA_MAGIC) */ |
259 uint32_t struct_version; /* Version of this structure */ | 261 uint32_t struct_version; /* Version of this structure */ |
260 uint64_t struct_size; /* Size of this structure in bytes */ | 262 uint64_t struct_size; /* Size of this structure in bytes */ |
261 uint64_t data_size; /* Size of shared data buffer in bytes */ | 263 uint64_t data_size; /* Size of shared data buffer in bytes */ |
262 uint64_t data_used; /* Amount of shared data used so far */ | 264 uint64_t data_used; /* Amount of shared data used so far */ |
263 uint32_t flags; /* Flags */ | 265 uint32_t flags; /* Flags */ |
266 uint32_t reserved0; /* Reserved */ | |
264 | 267 |
265 VbPublicKey kernel_subkey; /* Kernel subkey, from firmware */ | 268 VbPublicKey kernel_subkey; /* Kernel subkey, from firmware */ |
266 uint64_t kernel_subkey_data_offset; /* Offset of kernel subkey data from | 269 uint64_t kernel_subkey_data_offset; /* Offset of kernel subkey data from |
267 * start of this struct */ | 270 * start of this struct */ |
268 uint64_t kernel_subkey_data_size; /* Size of kernel subkey data */ | 271 uint64_t kernel_subkey_data_size; /* Size of kernel subkey data */ |
269 | 272 |
270 /* Timer values from VbGetTimer(). Unused values are set to 0. If a | 273 /* Timer values from VbGetTimer(). Unused values are set to 0. If a |
271 * function is called mutiple times, these are the times from the | 274 * function is called mutiple times, these are the times from the |
272 * most recent call. */ | 275 * most recent call. */ |
273 uint64_t timer_load_firmware_start_enter; /* LoadFirmwareStart() - enter */ | 276 uint64_t timer_load_firmware_start_enter; /* LoadFirmwareStart() - enter */ |
274 uint64_t timer_load_firmware_start_exit; /* LoadFirmwareStart() - exit */ | 277 uint64_t timer_load_firmware_start_exit; /* LoadFirmwareStart() - exit */ |
275 uint64_t timer_load_firmware_enter; /* LoadFirmware() - enter */ | 278 uint64_t timer_load_firmware_enter; /* LoadFirmware() - enter */ |
276 uint64_t timer_load_firmware_exit; /* LoadFirmware() - exit */ | 279 uint64_t timer_load_firmware_exit; /* LoadFirmware() - exit */ |
277 uint64_t timer_load_kernel_enter; /* LoadKernel() - enter */ | 280 uint64_t timer_load_kernel_enter; /* LoadKernel() - enter */ |
278 uint64_t timer_load_kernel_exit; /* LoadKernel() - exit */ | 281 uint64_t timer_load_kernel_exit; /* LoadKernel() - exit */ |
279 | 282 |
280 /* Information stored in TPM, as retrieved by firmware */ | 283 /* Information stored in TPM, as retrieved by firmware */ |
281 uint32_t fw_version_tpm; /* Current firmware version in TPM */ | 284 uint32_t fw_version_tpm; /* Current firmware version in TPM */ |
282 uint32_t kernel_version_tpm; /* Current kernel version in TPM */ | 285 uint32_t kernel_version_tpm; /* Current kernel version in TPM */ |
283 | 286 |
284 /* Debugging information from LoadFirmware() */ | 287 /* Debugging information from LoadFirmware() */ |
285 uint8_t check_fw_a_result; /* Result of checking RW firmware A */ | 288 uint8_t check_fw_a_result; /* Result of checking RW firmware A */ |
286 uint8_t check_fw_b_result; /* Result of checking RW firmware B */ | 289 uint8_t check_fw_b_result; /* Result of checking RW firmware B */ |
287 uint8_t firmware_index; /* Firmware index returned by | 290 uint8_t firmware_index; /* Firmware index returned by |
288 * LoadFirmware() or 0xFF if failure */ | 291 * LoadFirmware() or 0xFF if failure */ |
292 uint8_t reserved1; /* Reserved */ | |
289 uint32_t fw_version_tpm_start; /* Firmware TPM version at start of | 293 uint32_t fw_version_tpm_start; /* Firmware TPM version at start of |
290 * LoadFirmware() */ | 294 * LoadFirmware() */ |
291 uint32_t fw_version_lowest; /* Firmware lowest version found */ | 295 uint32_t fw_version_lowest; /* Firmware lowest version found */ |
292 | 296 |
293 /* Debugging information from LoadKernel() */ | 297 /* Debugging information from LoadKernel() */ |
294 uint32_t lk_call_count; /* Number of times LoadKernel() called */ | 298 uint32_t lk_call_count; /* Number of times LoadKernel() called */ |
295 VbSharedDataKernelCall lk_calls[VBSD_MAX_KERNEL_CALLS]; /* Info on calls */ | 299 VbSharedDataKernelCall lk_calls[VBSD_MAX_KERNEL_CALLS]; /* Info on calls */ |
296 | 300 |
297 /* Offset and size of supplemental kernel data. Reserve space for these | 301 /* Offset and size of supplemental kernel data. Reserve space for these |
298 * fields now, so that future LoadKernel() versions can store information | 302 * fields now, so that future LoadKernel() versions can store information |
(...skipping 12 matching lines...) Expand all Loading... | |
311 * the fields it knows about are present. Newer firmware needs to use | 315 * the fields it knows about are present. Newer firmware needs to use |
312 * reasonable defaults when accessing older structs. */ | 316 * reasonable defaults when accessing older structs. */ |
313 | 317 |
314 } __attribute__((packed)) VbSharedDataHeader; | 318 } __attribute__((packed)) VbSharedDataHeader; |
315 | 319 |
316 #define VB_SHARED_DATA_VERSION 1 /* Version for struct_version */ | 320 #define VB_SHARED_DATA_VERSION 1 /* Version for struct_version */ |
317 | 321 |
318 __pragma(pack(pop)) /* Support packing for MSVC. */ | 322 __pragma(pack(pop)) /* Support packing for MSVC. */ |
319 | 323 |
320 #endif /* VBOOT_REFERENCE_VBOOT_STRUCT_H_ */ | 324 #endif /* VBOOT_REFERENCE_VBOOT_STRUCT_H_ */ |
OLD | NEW |