Signed-off-by: Laurent Vivier <laur...@vivier.eu> --- hw/mips/mips_jazz.c | 4 ++-- hw/net/dp8393x.c | 18 +++++++++++++++++- include/hw/net/dp8393x.h | 3 ++- 3 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c index ecfaacb..4d556ab 100644 --- a/hw/mips/mips_jazz.c +++ b/hw/mips/mips_jazz.c @@ -268,8 +268,8 @@ static void mips_jazz_init(MemoryRegion *address_space, if (!nd->model) nd->model = g_strdup("dp83932"); if (strcmp(nd->model, "dp83932") == 0) { - dp83932_init(nd, 0x80001000, 2, 0, get_system_memory(), rc4030[4], - rc4030_opaque, rc4030_dma_memory_rw); + dp83932_init(nd, 0x80001000, 0, 2, 0, get_system_memory(), + rc4030[4], rc4030_opaque, rc4030_dma_memory_rw); break; } else if (is_help_option(nd->model)) { fprintf(stderr, "qemu: Supported NICs: dp83932\n"); diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c index 343191f..bd97851 100644 --- a/hw/net/dp8393x.c +++ b/hw/net/dp8393x.c @@ -24,6 +24,8 @@ //#define DEBUG_SONIC +#define SONIC_PROM_SIZE 8192 + /* Calculate CRCs properly on Rx packets */ #define SONIC_CALCULATE_RXCRC @@ -159,6 +161,7 @@ typedef struct dp8393xState { NICState *nic; MemoryRegion *address_space; MemoryRegion mmio; + MemoryRegion prom; /* Registers */ uint8_t cam[16][6]; @@ -880,12 +883,15 @@ static NetClientInfo net_dp83932_info = { .cleanup = nic_cleanup, }; -void dp83932_init(NICInfo *nd, hwaddr base, int it_shift, int regs_offset, +void dp83932_init(NICInfo *nd, hwaddr base, hwaddr prombase, + int it_shift, int regs_offset, MemoryRegion *address_space, qemu_irq irq, void* mem_opaque, void (*memory_rw)(void *opaque, hwaddr addr, uint8_t *buf, int len, int is_write)) { dp8393xState *s; + int i; + uint8_t *prom; qemu_check_nic_model(nd, "dp83932"); @@ -912,4 +918,14 @@ void dp83932_init(NICInfo *nd, hwaddr base, int it_shift, int regs_offset, memory_region_init_io(&s->mmio, NULL, &dp8393x_ops, s, "dp8393x", 0x40 << it_shift); memory_region_add_subregion(address_space, base, &s->mmio); + + if (prombase) { + memory_region_init_rom_device(&s->prom, NULL, NULL, NULL, + "dp8393x-prom", SONIC_PROM_SIZE, NULL); + prom = memory_region_get_ram_ptr(&s->prom); + for (i = 0; i < 6; i++) { + prom[i] = s->conf.macaddr.a[i]; + } + memory_region_add_subregion(address_space, prombase, &s->prom); + } } diff --git a/include/hw/net/dp8393x.h b/include/hw/net/dp8393x.h index 21aa0f7..47eb187 100644 --- a/include/hw/net/dp8393x.h +++ b/include/hw/net/dp8393x.h @@ -1,4 +1,5 @@ -void dp83932_init(NICInfo *nd, hwaddr base, int it_shift, int regs_offset, +void dp83932_init(NICInfo *nd, hwaddr base, hwaddr rombase, + int it_shift, int regs_offset, MemoryRegion *address_space, qemu_irq irq, void *mem_opaque, void (*memory_rw)(void *opaque, hwaddr addr, uint8_t *buf, -- 1.9.1