3C90X Emulation
RFC PATCH 1/1 3C90X Emulation
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.
--- 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
Makefile.target +1 -0
@@ -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
hw/3c90x.c new file +2421 -0
2,421 lines not on this page · raw message
hw/pci.c +2 -0
@@ -779,6 +779,7 @@ static const char * const pci_nic_models[] = {"i82557b" ,"i82559er" ,"rtl8139" , +"3c90x" ,"e1000" ,"pcnet" , "virtio",
@@ -791,6 +792,7 @@ static const char * const pci_nic_names[] = {"i82557b" ,"i82559er" ,"rtl8139" , +"3c90x" ,"e1000" ,"pcnet" , "virtio-net-pci",
hw/pci_ids.h +3 -0
@@ -75,6 +75,9 @@#define PCI_VENDOR_ID_REALTEK 0x10ec#define PCI_DEVICE_ID_REALTEK_8139 0x8139 +#define PCI_VENDOR_ID_3COM 0x10b7 +#define PCI_DEVICE_ID_3COM_3C90X 0x9200 +#define PCI_VENDOR_ID_XILINX 0x10ee#define PCI_VENDOR_ID_MARVELL 0x11ab
Signature · 1 line
1.5.6.3
Quoted 88 lines · Matthew Iselin
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 <[email protected]>--- 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.cMakefile.target +1
-0@@ -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 deviceshw/3c90x.c new file +52
-0@@ -0,0 +1,2421 @@ +/** +* QEMU 3C90X Emulation +* +* Copyright (c) 2009 Matthew Iselin (QEMU VERSION) +* Copyright (C) 2004 John Kelley ([email protected]) (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 <netinet/ip.h>
hw/3c90x.c line 62
Quoted 10 lines
hw/3c90x.c new file +10
-0+#include <netinet/tcp.h> +#include <netinet/udp.h> +#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
Quoted 8 lines · Matthew Iselin
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.
Quoted 8 lines
Signed-off-by Matthew Iselin <[email protected]>---
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
CC i386-softmmu/3c90x.o
cc1: warnings being treated as errorshw/3c90x.c: In function 'a3c90x_io_readx':hw/3c90x.c:2028: warning: comparison is always true due to limited range of data type hw/3c90x.c: In function 'a3c90x_io_writex':hw/3c90x.c:2096: warning: comparison is always true due to limited range of data type make[1]: *** [3c90x.o] Error 1
make: *** [subdir-i386-softmmu] Error 2
Quoted 5 lines
hw/pci_ids.h +0
-0
hw/pci_ids.h line 83
Quoted 9 lines
hw/pci_ids.h +3
-0@@ -75,6 +75,9 @@#define PCI_VENDOR_ID_REALTEK 0x10ec#define PCI_DEVICE_ID_REALTEK_8139 0x8139 +#define PCI_VENDOR_ID_3COM 0x10b7 +#define PCI_DEVICE_ID_3COM_3C90X 0x9200 +#define PCI_VENDOR_ID_XILINX 0x10ee#define PCI_VENDOR_ID_MARVELL 0x11ab
The file content is supposed to be sorted:
/* Vendors and devices. Sort key: vendor first, device next. */
- Sebastian