mirror of
https://git.proxmox.com/git/qemu
synced 2025-07-09 10:03:54 +00:00
milkymist-pfpu: convert to memory API
Signed-off-by: Michael Walle <michael@walle.cc> Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
parent
8c85d15b3f
commit
d46ccfcef3
@ -118,6 +118,7 @@ static const char *opcode_to_str[] = {
|
|||||||
|
|
||||||
struct MilkymistPFPUState {
|
struct MilkymistPFPUState {
|
||||||
SysBusDevice busdev;
|
SysBusDevice busdev;
|
||||||
|
MemoryRegion regs_region;
|
||||||
CharDriverState *chr;
|
CharDriverState *chr;
|
||||||
qemu_irq irq;
|
qemu_irq irq;
|
||||||
|
|
||||||
@ -379,7 +380,8 @@ static inline int get_microcode_address(MilkymistPFPUState *s, uint32_t addr)
|
|||||||
return (512 * s->regs[R_CODEPAGE]) + addr - MICROCODE_BEGIN;
|
return (512 * s->regs[R_CODEPAGE]) + addr - MICROCODE_BEGIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t pfpu_read(void *opaque, target_phys_addr_t addr)
|
static uint64_t pfpu_read(void *opaque, target_phys_addr_t addr,
|
||||||
|
unsigned size)
|
||||||
{
|
{
|
||||||
MilkymistPFPUState *s = opaque;
|
MilkymistPFPUState *s = opaque;
|
||||||
uint32_t r = 0;
|
uint32_t r = 0;
|
||||||
@ -418,8 +420,8 @@ static uint32_t pfpu_read(void *opaque, target_phys_addr_t addr)
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void pfpu_write(void *opaque, target_phys_addr_t addr, uint64_t value,
|
||||||
pfpu_write(void *opaque, target_phys_addr_t addr, uint32_t value)
|
unsigned size)
|
||||||
{
|
{
|
||||||
MilkymistPFPUState *s = opaque;
|
MilkymistPFPUState *s = opaque;
|
||||||
|
|
||||||
@ -459,16 +461,14 @@ pfpu_write(void *opaque, target_phys_addr_t addr, uint32_t value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static CPUReadMemoryFunc * const pfpu_read_fn[] = {
|
static const MemoryRegionOps pfpu_mmio_ops = {
|
||||||
NULL,
|
.read = pfpu_read,
|
||||||
NULL,
|
.write = pfpu_write,
|
||||||
&pfpu_read,
|
.valid = {
|
||||||
};
|
.min_access_size = 4,
|
||||||
|
.max_access_size = 4,
|
||||||
static CPUWriteMemoryFunc * const pfpu_write_fn[] = {
|
},
|
||||||
NULL,
|
.endianness = DEVICE_NATIVE_ENDIAN,
|
||||||
NULL,
|
|
||||||
&pfpu_write,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void milkymist_pfpu_reset(DeviceState *d)
|
static void milkymist_pfpu_reset(DeviceState *d)
|
||||||
@ -494,13 +494,12 @@ static void milkymist_pfpu_reset(DeviceState *d)
|
|||||||
static int milkymist_pfpu_init(SysBusDevice *dev)
|
static int milkymist_pfpu_init(SysBusDevice *dev)
|
||||||
{
|
{
|
||||||
MilkymistPFPUState *s = FROM_SYSBUS(typeof(*s), dev);
|
MilkymistPFPUState *s = FROM_SYSBUS(typeof(*s), dev);
|
||||||
int pfpu_regs;
|
|
||||||
|
|
||||||
sysbus_init_irq(dev, &s->irq);
|
sysbus_init_irq(dev, &s->irq);
|
||||||
|
|
||||||
pfpu_regs = cpu_register_io_memory(pfpu_read_fn, pfpu_write_fn, s,
|
memory_region_init_io(&s->regs_region, &pfpu_mmio_ops, s,
|
||||||
DEVICE_NATIVE_ENDIAN);
|
"milkymist-pfpu", MICROCODE_END * 4);
|
||||||
sysbus_init_mmio(dev, MICROCODE_END * 4, pfpu_regs);
|
sysbus_init_mmio_region(dev, &s->regs_region);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user