diff options
author | Oliver O'Halloran <oohall@gmail.com> | 2018-01-05 09:55:53 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2018-01-05 10:10:59 +1100 |
commit | 4e23b42d2ad76da21422a1d2de471df29f76b8df (patch) | |
tree | 0483730e622276fa7817244c813ab7c1846c2ac7 /hdata | |
parent | 8514d755c3ade836c335ae7f5d41d090f1243612 (diff) | |
download | skiboot-4e23b42d2ad76da21422a1d2de471df29f76b8df.zip skiboot-4e23b42d2ad76da21422a1d2de471df29f76b8df.tar.gz skiboot-4e23b42d2ad76da21422a1d2de471df29f76b8df.tar.bz2 |
hdata: Parse IPL FW feature settings
Add parsing for the firmware feature flags in the HDAT. This
indicates the settings of various parameters which are set at IPL time
by firmware.
Cc: stable # 5.4.x 371e88e23662 eeba2d64fb7a 0abc3af7e8f6
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hdata')
-rw-r--r-- | hdata/spira.c | 47 | ||||
-rw-r--r-- | hdata/spira.h | 7 |
2 files changed, 54 insertions, 0 deletions
diff --git a/hdata/spira.c b/hdata/spira.c index dc6370c..0724dcc 100644 --- a/hdata/spira.c +++ b/hdata/spira.c @@ -14,6 +14,7 @@ * limitations under the License. */ +#include <inttypes.h> #include <device.h> #include "spira.h" #include <cpu.h> @@ -1179,6 +1180,51 @@ static void add_iplparams_platform_dump(const void *iplp, struct dt_node *node) } } +static void add_iplparams_features(const struct HDIF_common_hdr *iplp) +{ + const struct iplparams_feature *feature; + const struct HDIF_array_hdr *array; + struct dt_node *fw_features; + unsigned int count, i; + char name[65]; + + array = HDIF_get_iarray(iplp, IPLPARAMS_FEATURES, &count); + if (!array || !count) + return; + + opal_node = dt_new_check(dt_root, "ibm,opal"); + fw_features = dt_new(opal_node, "fw-features"); + if (!fw_features) + return; + + HDIF_iarray_for_each(array, i, feature) { + struct dt_node *n; + uint64_t flags; + + /* the name field isn't necessarily null terminated */ + strncpy(name, feature->name, sizeof(feature->name)); + flags = be64_to_cpu(feature->flags); + + prlog(PR_DEBUG, "IPLPARAMS: FW feature %s = %016"PRIx64"\n", + name, flags); + + /* get rid of tm-suspend-mode-enabled being disabled */ + if (strcmp(name, "tm-suspend-mode-enabled") == 0) + strcpy(name, "tm-suspend-mode"); + + n = dt_new(fw_features, name); + + /* + * This is a bit overkill, but we'll want seperate properties + * for each flag bit(s). + */ + if (flags & PPC_BIT(0)) + dt_add_property(n, "enabled", NULL, 0); + else + dt_add_property(n, "disabled", NULL, 0); + } +} + static void add_iplparams(void) { struct dt_node *iplp_node; @@ -1199,6 +1245,7 @@ static void add_iplparams(void) add_iplparams_ipl_params(ipl_parms, iplp_node); add_iplparams_serials(ipl_parms, iplp_node); add_iplparams_platform_dump(ipl_parms, iplp_node); + add_iplparams_features(ipl_parms); } /* Various structure contain a "proc_chip_id" which is an arbitrary diff --git a/hdata/spira.h b/hdata/spira.h index 2ef13f3..39e0e33 100644 --- a/hdata/spira.h +++ b/hdata/spira.h @@ -443,6 +443,13 @@ struct iplparms_serial { #define PLPARMS_SERIAL_FLAGS_CALLHOME 0x8000 } __packed; +/* Idata index 9: FW features */ +#define IPLPARAMS_FEATURES 9 +struct iplparams_feature { + char name[64]; + __be64 flags; +} __packed; + /* * Chip TOD structure * |