[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] hw/net: npcm7xx_emc: set MAC in register space
From: |
Patrick Venture |
Subject: |
[PATCH] hw/net: npcm7xx_emc: set MAC in register space |
Date: |
Wed, 21 Sep 2022 16:46:46 -0700 |
The MAC address set from Qemu wasn't being saved into the register space.
Reviewed-by: Hao Wu <wuhaotsh@google.com>
Signed-off-by: Patrick Venture <venture@google.com>
---
hw/net/npcm7xx_emc.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/hw/net/npcm7xx_emc.c b/hw/net/npcm7xx_emc.c
index 7c86bb52e5..6be1008529 100644
--- a/hw/net/npcm7xx_emc.c
+++ b/hw/net/npcm7xx_emc.c
@@ -96,6 +96,9 @@ static const char *emc_reg_name(int regno)
#undef REG
}
+static void npcm7xx_emc_write(void *opaque, hwaddr offset,
+ uint64_t v, unsigned size);
+
static void emc_reset(NPCM7xxEMCState *emc)
{
trace_npcm7xx_emc_reset(emc->emc_num);
@@ -112,6 +115,18 @@ static void emc_reset(NPCM7xxEMCState *emc)
emc->tx_active = false;
emc->rx_active = false;
+
+ /* Set the MAC address in the register space. */
+ uint32_t value = (emc->conf.macaddr.a[0] << 24) |
+ (emc->conf.macaddr.a[1] << 16) |
+ (emc->conf.macaddr.a[2] << 8) |
+ emc->conf.macaddr.a[3];
+ npcm7xx_emc_write(emc, REG_CAMM_BASE * sizeof(uint32_t), value,
+ sizeof(uint32_t));
+
+ value = (emc->conf.macaddr.a[4] << 24) | (emc->conf.macaddr.a[5] << 16);
+ npcm7xx_emc_write(emc, REG_CAML_BASE * sizeof(uint32_t), value,
+ sizeof(uint32_t));
}
static void npcm7xx_emc_reset(DeviceState *dev)
--
2.37.3.998.g577e59143f-goog
- [PATCH] hw/net: npcm7xx_emc: set MAC in register space,
Patrick Venture <=
- Re: [PATCH] hw/net: npcm7xx_emc: set MAC in register space, Peter Maydell, 2022/09/22
- Re: [PATCH] hw/net: npcm7xx_emc: set MAC in register space, Jason Wang, 2022/09/22
- Re: [PATCH] hw/net: npcm7xx_emc: set MAC in register space, Patrick Venture, 2022/09/23
- Re: [PATCH] hw/net: npcm7xx_emc: set MAC in register space, Peter Maydell, 2022/09/24
- Re: [PATCH] hw/net: npcm7xx_emc: set MAC in register space, Patrick Venture, 2022/09/26
- Re: [PATCH] hw/net: npcm7xx_emc: set MAC in register space, Patrick Venture, 2022/09/29
- Re: [PATCH] hw/net: npcm7xx_emc: set MAC in register space, Peter Maydell, 2022/09/29
- Re: [PATCH] hw/net: npcm7xx_emc: set MAC in register space, Patrick Venture, 2022/09/29