diff options
author | Philippe Mathieu-Daudé <f4bug@amsat.org> | 2021-07-08 00:30:46 +0200 |
---|---|---|
committer | Philippe Mathieu-Daudé <f4bug@amsat.org> | 2021-07-11 22:29:54 +0200 |
commit | 67b38ddfe58cbfb7c9c4a8d8b7efdc3fe7def41f (patch) | |
tree | 9a815decb55b9378dc376e908a2692036d99b854 /hw/net | |
parent | 197ade0d110deeef58a05c11adec100926813560 (diff) |
dp8393x: Replace 0x40 magic value by SONIC_REG_COUNT definition
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Tested-by: Finn Thain <fthain@linux-m68k.org>
Message-Id: <20210710174954.2577195-3-f4bug@amsat.org>
Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Diffstat (limited to 'hw/net')
-rw-r--r-- | hw/net/dp8393x.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c index 9118364aa3..d1e147a82a 100644 --- a/hw/net/dp8393x.c +++ b/hw/net/dp8393x.c @@ -85,6 +85,7 @@ static const char *reg_names[] = { #define SONIC_MPT 0x2e #define SONIC_MDT 0x2f #define SONIC_DCR2 0x3f +#define SONIC_REG_COUNT 0x40 #define SONIC_CR_HTX 0x0001 #define SONIC_CR_TXP 0x0002 @@ -158,7 +159,7 @@ struct dp8393xState { /* Registers */ uint8_t cam[16][6]; - uint16_t regs[0x40]; + uint16_t regs[SONIC_REG_COUNT]; /* Temporaries */ uint8_t tx_buffer[0x10000]; @@ -972,7 +973,7 @@ static void dp8393x_realize(DeviceState *dev, Error **errp) address_space_init(&s->as, s->dma_mr, "dp8393x"); memory_region_init_io(&s->mmio, OBJECT(dev), &dp8393x_ops, s, - "dp8393x-regs", 0x40 << s->it_shift); + "dp8393x-regs", SONIC_REG_COUNT << s->it_shift); s->nic = qemu_new_nic(&net_dp83932_info, &s->conf, object_get_typename(OBJECT(dev)), dev->id, s); @@ -987,7 +988,7 @@ static const VMStateDescription vmstate_dp8393x = { .minimum_version_id = 0, .fields = (VMStateField []) { VMSTATE_BUFFER_UNSAFE(cam, dp8393xState, 0, 16 * 6), - VMSTATE_UINT16_ARRAY(regs, dp8393xState, 0x40), + VMSTATE_UINT16_ARRAY(regs, dp8393xState, SONIC_REG_COUNT), VMSTATE_END_OF_LIST() } }; |