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 #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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 } else if (!strcasecmp(name,"recovery_request")) { | 352 } else if (!strcasecmp(name,"recovery_request")) { |
353 value = VbGetNvStorage(VBNV_RECOVERY_REQUEST); | 353 value = VbGetNvStorage(VBNV_RECOVERY_REQUEST); |
354 } else if (!strcasecmp(name,"dbg_reset")) { | 354 } else if (!strcasecmp(name,"dbg_reset")) { |
355 value = VbGetNvStorage(VBNV_DEBUG_RESET_MODE); | 355 value = VbGetNvStorage(VBNV_DEBUG_RESET_MODE); |
356 } else if (!strcasecmp(name,"fwb_tries")) { | 356 } else if (!strcasecmp(name,"fwb_tries")) { |
357 value = VbGetNvStorage(VBNV_TRY_B_COUNT); | 357 value = VbGetNvStorage(VBNV_TRY_B_COUNT); |
358 } else if (!strcasecmp(name,"fwupdate_tries")) { | 358 } else if (!strcasecmp(name,"fwupdate_tries")) { |
359 value = VbGetNvStorage(VBNV_KERNEL_FIELD); | 359 value = VbGetNvStorage(VBNV_KERNEL_FIELD); |
360 if (value != -1) | 360 if (value != -1) |
361 value &= KERN_NV_FWUPDATE_TRIES_MASK; | 361 value &= KERN_NV_FWUPDATE_TRIES_MASK; |
| 362 } else if (!strcasecmp(name,"loc_idx")) { |
| 363 value = VbGetNvStorage(VBNV_LOCALIZATION_INDEX); |
362 } | 364 } |
363 /* Other parameters */ | 365 /* Other parameters */ |
364 else if (!strcasecmp(name,"cros_debug")) { | 366 else if (!strcasecmp(name,"cros_debug")) { |
365 value = VbGetCrosDebug(); | 367 value = VbGetCrosDebug(); |
366 } else if (!strcasecmp(name,"vdat_flags")) { | 368 } else if (!strcasecmp(name,"vdat_flags")) { |
367 value = GetVdatInt(VDAT_INT_FLAGS); | 369 value = GetVdatInt(VDAT_INT_FLAGS); |
368 } else if (!strcasecmp(name,"tpm_fwver")) { | 370 } else if (!strcasecmp(name,"tpm_fwver")) { |
369 value = GetVdatInt(VDAT_INT_FW_VERSION_TPM); | 371 value = GetVdatInt(VDAT_INT_FW_VERSION_TPM); |
370 } else if (!strcasecmp(name,"tpm_kernver")) { | 372 } else if (!strcasecmp(name,"tpm_kernver")) { |
371 value = GetVdatInt(VDAT_INT_KERNEL_VERSION_TPM); | 373 value = GetVdatInt(VDAT_INT_KERNEL_VERSION_TPM); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 return VbSetNvStorage(VBNV_DEBUG_RESET_MODE, value); | 427 return VbSetNvStorage(VBNV_DEBUG_RESET_MODE, value); |
426 } else if (!strcasecmp(name,"fwb_tries")) { | 428 } else if (!strcasecmp(name,"fwb_tries")) { |
427 return VbSetNvStorage(VBNV_TRY_B_COUNT, value); | 429 return VbSetNvStorage(VBNV_TRY_B_COUNT, value); |
428 } else if (!strcasecmp(name,"fwupdate_tries")) { | 430 } else if (!strcasecmp(name,"fwupdate_tries")) { |
429 int kern_nv = VbGetNvStorage(VBNV_KERNEL_FIELD); | 431 int kern_nv = VbGetNvStorage(VBNV_KERNEL_FIELD); |
430 if (kern_nv == -1) | 432 if (kern_nv == -1) |
431 return -1; | 433 return -1; |
432 kern_nv &= ~KERN_NV_FWUPDATE_TRIES_MASK; | 434 kern_nv &= ~KERN_NV_FWUPDATE_TRIES_MASK; |
433 kern_nv |= (value & KERN_NV_FWUPDATE_TRIES_MASK); | 435 kern_nv |= (value & KERN_NV_FWUPDATE_TRIES_MASK); |
434 return VbSetNvStorage(VBNV_KERNEL_FIELD, kern_nv); | 436 return VbSetNvStorage(VBNV_KERNEL_FIELD, kern_nv); |
| 437 } else if (!strcasecmp(name,"loc_idx")) { |
| 438 return VbSetNvStorage(VBNV_LOCALIZATION_INDEX, value); |
435 } | 439 } |
436 | 440 |
437 return -1; | 441 return -1; |
438 } | 442 } |
439 | 443 |
440 | 444 |
441 int VbSetSystemPropertyString(const char* name, const char* value) { | 445 int VbSetSystemPropertyString(const char* name, const char* value) { |
442 /* Chain to architecture-dependent properties */ | 446 /* Chain to architecture-dependent properties */ |
443 return VbSetArchPropertyString(name, value); | 447 return VbSetArchPropertyString(name, value); |
444 } | 448 } |
OLD | NEW |