summary refs log tree commit diff stats
path: root/hw
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@redhat.com>2019-04-22 15:51:26 +0200
committerPhilippe Mathieu-Daudé <philmd@redhat.com>2019-05-23 14:10:31 +0200
commita2b45ea5087dbaf4a57b47763da61339b1e7adb1 (patch)
tree06fb10c6baf1275568341e27c79618ef1ca31b2c /hw
parentd5a42d1942b77de0d1271f53d47c14a40b831be6 (diff)
downloadfocaccia-qemu-a2b45ea5087dbaf4a57b47763da61339b1e7adb1.tar.gz
focaccia-qemu-a2b45ea5087dbaf4a57b47763da61339b1e7adb1.zip
hw/sparc64: Implement fw_cfg_arch_key_name()
Implement fw_cfg_arch_key_name(), which returns the name of a
sparc64-specific key.

Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20190422195020.1494-8-philmd@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/sparc64/sun4u.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index 399f2d73c8..4230b17b87 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -91,6 +91,25 @@ typedef struct EbusState {
 #define TYPE_EBUS "ebus"
 #define EBUS(obj) OBJECT_CHECK(EbusState, (obj), TYPE_EBUS)
 
+const char *fw_cfg_arch_key_name(uint16_t key)
+{
+    static const struct {
+        uint16_t key;
+        const char *name;
+    } fw_cfg_arch_wellknown_keys[] = {
+        {FW_CFG_SPARC64_WIDTH, "width"},
+        {FW_CFG_SPARC64_HEIGHT, "height"},
+        {FW_CFG_SPARC64_DEPTH, "depth"},
+    };
+
+    for (size_t i = 0; i < ARRAY_SIZE(fw_cfg_arch_wellknown_keys); i++) {
+        if (fw_cfg_arch_wellknown_keys[i].key == key) {
+            return fw_cfg_arch_wellknown_keys[i].name;
+        }
+    }
+    return NULL;
+}
+
 static void fw_cfg_boot_set(void *opaque, const char *boot_device,
                             Error **errp)
 {