From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MPdHz-000356-8Q for qemu-devel@nongnu.org; Sat, 11 Jul 2009 10:10:55 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MPdHu-0002wy-M1 for qemu-devel@nongnu.org; Sat, 11 Jul 2009 10:10:54 -0400 Received: from [199.232.76.173] (port=40897 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MPdHu-0002wf-9e for qemu-devel@nongnu.org; Sat, 11 Jul 2009 10:10:50 -0400 Received: from mail-qy0-f174.google.com ([209.85.221.174]:63827) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MPdHt-0004ad-U6 for qemu-devel@nongnu.org; Sat, 11 Jul 2009 10:10:50 -0400 Received: by qyk4 with SMTP id 4so1124261qyk.4 for ; Sat, 11 Jul 2009 07:10:49 -0700 (PDT) Message-ID: <4A589D66.6070007@codemonkey.ws> Date: Sat, 11 Jul 2009 09:10:46 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [RFC] [PATCH] 3C90X Emulation References: <1247320357-7928-1-git-send-email-matthew@theiselins.net> In-Reply-To: <1247320357-7928-1-git-send-email-matthew@theiselins.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Matthew Iselin Cc: qemu-devel@nongnu.org Matthew Iselin wrote: > This patch adds a basic 3C90X emulation to QEMU. > > I have tested this with Linux kernels 2.4 and 2.6 (DSL and Ubuntu), and > Pedigree. > > This has been ported from the PearPC 3C90X emulation, with significant > modifications to enable it to work on 2.6 kernels. > > Signed-off-by: Matthew Iselin > --- > Makefile.target | 1 + > hw/3c90x.c | 2421 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ > hw/pci.c | 2 + > hw/pci_ids.h | 3 + > 4 files changed, 2427 insertions(+), 0 deletions(-) > create mode 100644 hw/3c90x.c > > diff --git a/Makefile.target b/Makefile.target > index 1a71f3a..9f3dd58 100644 > --- a/Makefile.target > +++ b/Makefile.target > @@ -556,6 +556,7 @@ obj-y += eepro100.o > obj-y += ne2000.o > obj-y += pcnet.o > obj-y += rtl8139.o > +obj-y += 3c90x.o > obj-y += e1000.o > > # Generic watchdog support and some watchdog devices > diff --git a/hw/3c90x.c b/hw/3c90x.c > new file mode 100644 > index 0000000..dc242dc > --- /dev/null > +++ b/hw/3c90x.c > @@ -0,0 +1,2421 @@ > +/** > + * QEMU 3C90X Emulation > + * > + * Copyright (c) 2009 Matthew Iselin (QEMU VERSION) > + * Copyright (C) 2004 John Kelley (pearpc@kelley.ca) (PEARPC VERSION) > + * Copyright (C) 2003 Stefan Weyergraf (PEARPC VERSION) > + * > + * Permission is hereby granted, free of charge, to any person obtaining a copy > + * of this software and associated documentation files (the "Software"), to deal > + * in the Software without restriction, including without limitation the rights > + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell > + * copies of the Software, and to permit persons to whom the Software is > + * furnished to do so, subject to the following conditions: > + * > + * The above copyright notice and this permission notice shall be included in > + * all copies or substantial portions of the Software. > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, > + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN > + * THE SOFTWARE. > + > + * Modifications: > + * (none) > + */ > + > +/** > + * TODO: > + * - Still a lot of unimplemented functionality > + * - savevm functions > + * TESTED ON: > + * - Damn Small Linux (4.4.10) - Linux 2.4 > + * - Damn Small Linux N - Linux 2.6 > + * - Ubuntu (8.10, 5.10) > + * - Pedigree > + */ > + > +#include "hw.h" > +#include "pci.h" > +#include "pc.h" > +#include "qemu-timer.h" > +#include "net.h" > + > +// Should we inspect incoming frames and print extra debugging information about them? > +//#define DEBUG_3C90X_ANALYSE_FRAMES 0 > + > +#ifdef DEBUG_3C90X_ANALYSE_FRAMES > +#define __FAVOR_BSD > +#include > +#include > +#include > +#endif > + > +#define PACKED __attribute__((packed)); > +#define ALIGNED __attribute__((aligned)); > +#define PACKED8 __attribute__((aligned(8))); > +#define PACKED16 __attribute__((aligned(16))); > +#define PACKED32 __attribute__((aligned(32))); > + > Besides being poorly formatted, the PACKED structures is a good indicator that this file is not endian safe and it doesn't appear to be. It needs some refactoring to make it work for qemu I think. Regards, Anthony Liguori