Browse Source

hw/nvram/fw_cfg: Add fw_cfg_arch_key_name()

Add fw_cfg_arch_key_name() which returns the name of
an architecture-specific key.

Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <2019042219.1494-3-philmd@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
master
Philippe Mathieu-Daudé 1 month ago
parent
commit
b15c0f7d55
5 changed files with 38 additions and 1 deletions
  1. 1
    0
      MAINTAINERS
  2. 1
    1
      hw/nvram/fw_cfg.c
  3. 14
    0
      include/hw/nvram/fw_cfg.h
  4. 1
    0
      stubs/Makefile.objs
  5. 21
    0
      stubs/fw_cfg.c

+ 1
- 0
MAINTAINERS View File

@@ -1696,6 +1696,7 @@ R: Gerd Hoffmann <kraxel@redhat.com>
1696 1696
 S: Supported
1697 1697
 F: docs/specs/fw_cfg.txt
1698 1698
 F: hw/nvram/fw_cfg.c
1699
+F: stubs/fw_cfg.c
1699 1700
 F: include/hw/nvram/fw_cfg.h
1700 1701
 F: include/standard-headers/linux/qemu_fw_cfg.h
1701 1702
 F: tests/libqos/fw_cfg.c

+ 1
- 1
hw/nvram/fw_cfg.c View File

@@ -100,7 +100,7 @@ static const char *key_name(uint16_t key)
100 100
     };
101 101
 
102 102
     if (key & FW_CFG_ARCH_LOCAL) {
103
-        return NULL;
103
+        return fw_cfg_arch_key_name(key);
104 104
     }
105 105
     if (key < FW_CFG_FILE_FIRST) {
106 106
         return fw_cfg_wellknown_keys[key];

+ 14
- 0
include/hw/nvram/fw_cfg.h View File

@@ -226,4 +226,18 @@ FWCfgState *fw_cfg_init_mem_wide(hwaddr ctl_addr,
226 226
 FWCfgState *fw_cfg_find(void);
227 227
 bool fw_cfg_dma_enabled(void *opaque);
228 228
 
229
+/**
230
+ * fw_cfg_arch_key_name:
231
+ *
232
+ * @key: The uint16 selector key.
233
+ *
234
+ * The key is architecture-specific (the FW_CFG_ARCH_LOCAL mask is expected
235
+ * to be set in the key).
236
+ *
237
+ * Returns: The stringified architecture-specific name if the selector
238
+ *          refers to a well-known numerically defined item, or NULL on
239
+ *          key lookup failure.
240
+ */
241
+const char *fw_cfg_arch_key_name(uint16_t key);
242
+
229 243
 #endif

+ 1
- 0
stubs/Makefile.objs View File

@@ -39,3 +39,4 @@ stub-obj-y += xen-hvm.o
39 39
 stub-obj-y += pci-host-piix.o
40 40
 stub-obj-y += ram-block.o
41 41
 stub-obj-y += ramfb.o
42
+stub-obj-y += fw_cfg.o

+ 21
- 0
stubs/fw_cfg.c View File

@@ -0,0 +1,21 @@
1
+/*
2
+ * fw_cfg stubs
3
+ *
4
+ * Copyright (c) 2019 Red Hat, Inc.
5
+ *
6
+ * Author:
7
+ *   Philippe Mathieu-Daudé <philmd@redhat.com>
8
+ *
9
+ * SPDX-License-Identifier: GPL-2.0-or-later
10
+ *
11
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
12
+ * See the COPYING file in the top-level directory.
13
+ */
14
+
15
+#include "qemu/osdep.h"
16
+#include "hw/nvram/fw_cfg.h"
17
+
18
+const char *fw_cfg_arch_key_name(uint16_t key)
19
+{
20
+    return NULL;
21
+}

Loading…
Cancel
Save