# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1207755921 -3600
# Node ID f3bb67460388ceb6f198f4f0b6ebe449c2122a4e
# Parent a9557e0d16a7d0638fc94b5a6f31f8f77aacc7e6
ioemu: Fix rtl8139 emulation so that reboot works correctly in 64-bit
Windows VMs. Return an error if the guest OS tries to transmit a
packet with the transmitter disabled, so that it doesn't spin forever
waiting for it to complete.
Signed-off-by: Steven Smith <Steven.Smith@xxxxxxxxxxxxx>
xen-unstable changeset: 17420:40c0dda6eae68ec1bbd3bfd3e812d8b9e34051a0
xen-unstable date: Wed Apr 09 16:03:40 2008 +0100
---
tools/ioemu/hw/rtl8139.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+)
diff -r a9557e0d16a7 -r f3bb67460388 tools/ioemu/hw/rtl8139.c
--- a/tools/ioemu/hw/rtl8139.c Wed Apr 09 16:44:54 2008 +0100
+++ b/tools/ioemu/hw/rtl8139.c Wed Apr 09 16:45:21 2008 +0100
@@ -1416,12 +1416,28 @@ static uint32_t rtl8139_ChipCmd_read(RTL
static void rtl8139_CpCmd_write(RTL8139State *s, uint32_t val)
{
+ int i;
+
val &= 0xffff;
DEBUG_PRINT(("RTL8139C+ command register write(w) val=0x%04x\n", val));
/* mask unwriteable bits */
val = SET_MASKED(val, 0xff84, s->CpCmd);
+
+ if ( (s->CpCmd & CPlusTxEnb) &&
+ !(val & CPlusTxEnb) )
+ {
+ /* Reset TX status when the transmitter drops from C+ to
+ non-C+ mode. Windows has a habit of turning off C+ and
+ then waiting for the TX requests to clear as part of shut
+ down, and you get stuck forever if there are old DTCRs in
+ the registers. */
+ for (i = 0; i < 4; i++)
+ {
+ s->TxStatus[i] = TxHostOwns;
+ }
+ }
s->CpCmd = val;
}
@@ -1765,6 +1781,7 @@ static int rtl8139_transmit_one(RTL8139S
{
DEBUG_PRINT(("RTL8139: +++ cannot transmit from descriptor %d:
transmitter disabled\n",
descriptor));
+ s->TxStatus[descriptor] = TxAborted | TxHostOwns;
return 0;
}
@@ -1772,6 +1789,7 @@ static int rtl8139_transmit_one(RTL8139S
{
DEBUG_PRINT(("RTL8139: +++ cannot transmit from descriptor %d: owned
by host (%08x)\n",
descriptor, s->TxStatus[descriptor]));
+ s->TxStatus[descriptor] = TxAborted | TxHostOwns;
return 0;
}
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|