12 #include <file/file.h>
13 #include <talloc/talloc.h>
14 #include <list/list.h>
16 #include <process/process.h>
22 static const char *partition = "common";
23 static const char *sysparams_dir = "/sys/firmware/opal/sysparams/";
24 static const char *devtree_dir = "/proc/device-tree/";
25 static const int ipmi_timeout = 5000; /* milliseconds. */
31 struct list_item list;
34 struct platform_powerpc {
37 bool ipmi_bootdev_persistent;
38 int (*get_ipmi_bootdev)(
39 struct platform_powerpc *platform,
40 uint8_t *bootdev, bool *persistent);
41 int (*clear_ipmi_bootdev)(
42 struct platform_powerpc *platform,
44 int (*set_os_boot_sensor)(
45 struct platform_powerpc *platform);
48 static const char *known_params[] = {
57 "petitboot,snapshots?",
61 #define to_platform_powerpc(p) \
62 (struct platform_powerpc *)(p->platform_data)
64 /* a partition max a max size of 64k * 16bytes = 1M */
65 static const int max_partition_size = 64 * 1024 * 16;
67 static bool param_is_known(const char *param, unsigned int len)
69 const char *known_param;
72 for (i = 0; known_params[i]; i++) {
73 known_param = known_params[i];
74 if (len == strlen(known_param) &&
75 !strncmp(param, known_param, len))
82 static int parse_nvram_params(struct platform_powerpc *platform,
85 char *pos, *name, *value;
86 unsigned int paramlen;
89 /* discard 2 header lines:
96 for (i = 0; i < len; i++) {
104 fprintf(stderr, "failure parsing nvram output\n");
108 for (pos = buf + i; pos < buf + len; pos += paramlen + 1) {
109 unsigned int namelen;
113 newline = strchr(pos, '\n');
119 paramlen = strlen(pos);
122 value = strchr(pos, '=');
126 namelen = value - name;
130 if (!param_is_known(name, namelen))
135 param = talloc(platform, struct param);
136 param->modified = false;
137 param->name = talloc_strndup(platform, name, namelen);
138 param->value = talloc_strdup(platform, value);
139 list_add(&platform->params, ¶m->list);
145 static int parse_nvram(struct platform_powerpc *platform)
147 struct process *process;
152 argv[1] = "--print-config";
153 argv[2] = "--partition";
157 process = process_create(platform);
158 process->path = "nvram";
159 process->argv = argv;
160 process->keep_stdout = true;
162 rc = process_run_sync(process);
164 if (rc || !process_exit_ok(process)) {
165 fprintf(stderr, "nvram process returned "
166 "non-zero exit status\n");
169 rc = parse_nvram_params(platform, process->stdout_buf,
170 process->stdout_len);
173 process_release(process);
177 static int write_nvram(struct platform_powerpc *platform)
179 struct process *process;
185 argv[1] = "--update-config";
187 argv[3] = "--partition";
191 process = process_create(platform);
192 process->path = "nvram";
193 process->argv = argv;
195 list_for_each_entry(&platform->params, param, list) {
198 if (!param->modified)
201 paramstr = talloc_asprintf(platform, "%s=%s",
202 param->name, param->value);
205 rc = process_run_sync(process);
207 talloc_free(paramstr);
209 if (rc || !process_exit_ok(process)) {
211 pb_log("nvram update process returned "
212 "non-zero exit status\n");
217 process_release(process);
221 static const char *get_param(struct platform_powerpc *platform,
226 list_for_each_entry(&platform->params, param, list)
227 if (!strcmp(param->name, name))
232 static void set_param(struct platform_powerpc *platform, const char *name,
237 list_for_each_entry(&platform->params, param, list) {
238 if (strcmp(param->name, name))
241 if (!strcmp(param->value, value))
244 talloc_free(param->value);
245 param->value = talloc_strdup(param, value);
246 param->modified = true;
251 param = talloc(platform, struct param);
252 param->modified = true;
253 param->name = talloc_strdup(platform, name);
254 param->value = talloc_strdup(platform, value);
255 list_add(&platform->params, ¶m->list);
258 static int parse_hwaddr(struct interface_config *ifconf, char *str)
262 if (strlen(str) != strlen("00:00:00:00:00:00"))
265 for (i = 0; i < HWADDR_SIZE; i++) {
269 byte[0] = str[i * 3 + 0];
270 byte[1] = str[i * 3 + 1];
273 x = strtoul(byte, &endp, 16);
274 if (endp != byte + 2)
277 ifconf->hwaddr[i] = x & 0xff;
283 static int parse_one_interface_config(struct config *config,
286 struct interface_config *ifconf;
289 ifconf = talloc_zero(config, struct interface_config);
291 if (!confstr || !strlen(confstr))
294 /* first token should be the mac address */
295 tok = strtok_r(confstr, ",", &saveptr);
299 if (parse_hwaddr(ifconf, tok))
302 /* second token is the method */
303 tok = strtok_r(NULL, ",", &saveptr);
304 if (!tok || !strlen(tok) || !strcmp(tok, "ignore")) {
305 ifconf->ignore = true;
307 } else if (!strcmp(tok, "dhcp")) {
308 ifconf->method = CONFIG_METHOD_DHCP;
310 } else if (!strcmp(tok, "static")) {
311 ifconf->method = CONFIG_METHOD_STATIC;
313 /* ip/mask, [optional] gateway */
314 tok = strtok_r(NULL, ",", &saveptr);
317 ifconf->static_config.address =
318 talloc_strdup(ifconf, tok);
320 tok = strtok_r(NULL, ",", &saveptr);
322 ifconf->static_config.gateway =
323 talloc_strdup(ifconf, tok);
327 pb_log("Unknown network configuration method %s\n", tok);
331 config->network.interfaces = talloc_realloc(config,
332 config->network.interfaces,
333 struct interface_config *,
334 ++config->network.n_interfaces);
336 config->network.interfaces[config->network.n_interfaces - 1] = ifconf;
344 static int parse_one_dns_config(struct config *config,
347 char *tok, *saveptr = NULL;
349 for (tok = strtok_r(confstr, ",", &saveptr); tok;
350 tok = strtok_r(NULL, ",", &saveptr)) {
352 char *server = talloc_strdup(config, tok);
354 config->network.dns_servers = talloc_realloc(config,
355 config->network.dns_servers, const char *,
356 ++config->network.n_dns_servers);
358 config->network.dns_servers[config->network.n_dns_servers - 1]
365 static void populate_network_config(struct platform_powerpc *platform,
366 struct config *config)
368 char *val, *saveptr = NULL;
372 cval = get_param(platform, "petitboot,network");
373 if (!cval || !strlen(cval))
376 val = talloc_strdup(config, cval);
381 tok = strtok_r(i == 0 ? val : NULL, " ", &saveptr);
385 if (!strncasecmp(tok, "dns,", strlen("dns,")))
386 parse_one_dns_config(config, tok + strlen("dns,"));
388 parse_one_interface_config(config, tok);
395 static int read_bootdev(void *ctx, char **pos, struct autoboot_option *opt)
397 char *delim = strchr(*pos, ' ');
398 int len, prefix = 0, rc = -1;
399 enum device_type type;
401 if (!strncmp(*pos, "uuid:", strlen("uuid:"))) {
402 prefix = strlen("uuid:");
403 opt->boot_type = BOOT_DEVICE_UUID;
405 } else if (!strncmp(*pos, "mac:", strlen("mac:"))) {
406 prefix = strlen("mac:");
407 opt->boot_type = BOOT_DEVICE_UUID;
410 type = find_device_type(*pos);
411 if (type != DEVICE_TYPE_UNKNOWN) {
413 opt->boot_type = BOOT_DEVICE_TYPE;
418 if (opt->boot_type == BOOT_DEVICE_UUID) {
420 len = (int)(delim - *pos) - prefix;
424 opt->uuid = talloc_strndup(ctx, *pos + prefix, len);
427 /* Always advance pointer to next option or end */
431 *pos += strlen(*pos);
436 static void populate_bootdev_config(struct platform_powerpc *platform,
437 struct config *config)
439 struct autoboot_option *opt, *new = NULL;
440 char *pos, *end, *old_dev = NULL;
441 unsigned int n_new = 0;
445 /* Check for old-style bootdev */
446 val = get_param(platform, "petitboot,bootdev");
447 if (val && strlen(val)) {
448 pos = talloc_strdup(config, val);
449 if (!strncmp(val, "uuid:", strlen("uuid:")))
450 old_dev = talloc_strdup(config,
451 val + strlen("uuid:"));
452 else if (!strncmp(val, "mac:", strlen("mac:")))
453 old_dev = talloc_strdup(config,
454 val + strlen("mac:"));
457 /* Check for ordered bootdevs */
458 val = get_param(platform, "petitboot,bootdevs");
459 if (!val || !strlen(val)) {
462 pos = talloc_strdup(config, val);
463 end = strchr(pos, '\0');
466 while (pos && pos < end) {
467 opt = talloc(config, struct autoboot_option);
469 if (read_bootdev(config, &pos, opt)) {
470 pb_log("bootdev config is in an unknown format "
471 "(expected uuid:... or mac:...)\n");
476 new = talloc_realloc(config, new, struct autoboot_option,
484 if (!n_new && !old_dev) {
485 /* If autoboot has been disabled, clear the default options */
486 if (!config->autoboot_enabled) {
487 talloc_free(config->autoboot_opts);
488 config->n_autoboot_opts = 0;
493 conflict = old_dev && (!n_new ||
494 new[0].boot_type == BOOT_DEVICE_TYPE ||
495 /* Canonical UUIDs are 36 characters long */
496 strncmp(new[0].uuid, old_dev, 36));
499 talloc_free(config->autoboot_opts);
500 config->autoboot_opts = new;
501 config->n_autoboot_opts = n_new;
506 * Difference detected, defer to old format in case it has been updated
509 pb_debug("Old autoboot bootdev detected\n");
510 talloc_free(config->autoboot_opts);
511 config->autoboot_opts = talloc(config, struct autoboot_option);
512 config->autoboot_opts[0].boot_type = BOOT_DEVICE_UUID;
513 config->autoboot_opts[0].uuid = talloc_strdup(config, old_dev);
514 config->n_autoboot_opts = 1;
517 static void populate_config(struct platform_powerpc *platform,
518 struct config *config)
522 unsigned long timeout;
524 /* if the "auto-boot?' property is present and "false", disable auto
526 val = get_param(platform, "auto-boot?");
527 config->autoboot_enabled = !val || strcmp(val, "false");
529 val = get_param(platform, "petitboot,timeout");
531 timeout = strtoul(val, &end, 10);
533 if (timeout >= INT_MAX)
535 config->autoboot_timeout_sec = (int)timeout;
539 val = get_param(platform, "petitboot,language");
540 config->lang = val ? talloc_strdup(config, val) : NULL;
542 populate_network_config(platform, config);
544 populate_bootdev_config(platform, config);
546 if (!config->debug) {
547 val = get_param(platform, "petitboot,debug?");
548 config->debug = val && !strcmp(val, "true");
551 val = get_param(platform, "petitboot,write?");
553 config->allow_writes = !strcmp(val, "true");
555 val = get_param(platform, "petitboot,snapshots?");
557 config->disable_snapshots = !strcmp(val, "false");
560 static char *iface_config_str(void *ctx, struct interface_config *config)
564 /* todo: HWADDR size is hardcoded as 6, but we may need to handle
565 * different hardware address formats */
566 str = talloc_asprintf(ctx, "%02x:%02x:%02x:%02x:%02x:%02x,",
567 config->hwaddr[0], config->hwaddr[1],
568 config->hwaddr[2], config->hwaddr[3],
569 config->hwaddr[4], config->hwaddr[5]);
571 if (config->ignore) {
572 str = talloc_asprintf_append(str, "ignore");
574 } else if (config->method == CONFIG_METHOD_DHCP) {
575 str = talloc_asprintf_append(str, "dhcp");
577 } else if (config->method == CONFIG_METHOD_STATIC) {
578 str = talloc_asprintf_append(str, "static,%s%s%s",
579 config->static_config.address,
580 config->static_config.gateway ? "," : "",
581 config->static_config.gateway ?: "");
586 static char *dns_config_str(void *ctx, const char **dns_servers, int n)
591 str = talloc_strdup(ctx, "dns,");
592 for (i = 0; i < n; i++) {
593 str = talloc_asprintf_append(str, "%s%s",
601 static void update_string_config(struct platform_powerpc *platform,
602 const char *name, const char *value)
606 cur = get_param(platform, name);
608 /* don't set an empty parameter if it doesn't already exist */
609 if (!cur && !strlen(value))
612 set_param(platform, name, value);
615 static void update_network_config(struct platform_powerpc *platform,
616 struct config *config)
621 val = talloc_strdup(platform, "");
623 for (i = 0; i < config->network.n_interfaces; i++) {
624 char *iface_str = iface_config_str(platform,
625 config->network.interfaces[i]);
626 val = talloc_asprintf_append(val, "%s%s",
627 *val == '\0' ? "" : " ", iface_str);
628 talloc_free(iface_str);
631 if (config->network.n_dns_servers) {
632 char *dns_str = dns_config_str(platform,
633 config->network.dns_servers,
634 config->network.n_dns_servers);
635 val = talloc_asprintf_append(val, "%s%s",
636 *val == '\0' ? "" : " ", dns_str);
637 talloc_free(dns_str);
640 update_string_config(platform, "petitboot,network", val);
645 static void update_bootdev_config(struct platform_powerpc *platform,
646 struct config *config)
648 char *val = NULL, *boot_str = NULL, *tmp = NULL, *first = NULL;
649 struct autoboot_option *opt;
650 const char delim = ' ';
653 if (!config->n_autoboot_opts)
655 else if (config->autoboot_opts[0].boot_type == BOOT_DEVICE_UUID)
656 first = talloc_asprintf(config, "uuid:%s",
657 config->autoboot_opts[0].uuid);
661 for (i = 0; i < config->n_autoboot_opts; i++) {
662 opt = &config->autoboot_opts[i];
663 switch (opt->boot_type) {
664 case BOOT_DEVICE_TYPE:
665 boot_str = talloc_asprintf(config, "%s%c",
666 device_type_name(opt->type),
669 case BOOT_DEVICE_UUID:
670 boot_str = talloc_asprintf(config, "uuid:%s%c",
674 tmp = val = talloc_asprintf_append(val, "%s", boot_str);
677 update_string_config(platform, "petitboot,bootdevs", val);
678 update_string_config(platform, "petitboot,bootdev", first);
681 talloc_free(boot_str);
684 static int update_config(struct platform_powerpc *platform,
685 struct config *config, struct config *defaults)
690 if (config->autoboot_enabled == defaults->autoboot_enabled)
693 val = config->autoboot_enabled ? "true" : "false";
694 update_string_config(platform, "auto-boot?", val);
696 if (config->autoboot_timeout_sec == defaults->autoboot_timeout_sec)
699 val = tmp = talloc_asprintf(platform, "%d",
700 config->autoboot_timeout_sec);
702 if (config->ipmi_bootdev == IPMI_BOOTDEV_INVALID &&
703 platform->clear_ipmi_bootdev) {
704 platform->clear_ipmi_bootdev(platform,
705 config->ipmi_bootdev_persistent);
706 config->ipmi_bootdev = IPMI_BOOTDEV_NONE;
707 config->ipmi_bootdev_persistent = false;
710 update_string_config(platform, "petitboot,timeout", val);
714 val = config->lang ?: "";
715 update_string_config(platform, "petitboot,language", val);
717 if (config->allow_writes == defaults->allow_writes)
720 val = config->allow_writes ? "true" : "false";
721 update_string_config(platform, "petitboot,write?", val);
723 update_network_config(platform, config);
725 update_bootdev_config(platform, config);
727 return write_nvram(platform);
730 static void set_ipmi_bootdev(struct config *config, enum ipmi_bootdev bootdev,
733 config->ipmi_bootdev = bootdev;
734 config->ipmi_bootdev_persistent = persistent;
737 case IPMI_BOOTDEV_NONE:
738 case IPMI_BOOTDEV_DISK:
739 case IPMI_BOOTDEV_NETWORK:
740 case IPMI_BOOTDEV_CDROM:
743 case IPMI_BOOTDEV_SETUP:
744 config->autoboot_enabled = false;
746 case IPMI_BOOTDEV_SAFE:
747 config->autoboot_enabled = false;
748 config->safe_mode = true;
753 static int read_bootdev_sysparam(const char *name, uint8_t *val)
759 assert(strlen(sysparams_dir) + strlen(name) < sizeof(path));
760 snprintf(path, sizeof(path), "%s%s", sysparams_dir, name);
762 fd = open(path, O_RDONLY);
764 pb_debug("powerpc: can't access sysparam %s\n",
769 rc = read(fd, buf, sizeof(buf));
773 /* bootdev definitions should only be one byte in size */
775 pb_debug("powerpc: sysparam %s read returned %d\n",
780 pb_debug("powerpc: sysparam %s: 0x%02x\n", name, buf[0]);
782 if (!ipmi_bootdev_is_valid(buf[0]))
789 static int write_bootdev_sysparam(const char *name, uint8_t val)
794 assert(strlen(sysparams_dir) + strlen(name) < sizeof(path));
795 snprintf(path, sizeof(path), "%s%s", sysparams_dir, name);
797 fd = open(path, O_WRONLY);
799 pb_debug("powerpc: can't access sysparam %s for writing\n",
806 rc = write(fd, &val, sizeof(val));
807 if (rc == sizeof(val)) {
812 if (rc <= 0 && errno != EINTR) {
813 pb_log("powerpc: error updating sysparam %s: %s",
814 name, strerror(errno));
823 pb_debug("powerpc: set sysparam %s: 0x%02x\n", name, val);
828 static int clear_ipmi_bootdev_sysparams(
829 struct platform_powerpc *platform __attribute__((unused)),
833 /* invalidate default-boot-device setting */
834 write_bootdev_sysparam("default-boot-device", 0xff);
836 /* invalidate next-boot-device setting */
837 write_bootdev_sysparam("next-boot-device", 0xff);
842 static int get_ipmi_bootdev_sysparams(
843 struct platform_powerpc *platform __attribute__((unused)),
844 uint8_t *bootdev, bool *persistent)
846 uint8_t next_bootdev, default_bootdev;
847 bool next_valid, default_valid;
850 rc = read_bootdev_sysparam("next-boot-device", &next_bootdev);
851 next_valid = rc == 0;
853 rc = read_bootdev_sysparam("default-boot-device", &default_bootdev);
854 default_valid = rc == 0;
856 /* nothing valid? no need to change the config */
857 if (!next_valid && !default_valid)
860 *persistent = !next_valid;
861 *bootdev = next_valid ? next_bootdev : default_bootdev;
865 static int clear_ipmi_bootdev_ipmi(struct platform_powerpc *platform,
866 bool persistent __attribute__((unused)))
871 0x05, /* parameter selector: boot flags */
872 0x80, /* data 1: valid */
873 0x00, /* data 2: bootdev: no override */
874 0x00, /* data 3: system defaults */
875 0x00, /* data 4: no request for shared mode, mux defaults */
876 0x00, /* data 5: no instance request */
879 resp_len = sizeof(resp);
881 ipmi_transaction(platform->ipmi, IPMI_NETFN_CHASSIS,
882 IPMI_CMD_CHASSIS_SET_SYSTEM_BOOT_OPTIONS,
889 static int get_ipmi_bootdev_ipmi(struct platform_powerpc *platform,
890 uint8_t *bootdev, bool *persistent)
896 0x05, /* parameter selector: boot flags */
897 0x00, /* no set selector */
898 0x00, /* no block selector */
901 resp_len = sizeof(resp);
902 rc = ipmi_transaction(platform->ipmi, IPMI_NETFN_CHASSIS,
903 IPMI_CMD_CHASSIS_GET_SYSTEM_BOOT_OPTIONS,
908 pb_log("platform: error reading IPMI boot options\n");
912 if (resp_len != sizeof(resp)) {
913 pb_log("platform: unexpected length (%d) in "
914 "boot options response\n", resp_len);
919 pb_log("platform: non-zero completion code %d from IPMI req\n",
924 /* check for correct parameter version */
925 if ((resp[1] & 0xf) != 0x1) {
926 pb_log("platform: unexpected version (0x%x) in "
927 "boot options response\n", resp[0]);
931 /* check for valid paramters */
932 if (resp[2] & 0x80) {
933 pb_debug("platform: boot options are invalid/locked\n");
939 /* check for valid flags */
940 if (!(resp[3] & 0x80)) {
941 pb_debug("platform: boot flags are invalid, ignoring\n");
945 *persistent = resp[3] & 0x40;
946 *bootdev = (resp[4] >> 2) & 0x0f;
950 static int set_ipmi_os_boot_sensor(struct platform_powerpc *platform)
956 0x00, /* sensor number: os boot */
957 0xA9, /* operation: set everything */
958 0x00, /* sensor reading: none */
959 0x40, /* assertion mask lsb: set state 6 */
960 0x00, /* assertion mask msb: none */
961 0x00, /* deassertion mask lsb: none */
962 0x00, /* deassertion mask msb: none */
963 0x00, /* event data 1: none */
964 0x00, /* event data 2: none */
965 0x00, /* event data 3: none */
968 sensor_number = get_ipmi_sensor(platform, IPMI_SENSOR_ID_OS_BOOT);
969 if (sensor_number < 0) {
970 pb_log("Couldn't find OS boot sensor in device tree\n");
974 req[0] = sensor_number;
976 resp_len = sizeof(resp);
978 ipmi_transaction(platform->ipmi, IPMI_NETFN_SE,
982 ipmi_timeout); return 0;
987 static void get_ipmi_bmc_mac(struct platform *p, uint8_t *buf)
989 struct platform_powerpc *platform = p->platform_data;
990 uint16_t resp_len = 8;
992 uint8_t req[] = { 0x1, 0x5, 0x0, 0x0 };
995 rc = ipmi_transaction(platform->ipmi, IPMI_NETFN_TRANSPORT,
996 IPMI_CMD_TRANSPORT_GET_LAN_PARAMS,
1001 pb_debug("BMC MAC resp [%d][%d]:\n", rc, resp_len);
1003 if (rc == 0 && resp_len > 0) {
1004 for (i = 2; i < resp_len; i++) {
1005 pb_debug(" %x", resp[i]);
1006 buf[i - 2] = resp[i];
1012 static int load_config(struct platform *p, struct config *config)
1014 struct platform_powerpc *platform = to_platform_powerpc(p);
1017 rc = parse_nvram(platform);
1021 populate_config(platform, config);
1023 if (platform->get_ipmi_bootdev) {
1024 bool bootdev_persistent;
1026 rc = platform->get_ipmi_bootdev(platform, &bootdev,
1027 &bootdev_persistent);
1028 if (!rc && ipmi_bootdev_is_valid(bootdev)) {
1029 set_ipmi_bootdev(config, bootdev, bootdev_persistent);
1036 static int save_config(struct platform *p, struct config *config)
1038 struct platform_powerpc *platform = to_platform_powerpc(p);
1039 struct config *defaults;
1042 defaults = talloc_zero(platform, struct config);
1043 config_set_defaults(defaults);
1045 rc = update_config(platform, config, defaults);
1047 talloc_free(defaults);
1051 static void pre_boot(struct platform *p, const struct config *config)
1053 struct platform_powerpc *platform = to_platform_powerpc(p);
1055 if (!config->ipmi_bootdev_persistent && platform->clear_ipmi_bootdev)
1056 platform->clear_ipmi_bootdev(platform, false);
1058 if (platform->set_os_boot_sensor)
1059 platform->set_os_boot_sensor(platform);
1062 static int get_sysinfo(struct platform *p, struct system_info *sysinfo)
1064 struct platform_powerpc *platform = p->platform_data;
1065 char *buf, *filename;
1068 filename = talloc_asprintf(platform, "%smodel", devtree_dir);
1069 rc = read_file(platform, filename, &buf, &len);
1071 sysinfo->type = talloc_steal(sysinfo, buf);
1072 talloc_free(filename);
1074 filename = talloc_asprintf(platform, "%ssystem-id", devtree_dir);
1075 rc = read_file(platform, filename, &buf, &len);
1077 sysinfo->identifier = talloc_steal(sysinfo, buf);
1078 talloc_free(filename);
1080 sysinfo->bmc_mac = talloc_zero_size(sysinfo, HWADDR_SIZE);
1082 get_ipmi_bmc_mac(p, sysinfo->bmc_mac);
1087 static bool probe(struct platform *p, void *ctx)
1089 struct platform_powerpc *platform;
1090 struct stat statbuf;
1093 /* we need a device tree */
1094 rc = stat("/proc/device-tree", &statbuf);
1098 if (!S_ISDIR(statbuf.st_mode))
1101 platform = talloc_zero(ctx, struct platform_powerpc);
1102 list_init(&platform->params);
1104 p->platform_data = platform;
1106 if (ipmi_present()) {
1107 pb_debug("platform: using direct IPMI for IPMI paramters\n");
1108 platform->ipmi = ipmi_open(platform);
1109 platform->get_ipmi_bootdev = get_ipmi_bootdev_ipmi;
1110 platform->clear_ipmi_bootdev = clear_ipmi_bootdev_ipmi;
1111 platform->set_os_boot_sensor = set_ipmi_os_boot_sensor;
1112 } else if (!stat(sysparams_dir, &statbuf)) {
1113 pb_debug("platform: using sysparams for IPMI paramters\n");
1114 platform->get_ipmi_bootdev = get_ipmi_bootdev_sysparams;
1115 platform->clear_ipmi_bootdev = clear_ipmi_bootdev_sysparams;
1118 pb_log("platform: no IPMI parameter support\n");
1125 static struct platform platform_powerpc = {
1127 .dhcp_arch_id = 0x000e,
1129 .load_config = load_config,
1130 .save_config = save_config,
1131 .pre_boot = pre_boot,
1132 .get_sysinfo = get_sysinfo,
1135 register_platform(platform_powerpc);