diff options
author | Che-Liang Chiou <clchiou@chromium.org> | 2011-01-28 12:00:11 +0800 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2011-08-24 10:00:13 -0700 |
commit | 1c4077b1fdd1509478f8ff612d3ed82d00448d04 (patch) | |
tree | b6d69964cda1b3670d9b5a5caf83a24186eb65ae /include | |
parent | 3f1cfde0688018ca3afc60596171b0f049885c5a (diff) |
Change GetFirmwareBody to use static firmware layout
It is unnecessary to scan the whole flashrom to look for the flashmap because
the flashmap is stored in read-only part of flashrom.
Furthermore, boot stub should use static firmware layout rather than fmap; this
is faster and easier.
BUG=chromium-os:1302
TEST=Run following u-boot commands successfully
CrOS> cros load_fw 0x10000000 0x00400000 0x10500000
do_load_fw: params.firmware_root_key_blob: 10160180
do_load_fw: params.verification_block_0: 10200000
do_load_fw: params.verification_size_0: 00001128
do_load_fw: params.verification_block_1: 102e0000
do_load_fw: params.verification_size_1: 00001128
do_load_fw: params.kernel_sign_key_blob: 10500000
do_load_fw: params.kernel_sign_key_size: 00000838
DEBUG: LoadFirmware started...
DEBUG: TPM: Startup
DEBUG: TPM: command 0x99 send/receive failed: 0x800
DEBUG: TPM: Continue self test
DEBUG: TPM: command 0x53 send/receive failed: 0x800
DEBUG: Checking key block signature...
DEBUG: Firmware 0 is valid.
DEBUG: Checking key block signature...
DEBUG: Will boot firmware index 0
LoadFirmware returns: LOAD_FIRMWARE_SUCCESS
firmware_index: 0
CrOS> mw.b 0x10210100 0x33 0x100
CrOS> cros load_fw 0x10000000 0x00400000 0x10500000
do_load_fw: params.firmware_root_key_blob: 10160180
do_load_fw: params.verification_block_0: 10200000
do_load_fw: params.verification_size_0: 00001128
do_load_fw: params.verification_block_1: 102e0000
do_load_fw: params.verification_size_1: 00001128
do_load_fw: params.kernel_sign_key_blob: 10500000
do_load_fw: params.kernel_sign_key_size: 00000838
DEBUG: LoadFirmware started...
DEBUG: TPM: Startup
DEBUG: TPM: command 0x99 send/receive failed: 0x800
DEBUG: TPM: Continue self test
DEBUG: TPM: command 0x53 send/receive failed: 0x800
DEBUG: Checking key block signature...
DEBUG: In RSAVerify(): Hash check failed!
DEBUG: Firmware body verification failed.
DEBUG: Checking key block signature...
DEBUG: Firmware 1 is valid.
DEBUG: Will boot firmware index 1
LoadFirmware returns: LOAD_FIRMWARE_SUCCESS
firmware_index: 1
CrOS> mw.b 0x102f0100 0x33 0x100
CrOS> cros load_fw 0x10000000 0x00400000 0x10500000
do_load_fw: params.firmware_root_key_blob: 10160180
do_load_fw: params.verification_block_0: 10200000
do_load_fw: params.verification_size_0: 00001128
do_load_fw: params.verification_block_1: 102e0000
do_load_fw: params.verification_size_1: 00001128
do_load_fw: params.kernel_sign_key_blob: 10500000
do_load_fw: params.kernel_sign_key_size: 00000838
DEBUG: LoadFirmware started...
DEBUG: TPM: Startup
DEBUG: TPM: command 0x99 send/receive failed: 0x800
DEBUG: TPM: Continue self test
DEBUG: TPM: command 0x53 send/receive failed: 0x800
DEBUG: Checking key block signature...
DEBUG: In RSAVerify(): Hash check failed!
DEBUG: Firmware body verification failed.
DEBUG: Checking key block signature...
DEBUG: In RSAVerify(): Hash check failed!
DEBUG: Firmware body verification failed.
DEBUG: Alas, no good firmware.
LoadFirmware returns: LOAD_FIRMWARE_RECOVERY
Review URL: http://codereview.chromium.org/6258021
Change-Id: I6a2ca31e9f5e1295ce4e04c4097f087cee56b135
Diffstat (limited to 'include')
-rw-r--r-- | include/chromeos/firmware_storage.h | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/include/chromeos/firmware_storage.h b/include/chromeos/firmware_storage.h index 70ace9b7fed..3f1081e0169 100644 --- a/include/chromeos/firmware_storage.h +++ b/include/chromeos/firmware_storage.h @@ -41,30 +41,15 @@ #ifndef __FIRMWARE_STORAGE_H__ #define __FIRMWARE_STORAGE_H__ -#include <chromeos/fmap.h> - -/* Recommended size of kernel_sign_key_blob in bytes */ -#define LOAD_FIRMWARE_KEY_BLOB_REC_SIZE 2104 - -struct firmware_storage_s { - struct fmap *fmap; - void *context; - ssize_t (*read)(struct firmware_storage_s *s, int area, void *buf, - size_t count); -}; - -typedef struct firmware_storage_s firmware_storage_t; +enum whence_t { SEEK_SET, SEEK_CUR, SEEK_END }; /* Internal data for caller of LoadFirmware() to talk to GetFirmwareBody() */ struct caller_internal_s { - int index; - void *cached_image; - size_t size; - firmware_storage_t firmware_storage; + off_t (*seek)(void *context, off_t offset, enum whence_t whence); + ssize_t (*read)(void *context, void *buf, size_t count); + void *context; }; -typedef struct caller_internal_s caller_internal_t; - -int lookup_area(struct fmap *fmap, const char *name); +typedef struct caller_internal_s caller_internal_t; #endif /* __FIRMWARE_STORAGE_H_ */ |