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

Side by Side Diff: host/lib/crossystem.c

Issue 6698032: Add VB test error func/num (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/vboot_reference.git@master
Patch Set: ready for 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 | « firmware/lib/vboot_nvstorage.c ('k') | tests/vboot_nvstorage_test.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5
6 #include <stdio.h> 6 #include <stdio.h>
7 #include <string.h> 7 #include <string.h>
8 #include <sys/types.h> 8 #include <sys/types.h>
9 #include <sys/stat.h> 9 #include <sys/stat.h>
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 } else if (!strcasecmp(name,"savedmem_size")) { 637 } else if (!strcasecmp(name,"savedmem_size")) {
638 return (-1 == ReadFileInt(ACPI_CHSW_PATH) ? -1 : 0x00100000); 638 return (-1 == ReadFileInt(ACPI_CHSW_PATH) ? -1 : 0x00100000);
639 } 639 }
640 /* NV storage values with no defaults for older BIOS. */ 640 /* NV storage values with no defaults for older BIOS. */
641 else if (!strcasecmp(name,"tried_fwb")) { 641 else if (!strcasecmp(name,"tried_fwb")) {
642 value = VbGetNvStorage(VBNV_TRIED_FIRMWARE_B); 642 value = VbGetNvStorage(VBNV_TRIED_FIRMWARE_B);
643 } else if (!strcasecmp(name,"kern_nv")) { 643 } else if (!strcasecmp(name,"kern_nv")) {
644 value = VbGetNvStorage(VBNV_KERNEL_FIELD); 644 value = VbGetNvStorage(VBNV_KERNEL_FIELD);
645 } else if (!strcasecmp(name,"nvram_cleared")) { 645 } else if (!strcasecmp(name,"nvram_cleared")) {
646 value = VbGetNvStorage(VBNV_KERNEL_SETTINGS_RESET); 646 value = VbGetNvStorage(VBNV_KERNEL_SETTINGS_RESET);
647 } else if (!strcasecmp(name,"vbtest_errfunc")) {
648 value = VbGetNvStorage(VBNV_TEST_ERROR_FUNC);
649 } else if (!strcasecmp(name,"vbtest_errno")) {
650 value = VbGetNvStorage(VBNV_TEST_ERROR_NUM);
647 } 651 }
648 /* NV storage values. If unable to get from NV storage, fall back to the 652 /* NV storage values. If unable to get from NV storage, fall back to the
649 * CMOS reboot field used by older BIOS. */ 653 * CMOS reboot field used by older BIOS. */
650 else if (!strcasecmp(name,"recovery_request")) { 654 else if (!strcasecmp(name,"recovery_request")) {
651 value = VbGetNvStorage(VBNV_RECOVERY_REQUEST); 655 value = VbGetNvStorage(VBNV_RECOVERY_REQUEST);
652 if (-1 == value) 656 if (-1 == value)
653 value = VbGetCmosRebootField(CMOSRF_RECOVERY); 657 value = VbGetCmosRebootField(CMOSRF_RECOVERY);
654 } else if (!strcasecmp(name,"dbg_reset")) { 658 } else if (!strcasecmp(name,"dbg_reset")) {
655 value = VbGetNvStorage(VBNV_DEBUG_RESET_MODE); 659 value = VbGetNvStorage(VBNV_DEBUG_RESET_MODE);
656 if (-1 == value) 660 if (-1 == value)
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 * 756 *
753 * Returns 0 if success, -1 if error. */ 757 * Returns 0 if success, -1 if error. */
754 int VbSetSystemPropertyInt(const char* name, int value) { 758 int VbSetSystemPropertyInt(const char* name, int value) {
755 759
756 /* NV storage values with no defaults for older BIOS. */ 760 /* NV storage values with no defaults for older BIOS. */
757 if (!strcasecmp(name,"nvram_cleared")) { 761 if (!strcasecmp(name,"nvram_cleared")) {
758 /* Can only clear this flag; it's set inside the NV storage library. */ 762 /* Can only clear this flag; it's set inside the NV storage library. */
759 return VbSetNvStorage(VBNV_KERNEL_SETTINGS_RESET, 0); 763 return VbSetNvStorage(VBNV_KERNEL_SETTINGS_RESET, 0);
760 } else if (!strcasecmp(name,"kern_nv")) { 764 } else if (!strcasecmp(name,"kern_nv")) {
761 return VbSetNvStorage(VBNV_KERNEL_FIELD, value); 765 return VbSetNvStorage(VBNV_KERNEL_FIELD, value);
766 } else if (!strcasecmp(name,"vbtest_errfunc")) {
767 return VbSetNvStorage(VBNV_TEST_ERROR_FUNC, value);
768 } else if (!strcasecmp(name,"vbtest_errno")) {
769 return VbSetNvStorage(VBNV_TEST_ERROR_NUM, value);
762 } 770 }
763 /* NV storage values. If unable to get from NV storage, fall back to the 771 /* NV storage values. If unable to get from NV storage, fall back to the
764 * CMOS reboot field used by older BIOS. */ 772 * CMOS reboot field used by older BIOS. */
765 else if (!strcasecmp(name,"recovery_request")) { 773 else if (!strcasecmp(name,"recovery_request")) {
766 if (0 == VbSetNvStorage(VBNV_RECOVERY_REQUEST, value)) 774 if (0 == VbSetNvStorage(VBNV_RECOVERY_REQUEST, value))
767 return 0; 775 return 0;
768 return VbSetCmosRebootField(CMOSRF_RECOVERY, value); 776 return VbSetCmosRebootField(CMOSRF_RECOVERY, value);
769 } else if (!strcasecmp(name,"dbg_reset")) { 777 } else if (!strcasecmp(name,"dbg_reset")) {
770 if (0 == VbSetNvStorage(VBNV_DEBUG_RESET_MODE, value)) 778 if (0 == VbSetNvStorage(VBNV_DEBUG_RESET_MODE, value))
771 return 0; 779 return 0;
772 return VbSetCmosRebootField(CMOSRF_DEBUG_RESET, value); 780 return VbSetCmosRebootField(CMOSRF_DEBUG_RESET, value);
773 } else if (!strcasecmp(name,"fwb_tries")) { 781 } else if (!strcasecmp(name,"fwb_tries")) {
774 if (0 == VbSetNvStorage(VBNV_TRY_B_COUNT, value)) 782 if (0 == VbSetNvStorage(VBNV_TRY_B_COUNT, value))
775 return 0; 783 return 0;
776 return VbSetCmosRebootField(CMOSRF_TRY_B, value); 784 return VbSetCmosRebootField(CMOSRF_TRY_B, value);
777 } 785 }
778 786
779 return -1; 787 return -1;
780 } 788 }
781 789
782 790
783 /* Set a system property string. 791 /* Set a system property string.
784 * 792 *
785 * Returns 0 if success, -1 if error. */ 793 * Returns 0 if success, -1 if error. */
786 int VbSetSystemPropertyString(const char* name, const char* value) { 794 int VbSetSystemPropertyString(const char* name, const char* value) {
787 795
788 /* TODO: support setting */ 796 /* TODO: support setting */
789 return -1; 797 return -1;
790 } 798 }
OLDNEW
« no previous file with comments | « firmware/lib/vboot_nvstorage.c ('k') | tests/vboot_nvstorage_test.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698