summaryrefslogtreecommitdiff
path: root/host
diff options
context:
space:
mode:
authorJoel Kitching <kitching@google.com>2020-02-13 18:04:21 +0800
committerCommit Bot <commit-bot@chromium.org>2020-02-14 11:51:40 +0000
commit58ae67008f4f70cdbf48d76234f70a3b61b6e83e (patch)
tree732431ee2be3df14d7fdb122bc3b808aad3e3be7 /host
parent19788a7d88397e2d9df3881c39a9111f365fa3cf (diff)
downloadvboot-58ae67008f4f70cdbf48d76234f70a3b61b6e83e.tar.gz
vboot: unmarry LoadKernel from VBSD
Create a function-local copy of VbSharedDataKernelCall rather than using the memory built-in to VBSD. Stop making any reference to vboot1 VBSD from LoadKernel. BUG=b:124141368, chromium:1038260 TEST=make clean && make runtests BRANCH=none Change-Id: I5dabfb33a0eb05c1f40509dcf00a4c5751af1ef5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2053182 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
Diffstat (limited to 'host')
-rw-r--r--host/lib/crossystem.c107
1 files changed, 3 insertions, 104 deletions
diff --git a/host/lib/crossystem.c b/host/lib/crossystem.c
index 71cdd5c9..33cf332f 100644
--- a/host/lib/crossystem.c
+++ b/host/lib/crossystem.c
@@ -28,9 +28,9 @@
/* Fields that GetVdatString() can get */
typedef enum VdatStringField {
VDAT_STRING_DEPRECATED_TIMERS = 0, /* Timer values */
- VDAT_STRING_LOAD_FIRMWARE_DEBUG, /* LoadFirmware() debug information */
- VDAT_STRING_LOAD_KERNEL_DEBUG, /* LoadKernel() debug information */
- VDAT_STRING_MAINFW_ACT /* Active main firmware */
+ VDAT_STRING_LOAD_FIRMWARE_DEBUG, /* LoadFirmware() debug info */
+ VDAT_STRING_DEPRECATED_LOAD_KERNEL_DEBUG, /* LoadKernel() debug info */
+ VDAT_STRING_MAINFW_ACT /* Active main firmware */
} VdatStringField;
@@ -243,101 +243,6 @@ static char *GetVdatLoadFirmwareDebug(char *dest, int size,
return dest;
}
-#define TRUNCATED "\n(truncated)\n"
-
-static char *GetVdatLoadKernelDebug(char *dest, int size,
- const VbSharedDataHeader *sh)
-{
- int used = 0;
- int first_call_tracked = 0;
- int call;
-
- /* Make sure we have space for truncation warning */
- if (size < strlen(TRUNCATED) + 1)
- return NULL;
- size -= strlen(TRUNCATED) + 1;
-
- used += snprintf(
- dest + used, size - used,
- "Calls to LoadKernel()=%d\n",
- sh->lk_call_count);
- if (used > size)
- goto LoadKernelDebugExit;
-
- /* Report on the last calls */
- if (sh->lk_call_count > VBSD_MAX_KERNEL_CALLS)
- first_call_tracked = sh->lk_call_count - VBSD_MAX_KERNEL_CALLS;
- for (call = first_call_tracked; call < sh->lk_call_count; call++) {
- const VbSharedDataKernelCall* shc = sh->lk_calls +
- (call & (VBSD_MAX_KERNEL_CALLS - 1));
- int first_part_tracked = 0;
- int part;
-
- used += snprintf(dest + used, size - used,
- "Call %d:\n"
- " Boot flags=0x%02x\n"
- " Boot mode=%d\n"
- " Test error=%d\n"
- " Return code=%d\n"
- " Debug flags=0x%02x\n"
- " Drive sectors=%" PRIu64 "\n"
- " Sector size=%d\n"
- " Check result=%d\n"
- " Kernel partitions found=%d\n",
- call + 1,
- shc->boot_flags,
- shc->boot_mode,
- shc->test_error_num,
- shc->return_code,
- shc->flags,
- shc->sector_count,
- shc->sector_size,
- shc->check_result,
- shc->kernel_parts_found);
- if (used > size)
- goto LoadKernelDebugExit;
-
- /* If we found too many partitions, only prints ones where the
- * structure has info. */
- if (shc->kernel_parts_found > VBSD_MAX_KERNEL_PARTS)
- first_part_tracked = shc->kernel_parts_found -
- VBSD_MAX_KERNEL_PARTS;
-
- /* Report on the partitions checked */
- for (part = first_part_tracked; part < shc->kernel_parts_found;
- part++) {
- const VbSharedDataKernelPart* shp = shc->parts +
- (part & (VBSD_MAX_KERNEL_PARTS - 1));
-
- used += snprintf(dest + used, size - used,
- " Kernel %d:\n"
- " GPT index=%d\n"
- " Start sector=%" PRIu64 "\n"
- " Sector count=%" PRIu64 "\n"
- " Combined version=0x%08x\n"
- " Check result=%d\n"
- " Debug flags=0x%02x\n",
- part + 1,
- shp->gpt_index,
- shp->sector_start,
- shp->sector_count,
- shp->combined_version,
- shp->check_result,
- shp->flags);
- if (used > size)
- goto LoadKernelDebugExit;
- }
- }
-
-LoadKernelDebugExit:
-
- /* Warn if data was truncated; we left space for this above. */
- if (used > size)
- strcat(dest, TRUNCATED);
-
- return dest;
-}
-
static char *GetVdatString(char *dest, int size, VdatStringField field)
{
VbSharedDataHeader *sh = VbSharedDataRead();
@@ -351,10 +256,6 @@ static char *GetVdatString(char *dest, int size, VdatStringField field)
value = GetVdatLoadFirmwareDebug(dest, size, sh);
break;
- case VDAT_STRING_LOAD_KERNEL_DEBUG:
- value = GetVdatLoadKernelDebug(dest, size, sh);
- break;
-
case VDAT_STRING_MAINFW_ACT:
switch(sh->firmware_index) {
case 0:
@@ -589,8 +490,6 @@ const char *VbGetSystemPropertyString(const char *name, char *dest,
} else if (!strcasecmp(name, "vdat_lfdebug")) {
return GetVdatString(dest, size,
VDAT_STRING_LOAD_FIRMWARE_DEBUG);
- } else if (!strcasecmp(name, "vdat_lkdebug")) {
- return GetVdatString(dest, size, VDAT_STRING_LOAD_KERNEL_DEBUG);
} else if (!strcasecmp(name, "fw_try_next")) {
return vb2_get_nv_storage(VB2_NV_TRY_NEXT) ? "B" : "A";
} else if (!strcasecmp(name, "fw_tried")) {