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

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: Code review 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 | lib/chromeos/load_firmware_fw.c » ('j') | lib/chromeos/load_firmware_fw.c » ('J')
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..31278c0470a97da6b3c087724cc66bdf6f0e8b2f 100644
--- a/common/cmd_cros_bootstub.c
+++ b/common/cmd_cros_bootstub.c
@@ -35,11 +35,30 @@
#define FIRMWARE_A 1
#define FIRMWARE_B 2
-int do_cros_bootstub(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+typedef struct {
+ int firmware_index;
sjg 2011/03/02 02:05:23 Comments, if you haven't done it in another CL.
Che-Liang Chiou 2011/03/02 10:39:32 Done.
+ uint8_t *firmware_body[2];
+} verified_firmware_t;
+
+int load_firmware(int primary_firmware, int boot_flags,
sjg 2011/03/02 02:05:23 params comment
Che-Liang Chiou 2011/03/02 10:39:32 Done. Copied and edited from later CL.
+ void *kernel_sign_key_blob, uint64_t kernel_sign_key_size,
+ verified_firmware_t *verified_firmware)
{
- 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[])
sjg 2011/03/02 02:05:23 I think you did tell me where the comment was for
Che-Liang Chiou 2011/03/02 10:39:32 I guess it's in a later CL.
+{
+ int status = LOAD_FIRMWARE_RECOVERY;
+ int primary_firmware, boot_flags = 0;
+ verified_firmware_t vf;
+ 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 */
@@ -56,33 +75,38 @@ int do_cros_bootstub(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (is_recovery_mode_gpio_asserted() ||
is_recovery_mode_field_containing_cookie()) {
- firmware_index = FIRMWARE_RECOVERY;
+ debug(PREFIX "boot recovery firmware\n");
} else {
if (is_try_firmware_b_field_containing_cookie())
primary_firmware = FIRMWARE_B;
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,
+ &vf);
+ }
WARN_ON_FAILURE(lock_tpm_rewritable_firmware_index());
- if (firmware_index == FIRMWARE_A) {
- /* TODO Jump to firmware A and should never return */
- }
+ if (status == LOAD_FIRMWARE_SUCCESS) {
+ debug(PREFIX "jump to rewritable firmware %d "
+ "and never return\n",
+ vf.firmware_index);
+ jump_to_firmware((void (*)(void))
sjg 2011/03/02 02:05:23 This is pretty ugly - since you are probably going
Che-Liang Chiou 2011/03/02 10:39:32 I will think about it.
+ vf.firmware_body[vf.firmware_index]);
- if (firmware_index == FIRMWARE_B) {
- /* TODO Jump to firmware B and should never return */
+ debug(PREFIX "error: should never reach here! "
+ "jump to recovery firmware\n");
}
- /* assert(firmware_index == FIRMWARE_RECOVERY); */
-
- /* Recovery Firmware ************************************************ */
+ /* TODO Jump to recovery firmware and never return */
- return 0;
+ debug(PREFIX "error: should never reach here!\n");
+ return 1;
sjg 2011/03/02 02:05:23 -1?
Che-Liang Chiou 2011/03/02 10:39:32 u-boot command's error code uses positive values.
}
U_BOOT_CMD(cros_bootstub, 1, 1, do_cros_bootstub, NULL, NULL);
« no previous file with comments | « no previous file | lib/chromeos/load_firmware_fw.c » ('j') | lib/chromeos/load_firmware_fw.c » ('J')

Powered by Google App Engine
This is Rietveld 408576698