Revision 06dccb82 hw/etraxfs_eth.c

b/hw/etraxfs_eth.c
320 320
struct fs_eth
321 321
{
322 322
	SysBusDevice busdev;
323
	MemoryRegion mmio;
323 324
	NICState *nic;
324 325
	NICConf conf;
325 326
	int ethregs;
......
373 374
	}
374 375
}
375 376

  
376
static uint32_t eth_readl (void *opaque, target_phys_addr_t addr)
377
static uint64_t
378
eth_read(void *opaque, target_phys_addr_t addr, unsigned int size)
377 379
{
378 380
	struct fs_eth *eth = opaque;
379 381
	uint32_t r = 0;
......
417 419
}
418 420

  
419 421
static void
420
eth_writel (void *opaque, target_phys_addr_t addr, uint32_t value)
422
eth_write(void *opaque, target_phys_addr_t addr,
423
          uint64_t val64, unsigned int size)
421 424
{
422 425
	struct fs_eth *eth = opaque;
426
	uint32_t value = val64;
423 427

  
424 428
	addr >>= 2;
425 429
	switch (addr)
......
553 557
	eth->phy.link = !nc->link_down;
554 558
}
555 559

  
556
static CPUReadMemoryFunc * const eth_read[] = {
557
	NULL, NULL,
558
	&eth_readl,
559
};
560

  
561
static CPUWriteMemoryFunc * const eth_write[] = {
562
	NULL, NULL,
563
	&eth_writel,
560
static const MemoryRegionOps eth_ops = {
561
	.read = eth_read,
562
	.write = eth_write,
563
	.endianness = DEVICE_LITTLE_ENDIAN,
564
	.valid = {
565
		.min_access_size = 4,
566
		.max_access_size = 4
567
	}
564 568
};
565 569

  
566 570
static void eth_cleanup(VLANClientState *nc)
......
589 593
static int fs_eth_init(SysBusDevice *dev)
590 594
{
591 595
	struct fs_eth *s = FROM_SYSBUS(typeof(*s), dev);
592
	int eth_regs;
593 596

  
594 597
	if (!s->dma_out || !s->dma_in) {
595 598
		hw_error("Unconnected ETRAX-FS Ethernet MAC.\n");
......
600 603
	s->dma_in->client.opaque = s;
601 604
	s->dma_in->client.pull = NULL;
602 605

  
603
	eth_regs = cpu_register_io_memory(eth_read, eth_write, s,
604
					  DEVICE_LITTLE_ENDIAN);
605
	sysbus_init_mmio(dev, 0x5c, eth_regs);
606
	memory_region_init_io(&s->mmio, &eth_ops, s, "etraxfs-eth", 0x5c);
607
	sysbus_init_mmio_region(dev, &s->mmio);
606 608

  
607 609
	qemu_macaddr_default_if_unset(&s->conf.macaddr);
608 610
	s->nic = qemu_new_nic(&net_etraxfs_info, &s->conf,

Also available in: Unified diff