mirror of
https://git.proxmox.com/git/qemu
synced 2025-08-07 04:08:55 +00:00
cirrus: simplify vga window mmio access functions
Make use of the memory API's ability to satisfy multi-byte accesses via multiple single-byte accesses. Reviewed-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
4e56f089ef
commit
a815b16649
@ -1956,7 +1956,9 @@ static void cirrus_mem_writeb_mode4and5_16bpp(CirrusVGAState * s,
|
|||||||
*
|
*
|
||||||
***************************************/
|
***************************************/
|
||||||
|
|
||||||
static uint32_t cirrus_vga_mem_readb(void *opaque, target_phys_addr_t addr)
|
static uint64_t cirrus_vga_mem_read(void *opaque,
|
||||||
|
target_phys_addr_t addr,
|
||||||
|
uint32_t size)
|
||||||
{
|
{
|
||||||
CirrusVGAState *s = opaque;
|
CirrusVGAState *s = opaque;
|
||||||
unsigned bank_index;
|
unsigned bank_index;
|
||||||
@ -1967,8 +1969,6 @@ static uint32_t cirrus_vga_mem_readb(void *opaque, target_phys_addr_t addr)
|
|||||||
return vga_mem_readb(s, addr);
|
return vga_mem_readb(s, addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
addr &= 0x1ffff;
|
|
||||||
|
|
||||||
if (addr < 0x10000) {
|
if (addr < 0x10000) {
|
||||||
/* XXX handle bitblt */
|
/* XXX handle bitblt */
|
||||||
/* video memory */
|
/* video memory */
|
||||||
@ -2000,28 +2000,10 @@ static uint32_t cirrus_vga_mem_readb(void *opaque, target_phys_addr_t addr)
|
|||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t cirrus_vga_mem_readw(void *opaque, target_phys_addr_t addr)
|
static void cirrus_vga_mem_write(void *opaque,
|
||||||
{
|
target_phys_addr_t addr,
|
||||||
uint32_t v;
|
uint64_t mem_value,
|
||||||
|
uint32_t size)
|
||||||
v = cirrus_vga_mem_readb(opaque, addr);
|
|
||||||
v |= cirrus_vga_mem_readb(opaque, addr + 1) << 8;
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
static uint32_t cirrus_vga_mem_readl(void *opaque, target_phys_addr_t addr)
|
|
||||||
{
|
|
||||||
uint32_t v;
|
|
||||||
|
|
||||||
v = cirrus_vga_mem_readb(opaque, addr);
|
|
||||||
v |= cirrus_vga_mem_readb(opaque, addr + 1) << 8;
|
|
||||||
v |= cirrus_vga_mem_readb(opaque, addr + 2) << 16;
|
|
||||||
v |= cirrus_vga_mem_readb(opaque, addr + 3) << 24;
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void cirrus_vga_mem_writeb(void *opaque, target_phys_addr_t addr,
|
|
||||||
uint32_t mem_value)
|
|
||||||
{
|
{
|
||||||
CirrusVGAState *s = opaque;
|
CirrusVGAState *s = opaque;
|
||||||
unsigned bank_index;
|
unsigned bank_index;
|
||||||
@ -2033,8 +2015,6 @@ static void cirrus_vga_mem_writeb(void *opaque, target_phys_addr_t addr,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
addr &= 0x1ffff;
|
|
||||||
|
|
||||||
if (addr < 0x10000) {
|
if (addr < 0x10000) {
|
||||||
if (s->cirrus_srcptr != s->cirrus_srcptr_end) {
|
if (s->cirrus_srcptr != s->cirrus_srcptr_end) {
|
||||||
/* bitblt */
|
/* bitblt */
|
||||||
@ -2084,51 +2064,14 @@ static void cirrus_vga_mem_writeb(void *opaque, target_phys_addr_t addr,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cirrus_vga_mem_writew(void *opaque, target_phys_addr_t addr, uint32_t val)
|
|
||||||
{
|
|
||||||
cirrus_vga_mem_writeb(opaque, addr, val & 0xff);
|
|
||||||
cirrus_vga_mem_writeb(opaque, addr + 1, (val >> 8) & 0xff);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void cirrus_vga_mem_writel(void *opaque, target_phys_addr_t addr, uint32_t val)
|
|
||||||
{
|
|
||||||
cirrus_vga_mem_writeb(opaque, addr, val & 0xff);
|
|
||||||
cirrus_vga_mem_writeb(opaque, addr + 1, (val >> 8) & 0xff);
|
|
||||||
cirrus_vga_mem_writeb(opaque, addr + 2, (val >> 16) & 0xff);
|
|
||||||
cirrus_vga_mem_writeb(opaque, addr + 3, (val >> 24) & 0xff);
|
|
||||||
}
|
|
||||||
|
|
||||||
static uint64_t cirrus_vga_mem_read(void *opaque,
|
|
||||||
target_phys_addr_t addr,
|
|
||||||
uint32_t size)
|
|
||||||
{
|
|
||||||
CirrusVGAState *s = opaque;
|
|
||||||
|
|
||||||
switch (size) {
|
|
||||||
case 1: return cirrus_vga_mem_readb(s, addr);
|
|
||||||
case 2: return cirrus_vga_mem_readw(s, addr);
|
|
||||||
case 4: return cirrus_vga_mem_readl(s, addr);
|
|
||||||
default: abort();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void cirrus_vga_mem_write(void *opaque, target_phys_addr_t addr,
|
|
||||||
uint64_t data, unsigned size)
|
|
||||||
{
|
|
||||||
CirrusVGAState *s = opaque;
|
|
||||||
|
|
||||||
switch (size) {
|
|
||||||
case 1: return cirrus_vga_mem_writeb(s, addr, data);
|
|
||||||
case 2: return cirrus_vga_mem_writew(s, addr, data);
|
|
||||||
case 4: return cirrus_vga_mem_writel(s, addr, data);
|
|
||||||
default: abort();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
static const MemoryRegionOps cirrus_vga_mem_ops = {
|
static const MemoryRegionOps cirrus_vga_mem_ops = {
|
||||||
.read = cirrus_vga_mem_read,
|
.read = cirrus_vga_mem_read,
|
||||||
.write = cirrus_vga_mem_write,
|
.write = cirrus_vga_mem_write,
|
||||||
.endianness = DEVICE_LITTLE_ENDIAN,
|
.endianness = DEVICE_LITTLE_ENDIAN,
|
||||||
|
.impl = {
|
||||||
|
.min_access_size = 1,
|
||||||
|
.max_access_size = 1,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
/***************************************
|
/***************************************
|
||||||
|
Loading…
Reference in New Issue
Block a user