diff options
author | Bernie Thompson <bhthompson@chromium.org> | 2012-01-17 11:15:56 -0800 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2012-01-18 09:44:23 -0800 |
commit | bd00c622e4249b67087a81adb1978a661c7ef8c9 (patch) | |
tree | b76825b0c69a42646cee9e37b19c0b8e8e5d53fe /host | |
parent | 82e69b9f7494c5f939e2b546c06eeb13d68bdd03 (diff) | |
download | vboot-bd00c622e4249b67087a81adb1978a661c7ef8c9.tar.gz |
Allow crossystem ReadFdtBlock() to use a direct path starting with '/'
This extends the ReadFdtBlock function for ARM to allow for a direct path
to a FDT entry by starting the property with a '/'. This allows the
ReadFdtPlatformFamily function to use a direct path instead of stepping back
through folders, and will enable future crossystem entries to do the same.
BUG=chromium-os:24669
TEST=Manual
Change-Id: Ibddb881815947259c2532d7f5474eda5fdc9f803
Reviewed-on: https://gerrit.chromium.org/gerrit/14305
Reviewed-by: Olof Johansson <olofj@chromium.org>
Reviewed-by: Bernie Thompson <bhthompson@chromium.org>
Tested-by: Bernie Thompson <bhthompson@chromium.org>
Commit-Ready: Bernie Thompson <bhthompson@chromium.org>
Diffstat (limited to 'host')
-rw-r--r-- | host/arch/arm/lib/crossystem_arch.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/host/arch/arm/lib/crossystem_arch.c b/host/arch/arm/lib/crossystem_arch.c index aa740b06..62cf31f6 100644 --- a/host/arch/arm/lib/crossystem_arch.c +++ b/host/arch/arm/lib/crossystem_arch.c @@ -19,8 +19,10 @@ #include "host_common.h" #include "crossystem_arch.h" -/* Base name for FDT files */ +/* Base name for firmware FDT files */ #define FDT_BASE_PATH "/proc/device-tree/firmware/chromeos" +/* Path to compatible FDT entry */ +#define FDT_COMPATIBLE_PATH "/proc/device-tree/compatible" /* Device for NVCTX write */ #define NVCTX_PATH "/dev/mmcblk%d" /* Errors */ @@ -112,7 +114,10 @@ static int ReadFdtBlock(const char *property, void **block, size_t *size) { if (!block) return E_FAIL; - snprintf(filename, sizeof(filename), FDT_BASE_PATH "/%s", property); + if (property[0] == '/') + StrCopy(filename, property, sizeof(filename)); + else + snprintf(filename, sizeof(filename), FDT_BASE_PATH "/%s", property); file = fopen(filename, "rb"); if (!file) { fprintf(stderr, "Unable to open FDT property %s\n", property); @@ -160,8 +165,7 @@ static char * ReadFdtPlatformFamily(void) { size_t size = 0; int slen; - /* TODO: Allow this to be a more direct path by modifying ReadFdtBlock */ - ReadFdtBlock("../../compatible", &compat, &size); + ReadFdtBlock(FDT_COMPATIBLE_PATH, &compat, &size); if (size > 0) compat[size-1] = 0; |