Fixed rtl8139 checksum calculation for Vista (rhbz #308201) Fixed rtl8139

mmio region mappings Fix ATAPI CDROM emulation (rhbz #253542)
This commit is contained in:
Daniel P. Berrange 2007-09-27 03:27:17 +00:00
parent 5500ca8b3c
commit 6e8d2af47a
4 changed files with 141 additions and 2 deletions

View File

@ -0,0 +1,52 @@
From: Brandon Philips <brandon@ifup.org>
Newsgroups: gmane.comp.emulators.qemu
Subject: [PATCH][RFC] Fix bugs in the ATAPI cdrom driver
Date: Fri, 17 Aug 2007 16:43:04 -0700
Message-ID: <20070817234304.GB10490@ifup.org>
Reply-To: qemu-devel@nongnu.org
The new libata-eh in the Linux kernel is throwing a fit over the QEMU
cdrom device for two reasons:
1) DRQ can be set with ERR_STAT set. This is a violation of the ATAPI
state machine.
2) After a TEST_UNIT_READY ATAPI command is sent ERR_STAT is getting set
which is correct. But, when the OS issues another ATAPI command
ERR_STAT is still set. Which is bad since the next expected command
from the OS is REQUEST_SENSE to find out why ERR_STAT is set.
bug this fixes: https://bugzilla.novell.com/show_bug.cgi?id=291775
Signed-off-by: Brandon Philips <bphilips@suse.de>
---
hw/ide.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
Index: qemu-0.9.0/hw/ide.c
===================================================================
--- qemu-0.9.0.orig/hw/ide.c
+++ qemu-0.9.0/hw/ide.c
@@ -586,7 +586,9 @@ static void ide_transfer_start(IDEState
s->end_transfer_func = end_transfer_func;
s->data_ptr = buf;
s->data_end = buf + size;
- s->status |= DRQ_STAT;
+ /* don't violate the HSM */
+ if (!(s->status & ERR_STAT))
+ s->status |= DRQ_STAT;
}
static void ide_transfer_stop(IDEState *s)
@@ -1805,6 +1807,7 @@ static void ide_ioport_write(void *opaqu
/* overlapping commands not supported */
if (s->feature & 0x02)
goto abort_cmd;
+ s->status = READY_STAT;
s->atapi_dma = s->feature & 1;
s->nsector = 1;
ide_transfer_start(s, s->io_buffer, ATAPI_PACKET_SIZE,

View File

@ -0,0 +1,47 @@
Index: hw/rtl8139.c
===================================================================
RCS file: /sources/qemu/qemu/hw/rtl8139.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- hw/rtl8139.c 11 Jul 2007 22:48:58 -0000 1.10
+++ hw/rtl8139.c 1 Aug 2007 13:10:29 -0000 1.11
@@ -53,9 +53,8 @@
/* debug RTL8139 card C+ mode only */
//#define DEBUG_RTL8139CP 1
-/* RTL8139 provides frame CRC with received packet, this feature seems to be
- ignored by most drivers, disabled by default */
-//#define RTL8139_CALCULATE_RXCRC 1
+/* Calculate CRCs properly on Rx packets */
+#define RTL8139_CALCULATE_RXCRC 1
/* Uncomment to enable on-board timer interrupts */
//#define RTL8139_ONBOARD_TIMER 1
@@ -747,7 +746,7 @@
int wrapped = MOD2(s->RxBufAddr + size, s->RxBufferSize);
/* write packet data */
- if (wrapped && s->RxBufferSize < 65536 && !rtl8139_RxWrap(s))
+ if (wrapped && !(s->RxBufferSize < 65536 && rtl8139_RxWrap(s)))
{
DEBUG_PRINT((">>> RTL8139: rx packet wrapped in buffer at %d\n", size-wrapped));
@@ -1023,7 +1022,7 @@
/* write checksum */
#if defined (RTL8139_CALCULATE_RXCRC)
- val = cpu_to_le32(crc32(~0, buf, size));
+ val = cpu_to_le32(crc32(0, buf, size));
#else
val = 0;
#endif
@@ -1129,7 +1128,7 @@
/* write checksum */
#if defined (RTL8139_CALCULATE_RXCRC)
- val = cpu_to_le32(crc32(~0, buf, size));
+ val = cpu_to_le32(crc32(0, buf, size));
#else
val = 0;
#endif

View File

@ -0,0 +1,25 @@
diff -rup qemu-0.9.0.orig/hw/rtl8139.c qemu-0.9.0.new/hw/rtl8139.c
--- qemu-0.9.0.orig/hw/rtl8139.c 2007-02-05 18:01:54.000000000 -0500
+++ qemu-0.9.0.new/hw/rtl8139.c 2007-08-28 11:37:29.000000000 -0400
@@ -3325,7 +3325,7 @@ static void rtl8139_mmio_map(PCIDevice *
PCIRTL8139State *d = (PCIRTL8139State *)pci_dev;
RTL8139State *s = &d->rtl8139;
- cpu_register_physical_memory(addr + 0, 0x100, s->rtl8139_mmio_io_addr);
+ cpu_register_physical_memory(addr + 0, 0x1000, s->rtl8139_mmio_io_addr);
}
static void rtl8139_ioport_map(PCIDevice *pci_dev, int region_num,
@@ -3438,10 +3438,10 @@ void pci_rtl8139_init(PCIBus *bus, NICIn
s->rtl8139_mmio_io_addr =
cpu_register_io_memory(0, rtl8139_mmio_read, rtl8139_mmio_write, s);
- pci_register_io_region(&d->dev, 0, 0x100,
+ pci_register_io_region(&d->dev, 0, 0x1000,
PCI_ADDRESS_SPACE_IO, rtl8139_ioport_map);
- pci_register_io_region(&d->dev, 1, 0x100,
+ pci_register_io_region(&d->dev, 1, 0x1000,
PCI_ADDRESS_SPACE_MEM, rtl8139_mmio_map);
s->irq = 16; /* PCI interrupt */

View File

@ -8,8 +8,8 @@
Summary: QEMU is a FAST! processor emulator
Name: qemu
Version: 0.9.0
Release: 2%{?dist}
License: GPL/LGPL
Release: 3%{?dist}
License: GPLv2+, LGPLv2+
Group: Development/Tools
URL: http://www.qemu.org/
Source0: http://www.qemu.org/%{name}-%{version}.tar.gz
@ -17,6 +17,12 @@ Source1: qemu.init
Patch0: qemu-0.7.0-build.patch
Patch1: qemu-0.8.0-sdata.patch
Patch2: qemu-0.9.0-load-initrd.patch
# Fix RTL8139 MMIO regions. Remove at next upgrade
Patch5: qemu-0.9.0-rtl8139-mmio-regions.patch
# Fix Atapi errors with latest kernel
Patch6: qemu-0.9.0-atapi-hsm.patch
# Fix RTL8139 checksum calculations for Vista
Patch7: qemu-0.9.0-rtl8139-checksum.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: SDL-devel compat-gcc-%{gccver} zlib-devel which texi2html
Requires(post): /sbin/chkconfig
@ -42,6 +48,9 @@ As QEMU requires no host kernel patches to run, it is safe and easy to use.
%patch0 -p1
%patch1 -p1
%patch2 -p0
%patch5 -p1
%patch6 -p1
%patch7 -p0
%build
./configure \
@ -92,6 +101,12 @@ fi
%{_mandir}/man1/*
%changelog
* Wed Sep 26 2007 Daniel P. Berrange <berrange@redhat.com> - 0.9.0-3.fc7
- Update licence
- Fix CDROM emulation (rhbz #253542)
- Fix rtl8139 mmio region mappings with multiple NICs
- Fix rtl8139 checksum calculation for Vista (rhbz #308201)
* Sun Apr 1 2007 Hans de Goede <j.w.r.degoede@hhs.nl> 0.9.0-2
- Fix direct loading of a linux kernel with -kernel & -initrd (bz 234681)
- Remove spurious execute bits from manpages (bz 222573)