lib: Move ipmi_bootdev enum to types.h
authorSamuel Mendoza-Jonas <sam.mj@au1.ibm.com>
Tue, 7 Apr 2015 23:45:43 +0000 (09:45 +1000)
committerSamuel Mendoza-Jonas <sam.mj@au1.ibm.com>
Tue, 5 May 2015 05:03:53 +0000 (15:03 +1000)
Move the ipmi_bootdev definition to types.h to support returning
descriptive strings to the system configuration UI.

Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
discover/ipmi.h
discover/platform-powerpc.c
lib/types/types.c
lib/types/types.h

index 83f29107e276ef5545d0288c4acf5f90eabb18bd..3b11683c0cbdb7ce7fcd7641bfccc3abef89acfb 100644 (file)
@@ -4,6 +4,8 @@
 #include <stdbool.h>
 #include <stdint.h>
 
+#include <types/types.h>
+
 enum ipmi_netfn {
        IPMI_NETFN_CHASSIS      = 0x0,
        IPMI_NETFN_SE           = 0x04,
@@ -15,15 +17,6 @@ enum ipmi_cmd {
        IPMI_CMD_SENSOR_SET                             = 0x30,
 };
 
-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,
-};
-
 enum ipmi_sensor_ids {
        IPMI_SENSOR_ID_OS_BOOT          = 0x1F,
 };
index bbffb604c8481d914b64b29a4be06935b45a4fc7..d777bc0e5b108e1ebfc8b99eb8d9d79a91d1da10 100644 (file)
@@ -716,6 +716,7 @@ static void set_ipmi_bootdev(struct config *config, enum ipmi_bootdev bootdev,
        case IPMI_BOOTDEV_DISK:
        case IPMI_BOOTDEV_NETWORK:
        case IPMI_BOOTDEV_CDROM:
+       default:
                break;
        case IPMI_BOOTDEV_SETUP:
                config->autoboot_enabled = false;
index 059e52a803db88eff5ed81477eba8c228b8d4937..95a3a48cb4fca9571fa9a6eac54449b9c2378c2e 100644 (file)
@@ -2,6 +2,26 @@
 #include <types/types.h>
 #include <i18n/i18n.h>
 
+const char *ipmi_bootdev_display_name(enum ipmi_bootdev bootdev)
+{
+       switch (bootdev) {
+       case IPMI_BOOTDEV_NONE:
+               return _("None");
+       case IPMI_BOOTDEV_NETWORK:
+               return _("Network");
+       case IPMI_BOOTDEV_DISK:
+               return _("Disk");
+       case IPMI_BOOTDEV_SAFE:
+               return _("Safe Mode");
+       case IPMI_BOOTDEV_CDROM:
+               return _("Optical");
+       case IPMI_BOOTDEV_SETUP:
+               return _("Setup Mode");
+       default:
+               return _("Unknown");
+       }
+}
+
 const char *device_type_display_name(enum device_type type)
 {
        switch (type) {
index 3bb8c9be456a6030028bb7569f4b256fa2066a3e..e5c7e3e00225daa162c7850eb1d302da63074f7a 100644 (file)
@@ -13,6 +13,17 @@ enum device_type {
        DEVICE_TYPE_UNKNOWN,
 };
 
+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,
+       IPMI_BOOTDEV_INVALID = 0xff,
+};
+
+const char *ipmi_bootdev_display_name(enum ipmi_bootdev bootdev);
 const char *device_type_display_name(enum device_type type);
 const char *device_type_name(enum device_type type);
 enum device_type find_device_type(const char *str);