From: Patrick Venture <venture@google.com>
To: hskinnemoen@google.com, kfting@nuvoton.com
Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org,
Patrick Venture <venture@google.com>,
Hao Wu <wuhaotsh@google.com>
Subject: [PATCH] hw/net: npcm7xx_emc: set MAC in register space
Date: Wed, 21 Sep 2022 16:46:46 -0700 [thread overview]
Message-ID: <20220921234646.949273-1-venture@google.com> (raw)
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
next reply other threads:[~2022-09-21 23:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-21 23:46 Patrick Venture [this message]
2022-09-22 12:35 ` [PATCH] hw/net: npcm7xx_emc: set MAC in register space Peter Maydell
2022-09-23 3:21 ` Jason Wang
2022-09-23 23:42 ` Patrick Venture
2022-09-24 9:10 ` Peter Maydell
2022-09-26 15:45 ` Patrick Venture
2022-09-29 15:28 ` Patrick Venture
2022-09-29 15:54 ` Peter Maydell
2022-09-30 2:05 ` Patrick Venture
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220921234646.949273-1-venture@google.com \
--to=venture@google.com \
--cc=hskinnemoen@google.com \
--cc=kfting@nuvoton.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=wuhaotsh@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).