aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/hw/i386/pc.h18
-rw-r--r--include/hw/pci-host/spapr.h1
-rw-r--r--include/qemu/range.h62
3 files changed, 65 insertions, 16 deletions
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 84720bede9..0abbe45637 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -354,21 +354,9 @@ extern const size_t pc_compat_1_4_len;
* depending on QEMU versions up to QEMU 2.4.
*/
#define PC_CPU_MODEL_IDS(v) \
- {\
- .driver = "qemu32-" TYPE_X86_CPU,\
- .property = "model-id",\
- .value = "QEMU Virtual CPU version " v,\
- },\
- {\
- .driver = "qemu64-" TYPE_X86_CPU,\
- .property = "model-id",\
- .value = "QEMU Virtual CPU version " v,\
- },\
- {\
- .driver = "athlon-" TYPE_X86_CPU,\
- .property = "model-id",\
- .value = "QEMU Virtual CPU version " v,\
- },
+ { "qemu32-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, },\
+ { "qemu64-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, },\
+ { "athlon-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, },
#define DEFINE_PC_MACHINE(suffix, namestr, initfn, optsfn) \
static void pc_machine_##suffix##_class_init(ObjectClass *oc, void *data) \
diff --git a/include/hw/pci-host/spapr.h b/include/hw/pci-host/spapr.h
index 4eb3a2ce3e..a5a7bf4837 100644
--- a/include/hw/pci-host/spapr.h
+++ b/include/hw/pci-host/spapr.h
@@ -101,7 +101,6 @@ struct sPAPRPHBState {
#define SPAPR_MAX_PHBS ((SPAPR_PCI_LIMIT - SPAPR_PCI_BASE) / \
SPAPR_PCI_MEM64_WIN_SIZE - 1)
-#define SPAPR_PCI_2_7_MMIO_WIN_SIZE 0xf80000000
#define SPAPR_PCI_IO_WIN_SIZE 0x10000
#define SPAPR_PCI_MSI_WINDOW 0x40000000000ULL
diff --git a/include/qemu/range.h b/include/qemu/range.h
index 7e75f4e655..ba606c6bc0 100644
--- a/include/qemu/range.h
+++ b/include/qemu/range.h
@@ -113,6 +113,68 @@ static inline uint64_t range_upb(Range *range)
}
/*
+ * Initialize @range to span the interval [@lob,@lob + @size - 1].
+ * @size may be 0. If the range would overflow, returns -ERANGE, otherwise
+ * 0.
+ */
+static inline int QEMU_WARN_UNUSED_RESULT range_init(Range *range, uint64_t lob,
+ uint64_t size)
+{
+ if (lob + size < lob) {
+ return -ERANGE;
+ }
+ range->lob = lob;
+ range->upb = lob + size - 1;
+ range_invariant(range);
+ return 0;
+}
+
+/*
+ * Initialize @range to span the interval [@lob,@lob + @size - 1].
+ * @size may be 0. Range must not overflow.
+ */
+static inline void range_init_nofail(Range *range, uint64_t lob, uint64_t size)
+{
+ range->lob = lob;
+ range->upb = lob + size - 1;
+ range_invariant(range);
+}
+
+/*
+ * Get the size of @range.
+ */
+static inline uint64_t range_size(const Range *range)
+{
+ return range->upb - range->lob + 1;
+}
+
+/*
+ * Check if @range1 overlaps with @range2. If one of the ranges is empty,
+ * the result is always "false".
+ */
+static inline bool range_overlaps_range(const Range *range1,
+ const Range *range2)
+{
+ if (range_is_empty(range1) || range_is_empty(range2)) {
+ return false;
+ }
+ return !(range2->upb < range1->lob || range1->upb < range2->lob);
+}
+
+/*
+ * Check if @range1 contains @range2. If one of the ranges is empty,
+ * the result is always "false".
+ */
+static inline bool range_contains_range(const Range *range1,
+ const Range *range2)
+{
+ if (range_is_empty(range1) || range_is_empty(range2)) {
+ return false;
+ }
+ return range1->lob <= range2->lob && range1->upb >= range2->upb;
+}
+
+/*
* Extend @range to the smallest interval that includes @extend_by, too.
*/
static inline void range_extend(Range *range, Range *extend_by)