[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 19/29] net/dp8393x: add PROM to store MAC address
From: |
Leon Alrae |
Subject: |
[Qemu-devel] [PULL 19/29] net/dp8393x: add PROM to store MAC address |
Date: |
Fri, 12 Jun 2015 10:35:26 +0100 |
From: Hervé Poussineau <address@hidden>
Signed-off-by: Laurent Vivier <address@hidden>
Signed-off-by: Hervé Poussineau <address@hidden>
Reviewed-by: Aurelien Jarno <address@hidden>
Signed-off-by: Leon Alrae <address@hidden>
---
hw/mips/mips_jazz.c | 1 +
hw/net/dp8393x.c | 18 ++++++++++++++++++
2 files changed, 19 insertions(+)
diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c
index 648654e..9d60633 100644
--- a/hw/mips/mips_jazz.c
+++ b/hw/mips/mips_jazz.c
@@ -282,6 +282,7 @@ static void mips_jazz_init(MachineState *machine,
qdev_init_nofail(dev);
sysbus = SYS_BUS_DEVICE(dev);
sysbus_mmio_map(sysbus, 0, 0x80001000);
+ sysbus_mmio_map(sysbus, 1, 0x8000b000);
sysbus_connect_irq(sysbus, 0, qdev_get_gpio_in(rc4030, 4));
break;
} else if (is_help_option(nd->model)) {
diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c
index 51e728b..ef1fb0e 100644
--- a/hw/net/dp8393x.c
+++ b/hw/net/dp8393x.c
@@ -25,6 +25,7 @@
//#define DEBUG_SONIC
+#define SONIC_PROM_SIZE 0x1000
#ifdef DEBUG_SONIC
#define DPRINTF(fmt, ...) \
@@ -156,6 +157,7 @@ typedef struct dp8393xState {
NICConf conf;
NICState *nic;
MemoryRegion mmio;
+ MemoryRegion prom;
/* Registers */
uint8_t cam[16][6];
@@ -816,12 +818,15 @@ static void dp8393x_instance_init(Object *obj)
dp8393xState *s = DP8393X(obj);
sysbus_init_mmio(sbd, &s->mmio);
+ sysbus_init_mmio(sbd, &s->prom);
sysbus_init_irq(sbd, &s->irq);
}
static void dp8393x_realize(DeviceState *dev, Error **errp)
{
dp8393xState *s = DP8393X(dev);
+ int i, checksum;
+ uint8_t *prom;
address_space_init(&s->as, s->dma_mr, "dp8393x");
memory_region_init_io(&s->mmio, OBJECT(dev), &dp8393x_ops, s,
@@ -833,6 +838,19 @@ static void dp8393x_realize(DeviceState *dev, Error **errp)
s->watchdog = timer_new_ns(QEMU_CLOCK_VIRTUAL, dp8393x_watchdog, s);
s->regs[SONIC_SR] = 0x0004; /* only revision recognized by Linux */
+
+ memory_region_init_rom_device(&s->prom, OBJECT(dev), NULL, NULL,
+ "dp8393x-prom", SONIC_PROM_SIZE, NULL);
+ prom = memory_region_get_ram_ptr(&s->prom);
+ checksum = 0;
+ for (i = 0; i < 6; i++) {
+ prom[i] = s->conf.macaddr.a[i];
+ checksum += prom[i];
+ if (checksum > 0xff) {
+ checksum = (checksum + 1) & 0xff;
+ }
+ }
+ prom[7] = 0xff - checksum;
}
static Property dp8393x_properties[] = {
--
2.1.0
- [Qemu-devel] [PULL 13/29] dma/rc4030: use trace events instead of custom logging, (continued)
- [Qemu-devel] [PULL 13/29] dma/rc4030: use trace events instead of custom logging, Leon Alrae, 2015/06/12
- [Qemu-devel] [PULL 02/29] target-mips: add Config5.FRE support allowing Status.FR=0 emulation, Leon Alrae, 2015/06/12
- [Qemu-devel] [PULL 10/29] dma/rc4030: use AddressSpace and address_space_rw in users, Leon Alrae, 2015/06/12
- [Qemu-devel] [PULL 14/29] dma/rc4030: convert to QOM, Leon Alrae, 2015/06/12
- [Qemu-devel] [PULL 16/29] net/dp8393x: do not use old_mmio accesses, Leon Alrae, 2015/06/12
- [Qemu-devel] [PULL 25/29] target-mips: support Page Frame Number Extension field, Leon Alrae, 2015/06/12
- [Qemu-devel] [PULL 23/29] target-mips: correct MFC0 for CP0.EntryLo in MIPS64, Leon Alrae, 2015/06/12
- [Qemu-devel] [PULL 21/29] net/dp8393x: correctly reset in_use field, Leon Alrae, 2015/06/12
- [Qemu-devel] [PULL 20/29] net/dp8393x: add load/save support, Leon Alrae, 2015/06/12
- [Qemu-devel] [PULL 22/29] net/dp8393x: fix hardware reset, Leon Alrae, 2015/06/12
- [Qemu-devel] [PULL 19/29] net/dp8393x: add PROM to store MAC address,
Leon Alrae <=
- [Qemu-devel] [PULL 17/29] net/dp8393x: use dp8393x_ prefix for all functions, Leon Alrae, 2015/06/12
- [Qemu-devel] [PULL 18/29] net/dp8393x: QOM'ify, Leon Alrae, 2015/06/12
- [Qemu-devel] [PULL 28/29] target-mips: remove misleading comments in translate_init.c, Leon Alrae, 2015/06/12
- [Qemu-devel] [PULL 29/29] target-mips: enable XPA and LPA features, Leon Alrae, 2015/06/12
- [Qemu-devel] [PULL 24/29] target-mips: extend selected CP0 registers to 64-bits in MIPS32, Leon Alrae, 2015/06/12
- [Qemu-devel] [PULL 27/29] target-mips: add MTHC0 and MFHC0 instructions, Leon Alrae, 2015/06/12
- [Qemu-devel] [PULL 26/29] target-mips: add CP0.PageGrain.ELPA support, Leon Alrae, 2015/06/12
- Re: [Qemu-devel] [PULL 00/29] target-mips queue, Peter Maydell, 2015/06/12