]> git.ozlabs.org Git - petitboot/blobdiff - discover/platform-powerpc.c
discover: Add ipmi module
[petitboot] / discover / platform-powerpc.c
index 642c93c1cdf453412959c415fa878bebdc17fad6..e5dac9efcc8e4b2b8a8f7ef540fe78e5232e8e04 100644 (file)
@@ -16,6 +16,7 @@
 #include <process/process.h>
 
 #include "platform.h"
+#include "ipmi.h"
 
 static const char *partition = "common";
 static const char *sysparams_dir = "/sys/firmware/opal/sysparams/";
@@ -37,6 +38,7 @@ static const char *known_params[] = {
        "petitboot,network",
        "petitboot,timeout",
        "petitboot,bootdev",
+       "petitboot,language",
        "petitboot,debug?",
        NULL,
 };
@@ -423,6 +425,9 @@ static void populate_config(struct platform_powerpc *platform,
                }
        }
 
+       val = get_param(platform, "petitboot,language");
+       config->lang = val ? talloc_strdup(config, val) : NULL;
+
        populate_network_config(platform, config);
 
        populate_bootdev_config(platform, config);
@@ -555,6 +560,9 @@ static int update_config(struct platform_powerpc *platform,
        if (tmp)
                talloc_free(tmp);
 
+       val = config->lang ?: "";
+       update_string_config(platform, "petitboot,language", val);
+
        update_network_config(platform, config);
 
        update_bootdev_config(platform, config);
@@ -575,16 +583,6 @@ static void set_exclusive_devtype(struct config *config,
        config->boot_priorities[1].priority = -1;
 }
 
-/* bootdev options that we recognise */
-enum ipmi_bootdev {
-       IPMI_BOOTDEV_NONE = 0x00,
-       IPMI_BOOTDEV_NETWORK = 0x01,
-       IPMI_BOOTDEV_DISK = 0x2,
-       IPMI_BOOTDEV_SAFE = 0x3,
-       IPMI_BOOTDEV_CDROM = 0x5,
-       IPMI_BOOTDEV_SETUP = 0x6,
-};
-
 static int read_bootdev_sysparam(const char *name, uint8_t *val)
 {
        uint8_t buf[2];
@@ -686,12 +684,8 @@ static void parse_opal_sysparams(struct config *config)
        if (!next_valid && !default_valid)
                return;
 
-       if (next_valid) {
-               /* invalidate next-boot-device setting */
-               write_bootdev_sysparam("next-boot-device", 0xff);
-       } else {
+       if (!next_valid)
                next_bootdev = default_bootdev;
-       }
 
        switch (next_bootdev) {
        case IPMI_BOOTDEV_NONE:
@@ -746,6 +740,12 @@ static int save_config(struct platform *p, struct config *config)
        return rc;
 }
 
+static void finalise_config(struct platform *platform __attribute__((unused)))
+{
+       /* invalidate next-boot-device setting */
+       write_bootdev_sysparam("next-boot-device", 0xff);
+}
+
 static int get_sysinfo(struct platform *p, struct system_info *sysinfo)
 {
        struct platform_powerpc *platform = p->platform_data;
@@ -790,12 +790,13 @@ static bool probe(struct platform *p, void *ctx)
 
 
 static struct platform platform_powerpc = {
-       .name           = "powerpc",
-       .dhcp_arch_id   = 0x000e,
-       .probe          = probe,
-       .load_config    = load_config,
-       .save_config    = save_config,
-       .get_sysinfo    = get_sysinfo,
+       .name                   = "powerpc",
+       .dhcp_arch_id           = 0x000e,
+       .probe                  = probe,
+       .load_config            = load_config,
+       .save_config            = save_config,
+       .finalise_config        = finalise_config,
+       .get_sysinfo            = get_sysinfo,
 };
 
 register_platform(platform_powerpc);