xref: /openbmc/qemu/hw/display/edid-region.c (revision 4366e1db)
1 #include "qemu/osdep.h"
2 #include "qemu-common.h"
3 #include "hw/display/edid.h"
4 
5 static uint64_t edid_region_read(void *ptr, hwaddr addr, unsigned size)
6 {
7     uint8_t *edid = ptr;
8 
9     return edid[addr];
10 }
11 
12 static void edid_region_write(void *ptr, hwaddr addr,
13                              uint64_t val, unsigned size)
14 {
15     /* read only */
16 }
17 
18 static const MemoryRegionOps edid_region_ops = {
19     .read = edid_region_read,
20     .write = edid_region_write,
21     .valid.min_access_size = 1,
22     .valid.max_access_size = 4,
23     .impl.min_access_size = 1,
24     .impl.max_access_size = 1,
25     .endianness = DEVICE_LITTLE_ENDIAN,
26 };
27 
28 void qemu_edid_region_io(MemoryRegion *region, Object *owner,
29                          uint8_t *edid, size_t size)
30 {
31     memory_region_init_io(region, owner, &edid_region_ops,
32                           edid, "edid", size);
33 }
34