| 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 | 5 |
| 6 #include <stdio.h> | 6 #include <stdio.h> |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "host_common.h" | 9 #include "host_common.h" |
| 10 | 10 |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 if (-1 != value && FwidStartsWith("Mario.")) | 477 if (-1 != value && FwidStartsWith("Mario.")) |
| 478 value = 1 - value; /* Mario reports this backwards */ | 478 value = 1 - value; /* Mario reports this backwards */ |
| 479 } | 479 } |
| 480 /* Saved memory is at a fixed location for all H2C BIOS. If the CHSW | 480 /* Saved memory is at a fixed location for all H2C BIOS. If the CHSW |
| 481 * path exists in sysfs, it's a H2C BIOS. */ | 481 * path exists in sysfs, it's a H2C BIOS. */ |
| 482 else if (!strcasecmp(name,"savedmem_base")) { | 482 else if (!strcasecmp(name,"savedmem_base")) { |
| 483 return (-1 == ReadFileInt(ACPI_CHSW_PATH) ? -1 : 0x00F00000); | 483 return (-1 == ReadFileInt(ACPI_CHSW_PATH) ? -1 : 0x00F00000); |
| 484 } else if (!strcasecmp(name,"savedmem_size")) { | 484 } else if (!strcasecmp(name,"savedmem_size")) { |
| 485 return (-1 == ReadFileInt(ACPI_CHSW_PATH) ? -1 : 0x00100000); | 485 return (-1 == ReadFileInt(ACPI_CHSW_PATH) ? -1 : 0x00100000); |
| 486 } | 486 } |
| 487 /* NV storage values with no defaults for older BIOS. */ |
| 488 else if (!strcasecmp(name,"tried_fwb")) { |
| 489 value = VbGetNvStorage(VBNV_FW_USED_TRY_B); |
| 490 } |
| 487 /* NV storage values. If unable to get from NV storage, fall back to the | 491 /* NV storage values. If unable to get from NV storage, fall back to the |
| 488 * CMOS reboot field used by older BIOS. */ | 492 * CMOS reboot field used by older BIOS. */ |
| 489 else if (!strcasecmp(name,"recovery_request")) { | 493 else if (!strcasecmp(name,"recovery_request")) { |
| 490 value = VbGetNvStorage(VBNV_RECOVERY_REQUEST); | 494 value = VbGetNvStorage(VBNV_RECOVERY_REQUEST); |
| 491 if (-1 == value) | 495 if (-1 == value) |
| 492 value = VbGetCmosRebootField(CMOSRF_RECOVERY); | 496 value = VbGetCmosRebootField(CMOSRF_RECOVERY); |
| 493 } else if (!strcasecmp(name,"dbg_reset")) { | 497 } else if (!strcasecmp(name,"dbg_reset")) { |
| 494 value = VbGetNvStorage(VBNV_DEBUG_RESET_MODE); | 498 value = VbGetNvStorage(VBNV_DEBUG_RESET_MODE); |
| 495 if (-1 == value) | 499 if (-1 == value) |
| 496 value = VbGetCmosRebootField(CMOSRF_DEBUG_RESET); | 500 value = VbGetCmosRebootField(CMOSRF_DEBUG_RESET); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 return VbReadMainFwType(dest, size); | 545 return VbReadMainFwType(dest, size); |
| 542 } else if (!strcasecmp(name,"ecfw_act")) { | 546 } else if (!strcasecmp(name,"ecfw_act")) { |
| 543 switch(ReadFileInt(ACPI_BINF_PATH ".2")) { | 547 switch(ReadFileInt(ACPI_BINF_PATH ".2")) { |
| 544 case 0: | 548 case 0: |
| 545 return StrCopy(dest, "RO", size); | 549 return StrCopy(dest, "RO", size); |
| 546 case 1: | 550 case 1: |
| 547 return StrCopy(dest, "RW", size); | 551 return StrCopy(dest, "RW", size); |
| 548 default: | 552 default: |
| 549 return NULL; | 553 return NULL; |
| 550 } | 554 } |
| 555 } else if (!strcasecmp(name,"kernkey_vfy")) { |
| 556 switch(VbGetNvStorage(VBNV_FW_VERIFIED_KERNEL_KEY)) { |
| 557 case 0: |
| 558 return "hash"; |
| 559 case 1: |
| 560 return "sig"; |
| 561 default: |
| 562 return NULL; |
| 563 } |
| 551 } else | 564 } else |
| 552 return NULL; | 565 return NULL; |
| 553 } | 566 } |
| 554 | 567 |
| 555 | 568 |
| 556 /* Set a system property integer. | 569 /* Set a system property integer. |
| 557 * | 570 * |
| 558 * Returns 0 if success, -1 if error. */ | 571 * Returns 0 if success, -1 if error. */ |
| 559 int VbSetSystemPropertyInt(const char* name, int value) { | 572 int VbSetSystemPropertyInt(const char* name, int value) { |
| 560 | 573 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 583 | 596 |
| 584 | 597 |
| 585 /* Set a system property string. | 598 /* Set a system property string. |
| 586 * | 599 * |
| 587 * Returns 0 if success, -1 if error. */ | 600 * Returns 0 if success, -1 if error. */ |
| 588 int VbSetSystemPropertyString(const char* name, const char* value) { | 601 int VbSetSystemPropertyString(const char* name, const char* value) { |
| 589 | 602 |
| 590 /* TODO: support setting */ | 603 /* TODO: support setting */ |
| 591 return -1; | 604 return -1; |
| 592 } | 605 } |
| OLD | NEW |