| 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 kernel. | 5 * High-level firmware API for loading and verifying kernel. |
| 6 * (Firmware Portion) | 6 * (Firmware Portion) |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #ifndef VBOOT_REFERENCE_LOAD_KERNEL_FW_H_ | 9 #ifndef VBOOT_REFERENCE_LOAD_KERNEL_FW_H_ |
| 10 #define VBOOT_REFERENCE_LOAD_KERNEL_FW_H_ | 10 #define VBOOT_REFERENCE_LOAD_KERNEL_FW_H_ |
| 11 | 11 |
| 12 #include "sysincludes.h" | 12 #include "sysincludes.h" |
| 13 #include "vboot_nvstorage.h" |
| 13 | 14 |
| 14 /* Interface provided by verified boot library to BDS */ | 15 /* Interface provided by verified boot library to BDS */ |
| 15 | 16 |
| 16 /* Return codes for LoadKernel() */ | 17 /* Return codes for LoadKernel() */ |
| 17 #define LOAD_KERNEL_SUCCESS 0 /* Success; good kernel found on device */ | 18 #define LOAD_KERNEL_SUCCESS 0 /* Success; good kernel found on device */ |
| 18 #define LOAD_KERNEL_NOT_FOUND 1 /* No kernel found on device */ | 19 #define LOAD_KERNEL_NOT_FOUND 1 /* No kernel found on device */ |
| 19 #define LOAD_KERNEL_INVALID 2 /* Only invalid kernels found on device */ | 20 #define LOAD_KERNEL_INVALID 2 /* Only invalid kernels found on device */ |
| 20 #define LOAD_KERNEL_RECOVERY 3 /* Internal error; reboot to recovery mode */ | 21 #define LOAD_KERNEL_RECOVERY 3 /* Internal error; reboot to recovery mode */ |
| 21 #define LOAD_KERNEL_REBOOT 4 /* Internal error; reboot to current mode */ | 22 #define LOAD_KERNEL_REBOOT 4 /* Internal error; reboot to current mode */ |
| 22 | 23 |
| 23 | 24 |
| 24 /* Boot flags for LoadKernel().boot_flags */ | 25 /* Boot flags for LoadKernel().boot_flags */ |
| 25 /* Developer switch is on */ | 26 /* Developer switch is on */ |
| 26 #define BOOT_FLAG_DEVELOPER UINT64_C(0x01) | 27 #define BOOT_FLAG_DEVELOPER UINT64_C(0x01) |
| 27 /* In recovery mode */ | 28 /* In recovery mode */ |
| 28 #define BOOT_FLAG_RECOVERY UINT64_C(0x02) | 29 #define BOOT_FLAG_RECOVERY UINT64_C(0x02) |
| 29 /* Skip check of kernel buffer address */ | 30 /* Skip check of kernel buffer address */ |
| 30 #define BOOT_FLAG_SKIP_ADDR_CHECK UINT64_C(0x04) | 31 #define BOOT_FLAG_SKIP_ADDR_CHECK UINT64_C(0x04) |
| 31 /* Active main firmware is developer-type, not normal-type or recovery-type. */ | 32 /* Active main firmware is developer-type, not normal-type or recovery-type. */ |
| 32 #define BOOT_FLAG_DEV_FIRMWARE UINT64_C(0x08) | 33 #define BOOT_FLAG_DEV_FIRMWARE UINT64_C(0x08) |
| 33 | 34 |
| 34 typedef struct LoadKernelParams { | 35 typedef struct LoadKernelParams { |
| 35 /* Inputs to LoadKernel() */ | 36 /* Inputs to LoadKernel() */ |
| 36 void *header_sign_key_blob; /* Key blob used to sign the kernel header */ | 37 void* header_sign_key_blob; /* Key blob used to sign the kernel header */ |
| 37 uint64_t bytes_per_lba; /* Bytes per lba sector on current device */ | 38 uint64_t bytes_per_lba; /* Bytes per lba sector on current device */ |
| 38 uint64_t ending_lba; /* Last addressable lba sector on current | 39 uint64_t ending_lba; /* Last addressable lba sector on current |
| 39 * device */ | 40 * device */ |
| 40 void *kernel_buffer; /* Destination buffer for kernel | 41 void* kernel_buffer; /* Destination buffer for kernel |
| 41 * (normally at 0x100000) */ | 42 * (normally at 0x100000) */ |
| 42 uint64_t kernel_buffer_size; /* Size of kernel buffer in bytes */ | 43 uint64_t kernel_buffer_size; /* Size of kernel buffer in bytes */ |
| 43 uint64_t boot_flags; /* Boot flags */ | 44 uint64_t boot_flags; /* Boot flags */ |
| 45 VbNvContext* nv_context; /* Context for NV storage. nv_context->raw |
| 46 * must be filled before calling |
| 47 * LoadKernel(). On output, check |
| 48 * nv_context->raw_changed to see if |
| 49 * nv_context->raw has been modified and |
| 50 * needs saving. */ |
| 44 | 51 |
| 45 /* Outputs from LoadKernel(); valid only if LoadKernel() returns | 52 /* Outputs from LoadKernel(); valid only if LoadKernel() returns |
| 46 * LOAD_KERNEL_SUCCESS */ | 53 * LOAD_KERNEL_SUCCESS */ |
| 47 uint64_t partition_number; /* Partition number to boot on current device | 54 uint64_t partition_number; /* Partition number to boot on current device |
| 48 * (1...M) */ | 55 * (1...M) */ |
| 49 uint64_t bootloader_address; /* Address of bootloader image in RAM */ | 56 uint64_t bootloader_address; /* Address of bootloader image in RAM */ |
| 50 uint64_t bootloader_size; /* Size of bootloader image in bytes */ | 57 uint64_t bootloader_size; /* Size of bootloader image in bytes */ |
| 51 uint8_t partition_guid[16]; /* UniquePartitionGuid for boot partition */ | 58 uint8_t partition_guid[16]; /* UniquePartitionGuid for boot partition */ |
| 52 } LoadKernelParams; | 59 } LoadKernelParams; |
| 53 | 60 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 65 * LoadKernel() in | 72 * LoadKernel() in |
| 66 * LoadKernelParams.partition_number */ | 73 * LoadKernelParams.partition_number */ |
| 67 uint64_t original_address; /* Absolute bootloader start adddress, | 74 uint64_t original_address; /* Absolute bootloader start adddress, |
| 68 * as returned from LoadKernel() in | 75 * as returned from LoadKernel() in |
| 69 * LoadKernelParams.bootloader_start */ | 76 * LoadKernelParams.bootloader_start */ |
| 70 uint8_t partition_guid[16]; /* UniquePartitionGuid for boot partition */ | 77 uint8_t partition_guid[16]; /* UniquePartitionGuid for boot partition */ |
| 71 } KernelBootloaderOptions; | 78 } KernelBootloaderOptions; |
| 72 | 79 |
| 73 | 80 |
| 74 #endif /* VBOOT_REFERENCE_LOAD_KERNEL_FW_H_ */ | 81 #endif /* VBOOT_REFERENCE_LOAD_KERNEL_FW_H_ */ |
| OLD | NEW |