From: Grant Likely <grant.likely@secretlab.ca>
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Anthony Liguori" <aliguori@us.ibm.com>,
"Grant Likely" <grant.likely@secretlab.ca>,
"Paul Brook" <paul@codesourcery.com>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
"Andreas Färber" <afaerber@suse.de>
Subject: [Qemu-devel] [PATCH V3 7/8] hw/mdio: Add VMState support
Date: Sat, 2 Feb 2013 23:40:08 +0000 [thread overview]
Message-ID: <1359848409-1106-8-git-send-email-grant.likely@secretlab.ca> (raw)
In-Reply-To: <1359848409-1106-1-git-send-email-grant.likely@secretlab.ca>
The MDIO model needs to have VMState support before it can be used by
devices that support VMState. This patch adds VMState macros for both
qemu_mdio and qemu_phy.
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Paul Brook <paul@codesourcery.com>
Cc: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>
Cc: Andreas Färber <afaerber@suse.de>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
hw/mdio.c | 30 ++++++++++++++++++++++++++++++
hw/mdio.h | 21 +++++++++++++++++++++
2 files changed, 51 insertions(+)
diff --git a/hw/mdio.c b/hw/mdio.c
index 79f0e3b..023ad90 100644
--- a/hw/mdio.c
+++ b/hw/mdio.c
@@ -244,3 +244,33 @@ void mdio_bitbang_set_clk(struct qemu_mdio *bus, bool mdc)
break;
}
}
+
+const VMStateDescription vmstate_mdio = {
+ .name = "mdio",
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .minimum_version_id_old = 1,
+ .fields = (VMStateField[]) {
+ VMSTATE_BOOL(mdc, struct qemu_mdio),
+ VMSTATE_BOOL(mdio, struct qemu_mdio),
+ VMSTATE_UINT32(state, struct qemu_mdio),
+ VMSTATE_UINT16(cnt, struct qemu_mdio),
+ VMSTATE_UINT16(addr, struct qemu_mdio),
+ VMSTATE_UINT16(opc, struct qemu_mdio),
+ VMSTATE_UINT16(req, struct qemu_mdio),
+ VMSTATE_UINT32(shiftreg, struct qemu_mdio),
+ VMSTATE_END_OF_LIST()
+ }
+};
+
+const VMStateDescription vmstate_mdio_phy = {
+ .name = "mdio",
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .minimum_version_id_old = 1,
+ .fields = (VMStateField[]) {
+ VMSTATE_UINT16_ARRAY(regs, struct qemu_phy, 32),
+ VMSTATE_BOOL(link, struct qemu_phy),
+ VMSTATE_END_OF_LIST()
+ }
+};
diff --git a/hw/mdio.h b/hw/mdio.h
index 340501e..62d292b 100644
--- a/hw/mdio.h
+++ b/hw/mdio.h
@@ -26,6 +26,7 @@
*/
#include <stdint.h>
+#include "migration/vmstate.h"
/* PHY MII Register/Bit Definitions */
/* PHY Registers defined by IEEE */
@@ -63,6 +64,16 @@ struct qemu_phy {
void (*write)(struct qemu_phy *phy, unsigned int req, uint16_t data);
};
+extern const VMStateDescription vmstate_mdio_phy;
+
+#define VMSTATE_MDIO_PHY(_field, _state) { \
+ .name = (stringify(_field)), \
+ .size = sizeof(struct qemu_phy), \
+ .vmsd = &vmstate_mdio_phy, \
+ .flags = VMS_STRUCT, \
+ .offset = vmstate_offset_value(_state, _field, struct qemu_phy), \
+}
+
struct qemu_mdio {
/* bitbanging state machine */
bool mdc;
@@ -85,6 +96,16 @@ struct qemu_mdio {
struct qemu_phy *devs[32];
};
+extern const VMStateDescription vmstate_mdio;
+
+#define VMSTATE_MDIO(_field, _state) { \
+ .name = (stringify(_field)), \
+ .size = sizeof(struct qemu_mdio), \
+ .vmsd = &vmstate_mdio, \
+ .flags = VMS_STRUCT, \
+ .offset = vmstate_offset_value(_state, _field, struct qemu_mdio), \
+}
+
void mdio_phy_init(struct qemu_phy *phy, uint16_t id1, uint16_t id2);
void mdio_attach(struct qemu_mdio *bus, struct qemu_phy *phy,
unsigned int addr);
--
1.7.10.4
next prev parent reply other threads:[~2013-02-02 23:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-02 23:40 [Qemu-devel] [PATCH V3 0/8] Generalize MDIO framework Grant Likely
2013-02-02 23:40 ` [Qemu-devel] [PATCH V3 1/8] hw/etraxfs_eth: Eliminate checkpatch errors Grant Likely
2013-02-02 23:40 ` [Qemu-devel] [PATCH V3 2/8] hw/mdio: Generalize etraxfs MDIO bitbanging emulation Grant Likely
2013-02-02 23:40 ` [Qemu-devel] [PATCH V3 3/8] hw/mdio: Add PHY register definition Grant Likely
2013-02-02 23:40 ` [Qemu-devel] [PATCH V3 4/8] hw/mdio: Generalize phy initialization routine Grant Likely
2013-02-02 23:40 ` [Qemu-devel] [PATCH V3 5/8] hw/mdio: Mask out read-only bits Grant Likely
2013-02-02 23:40 ` [Qemu-devel] [PATCH V3 6/8] hw/mdio: Refactor bitbanging state machine Grant Likely
2013-02-02 23:40 ` Grant Likely [this message]
2013-02-02 23:40 ` [Qemu-devel] [PATCH V3 8/8] hw/mdio: Use bitbang core for smc91c111 network device Grant Likely
2013-02-02 23:51 ` Peter Maydell
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=1359848409-1106-8-git-send-email-grant.likely@secretlab.ca \
--to=grant.likely@secretlab.ca \
--cc=afaerber@suse.de \
--cc=aliguori@us.ibm.com \
--cc=edgar.iglesias@gmail.com \
--cc=paul@codesourcery.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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).