summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2011-10-07 12:27:25 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2011-11-01 16:52:09 -0500
commite1c2008af64487e7d3cec615612b7f467ebe9bc8 (patch)
tree167fef4694a67733ab984d28f3ad4561768d9e8b
parent7ba7974197090285fdb413c6e1c41aaacd44b9c4 (diff)
downloadqemu-e1c2008af64487e7d3cec615612b7f467ebe9bc8.tar.gz
pcnet: Add link state support
Update lnkst on link state changes so that guests can obtain this information via reading back the LED output pin. Works for Linux but not for guests that depend on the missing PHY. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--hw/lance.c1
-rw-r--r--hw/pcnet-pci.c1
-rw-r--r--hw/pcnet.c7
-rw-r--r--hw/pcnet.h1
4 files changed, 10 insertions, 0 deletions
diff --git a/hw/lance.c b/hw/lance.c
index d83e7f57a9..93d5fda35b 100644
--- a/hw/lance.c
+++ b/hw/lance.c
@@ -97,6 +97,7 @@ static NetClientInfo net_lance_info = {
.size = sizeof(NICState),
.can_receive = pcnet_can_receive,
.receive = pcnet_receive,
+ .link_status_changed = pcnet_set_link_status,
.cleanup = lance_cleanup,
};
diff --git a/hw/pcnet-pci.c b/hw/pcnet-pci.c
index ea5dfdef76..4e164da3ac 100644
--- a/hw/pcnet-pci.c
+++ b/hw/pcnet-pci.c
@@ -288,6 +288,7 @@ static NetClientInfo net_pci_pcnet_info = {
.size = sizeof(NICState),
.can_receive = pcnet_can_receive,
.receive = pcnet_receive,
+ .link_status_changed = pcnet_set_link_status,
.cleanup = pci_pcnet_cleanup,
};
diff --git a/hw/pcnet.c b/hw/pcnet.c
index add3ec2559..cba253ba7b 100644
--- a/hw/pcnet.c
+++ b/hw/pcnet.c
@@ -1197,6 +1197,13 @@ ssize_t pcnet_receive(VLANClientState *nc, const uint8_t *buf, size_t size_)
return size_;
}
+void pcnet_set_link_status(VLANClientState *nc)
+{
+ PCNetState *d = DO_UPCAST(NICState, nc, nc)->opaque;
+
+ d->lnkst = nc->link_down ? 0 : 0x40;
+}
+
static void pcnet_transmit(PCNetState *s)
{
target_phys_addr_t xmit_cxda = 0;
diff --git a/hw/pcnet.h b/hw/pcnet.h
index 52cc52e940..edc81c90ac 100644
--- a/hw/pcnet.h
+++ b/hw/pcnet.h
@@ -58,6 +58,7 @@ uint32_t pcnet_ioport_readl(void *opaque, uint32_t addr);
uint32_t pcnet_bcr_readw(PCNetState *s, uint32_t rap);
int pcnet_can_receive(VLANClientState *nc);
ssize_t pcnet_receive(VLANClientState *nc, const uint8_t *buf, size_t size_);
+void pcnet_set_link_status(VLANClientState *nc);
void pcnet_common_cleanup(PCNetState *d);
int pcnet_common_init(DeviceState *dev, PCNetState *s, NetClientInfo *info);
extern const VMStateDescription vmstate_pcnet;