summary refs log tree commit diff stats
path: root/hw
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2018-09-25 09:56:44 +0200
committerGerd Hoffmann <kraxel@redhat.com>2018-09-27 08:07:51 +0200
commit97917e9e02e04bbb5f3b14c0f2b58913ef5f09d2 (patch)
tree63dd189dca667ee32b1c40c34139055f52ee3f47 /hw
parente7992fc5a002003ae865685ad4635b952c1ca9bf (diff)
downloadfocaccia-qemu-97917e9e02e04bbb5f3b14c0f2b58913ef5f09d2.tar.gz
focaccia-qemu-97917e9e02e04bbb5f3b14c0f2b58913ef5f09d2.zip
display/edid: add region helper.
Create a io region for an EDID data block.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20180925075646.25114-4-kraxel@redhat.com
Diffstat (limited to 'hw')
-rw-r--r--hw/display/Makefile.objs1
-rw-r--r--hw/display/edid-region.c33
2 files changed, 34 insertions, 0 deletions
diff --git a/hw/display/Makefile.objs b/hw/display/Makefile.objs
index 492404c09e..780a76b9f0 100644
--- a/hw/display/Makefile.objs
+++ b/hw/display/Makefile.objs
@@ -15,6 +15,7 @@ common-obj-$(CONFIG_XEN) += xenfb.o
 
 common-obj-$(CONFIG_VGA_PCI) += vga-pci.o
 common-obj-$(CONFIG_VGA_PCI) += bochs-display.o
+common-obj-$(CONFIG_VGA_PCI) += edid-region.o
 common-obj-$(CONFIG_VGA_ISA) += vga-isa.o
 common-obj-$(CONFIG_VGA_ISA_MM) += vga-isa-mm.o
 common-obj-$(CONFIG_VMWARE_VGA) += vmware_vga.o
diff --git a/hw/display/edid-region.c b/hw/display/edid-region.c
new file mode 100644
index 0000000000..9a15734d3a
--- /dev/null
+++ b/hw/display/edid-region.c
@@ -0,0 +1,33 @@
+#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "hw/display/edid.h"
+
+static uint64_t edid_region_read(void *ptr, hwaddr addr, unsigned size)
+{
+    uint8_t *edid = ptr;
+
+    return edid[addr];
+}
+
+static void edid_region_write(void *ptr, hwaddr addr,
+                             uint64_t val, unsigned size)
+{
+    /* read only */
+}
+
+static const MemoryRegionOps edid_region_ops = {
+    .read = edid_region_read,
+    .write = edid_region_write,
+    .valid.min_access_size = 1,
+    .valid.max_access_size = 4,
+    .impl.min_access_size = 1,
+    .impl.max_access_size = 1,
+    .endianness = DEVICE_LITTLE_ENDIAN,
+};
+
+void qemu_edid_region_io(MemoryRegion *region, Object *owner,
+                         uint8_t *edid, size_t size)
+{
+    memory_region_init_io(region, owner, &edid_region_ops,
+                          edid, "edid", size);
+}