From patchwork Tue Sep 27 12:58:52 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [2/2] e1000: CTRL.RST emulation Date: Tue, 27 Sep 2011 02:58:52 -0000 From: Michael S. Tsirkin X-Patchwork-Id: 116599 Message-Id: To: qemu-devel@nongnu.org, Andy Gospodarek , Dean Nelson , Jesse Brandeburg , Jeff Kirsher Cc: peter.maydell@linaro.org, Anthony Liguori , "Michael S. Tsirkin" , Alex Williamson , Anthony PERARD , Kevin Wolf , Aurelien Jarno e1000 spec says CTRL.RST write should have the same effect as bus reset, except that is preserves PCI Config. Reset device registers and interrupts. Fix suggested by Andy Gospodarek Similar fix proposed by Anthony PERARD Signed-off-by: Michael S. Tsirkin --- hw/e1000.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/e1000.c b/hw/e1000.c index 87a1104..b51e089 100644 --- a/hw/e1000.c +++ b/hw/e1000.c @@ -241,8 +241,13 @@ static void e1000_reset(void *opaque) static void set_ctrl(E1000State *s, int index, uint32_t val) { - /* RST is self clearing */ - s->mac_reg[CTRL] = val & ~E1000_CTRL_RST; + if (val & E1000_CTRL_RST) { + e1000_reset(s); + qemu_set_irq(s->dev.irq[0], 0); + return; + } + + s->mac_reg[CTRL] = val; } static void