diff options
author | Cyril Bur <cyril.bur@au1.ibm.com> | 2017-08-03 17:08:52 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-09-12 22:52:08 -0500 |
commit | c524d6b022e12e3e347d308d16d2bd51acec17f4 (patch) | |
tree | 3215a4c23cea6adaf591bf42f3de0bfc53328ba6 | |
parent | bf1751cc6b4b9cbfb4b476ce776b0010f3137c0d (diff) | |
download | skiboot-c524d6b022e12e3e347d308d16d2bd51acec17f4.zip skiboot-c524d6b022e12e3e347d308d16d2bd51acec17f4.tar.gz skiboot-c524d6b022e12e3e347d308d16d2bd51acec17f4.tar.bz2 |
external/gard: Print an error if run on an FSP system
Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r-- | external/gard/gard.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/external/gard/gard.c b/external/gard/gard.c index c5cb93b..5dc14c5 100644 --- a/external/gard/gard.c +++ b/external/gard/gard.c @@ -43,7 +43,9 @@ #define CLEARED_RECORD_ID 0xFFFFFFFF -#define FDT_ACTIVE_FLASH_PATH "/proc/device-tree/chosen/ibm,system-flash" +#define FDT_PATH "/proc/device-tree" +#define FDT_FSP_NODE FDT_PATH"/fsps" +#define FDT_ACTIVE_FLASH_PATH FDT_PATH"/chosen/ibm,system-flash" #define SYSFS_MTD_PATH "/sys/class/mtd/" #define FLASH_GARD_PART "GUARD" @@ -583,6 +585,11 @@ static void usage(const char *progname) } } +static bool is_fsp(void) +{ + return access(FDT_FSP_NODE, F_OK) == 0; +} + static struct option global_options[] = { { "file", required_argument, 0, 'f' }, { "part", no_argument, 0, 'p' }, @@ -606,6 +613,12 @@ int main(int argc, char **argv) ctx = &_ctx; memset(ctx, 0, sizeof(*ctx)); + if (is_fsp()) { + fprintf(stderr, "This is the OpenPower gard tool which does " + "not support FSP systems\n"); + return EXIT_FAILURE; + } + /* process global options */ for (;;) { int c; |