summaryrefslogtreecommitdiffstats
path: root/discover/platform-powerpc.c
diff options
context:
space:
mode:
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>2016-03-21 16:35:05 +1100
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>2016-03-23 14:02:10 +1100
commit79f738d13fa491abac82c77ac42f59aef4217b1d (patch)
treebd25d430714c2a7640584c235a29511d903f564f /discover/platform-powerpc.c
parenta2441c75956929293359888a4169114267a5fdbf (diff)
downloadpetitboot-79f738d13fa491abac82c77ac42f59aef4217b1d.zip
petitboot-79f738d13fa491abac82c77ac42f59aef4217b1d.tar.gz
discover: Respect persistent flag for network overridesv1.0.0
If the persistent bit is set in a IPMI network override, overwrite any existing interface config in NVRAM with the new network override. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Diffstat (limited to 'discover/platform-powerpc.c')
-rw-r--r--discover/platform-powerpc.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/discover/platform-powerpc.c b/discover/platform-powerpc.c
index 0e3a10b..b426df6 100644
--- a/discover/platform-powerpc.c
+++ b/discover/platform-powerpc.c
@@ -1121,6 +1121,7 @@ static void get_ipmi_network_override(struct platform_powerpc *platform,
const uint32_t magic_value = 0x21706221;
uint8_t resp[resp_len];
uint32_t cookie;
+ bool persistent;
int i, rc;
uint8_t req[] = {
0x61, /* parameter selector: OEM section (network) */
@@ -1169,18 +1170,21 @@ static void get_ipmi_network_override(struct platform_powerpc *platform,
return;
}
- /* Check for valid parameters. For now ignore the persistent flag */
+ /* Check that the parameters are valid */
if (resp[2] & 0x80) {
pb_debug("platform: network override is invalid/locked\n");
return;
}
- /* Check for valid parameters in the boot flags section, ignoring the
- * persistent bit */
+ /* Check for valid parameters in the boot flags section */
if (!(resp[3] & 0x80)) {
pb_debug("platform: network override valid flag not set\n");
return;
}
+ /* Read the persistent flag; if it is set we need to save this config */
+ persistent = resp[3] & 0x40;
+ if (persistent)
+ pb_debug("platform: network override is persistent\n");
/* Check 4-byte cookie value */
i = 4;
@@ -1202,7 +1206,15 @@ static void get_ipmi_network_override(struct platform_powerpc *platform,
}
/* Interpret the rest of the interface config */
- parse_ipmi_interface_override(config, &resp[i], resp_len - i);
+ rc = parse_ipmi_interface_override(config, &resp[i], resp_len - i);
+
+ if (!rc && persistent) {
+ /* Write this new config to NVRAM */
+ update_network_config(platform, config);
+ rc = write_nvram(platform);
+ if (rc)
+ pb_log("platform: Failed to save persistent interface override\n");
+ }
}
static int load_config(struct platform *p, struct config *config)
OpenPOWER on IntegriCloud