qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Markus Armbruster <armbru@redhat.com>
Subject: [Qemu-devel] [PULL 04/29] fw_cfg: Split fw_cfg_keys.h off fw_cfg.h
Date: Tue, 22 Mar 2016 15:16:44 +0100	[thread overview]
Message-ID: <1458656229-32043-5-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1458656229-32043-1-git-send-email-pbonzini@redhat.com>

From: Markus Armbruster <armbru@redhat.com>

Much of fw_cfg.h's contents is #ifndef NO_QEMU_PROTOS.  This lets a
few places include it without satisfying the dependencies of the
suppressed code.  If you somehow include it with NO_QEMU_PROTOS, any
future includes are ignored.  Unnecessarily unclean.

Move the stuff not under NO_QEMU_PROTOS into its own header
fw_cfg_keys.h, and include it as appropriate.  Tidy up the moved code
to please checkpatch.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/hw/nvram/fw_cfg.h      | 49 +-----------------------------------------
 include/hw/nvram/fw_cfg_keys.h | 46 +++++++++++++++++++++++++++++++++++++++
 pc-bios/optionrom/optionrom.h  |  3 +--
 tests/boot-order-test.c        |  4 +---
 tests/fw_cfg-test.c            |  3 +--
 tests/libqos/malloc-pc.c       |  3 +--
 6 files changed, 51 insertions(+), 57 deletions(-)
 create mode 100644 include/hw/nvram/fw_cfg_keys.h

diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h
index 10a9971..d516989 100644
--- a/include/hw/nvram/fw_cfg.h
+++ b/include/hw/nvram/fw_cfg.h
@@ -1,54 +1,9 @@
 #ifndef FW_CFG_H
 #define FW_CFG_H
 
-#ifndef NO_QEMU_PROTOS
-
 #include "exec/hwaddr.h"
-#endif
+#include "hw/nvram/fw_cfg_keys.h"
 
-#define FW_CFG_SIGNATURE        0x00
-#define FW_CFG_ID               0x01
-#define FW_CFG_UUID             0x02
-#define FW_CFG_RAM_SIZE         0x03
-#define FW_CFG_NOGRAPHIC        0x04
-#define FW_CFG_NB_CPUS          0x05
-#define FW_CFG_MACHINE_ID       0x06
-#define FW_CFG_KERNEL_ADDR      0x07
-#define FW_CFG_KERNEL_SIZE      0x08
-#define FW_CFG_KERNEL_CMDLINE   0x09
-#define FW_CFG_INITRD_ADDR      0x0a
-#define FW_CFG_INITRD_SIZE      0x0b
-#define FW_CFG_BOOT_DEVICE      0x0c
-#define FW_CFG_NUMA             0x0d
-#define FW_CFG_BOOT_MENU        0x0e
-#define FW_CFG_MAX_CPUS         0x0f
-#define FW_CFG_KERNEL_ENTRY     0x10
-#define FW_CFG_KERNEL_DATA      0x11
-#define FW_CFG_INITRD_DATA      0x12
-#define FW_CFG_CMDLINE_ADDR     0x13
-#define FW_CFG_CMDLINE_SIZE     0x14
-#define FW_CFG_CMDLINE_DATA     0x15
-#define FW_CFG_SETUP_ADDR       0x16
-#define FW_CFG_SETUP_SIZE       0x17
-#define FW_CFG_SETUP_DATA       0x18
-#define FW_CFG_FILE_DIR         0x19
-
-#define FW_CFG_FILE_FIRST       0x20
-#define FW_CFG_FILE_SLOTS       0x10
-#define FW_CFG_MAX_ENTRY        (FW_CFG_FILE_FIRST+FW_CFG_FILE_SLOTS)
-
-#define FW_CFG_WRITE_CHANNEL    0x4000
-#define FW_CFG_ARCH_LOCAL       0x8000
-#define FW_CFG_ENTRY_MASK       ~(FW_CFG_WRITE_CHANNEL | FW_CFG_ARCH_LOCAL)
-
-#define FW_CFG_INVALID          0xffff
-
-/* width in bytes of fw_cfg control register */
-#define FW_CFG_CTL_SIZE         0x02
-
-#define FW_CFG_MAX_FILE_PATH    56
-
-#ifndef NO_QEMU_PROTOS
 typedef struct FWCfgFile {
     uint32_t  size;        /* file size */
     uint16_t  select;      /* write this to 0x510 to read it */
@@ -220,6 +175,4 @@ FWCfgState *fw_cfg_init_mem_wide(hwaddr ctl_addr,
 
 FWCfgState *fw_cfg_find(void);
 
-#endif /* NO_QEMU_PROTOS */
-
 #endif
diff --git a/include/hw/nvram/fw_cfg_keys.h b/include/hw/nvram/fw_cfg_keys.h
new file mode 100644
index 0000000..0f3e871
--- /dev/null
+++ b/include/hw/nvram/fw_cfg_keys.h
@@ -0,0 +1,46 @@
+#ifndef FW_CFG_KEYS_H
+#define FW_CFG_KEYS_H
+
+#define FW_CFG_SIGNATURE        0x00
+#define FW_CFG_ID               0x01
+#define FW_CFG_UUID             0x02
+#define FW_CFG_RAM_SIZE         0x03
+#define FW_CFG_NOGRAPHIC        0x04
+#define FW_CFG_NB_CPUS          0x05
+#define FW_CFG_MACHINE_ID       0x06
+#define FW_CFG_KERNEL_ADDR      0x07
+#define FW_CFG_KERNEL_SIZE      0x08
+#define FW_CFG_KERNEL_CMDLINE   0x09
+#define FW_CFG_INITRD_ADDR      0x0a
+#define FW_CFG_INITRD_SIZE      0x0b
+#define FW_CFG_BOOT_DEVICE      0x0c
+#define FW_CFG_NUMA             0x0d
+#define FW_CFG_BOOT_MENU        0x0e
+#define FW_CFG_MAX_CPUS         0x0f
+#define FW_CFG_KERNEL_ENTRY     0x10
+#define FW_CFG_KERNEL_DATA      0x11
+#define FW_CFG_INITRD_DATA      0x12
+#define FW_CFG_CMDLINE_ADDR     0x13
+#define FW_CFG_CMDLINE_SIZE     0x14
+#define FW_CFG_CMDLINE_DATA     0x15
+#define FW_CFG_SETUP_ADDR       0x16
+#define FW_CFG_SETUP_SIZE       0x17
+#define FW_CFG_SETUP_DATA       0x18
+#define FW_CFG_FILE_DIR         0x19
+
+#define FW_CFG_FILE_FIRST       0x20
+#define FW_CFG_FILE_SLOTS       0x10
+#define FW_CFG_MAX_ENTRY        (FW_CFG_FILE_FIRST + FW_CFG_FILE_SLOTS)
+
+#define FW_CFG_WRITE_CHANNEL    0x4000
+#define FW_CFG_ARCH_LOCAL       0x8000
+#define FW_CFG_ENTRY_MASK       (~(FW_CFG_WRITE_CHANNEL | FW_CFG_ARCH_LOCAL))
+
+#define FW_CFG_INVALID          0xffff
+
+/* width in bytes of fw_cfg control register */
+#define FW_CFG_CTL_SIZE         0x02
+
+#define FW_CFG_MAX_FILE_PATH    56
+
+#endif
diff --git a/pc-bios/optionrom/optionrom.h b/pc-bios/optionrom/optionrom.h
index f1a9021..6c4c2c8 100644
--- a/pc-bios/optionrom/optionrom.h
+++ b/pc-bios/optionrom/optionrom.h
@@ -19,8 +19,7 @@
  */
 
 
-#define NO_QEMU_PROTOS
-#include "../../include/hw/nvram/fw_cfg.h"
+#include "../../include/hw/nvram/fw_cfg_keys.h"
 
 #define BIOS_CFG_IOPORT_CFG	0x510
 #define BIOS_CFG_IOPORT_DATA	0x511
diff --git a/tests/boot-order-test.c b/tests/boot-order-test.c
index 210964a..a6d8bd5 100644
--- a/tests/boot-order-test.c
+++ b/tests/boot-order-test.c
@@ -15,9 +15,7 @@
 #include "libqos/fw_cfg.h"
 #include "libqtest.h"
 
-#define NO_QEMU_PROTOS
-#include "hw/nvram/fw_cfg.h"
-#undef NO_QEMU_PROTOS
+#include "hw/nvram/fw_cfg_keys.h"
 
 typedef struct {
     const char *args;
diff --git a/tests/fw_cfg-test.c b/tests/fw_cfg-test.c
index 398643a..b4392c2 100644
--- a/tests/fw_cfg-test.c
+++ b/tests/fw_cfg-test.c
@@ -14,8 +14,7 @@
 #include <glib.h>
 
 #include "libqtest.h"
-#define NO_QEMU_PROTOS
-#include "hw/nvram/fw_cfg.h"
+#include "hw/nvram/fw_cfg_keys.h"
 #include "libqos/fw_cfg.h"
 
 static uint64_t ram_size = 128 << 20;
diff --git a/tests/libqos/malloc-pc.c b/tests/libqos/malloc-pc.c
index 74f76c5..eee706b 100644
--- a/tests/libqos/malloc-pc.c
+++ b/tests/libqos/malloc-pc.c
@@ -14,8 +14,7 @@
 #include "libqos/malloc-pc.h"
 #include "libqos/fw_cfg.h"
 
-#define NO_QEMU_PROTOS
-#include "hw/nvram/fw_cfg.h"
+#include "hw/nvram/fw_cfg_keys.h"
 
 #include "qemu-common.h"
 #include <glib.h>
-- 
2.5.0

  parent reply	other threads:[~2016-03-22 14:17 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-22 14:16 [Qemu-devel] [PULL 00/29] Miscellaneous changes for 2016-03-22 Paolo Bonzini
2016-03-22 14:16 ` [Qemu-devel] [PULL 01/29] include/qemu/osdep.h: Don't include qapi/error.h Paolo Bonzini
2016-03-22 14:16 ` [Qemu-devel] [PULL 02/29] Use scripts/clean-includes to drop redundant qemu/typedefs.h Paolo Bonzini
2016-03-22 14:16 ` [Qemu-devel] [PULL 03/29] Clean up includes some more Paolo Bonzini
2016-03-22 14:16 ` Paolo Bonzini [this message]
2016-03-22 14:16 ` [Qemu-devel] [PULL 05/29] include/qemu/iov.h: Don't include qemu-common.h Paolo Bonzini
2016-03-22 14:16 ` [Qemu-devel] [PULL 06/29] include/hw/hw.h: " Paolo Bonzini
2016-03-22 14:16 ` [Qemu-devel] [PULL 07/29] hw/pci/pci.h: " Paolo Bonzini
2016-03-22 14:16 ` [Qemu-devel] [PULL 08/29] Move HOST_LONG_BITS from qemu-common.h to qemu/osdep.h Paolo Bonzini
2016-03-22 14:16 ` [Qemu-devel] [PULL 09/29] Move QEMU_ALIGN_*() " Paolo Bonzini
2016-03-22 14:16 ` [Qemu-devel] [PULL 10/29] Move ParallelIOArg from qemu-common.h to sysemu/char.h Paolo Bonzini
2016-03-22 14:16 ` [Qemu-devel] [PULL 11/29] isa: Move DMA_transfer_handler from qemu-common.h to hw/isa/isa.h Paolo Bonzini
2016-03-22 14:16 ` [Qemu-devel] [PULL 12/29] include/crypto: Include qapi-types.h or qemu/bswap.h instead of qemu-common.h Paolo Bonzini
2016-03-22 14:16 ` [Qemu-devel] [PULL 13/29] hw: explicitly include qemu-common.h and cpu.h Paolo Bonzini
2016-03-22 14:16 ` [Qemu-devel] [PULL 14/29] Replaced get_tick_per_sec() by NANOSECONDS_PER_SECOND Paolo Bonzini
2016-03-22 14:16 ` [Qemu-devel] [PULL 15/29] util: move declarations out of qemu-common.h Paolo Bonzini
2016-03-22 14:16 ` [Qemu-devel] [PULL 16/29] tcg: pass down TranslationBlock to tcg_code_gen Paolo Bonzini
2016-03-22 14:16 ` [Qemu-devel] [PULL 17/29] qemu-log: correct help text for -d cpu Paolo Bonzini
2016-03-22 14:16 ` [Qemu-devel] [PULL 18/29] qemu-log: Avoid function call for disabled qemu_log_mask logging Paolo Bonzini
2016-03-22 14:16 ` [Qemu-devel] [PULL 19/29] qemu-log: Improve the "exec" TB execution logging Paolo Bonzini
2016-03-22 14:17 ` [Qemu-devel] [PULL 20/29] qemu-log: new option -dfilter to limit output Paolo Bonzini
2016-03-22 14:17 ` [Qemu-devel] [PULL 21/29] qemu-log: dfilter-ise exec, out_asm, op and opt_op Paolo Bonzini
2016-03-22 14:17 ` [Qemu-devel] [PULL 22/29] target-arm: dfilter support for in_asm Paolo Bonzini
2016-03-22 14:17 ` [Qemu-devel] [PULL 23/29] qemu-log: support simple pid substitution for logs Paolo Bonzini
2016-03-22 14:17 ` [Qemu-devel] [PULL 24/29] cputlb: modernise the debug support Paolo Bonzini
2016-03-22 14:17 ` [Qemu-devel] [PULL 25/29] exec: fix error handling in file_ram_alloc Paolo Bonzini
2016-03-22 14:17 ` [Qemu-devel] [PULL 26/29] char: translate from QIOChannel error to errno Paolo Bonzini
2016-03-22 14:17 ` [Qemu-devel] [PULL 27/29] char: ensure all clients are in non-blocking mode Paolo Bonzini
2016-03-22 14:17 ` [Qemu-devel] [PULL 28/29] config.status: Pass extra parameters Paolo Bonzini
2016-03-22 14:17 ` [Qemu-devel] [PULL 29/29] target-i386: implement PKE for TCG Paolo Bonzini
2016-03-22 20:27 ` [Qemu-devel] [PULL 00/29] Miscellaneous changes for 2016-03-22 Peter Maydell
2016-03-22 21:26   ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1458656229-32043-5-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=armbru@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).