提交 af956cad 编写于 作者: A Avi Kivity 提交者: Anthony Liguori

isa-mmio: convert to memory API

Reviewed-by: NRichard Henderson <rth@twiddle.net>
Reviewed-by: NAnthony Liguori <aliguori@us.ibm.com>
Signed-off-by: NAvi Kivity <avi@redhat.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 d9c6ebd1
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
/* ISA bus */ /* ISA bus */
#include "ioport.h" #include "ioport.h"
#include "memory.h"
#include "qdev.h" #include "qdev.h"
typedef struct ISABus ISABus; typedef struct ISABus ISABus;
...@@ -37,6 +38,7 @@ ISADevice *isa_create_simple(const char *name); ...@@ -37,6 +38,7 @@ ISADevice *isa_create_simple(const char *name);
extern target_phys_addr_t isa_mem_base; extern target_phys_addr_t isa_mem_base;
void isa_mmio_setup(MemoryRegion *mr, target_phys_addr_t size);
void isa_mmio_init(target_phys_addr_t base, target_phys_addr_t size); void isa_mmio_init(target_phys_addr_t base, target_phys_addr_t size);
/* dma.c */ /* dma.c */
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "hw.h" #include "hw.h"
#include "isa.h" #include "isa.h"
#include "exec-memory.h"
static void isa_mmio_writeb (void *opaque, target_phys_addr_t addr, static void isa_mmio_writeb (void *opaque, target_phys_addr_t addr,
uint32_t val) uint32_t val)
...@@ -58,25 +59,23 @@ static uint32_t isa_mmio_readl(void *opaque, target_phys_addr_t addr) ...@@ -58,25 +59,23 @@ static uint32_t isa_mmio_readl(void *opaque, target_phys_addr_t addr)
return cpu_inl(addr & IOPORTS_MASK); return cpu_inl(addr & IOPORTS_MASK);
} }
static CPUWriteMemoryFunc * const isa_mmio_write[] = { static const MemoryRegionOps isa_mmio_ops = {
&isa_mmio_writeb, .old_mmio = {
&isa_mmio_writew, .write = { isa_mmio_writeb, isa_mmio_writew, isa_mmio_writel },
&isa_mmio_writel, .read = { isa_mmio_readb, isa_mmio_readw, isa_mmio_readl, },
},
.endianness = DEVICE_LITTLE_ENDIAN,
}; };
static CPUReadMemoryFunc * const isa_mmio_read[] = { void isa_mmio_setup(MemoryRegion *mr, target_phys_addr_t size)
&isa_mmio_readb, {
&isa_mmio_readw, memory_region_init_io(mr, &isa_mmio_ops, NULL, "isa-mmio", size);
&isa_mmio_readl, }
};
void isa_mmio_init(target_phys_addr_t base, target_phys_addr_t size) void isa_mmio_init(target_phys_addr_t base, target_phys_addr_t size)
{ {
int isa_mmio_iomemtype; MemoryRegion *mr = qemu_malloc(sizeof(*mr));
isa_mmio_iomemtype = cpu_register_io_memory(isa_mmio_read, isa_mmio_setup(mr, size);
isa_mmio_write, memory_region_add_subregion(get_system_memory(), base, mr);
NULL,
DEVICE_LITTLE_ENDIAN);
cpu_register_physical_memory(base, size, isa_mmio_iomemtype);
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册