diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2018-09-25 09:56:44 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2018-09-27 08:07:51 +0200 |
commit | 97917e9e02e04bbb5f3b14c0f2b58913ef5f09d2 (patch) | |
tree | 63dd189dca667ee32b1c40c34139055f52ee3f47 /hw/display | |
parent | e7992fc5a002003ae865685ad4635b952c1ca9bf (diff) | |
download | qemu-97917e9e02e04bbb5f3b14c0f2b58913ef5f09d2.zip qemu-97917e9e02e04bbb5f3b14c0f2b58913ef5f09d2.tar.gz qemu-97917e9e02e04bbb5f3b14c0f2b58913ef5f09d2.tar.bz2 |
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/display')
-rw-r--r-- | hw/display/Makefile.objs | 1 | ||||
-rw-r--r-- | hw/display/edid-region.c | 33 |
2 files changed, 34 insertions, 0 deletions
diff --git a/hw/display/Makefile.objs b/hw/display/Makefile.objs index 492404c..780a76b 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 0000000..9a15734 --- /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); +} |