]> git.ozlabs.org Git - petitboot/blobdiff - discover/platform-powerpc.c
Display VERSION partition info on BMC machines
[petitboot] / discover / platform-powerpc.c
index 7370d7dcc20a21e78dacc57e2efc8ebe7e3cdb0f..46f81d201a403bec565bb735d728aa1e661fbcc1 100644 (file)
@@ -14,7 +14,9 @@
 #include <list/list.h>
 #include <log/log.h>
 #include <process/process.h>
+#include <types/types.h>
 
+#include "hostboot.h"
 #include "platform.h"
 #include "ipmi.h"
 #include "dt.h"
@@ -43,6 +45,7 @@ struct platform_powerpc {
                                bool persistent);
        int             (*set_os_boot_sensor)(
                                struct platform_powerpc *platform);
+       void            (*get_platform_versions)(struct system_info *info);
 };
 
 static const char *known_params[] = {
@@ -310,7 +313,7 @@ static int parse_one_interface_config(struct config *config,
        } else if (!strcmp(tok, "static")) {
                ifconf->method = CONFIG_METHOD_STATIC;
 
-               /* ip/mask, [optional] gateway */
+               /* ip/mask, [optional] gateway, [optional] url */
                tok = strtok_r(NULL, ",", &saveptr);
                if (!tok)
                        goto out_err;
@@ -323,6 +326,12 @@ static int parse_one_interface_config(struct config *config,
                                talloc_strdup(ifconf, tok);
                }
 
+               tok = strtok_r(NULL, ",", &saveptr);
+               if (tok) {
+                       ifconf->static_config.url =
+                               talloc_strdup(ifconf, tok);
+               }
+
        } else {
                pb_log("Unknown network configuration method %s\n", tok);
                goto out_err;
@@ -575,10 +584,12 @@ static char *iface_config_str(void *ctx, struct interface_config *config)
                str = talloc_asprintf_append(str, "dhcp");
 
        } else if (config->method == CONFIG_METHOD_STATIC) {
-               str = talloc_asprintf_append(str, "static,%s%s%s",
+               str = talloc_asprintf_append(str, "static,%s%s%s%s%s",
                                config->static_config.address,
                                config->static_config.gateway ? "," : "",
-                               config->static_config.gateway ?: "");
+                               config->static_config.gateway ?: "",
+                               config->static_config.url ? "," : "",
+                               config->static_config.url ?: "");
        }
        return str;
 }
@@ -915,6 +926,11 @@ static int get_ipmi_bootdev_ipmi(struct platform_powerpc *platform,
                return -1;
        }
 
+       pb_debug("IPMI get_bootdev response:\n");
+       for (int i = 0; i < resp_len; i++)
+               pb_debug("%x ", resp[i]);
+       pb_debug("\n");
+
        if (resp[0] != 0) {
                pb_log("platform: non-zero completion code %d from IPMI req\n",
                                resp[0]);
@@ -1081,6 +1097,9 @@ static int get_sysinfo(struct platform *p, struct system_info *sysinfo)
        if (platform->ipmi)
                get_ipmi_bmc_mac(p, sysinfo->bmc_mac);
 
+       if (platform->get_platform_versions)
+               platform->get_platform_versions(sysinfo);
+
        return 0;
 }
 
@@ -1118,6 +1137,10 @@ static bool probe(struct platform *p, void *ctx)
                pb_log("platform: no IPMI parameter support\n");
        }
 
+       rc = stat("/proc/device-tree/bmc", &statbuf);
+       if (!rc)
+               platform->get_platform_versions = hostboot_load_versions;
+
        return true;
 }