*/
#include "hw.h"
#include "omap.h"
+#include "exec-memory.h"
/* Interrupt Handlers */
struct omap_intr_handler_bank_s {
struct omap_intr_handler_s {
qemu_irq *pins;
qemu_irq parent_intr[2];
+ MemoryRegion mmio;
unsigned char nbanks;
int level_only;
bank->irqs = (bank->inputs &= ~(1 << n)) | bank->swi;
}
-static uint32_t omap_inth_read(void *opaque, target_phys_addr_t addr)
+static uint64_t omap_inth_read(void *opaque, target_phys_addr_t addr,
+ unsigned size)
{
struct omap_intr_handler_s *s = (struct omap_intr_handler_s *) opaque;
int i, offset = addr;
}
static void omap_inth_write(void *opaque, target_phys_addr_t addr,
- uint32_t value)
+ uint64_t value, unsigned size)
{
struct omap_intr_handler_s *s = (struct omap_intr_handler_s *) opaque;
int i, offset = addr;
OMAP_BAD_REG(addr);
}
-static CPUReadMemoryFunc * const omap_inth_readfn[] = {
- omap_badwidth_read32,
- omap_badwidth_read32,
- omap_inth_read,
-};
-
-static CPUWriteMemoryFunc * const omap_inth_writefn[] = {
- omap_inth_write,
- omap_inth_write,
- omap_inth_write,
+static const MemoryRegionOps omap_inth_mem_ops = {
+ .read = omap_inth_read,
+ .write = omap_inth_write,
+ .endianness = DEVICE_NATIVE_ENDIAN,
+ .valid = {
+ .min_access_size = 4,
+ .max_access_size = 4,
+ },
};
void omap_inth_reset(struct omap_intr_handler_s *s)
unsigned long size, unsigned char nbanks, qemu_irq **pins,
qemu_irq parent_irq, qemu_irq parent_fiq, omap_clk clk)
{
- int iomemtype;
struct omap_intr_handler_s *s = (struct omap_intr_handler_s *)
g_malloc0(sizeof(struct omap_intr_handler_s) +
sizeof(struct omap_intr_handler_bank_s) * nbanks);
if (pins)
*pins = s->pins;
- omap_inth_reset(s);
+ memory_region_init_io(&s->mmio, &omap_inth_mem_ops, s, "omap-intc", size);
+ memory_region_add_subregion(get_system_memory(), base, &s->mmio);
- iomemtype = cpu_register_io_memory(omap_inth_readfn,
- omap_inth_writefn, s, DEVICE_NATIVE_ENDIAN);
- cpu_register_physical_memory(base, size, iomemtype);
+ omap_inth_reset(s);
return s;
}
-static uint32_t omap2_inth_read(void *opaque, target_phys_addr_t addr)
+static uint64_t omap2_inth_read(void *opaque, target_phys_addr_t addr,
+ unsigned size)
{
struct omap_intr_handler_s *s = (struct omap_intr_handler_s *) opaque;
int offset = addr;
}
static void omap2_inth_write(void *opaque, target_phys_addr_t addr,
- uint32_t value)
+ uint64_t value, unsigned size)
{
struct omap_intr_handler_s *s = (struct omap_intr_handler_s *) opaque;
int offset = addr;
OMAP_BAD_REG(addr);
}
-static CPUReadMemoryFunc * const omap2_inth_readfn[] = {
- omap_badwidth_read32,
- omap_badwidth_read32,
- omap2_inth_read,
-};
-
-static CPUWriteMemoryFunc * const omap2_inth_writefn[] = {
- omap2_inth_write,
- omap2_inth_write,
- omap2_inth_write,
+static const MemoryRegionOps omap2_inth_mem_ops = {
+ .read = omap2_inth_read,
+ .write = omap2_inth_write,
+ .endianness = DEVICE_NATIVE_ENDIAN,
+ .valid = {
+ .min_access_size = 4,
+ .max_access_size = 4,
+ },
};
struct omap_intr_handler_s *omap2_inth_init(target_phys_addr_t base,
qemu_irq parent_irq, qemu_irq parent_fiq,
omap_clk fclk, omap_clk iclk)
{
- int iomemtype;
struct omap_intr_handler_s *s = (struct omap_intr_handler_s *)
g_malloc0(sizeof(struct omap_intr_handler_s) +
sizeof(struct omap_intr_handler_bank_s) * nbanks);
if (pins)
*pins = s->pins;
- omap_inth_reset(s);
+ memory_region_init_io(&s->mmio, &omap2_inth_mem_ops, s, "omap2-intc", size);
+ memory_region_add_subregion(get_system_memory(), base, &s->mmio);
- iomemtype = cpu_register_io_memory(omap2_inth_readfn,
- omap2_inth_writefn, s, DEVICE_NATIVE_ENDIAN);
- cpu_register_physical_memory(base, size, iomemtype);
+ omap_inth_reset(s);
return s;
}