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