OLD | NEW |
1 /* Copyright (c) 2011 The Chromium OS Authors. All rights reserved. | 1 /* Copyright (c) 2011 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 * Chrome OS firmware/system interface utility | 5 * Chrome OS firmware/system interface utility |
6 */ | 6 */ |
7 | 7 |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 #include <string.h> | 10 #include <string.h> |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 typedef struct Param { | 23 typedef struct Param { |
24 const char* name; /* Parameter name */ | 24 const char* name; /* Parameter name */ |
25 int flags; /* Flags (see above) */ | 25 int flags; /* Flags (see above) */ |
26 const char* desc; /* Human-readable description */ | 26 const char* desc; /* Human-readable description */ |
27 const char* format; /* Format string, if non-NULL and 0==is_string*/ | 27 const char* format; /* Format string, if non-NULL and 0==is_string*/ |
28 } Param; | 28 } Param; |
29 | 29 |
30 /* List of parameters, terminated with a param with NULL name */ | 30 /* List of parameters, terminated with a param with NULL name */ |
31 const Param sys_param_list[] = { | 31 const Param sys_param_list[] = { |
32 /* Read-only integers */ | 32 {"arch", IS_STRING, "Platform architecture"}, |
| 33 {"cros_debug", 0, "OS should allow debug features"}, |
| 34 {"dbg_reset", CAN_WRITE, "Debug reset mode request (writable)"}, |
| 35 {"devsw_boot", 0, "Developer switch position at boot"}, |
33 {"devsw_cur", 0, "Developer switch current position"}, | 36 {"devsw_cur", 0, "Developer switch current position"}, |
34 {"devsw_boot", 0, "Developer switch position at boot"}, | 37 {"ecfw_act", IS_STRING, "Active EC firmware"}, |
| 38 {"fmap_base", 0, "Main firmware flashmap physical address", "0x%08x"}, |
| 39 {"fwb_tries", CAN_WRITE, "Try firmware B count (writable)"}, |
| 40 {"fwid", IS_STRING, "Active firmware ID"}, |
| 41 {"fwupdate_tries", CAN_WRITE, |
| 42 "Times to try OS firmware update (writable, inside kern_nv)"}, |
| 43 {"hwid", IS_STRING, "Hardware ID"}, |
| 44 {"kern_nv", CAN_WRITE, "Non-volatile field for kernel use", "0x%08x"}, |
| 45 {"kernkey_vfy", IS_STRING, "Type of verification done on kernel key block"}, |
| 46 {"loc_idx", CAN_WRITE, "Localization index for firmware screens (writable)"}, |
| 47 {"mainfw_act", IS_STRING, "Active main firmware"}, |
| 48 {"mainfw_type", IS_STRING, "Active main firmware type"}, |
| 49 {"nvram_cleared", CAN_WRITE, "Have NV settings been lost? Write 0 to clear"}, |
| 50 {"recovery_reason", 0, "Recovery mode reason for current boot"}, |
| 51 {"recovery_request", CAN_WRITE, "Recovery mode request (writable)"}, |
| 52 {"recoverysw_boot", 0, "Recovery switch position at boot"}, |
35 {"recoverysw_cur", 0, "Recovery switch current position"}, | 53 {"recoverysw_cur", 0, "Recovery switch current position"}, |
36 {"recoverysw_boot", 0, "Recovery switch position at boot"}, | |
37 {"recoverysw_ec_boot", 0, "Recovery switch position at EC boot"}, | 54 {"recoverysw_ec_boot", 0, "Recovery switch position at EC boot"}, |
38 {"wpsw_cur", 0, "Firmware write protect hardware switch current position"}, | 55 {"ro_fwid", IS_STRING, "Read-only firmware ID"}, |
39 {"wpsw_boot", 0, "Firmware write protect hardware switch position at boot"}, | |
40 {"recovery_reason", 0, "Recovery mode reason for current boot"}, | |
41 {"savedmem_base", 0, "RAM debug data area physical address", "0x%08x"}, | 56 {"savedmem_base", 0, "RAM debug data area physical address", "0x%08x"}, |
42 {"savedmem_size", 0, "RAM debug data area size in bytes"}, | 57 {"savedmem_size", 0, "RAM debug data area size in bytes"}, |
43 {"fmap_base", 0, "Main firmware flashmap physical address", "0x%08x"}, | |
44 {"tried_fwb", 0, "Tried firmware B before A this boot"}, | |
45 {"cros_debug", 0, "OS should allow debug features"}, | |
46 {"vdat_flags", 0, "Flags from VbSharedData", "0x%08x"}, | |
47 {"tpm_fwver", 0, "Firmware version stored in TPM", "0x%08x"}, | 58 {"tpm_fwver", 0, "Firmware version stored in TPM", "0x%08x"}, |
48 {"tpm_kernver", 0, "Kernel version stored in TPM", "0x%08x"}, | 59 {"tpm_kernver", 0, "Kernel version stored in TPM", "0x%08x"}, |
49 /* Read-only strings */ | 60 {"tried_fwb", 0, "Tried firmware B before A this boot"}, |
50 {"arch", IS_STRING, "Platform architecture"}, | |
51 {"hwid", IS_STRING, "Hardware ID"}, | |
52 {"fwid", IS_STRING, "Active firmware ID"}, | |
53 {"ro_fwid", IS_STRING, "Read-only firmware ID"}, | |
54 {"mainfw_act", IS_STRING, "Active main firmware"}, | |
55 {"mainfw_type", IS_STRING, "Active main firmware type"}, | |
56 {"ecfw_act", IS_STRING, "Active EC firmware"}, | |
57 {"kernkey_vfy", IS_STRING, "Type of verification done on kernel key block"}, | |
58 {"vdat_timers", IS_STRING, "Timer values from VbSharedData"}, | |
59 /* Writable integers */ | |
60 {"nvram_cleared", CAN_WRITE, "Have NV settings been lost? Write 0 to clear"}, | |
61 {"kern_nv", CAN_WRITE, "Non-volatile field for kernel use", "0x%08x"}, | |
62 {"recovery_request", CAN_WRITE, "Recovery mode request (writable)"}, | |
63 {"dbg_reset", CAN_WRITE, "Debug reset mode request (writable)"}, | |
64 {"fwb_tries", CAN_WRITE, "Try firmware B count (writable)"}, | |
65 {"fwupdate_tries", CAN_WRITE, | |
66 "Times to try OS firmware update (writable, inside kern_nv)"}, | |
67 {"vbtest_errfunc", CAN_WRITE, "Verified boot test error function (writable)"}, | 61 {"vbtest_errfunc", CAN_WRITE, "Verified boot test error function (writable)"}, |
68 {"vbtest_errno", CAN_WRITE, "Verified boot test error number (writable)"}, | 62 {"vbtest_errno", CAN_WRITE, "Verified boot test error number (writable)"}, |
69 {"loc_idx", CAN_WRITE, "Localization index for firmware screens (writable)"}, | 63 {"vdat_flags", 0, "Flags from VbSharedData", "0x%08x"}, |
70 /* Fields not shown in a print-all list */ | |
71 {"vdat_lfdebug", IS_STRING|NO_PRINT_ALL, | 64 {"vdat_lfdebug", IS_STRING|NO_PRINT_ALL, |
72 "LoadFirmware() debug data (not in print-all)"}, | 65 "LoadFirmware() debug data (not in print-all)"}, |
73 {"vdat_lkdebug", IS_STRING|NO_PRINT_ALL, | 66 {"vdat_lkdebug", IS_STRING|NO_PRINT_ALL, |
74 "LoadKernel() debug data (not in print-all)"}, | 67 "LoadKernel() debug data (not in print-all)"}, |
| 68 {"vdat_timers", IS_STRING, "Timer values from VbSharedData"}, |
| 69 {"wpsw_boot", 0, "Firmware write protect hardware switch position at boot"}, |
| 70 {"wpsw_cur", 0, "Firmware write protect hardware switch current position"}, |
75 /* Terminate with null name */ | 71 /* Terminate with null name */ |
76 {NULL, 0, NULL} | 72 {NULL, 0, NULL} |
77 }; | 73 }; |
78 | 74 |
79 | 75 |
80 /* Print help */ | 76 /* Print help */ |
81 void PrintHelp(const char *progname) { | 77 void PrintHelp(const char *progname) { |
82 const Param *p; | 78 const Param *p; |
83 | 79 |
84 printf("\nUsage:\n" | 80 printf("\nUsage:\n" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 if (has_set) | 260 if (has_set) |
265 retval = SetParam(p, value); | 261 retval = SetParam(p, value); |
266 else if (has_expect) | 262 else if (has_expect) |
267 retval = CheckParam(p, value); | 263 retval = CheckParam(p, value); |
268 else | 264 else |
269 retval = PrintParam(p); | 265 retval = PrintParam(p); |
270 } | 266 } |
271 | 267 |
272 return retval; | 268 return retval; |
273 } | 269 } |
OLD | NEW |