From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:51283) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qya5G-00057x-AE for qemu-devel@nongnu.org; Tue, 30 Aug 2011 21:59:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qya5E-0004Mb-JL for qemu-devel@nongnu.org; Tue, 30 Aug 2011 21:59:18 -0400 Received: from mail-yw0-f45.google.com ([209.85.213.45]:48240) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qya5E-0004MU-Et for qemu-devel@nongnu.org; Tue, 30 Aug 2011 21:59:16 -0400 Received: by ywf9 with SMTP id 9so241736ywf.4 for ; Tue, 30 Aug 2011 18:59:15 -0700 (PDT) Message-ID: <4E5D9570.1030201@codemonkey.ws> Date: Tue, 30 Aug 2011 20:59:12 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <1314752751.84463.YahooMailClassic@web27003.mail.ukl.yahoo.com> <4E5D8BAA.9010302@codemonkey.ws> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] Add support for r6040 NIC List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: malc Cc: qemu-devel@nongnu.org, bifferos On 08/30/2011 08:30 PM, malc wrote: > On Tue, 30 Aug 2011, Anthony Liguori wrote: > >> This won't even come close to passing checkpatch.pl > > Have you actually tried? Sigh. I was hoping checkpatch.pl was more useful than it appears to be. At any rate, the patch doesn't follow CODING_STYLE. Regards, Anthony Liguori > >> >> Regards, >> >> Anthony Liguori >> >> On 08/30/2011 08:05 PM, bifferos wrote: >>> >>> Signed-off-by: Mark Kelly >>> diff --git a/Makefile.objs b/Makefile.objs >>> index 6991a9f..7d87503 100644 >>> --- a/Makefile.objs >>> +++ b/Makefile.objs >>> @@ -240,6 +240,7 @@ hw-obj-$(CONFIG_PCNET_PCI) += pcnet-pci.o >>> hw-obj-$(CONFIG_PCNET_COMMON) += pcnet.o >>> hw-obj-$(CONFIG_E1000_PCI) += e1000.o >>> hw-obj-$(CONFIG_RTL8139_PCI) += rtl8139.o >>> +hw-obj-$(CONFIG_R6040_PCI) += r6040.o >>> >>> hw-obj-$(CONFIG_SMC91C111) += smc91c111.o >>> hw-obj-$(CONFIG_LAN9118) += lan9118.o >>> diff --git a/default-configs/pci.mak b/default-configs/pci.mak >>> index 22bd350..d2ea7a2 100644 >>> --- a/default-configs/pci.mak >>> +++ b/default-configs/pci.mak >>> @@ -10,6 +10,7 @@ CONFIG_PCNET_PCI=y >>> CONFIG_PCNET_COMMON=y >>> CONFIG_LSI_SCSI_PCI=y >>> CONFIG_RTL8139_PCI=y >>> +CONFIG_R6040_PCI=y >>> CONFIG_E1000_PCI=y >>> CONFIG_IDE_CORE=y >>> CONFIG_IDE_QDEV=y >>> diff --git a/hw/pci.c b/hw/pci.c >>> index b904a4e..7e12935 100644 >>> --- a/hw/pci.c >>> +++ b/hw/pci.c >>> @@ -1527,6 +1527,7 @@ static const char * const pci_nic_models[] = { >>> "rtl8139", >>> "e1000", >>> "pcnet", >>> + "r6040", >>> "virtio", >>> NULL >>> }; >>> @@ -1539,6 +1540,7 @@ static const char * const pci_nic_names[] = { >>> "rtl8139", >>> "e1000", >>> "pcnet", >>> + "r6040", >>> "virtio-net-pci", >>> NULL >>> }; >>> diff --git a/hw/r6040.c b/hw/r6040.c >>> new file mode 100644 >>> index 0000000..83587e7 >>> --- /dev/null >>> +++ b/hw/r6040.c >>> @@ -0,0 +1,627 @@ >>> +/* >>> + Emulation of r6040 ethernet controller found in a number of SoCs. >>> + Copyright (c) 2011 Mark Kelly, mark@bifferos.com > > This doesn't spell out under which conditions this can be used by > people other than Mark Kelly. > >>> + >>> + This has been written using the R8610[1] and ip101a[2] datasheets. >>> + >>> + ICs with the embedded controller include R8610, R3210, AMRISC20000 >>> + and Vortex86SX >>> + >>> + The emulation seems good enough to fool Linux 2.6.37.6. It is >>> + not perfect, but has proven useful. >>> + >>> + [1] http://www.sima.com.tw/download/R8610_D06_20051003.pdf >>> + [2] http://www.icplus.com.tw/pp-IP101A.html >>> + */ >>> + >>> +#include "hw.h" >>> +#include "pci.h" >>> +#include "net.h" >>> +#include "loader.h" >>> +#include "sysemu.h" >>> +#include "qemu-timer.h" >>> + >>> +/* #define DEBUG_R6040 1 */ >>> + >>> + >>> +#if defined DEBUG_R6040 >>> +#define DPRINTF(fmt, ...) \ >>> + do { fprintf(stderr, "R6040: " fmt, ## __VA_ARGS__); } while (0) >>> +#else >>> +static inline GCC_FMT_ATTR(1, 2) int DPRINTF(const char *fmt, ...) >>> +{ >>> + return 0; >>> +} >>> +#endif >>> + >>> + >>> +/* Cast in order of appearance. _W prevfix means it's used to index the > > prefix (though suffix is even better) > > [..snip..] >