summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2022-11-21 17:36:41 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-11-23 09:30:25 +0000
commitedcc75666d8fab2e1be895ac87af87ee74ec0079 (patch)
tree1ec803898be6a816b9fe63b1af90e1b6ba63b6dd
parent87663c3bef0f6b198945cf3eb83632f461a5d6f8 (diff)
downloadvboot-edcc75666d8fab2e1be895ac87af87ee74ec0079.tar.gz
crossystem: arm: Make FDT_BASE_PATH /proc/device-tree
Hard-coding to /proc/device-tree/firmware/chromeos won't let us read device-tree properties outside of /firmware/chromeos. The follow-on CL reads from /firmware/coreboot. BUG=b:187790074 BRANCH=none TEST=CQ passes Change-Id: I752aa5a1e20db1dad7f2508852c7a1c982a4bcb4 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4045046 Reviewed-by: Julius Werner <jwerner@chromium.org>
-rw-r--r--host/arch/arm/lib/crossystem_arch.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/host/arch/arm/lib/crossystem_arch.c b/host/arch/arm/lib/crossystem_arch.c
index 79fb152e..897036d2 100644
--- a/host/arch/arm/lib/crossystem_arch.c
+++ b/host/arch/arm/lib/crossystem_arch.c
@@ -29,7 +29,9 @@
#include "host_common.h"
/* Base name for firmware FDT files */
-#define FDT_BASE_PATH "/proc/device-tree/firmware/chromeos"
+#define FDT_BASE_PATH "/proc/device-tree"
+/* The /firmware/chromeos path in FDT */
+#define FDT_CHROMEOS "firmware/chromeos/"
/* Path to compatible FDT entry */
#define FDT_COMPATIBLE_PATH "/proc/device-tree/compatible"
/* Path to the chromeos_arm platform device (deprecated) */
@@ -45,7 +47,7 @@
#define GPIO_BASE_PATH "/sys/class/gpio"
#define GPIO_EXPORT_PATH GPIO_BASE_PATH "/export"
/* Name of NvStorage type property */
-#define FDT_NVSTORAGE_TYPE_PROP "nonvolatile-context-storage"
+#define FDT_NVSTORAGE_TYPE_PROP FDT_CHROMEOS "nonvolatile-context-storage"
/* Errors */
#define E_FAIL -1
#define E_FILEOP -2
@@ -348,9 +350,9 @@ static int vb2_read_nv_storage_disk(struct vb2_context *ctx)
int rv = -1;
char nvctx_path[FNAME_SIZE];
int emmc_dev;
- int lba = ReadFdtInt("nonvolatile-context-lba");
- int offset = ReadFdtInt("nonvolatile-context-offset");
- int size = ReadFdtInt("nonvolatile-context-size");
+ int lba = ReadFdtInt(FDT_CHROMEOS "nonvolatile-context-lba");
+ int offset = ReadFdtInt(FDT_CHROMEOS "nonvolatile-context-offset");
+ int size = ReadFdtInt(FDT_CHROMEOS "nonvolatile-context-size");
emmc_dev = FindEmmcDev();
if (emmc_dev < 0)
@@ -391,9 +393,9 @@ static int vb2_write_nv_storage_disk(struct vb2_context *ctx)
int rv = -1;
char nvctx_path[FNAME_SIZE];
int emmc_dev;
- int lba = ReadFdtInt("nonvolatile-context-lba");
- int offset = ReadFdtInt("nonvolatile-context-offset");
- int size = ReadFdtInt("nonvolatile-context-size");
+ int lba = ReadFdtInt(FDT_CHROMEOS "nonvolatile-context-lba");
+ int offset = ReadFdtInt(FDT_CHROMEOS "nonvolatile-context-offset");
+ int size = ReadFdtInt(FDT_CHROMEOS "nonvolatile-context-size");
emmc_dev = FindEmmcDev();
if (emmc_dev < 0)
@@ -480,7 +482,7 @@ VbSharedDataHeader *VbSharedDataRead(void)
{
void *block = NULL;
size_t size = 0;
- if (ReadFdtBlock("vboot-shared-data", &block, &size))
+ if (ReadFdtBlock(FDT_CHROMEOS "vboot-shared-data", &block, &size))
return NULL;
VbSharedDataHeader *p = (VbSharedDataHeader *)block;
if (p->magic != VB_SHARED_DATA_MAGIC) {
@@ -540,16 +542,15 @@ const char* VbGetArchPropertyString(const char* name, char* dest,
/* Properties from fdt */
if (!strcasecmp(name, "ro_fwid"))
- prop = "readonly-firmware-version";
+ prop = FDT_CHROMEOS "readonly-firmware-version";
else if (!strcasecmp(name, "hwid"))
- prop = "hardware-id";
+ prop = FDT_CHROMEOS "hardware-id";
else if (!strcasecmp(name, "fwid"))
- prop = "firmware-version";
+ prop = FDT_CHROMEOS "firmware-version";
else if (!strcasecmp(name, "mainfw_type"))
- prop = "firmware-type";
+ prop = FDT_CHROMEOS "firmware-type";
else if (!strcasecmp(name, "ecfw_act"))
- prop = "active-ec-firmware";
-
+ prop = FDT_CHROMEOS "active-ec-firmware";
if (prop)
str = ReadFdtString(prop);