summaryrefslogtreecommitdiffstats
path: root/hw/e1000.c
Commit message (Collapse)AuthorAgeFilesLines
* hw/e1000.c: convert to PCIDeviceInfo to initialize idsIsaku Yamahata2011-06-121-4/+4
| | | | | | | use PCIDeviceInfo to initialize ids. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* PXE: Use consistent naming for PXE ROMsAlex Williamson2011-04-181-1/+1
| | | | | | And add missing ROMs to tarbin build target. Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
* e1000: Mask out lower bits of RDBAL/TDBALKevin Wolf2011-04-041-3/+18
| | | | | | | | | Rx and Tx descriptors are 16 byte aligned, so the lower bits are ignored by real hardware. In fact, they always read back as zero on real hardware, but probably nobody relies on that. Signed-off-by: Kevin Wolf <mail@kevin-wolf.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* e1000: check buffer availabilityMichael S. Tsirkin2011-03-281-8/+8
| | | | | | | | Reduce spurious packet drops on RX ring empty by verifying that we have at least 1 buffer ahead of the time. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* e1000: Fix multi-descriptor packet checksum offloadStefan Hajnoczi2011-03-211-1/+3
| | | | | | | | | | | | | | | | | | | | | | The PCI/PCI-X Family of Gigabit Ethernet Controllers Software Developer’s Manual states the following about the POPTS field: Provides a number of options which control the handling of this packet. This field is ignored except on the first data descriptor of a packet. The current implementation always loads the field and its checksum offload flags. This patch uses only the first descriptor's POPTS field in order to comply with the specification. When Solaris sends multi-descriptor packets it fills in POPTS for the first descriptor only. Therefore this patch is necessary in order to perform checksum offload correctly for multi-descriptor packets. Reported-by: Daniel Pecka <dpecka@techniservit.cz> Reported-by: Gabriele A. Trombetti <gabriele.trombetti@itb.cnr.it> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* e1000: verify we have buffers, upfrontMichael S. Tsirkin2011-02-201-6/+22
| | | | | | | | | | | | | | | | | | | | The spec says: Any descriptor with a non-zero status byte has been processed by the hardware, and is ready to be handled by the software. Thus, once we change a descriptor status to non-zero we should never move the head backwards and try to reuse this descriptor from hardware. This actually happened with a multibuffer packet that arrives when we don't have enough buffers. Fix by checking that we have enough buffers upfront so we never need to discard the packet midway through. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Alex Williamson <alex.williamson@redhat.com> Acked-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* e1000: clear EOP for multi-buffer descriptorsMichael S. Tsirkin2011-02-201-2/+4
| | | | | | | | | | | | | | | | | | | | The e1000 spec says: if software statically allocates buffers, and uses memory read to check for completed descriptors, it simply has to zero the status byte in the descriptor to make it ready for reuse by hardware. This is not a hardware requirement (moving the hardware tail pointer is), but is necessary for performing an in–memory scan. Thus the guest does not have to clear the status byte. In case it doesn't we need to clear EOP for all descriptors except the last. While I don't know of any such guests, it's probably a good idea to stick to the spec. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reported-by: Juan Quintela <quintela@redhat.com> Acked-by: Alex Williamson <alex.williamson@redhat.com> Acked-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* e1000: multi-buffer packet supportMichael S. Tsirkin2011-02-201-11/+28
| | | | | | | | | | | | | | | e1000 supports multi-buffer packets larger than rxbuf_size. This fixes the following (on linux): - in guest: ifconfig eth1 mtu 16110 - in host: ifconfig tap0 mtu 16110 ping -s 16082 <guest-ip> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Acked-by: Alex Williamson <alex.williamson@redhat.com> Acked-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* Add bootindex parameter to net/block/fd deviceGleb Natapov2010-12-111-0/+4
| | | | | | | | | If bootindex is specified on command line a string that describes device in firmware readable way is added into sorted list. Later this list will be passed into firmware to control boot order. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* e1000: Make little endianAlexander Graf2010-12-111-9/+2
| | | | | | | | | | | | | | The e1000 has compatibility code to handle big endianness which makes it mandatory to be recompiled on different targets. With the generic mmio endianness solution, there's no need for that anymore. We just declare all mmio to be little endian and call it a day. Because we don't depend on the target endianness anymore, we can also move the driver over to Makefile.objs. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Add endianness as io mem parameterAlexander Graf2010-12-111-1/+1
| | | | | | | | | | | | | As stated before, devices can be little, big or native endian. The target endianness is not of their concern, so we need to push things down a level. This patch adds a parameter to cpu_register_io_memory that allows a device to choose its endianness. For now, all devices simply choose native endian, because that's the same behavior as before. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Merge remote branch 'origin/master' into pciMichael S. Tsirkin2010-12-011-5/+8
|\ | | | | | | | | | | Conflicts: Makefile.objs hw/virtio.c
| * Add missing bracesJes Sorensen2010-11-161-5/+8
| | | | | | | | | | | | | | | | | | This patch adds missing braces around if/else statements that call macros which are likely to result in errors if the macro is changed. It also makes the code comply better with CODING_STYLE. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
| * e1000: Fix TCP checksum overflow with TSOAlex Williamson2010-11-161-1/+4
| | | | | | | | | | | | | | | | | | When adding the length to the pseudo header, we're not properly accounting for overflow. From: Mark Wu <dwu@redhat.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* | pci: Replace unneeded type casts in calls of pci_register_barStefan Weil2010-11-221-2/+2
| | | | | | | | | | | | | | | | | | | | There is no need for these type casts (as other existing code shows). So re-write the first argument without type cast (and remove a related TODO comment). Cc: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* | e1000: Fix TCP checksum overflow with TSOAlex Williamson2010-11-131-1/+4
|/ | | | | | | | | When adding the length to the pseudo header, we're not properly accounting for overflow. From: Mark Wu <dwu@redhat.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* e1000: Pad short frames to minimum size (60 bytes)Stefan Hajnoczi2010-09-201-0/+10
| | | | | | | | | | | The OpenIndiana (Solaris) e1000g driver drops frames that are too long or too short. It expects to receive frames of at least the Ethernet minimum size. ARP requests in particular are small and will be dropped if they are not padded appropriately, preventing a Solaris VM from becoming visible on the network. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* qemu: e1000 fix TOR mathMichael S. Tsirkin2010-09-061-3/+8
| | | | | | | | | Patch b0b900070c7cb29bbefb732ec00397abe5de6d73 made TOR valuer incorrect: the spec says it should always include the CRC field. No one seems to use this field, but better to stick to spec. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* Merge remote branch 'mst/for_anthony' into stagingAnthony Liguori2010-07-261-2/+10
|\
| * e1000: secrc supportMichael S. Tsirkin2010-07-191-1/+10
| | | | | | | | | | | | Add support for secrc field. Reportedly needed by old RHEL guests. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
| * e1000: fix access 4 bytes beyond buffer endMichael S. Tsirkin2010-07-191-2/+1
| | | | | | | | | | | | | | | | We do range check for size, and get size as buffer, but copy size + 4 bytes (4 is for FCS). Let's copy size bytes but put size + 4 in length. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* | e1000: Fix wrong microwire EEPROM state initializationIzumi Tsutsui2010-07-221-9/+8
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change fixes initialization of e1000's microwire EEPROM internal state values so that qemu's e1000 emulation works on NetBSD, which doesn't use Intel's em driver but has its own wm driver for the Intel i8254x Gigabit Ethernet. Previously set_eecd() function in e1000.c clears EEPROM internal state values on SK rising edge during CS==L, but according to FM93C06 EEPROM (which is MicroWire compatible) data sheet, EEPROM internal status should be cleared on CS rise edge regardless of SK input: "... a rising edge on this (CS) signal is required to reset the internal state-machine to accept a new cycle .." and nothing should be changed during CS (chip select) is inactive. Intel's em driver seems to explicitly raise SK output after CS is negated in em_standby_eeprom() so many other OSes that use Intel's driver don't have this problem even on the previous e1000.c implementation, but I can't find any articles that say the MICROWIRE or EEPROM spec requires such sequence, and actually hardware works fine without it (i.e. real i82540EM has been working on NetBSD). This fix also changes initialization to clear each state value in struct eecd_state individually rather than using memset() against the whole structre. The old_eecd member stores the last SK and CS signal levels and it should be preserved even after reset of internal EEPROM state to detect next signal edges for proper EEPROM emulation. Signed-off-by: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* Change #define DEBUG to #define E1000_DEBUG in hw/e1000.cJes Sorensen2010-06-141-2/+2
| | | | | | | | Change #define DEBUG to #define E1000_DEBUG in hw/e1000.c to make it possible to build QEMU with -DDEBUG Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* e1000: make some tables 'const'Blue Swirl2010-05-141-2/+2
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* e1000: fix build on Ubuntu with _FORTIFY_SOURCEThomas Monjalon2010-04-081-1/+1
| | | | | | | | | | There was a pointer cast warning on Ubuntu since _FORTIFY_SOURCE has been reenabled. _FORTIFY_SOURCE had been disabled by 4a24470497360d8b77568b83008d0e9d6eb0787d and reenabled by 849583050d5f6f782718be8cb50688978973fbea. Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* Merge remote branch 'mst/for_anthony' into stagingAnthony Liguori2010-01-061-4/+7
|\
| * e1000: switch to symbolic names for pci registersMichael S. Tsirkin2009-12-231-4/+7
| | | | | | | | | | | | | | | | | | No functional changes. I verified that the generated object binary does not change. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Juan Quintela <quintela@redhat.com> Acked-by: Glauber Costa <glommer@gmail.com>
* | e1000: add link to data sheetMichael S. Tsirkin2009-12-231-0/+3
|/ | | | | | | Link to data sheet at intel.com so people can find it. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* e1000: Don't muck with PCI commmand registerAnthony Liguori2009-12-191-1/+0
| | | | | | | | | Otherwise, the driver does not work in Linux after the INT_DISABLE changes in PCI. Michael Tsirkin had a patch to do this, I'm not sure what happened to it. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* pci romfiles: add property, add default to PCIDeviceInfoGerd Hoffmann2009-12-181-8/+1
| | | | | | | | | | This patch adds a romfile property to the pci bus. It allows to specify a romfile to load into the rom bar of the pci device. The default value comes from a new field in PCIDeviceInfo. The property allows to change the file and also to disable the rom loading using an empty string. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Support PCI based option rom loadingAnthony Liguori2009-12-181-1/+1
| | | | | | | | | | | | | | | | | Currently, we preload option roms into the option rom space in memory. This prevents DDIM from functioning correctly which severely limits the number of roms we can support. This patch introduces a pci_add_option_rom() which registers the PCI_ROM_ADDRESS bar which points to our option rom. It also converts over the cirrus vga adapter, the rtl8139, virtio, and the e1000 to use this new mechanism. The result is that PXE boot functions even with three unique types of cards. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* e1000: Fix warning from code reviewStefan Weil2009-12-031-1/+3
| | | | | | | | | | | | | A code review run by Steve Grubb complained about code in e1000.c: In hw/e1000.c at line 89, vlan is declared to be 4 bytes. At line 382 is an attempt to do a memmove over it with a size of 12. This was fixed by splitting the memmove in two calls and adding a comment to the declaration of vlan and data. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* savevm: Port to qdev.vmsd all devices that have qdevJuan Quintela2009-12-031-3/+1
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: convert e1000 to NICStateMark McLoughlin2009-12-031-21/+26
| | | | | Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* e1000 fix: read access to some registers is missing.Kay Ackermann2009-11-121-0/+2
| | | | | | | | | While writing working on an e1000 driver for my university's OS I noticed that some registers aren't readable in QEMU, but they should be readable as stated in Intels Driver Developer Manual (and also verified on real hardware). Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* pci: introduce FMT_PCIBUS for printf format for pcibus_t.Isaku Yamahata2009-11-091-2/+4
| | | | | | | | | | This patch is preliminary for 64bit BAR. Later pcibus_t will be changed from uint32_t to uint64_t. Introduce FMT_PCIBUS for printf format for pcibus_t. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* pci: introduce pcibus_t to represent pci bus address/size instead of uint32_tIsaku Yamahata2009-11-091-3/+3
| | | | | | | | | | | This patch is preliminary for 64 bit BAR support. Introduce dedicated type, pcibus_t, to represent pci bus address/size instead of uint32_t. Later this type will be changed to uint64_t. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* pci: s/PCI_ADDRESS_SPACE_/PCI_BASE_ADDRESS_SPACE_/ to match pci_regs.hIsaku Yamahata2009-11-091-2/+2
| | | | | | | | | make constants for pci base address match pci_regs.h by renaming PCI_ADDRESS_SPACE_xxx to PCI_BASE_ADDRESS_SPACE_xxx. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* v3: don't call reset functions on cpu initializationGlauber Costa2009-11-071-1/+0
| | | | | | | | | | | | | | | | | | | | | | There is absolutely no need to call reset functions when initializing devices. Since we are already registering them, calling qemu_system_reset() should suffice. Actually, it is what happens when we reboot the machine, and using the same process instead of a special case semantics will even allow us to find bugs easier. Furthermore, the fact that we initialize things like the cpu quite early, leads to the need to introduce synchronization stuff like qemu_system_cond. This patch removes it entirely. All we need to do is call qemu_system_reset() only when we're already sure the system is up and running I tested it with qemu (with and without io-thread) and qemu-kvm, and it seems to be doing okay - although qemu-kvm uses a slightly different patch. [ v2: user mode still needs cpu_reset, so put it in ifdef. ] [ v3: leave qemu_system_cond for now. ] Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Remove e1000 rom loading hackAnthony Liguori2009-10-301-2/+0
| | | | | | The gPXE rom supports BEV properly. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: move net-checksum.c under net/Mark McLoughlin2009-10-301-0/+1
| | | | | | | Also add a new net/checksum.h header Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* e1000: port to vmstateJuan Quintela2009-10-271-163/+81
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* e1000: unfold mac_regarraystosave arrayJuan Quintela2009-10-271-16/+14
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* e1000: unfold mac_reg_tosave arrayJuan Quintela2009-10-271-13/+74
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* e1000: use qdev properties for configuration.Gerd Hoffmann2009-10-271-11/+38
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* pci: move unregister from PCIDevice to PCIDeviceInfoGerd Hoffmann2009-10-051-1/+1
| | | | | | | One more cleanup while being at it ;) Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Revert "Get rid of _t suffix"Anthony Liguori2009-10-011-9/+9
| | | | | | | | | | | | In the very least, a change like this requires discussion on the list. The naming convention is goofy and it causes a massive merge problem. Something like this _must_ be presented on the list first so people can provide input and cope with it. This reverts commit 99a0949b720a0936da2052cb9a46db04ffc6db29. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Get rid of _t suffixmalc2009-10-011-9/+9
| | | | | | | Some not so obvious bits, slirp and Xen were left alone for the time being. Signed-off-by: malc <av1474@comtv.ru>
* e1000 cleanupJuan Quintela2009-08-271-5/+5
| | | | | | | | Remove un needed casts from void *. Use DO_UPCAST() instead of blind casts Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev: add return value to init() callbacks.Gerd Hoffmann2009-08-271-1/+2
| | | | | | | | | | | | | | | | | | Sorry folks, but it has to be. One more of these invasive qdev patches. We have a serious design bug in the qdev interface: device init callbacks can't signal failure because the init() callback has no return value. This patch fixes it. We have already one case in-tree where this is needed: Try -device virtio-blk-pci (without drive= specified) and watch qemu segfault. This patch fixes it. With usb+scsi being converted to qdev we'll get more devices where the init callback can fail for various reasons. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
OpenPOWER on IntegriCloud