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

Side by Side 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, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | lib/chromeos/load_firmware_fw.c » ('j') | lib/chromeos/load_firmware_fw.c » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The Chromium OS Authors. All rights reserved. 2 * Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 * 5 *
6 * Alternatively, this software may be distributed under the terms of the 6 * Alternatively, this software may be distributed under the terms of the
7 * GNU General Public License ("GPL") version 2 as published by the Free 7 * GNU General Public License ("GPL") version 2 as published by the Free
8 * Software Foundation. 8 * Software Foundation.
9 */ 9 */
10 10
(...skipping 17 matching lines...) Expand all
28 #action, return_code); \ 28 #action, return_code); \
29 } while (0) 29 } while (0)
30 #else 30 #else
31 #define WARN_ON_FAILURE(action) action 31 #define WARN_ON_FAILURE(action) action
32 #endif 32 #endif
33 33
34 #define FIRMWARE_RECOVERY 0 34 #define FIRMWARE_RECOVERY 0
35 #define FIRMWARE_A 1 35 #define FIRMWARE_A 1
36 #define FIRMWARE_B 2 36 #define FIRMWARE_B 2
37 37
38 typedef struct {
39 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.
40 uint8_t *firmware_body[2];
41 } verified_firmware_t;
42
43 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.
44 void *kernel_sign_key_blob, uint64_t kernel_sign_key_size,
45 verified_firmware_t *verified_firmware)
46 {
47 return LOAD_FIRMWARE_RECOVERY;
48 }
49
50 void jump_to_firmware(void (*rwfw_entry_point)(void))
51 {
52 debug(PREFIX "jump to firmware %p\n", rwfw_entry_point);
53 }
54
38 int do_cros_bootstub(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) 55 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.
39 { 56 {
40 » int firmware_index, primary_firmware; 57 » int status = LOAD_FIRMWARE_RECOVERY;
41 58 » int primary_firmware, boot_flags = 0;
42 » /* Boot Stub ******************************************************** */ 59 » verified_firmware_t vf;
60 » uint8_t *kernel_sign_key_blob = (uint8_t *) CONFIG_KERNEL_SIGN_KEY_BLOB;
61 » uint64_t kernel_sign_key_size = CONFIG_KERNEL_SIGN_KEY_SIZE;
43 62
44 /* TODO Start initializing chipset */ 63 /* TODO Start initializing chipset */
45 64
46 if (is_firmware_write_protect_gpio_asserted()) 65 if (is_firmware_write_protect_gpio_asserted())
47 WARN_ON_FAILURE(lock_down_eeprom()); 66 WARN_ON_FAILURE(lock_down_eeprom());
48 67
49 WARN_ON_FAILURE(initialize_tpm()); 68 WARN_ON_FAILURE(initialize_tpm());
50 69
51 if (is_s3_resume() && !is_debug_reset_mode_field_containing_cookie()) { 70 if (is_s3_resume() && !is_debug_reset_mode_field_containing_cookie()) {
52 WARN_ON_FAILURE(lock_tpm()); 71 WARN_ON_FAILURE(lock_tpm());
53 /* TODO Jump to S3 resume pointer and should never return */ 72 /* TODO Jump to S3 resume pointer and should never return */
54 return 0; 73 return 0;
55 } 74 }
56 75
57 if (is_recovery_mode_gpio_asserted() || 76 if (is_recovery_mode_gpio_asserted() ||
58 is_recovery_mode_field_containing_cookie()) { 77 is_recovery_mode_field_containing_cookie()) {
59 » » firmware_index = FIRMWARE_RECOVERY; 78 » » debug(PREFIX "boot recovery firmware\n");
60 } else { 79 } else {
61 if (is_try_firmware_b_field_containing_cookie()) 80 if (is_try_firmware_b_field_containing_cookie())
62 primary_firmware = FIRMWARE_B; 81 primary_firmware = FIRMWARE_B;
63 else 82 else
64 primary_firmware = FIRMWARE_A; 83 primary_firmware = FIRMWARE_A;
65 84
66 » » /* TODO call LoadFirmware */ 85 » » if (is_developer_mode_gpio_asserted())
86 » » » boot_flags |= BOOT_FLAG_DEVELOPER;
87
88 » » status = load_firmware(primary_firmware, boot_flags,
89 » » » » kernel_sign_key_blob, kernel_sign_key_size,
90 » » » » &vf);
67 } 91 }
68 92
69 debug(PREFIX "load firmware of index %d\n", firmware_index);
70
71 WARN_ON_FAILURE(lock_tpm_rewritable_firmware_index()); 93 WARN_ON_FAILURE(lock_tpm_rewritable_firmware_index());
72 94
73 » if (firmware_index == FIRMWARE_A) { 95 » if (status == LOAD_FIRMWARE_SUCCESS) {
74 » » /* TODO Jump to firmware A and should never return */ 96 » » debug(PREFIX "jump to rewritable firmware %d "
97 » » » » "and never return\n",
98 » » » » vf.firmware_index);
99 » » 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.
100 » » » » vf.firmware_body[vf.firmware_index]);
101
102 » » debug(PREFIX "error: should never reach here! "
103 » » » » "jump to recovery firmware\n");
75 } 104 }
76 105
77 » if (firmware_index == FIRMWARE_B) { 106 » /* TODO Jump to recovery firmware and never return */
78 » » /* TODO Jump to firmware B and should never return */
79 » }
80 107
81 » /* assert(firmware_index == FIRMWARE_RECOVERY); */ 108 » debug(PREFIX "error: should never reach here!\n");
82 109 » 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.
83 » /* Recovery Firmware ************************************************ */
84
85 » return 0;
86 } 110 }
87 111
88 U_BOOT_CMD(cros_bootstub, 1, 1, do_cros_bootstub, NULL, NULL); 112 U_BOOT_CMD(cros_bootstub, 1, 1, do_cros_bootstub, NULL, NULL);
OLDNEW
« 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