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
This commit is contained in:
parent
e7992fc5a0
commit
97917e9e02
@ -15,6 +15,7 @@ common-obj-$(CONFIG_XEN) += xenfb.o
|
|||||||
|
|
||||||
common-obj-$(CONFIG_VGA_PCI) += vga-pci.o
|
common-obj-$(CONFIG_VGA_PCI) += vga-pci.o
|
||||||
common-obj-$(CONFIG_VGA_PCI) += bochs-display.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) += vga-isa.o
|
||||||
common-obj-$(CONFIG_VGA_ISA_MM) += vga-isa-mm.o
|
common-obj-$(CONFIG_VGA_ISA_MM) += vga-isa-mm.o
|
||||||
common-obj-$(CONFIG_VMWARE_VGA) += vmware_vga.o
|
common-obj-$(CONFIG_VMWARE_VGA) += vmware_vga.o
|
||||||
|
33
hw/display/edid-region.c
Normal file
33
hw/display/edid-region.c
Normal file
@ -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);
|
||||||
|
}
|
@ -1,6 +1,8 @@
|
|||||||
#ifndef EDID_H
|
#ifndef EDID_H
|
||||||
#define EDID_H
|
#define EDID_H
|
||||||
|
|
||||||
|
#include "hw/hw.h"
|
||||||
|
|
||||||
typedef struct qemu_edid_info {
|
typedef struct qemu_edid_info {
|
||||||
const char *vendor;
|
const char *vendor;
|
||||||
const char *name;
|
const char *name;
|
||||||
@ -15,5 +17,7 @@ typedef struct qemu_edid_info {
|
|||||||
void qemu_edid_generate(uint8_t *edid, size_t size,
|
void qemu_edid_generate(uint8_t *edid, size_t size,
|
||||||
qemu_edid_info *info);
|
qemu_edid_info *info);
|
||||||
size_t qemu_edid_size(uint8_t *edid);
|
size_t qemu_edid_size(uint8_t *edid);
|
||||||
|
void qemu_edid_region_io(MemoryRegion *region, Object *owner,
|
||||||
|
uint8_t *edid, size_t size);
|
||||||
|
|
||||||
#endif /* EDID_H */
|
#endif /* EDID_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user