Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Unified Diff: common/cmd_cros_bootstub.c

Issue 6594043: Fill-in more details of boot stub (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/u-boot-next.git@chromeos-v2010.09
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: common/cmd_cros_bootstub.c
diff --git a/common/cmd_cros_bootstub.c b/common/cmd_cros_bootstub.c
index 576bf59f884fa6da78e856ad9710fcac7715ef40..b7eab40383a4277f9738fb4d857548962bcfec6f 100644
--- a/common/cmd_cros_bootstub.c
+++ b/common/cmd_cros_bootstub.c
@@ -35,11 +35,24 @@
#define FIRMWARE_A 1
#define FIRMWARE_B 2
-int do_cros_bootstub(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int load_firmware(int primary_firmware, int boot_flags,
+ void *kernel_sign_key_blob, uint64_t kernel_sign_key_size,
+ int *firmware_index_ptr)
{
- int firmware_index, primary_firmware;
+ return LOAD_FIRMWARE_RECOVERY;
+}
- /* Boot Stub ******************************************************** */
+void jump_to_firmware(void (*rwfw_entry_point)(void))
+{
+ debug(PREFIX "jump to firmware %p\n", rwfw_entry_point);
+}
+
+int do_cros_bootstub(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+ int status = !LOAD_FIRMWARE_SUCCESS;
sjg 2011/03/01 05:13:41 Ick - this is odd. Perhaps just 0 for ok, -1 for e
Che-Liang Chiou 2011/03/01 08:45:22 Change it to LOAD_FIRMWARE_RECOVERY (since we shou
+ int firmware_index, primary_firmware, boot_flags = 0;
+ uint8_t *kernel_sign_key_blob = (uint8_t *) CONFIG_KERNEL_SIGN_KEY_BLOB;
+ uint64_t kernel_sign_key_size = CONFIG_KERNEL_SIGN_KEY_SIZE;
/* TODO Start initializing chipset */
@@ -63,26 +76,28 @@ int do_cros_bootstub(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
else
primary_firmware = FIRMWARE_A;
- /* TODO call LoadFirmware */
- }
+ if (is_developer_mode_gpio_asserted())
+ boot_flags |= BOOT_FLAG_DEVELOPER;
- debug(PREFIX "load firmware of index %d\n", firmware_index);
+ status = load_firmware(primary_firmware, boot_flags,
+ kernel_sign_key_blob, kernel_sign_key_size,
+ &firmware_index);
+ }
WARN_ON_FAILURE(lock_tpm_rewritable_firmware_index());
- if (firmware_index == FIRMWARE_A) {
- /* TODO Jump to firmware A and should never return */
- }
-
- if (firmware_index == FIRMWARE_B) {
- /* TODO Jump to firmware B and should never return */
+ if (status == LOAD_FIRMWARE_SUCCESS) {
+ debug(PREFIX "jump to rewritable firmware %d "
+ "and never return\n", firmware_index);
+ jump_to_firmware((void (*)(void)) (firmware_index == 0 ?
+ CONFIG_FIRMWARE_BODY_BUFFER_0 :
Che-Liang Chiou 2011/03/01 08:45:22 Remove statically allocated buffers. Changes due t
+ CONFIG_FIRMWARE_BODY_BUFFER_1));
+ } else {
+ /* TODO Jump to recovery firmware and never return */
}
- /* assert(firmware_index == FIRMWARE_RECOVERY); */
-
- /* Recovery Firmware ************************************************ */
-
- return 0;
+ debug(PREFIX "error: should never reach here!\n");
+ return 1;
sjg 2011/03/01 05:13:41 Should this hang, jump to recovery mode, something
Che-Liang Chiou 2011/03/01 08:45:22 We should jump to recovery firmware when rewritabl
}
U_BOOT_CMD(cros_bootstub, 1, 1, do_cros_bootstub, NULL, NULL);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698