- switch (next_bootdev) {
- case IPMI_BOOTDEV_NONE:
- return;
- case IPMI_BOOTDEV_DISK:
- set_exclusive_devtype(config, DEVICE_TYPE_DISK);
- break;
- case IPMI_BOOTDEV_NETWORK:
- set_exclusive_devtype(config, DEVICE_TYPE_NETWORK);
- break;
- case IPMI_BOOTDEV_CDROM:
- set_exclusive_devtype(config, DEVICE_TYPE_OPTICAL);
- break;
- case IPMI_BOOTDEV_SETUP:
- config->autoboot_enabled = false;
- break;
- case IPMI_BOOTDEV_SAFE:
- config->autoboot_enabled = false;
- config->safe_mode = true;
- break;
+static int clear_ipmi_bootdev_ipmi(struct platform_powerpc *platform)
+{
+ uint16_t resp_len;
+ uint8_t resp[1];
+ uint8_t req[] = {
+ 0x05, /* parameter selector: boot flags */
+ 0x80, /* data 1: valid */
+ 0x00, /* data 2: bootdev: no override */
+ 0x00, /* data 3: system defaults */
+ 0x00, /* data 4: no request for shared mode, mux defaults */
+ 0x00, /* data 5: no instance request */
+ };
+
+ resp_len = sizeof(resp);
+
+ ipmi_transaction(platform->ipmi, IPMI_NETFN_CHASSIS,
+ IPMI_CMD_CHASSIS_SET_SYSTEM_BOOT_OPTIONS,
+ req, sizeof(req),
+ resp, &resp_len,
+ ipmi_timeout);
+ return 0;
+}
+
+static int get_ipmi_bootdev_ipmi(struct platform_powerpc *platform,
+ uint8_t *bootdev, bool *persistent)
+{
+ uint16_t resp_len;
+ uint8_t resp[8];
+ int rc;
+ uint8_t req[] = {
+ 0x05, /* parameter selector: boot flags */
+ 0x00, /* no set selector */
+ 0x00, /* no block selector */
+ };
+
+ resp_len = sizeof(resp);
+ rc = ipmi_transaction(platform->ipmi, IPMI_NETFN_CHASSIS,
+ IPMI_CMD_CHASSIS_GET_SYSTEM_BOOT_OPTIONS,
+ req, sizeof(req),
+ resp, &resp_len,
+ ipmi_timeout);
+ if (rc) {
+ pb_log("platform: error reading IPMI boot options\n");
+ return -1;