summaryrefslogtreecommitdiffstats
path: root/hw/eepro100.c
Commit message (Collapse)AuthorAgeFilesLines
* qom: Unify type registrationAndreas Färber2012-02-151-2/+2
| | | | | | | | | | | | | Replace device_init() with generalized type_init(). While at it, unify naming convention: type_init([$prefix_]register_types) Also, type_init() is a function, so add preceding blank line where necessary and don't put a semicolon after the closing brace. Signed-off-by: Andreas Färber <afaerber@suse.de> Cc: Anthony Liguori <anthony@codemonkey.ws> Cc: malc <av1474@comtv.ru> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev: register all types natively through QEMU Object ModelAnthony Liguori2012-02-031-39/+44
| | | | | | | | | | | | | | | | | | | | | This was done in a mostly automated fashion. I did it in three steps and then rebased it into a single step which avoids repeatedly touching every file in the tree. The first step was a sed-based addition of the parent type to the subclass registration functions. The second step was another sed-based removal of subclass registration functions while also adding virtual functions from the base class into a class_init function as appropriate. Finally, a python script was used to convert the DeviceInfo structures and qdev_register_subclass functions to TypeInfo structures, class_init functions, and type_register_static calls. We are almost fully converted to QOM after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* pci: convert to QEMU Object ModelAnthony Liguori2012-01-271-75/+125
| | | | Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev: don't access name through infoAnthony Liguori2012-01-271-1/+1
| | | | | | We already have a QOM interface for this so let's use it. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev: move qdev->info to classAnthony Liguori2012-01-271-2/+2
| | | | | | | | Right now, DeviceInfo acts as the class for qdev. In order to switch to a proper ObjectClass derivative, we need to ween all of the callers off of interacting directly with the info pointer. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Merge remote-tracking branch 'stefanha/trivial-patches-next' into stagingAnthony Liguori2011-12-141-1/+1
|\
| * fix typo: delete redundant semicolonDong Xu Wang2011-12-061-1/+1
| | | | | | | | | | | | | | Double semicolons should be single. Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* | Remove unnecessary casts from PCI DMA code in eepro100David Gibson2011-12-121-4/+3
|/ | | | | | | | | This patch removes some unnecessary casts in the eepro100 device, introduced by commit 16ef60c9a8eeee269f7cbc95219a431b1d7cbf29 'eepro100: Use PCI DMA stub functions'. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* eepro100: Fix alignment requirement for statistical countersStefan Weil2011-11-281-1/+9
| | | | | | | | | | | According to Intel's Open Source Software Developer Manual, the dump counters address must be Dword aligned. The new code enforces this alignment, so s->statsaddr may now be used with stw_le_pci_dma() and stl_le_pci_dma(). Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* eepro100: Use PCI DMA stub functionsEduard - Gabriel Munteanu2011-11-011-72/+49
| | | | | | | | | | This updates the eepro100 device emulation to use the explicit PCI DMA functions, instead of directly calling physical memory access functions. Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro> Signed-off-by: David Gibson <dwg@au1.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Use glib memory allocation and free functionsAnthony Liguori2011-08-201-1/+1
| | | | | | qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* pci: rename pci_register_bar_region() to pci_register_bar()Avi Kivity2011-08-081-4/+3
| | | | | | | Reviewed-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* eepro100: convert to memory APIAvi Kivity2011-08-081-145/+37
| | | | | | | | | | Note: the existing code aliases the flash BAR into the MMIO bar. This is probably a bug. This patch does not correct the problem. Reviewed-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Merge remote-tracking branch 'origin/master' into pciMichael S. Tsirkin2011-06-151-1/+1
|\ | | | | | | | | Conflicts: hw/virtio-pci.c
| * Fix typo in code and commentsStefan Weil2011-05-061-1/+1
| | | | | | | | | | | | | | Replace writeable -> writable Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* | eepro100: convert to PCIDeviceInfo to initialize idsIsaku Yamahata2011-06-121-41/+33
|/ | | | | | | use PCIDeviceInfo to initialize ids. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* Merge remote branch 'origin/master' into pciMichael S. Tsirkin2011-05-051-1/+1
|\ | | | | | | | | Conflicts: exec.c
| * 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>
* | eepro100: Support 32 bit read/write access to flash registerStefan Weil2011-05-051-0/+9
| | | | | | | | | | Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* | eepro100: Support byte read access to general control registerStefan Weil2011-05-051-0/+3
| | | | | | | | | | | | | | | | The general control register is a byte register. Add support for byte reads. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* | eepro100: Support byte/word read/write access to MDI control registerStefan Weil2011-05-051-2/+32
| | | | | | | | | | | | | | | | | | | | MDI control is a 32 bit register, but may be read or written using 8 or 16 bit access. Data is latched when the MSB is written. Add support for byte/word read/write access. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* | eepro100: Support byte/word writes to pointer registerStefan Weil2011-05-051-17/+16
| | | | | | | | | | | | | | | | pointer is a 32 bit register, but may be written using 8 or 16 bit writes. Add support for byte/word writes. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* | eepro100: Support byte/word writes to port addressStefan Weil2011-05-051-2/+18
| | | | | | | | | | | | | | | | port is a 32 bit register, but may be written using 8 or 16 bit writes. Add support for byte/word writes. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* | eepro100: Fix endianness issuesStefan Weil2011-05-051-44/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Like other Intel devices, e100 (eepro100) uses little endian byte order. This patch was tested with these combinations: i386 host, i386 + mipsel guests (le-le) mipsel host, i386 guest (le-le) i386 host, mips + ppc guests (le-be) mips host, i386 guest (be-le) mips and mipsel hosts were emulated machines. v2: Use prefix for new functions. Add the same prefix to stl_le_phys. Fix alignment of mem (needed for word/dword reads/writes). Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* | eepro100: Pad received short framesStefan Weil2011-05-051-1/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | QEMU sends frames smaller than 60 bytes to ethernet nics. Such frames are rejected by real NICs and their emulations. To avoid this behaviour, other NIC emulations pad received frames. This patch enables this workaround for eepro100, too. All related code is marked with CONFIG_PAD_RECEIVED_FRAMES, so we can drop this in case QEMU's networking code is ever changed. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* | eepro100: Remove unused structure elementStefan Weil2011-05-051-3/+3
| | | | | | | | | | | | | | | | | | | | cppcheck reports that 'packet' is unused. It was only used to calculate the size of the preceding data. Removing it saves a lot of stack space (local variable rx). Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* | eepro100: Remove type casts which are no longer neededStefan Weil2011-05-051-7/+6
| | | | | | | | | | Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* | eepro100: Avoid duplicate debug messagesStefan Weil2011-05-051-5/+9
| | | | | | | | | | | | | | | | | | When DEBUG_EEPRO100 was enabled, unsupported writes were logged twice. Now logging in eepro100_write1 and eepro100_write2 is similar to the logging in eepro100_write4 (which already was correct). Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* | eepro100: convert to pci_register_bar_simple()Avi Kivity2011-04-071-30/+13
|/ | | | | Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* Add bootindex parameter to net/block/fd deviceGleb Natapov2010-12-111-0/+3
| | | | | | | | | 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>
* Add endianness as io mem parameterAlexander Graf2010-12-111-1/+2
| | | | | | | | | | | | | 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>
* eepro100: Use a single rom file for all i825xx devicesStefan Weil2010-11-221-11/+3
| | | | | | | | | | | | | Patching the rom data during load (in qemu) now also supports i82801 (which had no rom file). We only need a single rom file for the whole device family, so remove the second one which is no longer needed. Cc: Markus Armbruster <armbru@redhat.com> 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>
* Merge branch 'pci' into for_anthonyMichael S. Tsirkin2010-10-271-2/+2
|\
| * pci: consolidate pci_add_capability_at_offset() into pci_add_capability().Isaku Yamahata2010-09-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | By making pci_add_capability() the special case of pci_add_capability_at_offset() of offset = 0, consolidate pci_add_capability_at_offset() into pci_add_capability(). Cc: Stefan Weil <weil@mail.berlios.de> Cc: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* | eepro100: initialize a variable in all casesBlue Swirl2010-10-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Compiling with GCC 4.6.0 20100925 produced warnings: /src/qemu/hw/eepro100.c: In function 'eepro100_read4': /src/qemu/hw/eepro100.c:1351:14: error: 'val' may be used uninitialized in this function [-Werror=uninitialized] /src/qemu/hw/eepro100.c: In function 'eepro100_read2': /src/qemu/hw/eepro100.c:1328:14: error: 'val' may be used uninitialized in this function [-Werror=uninitialized] /src/qemu/hw/eepro100.c: In function 'eepro100_read1': /src/qemu/hw/eepro100.c:1285:13: error: 'val' may be used uninitialized in this function [-Werror=uninitialized] Fix by initializing 'val' at start. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* | eepro100: Add support for multiple individual addresses (multiple IA)Stefan Weil2010-10-071-9/+21
|/ | | | | | | | | | | | | | | | | | | | | | | | | | I reviewed the latest sources of Linux, FreeBSD and NetBSD. They all reset the multiple IA bit (multi_ia in BSD) to zero, but I did not find code which sets this bit to one (like it is done by some routers). Running Windows guests also did not set this bit. Intel's Open Source Software Developer Manual does not give much information on the semantics related to this bit, so I had to guess how it works. The guess was good enough to make the router emulation work. Related changes in this patch: * Update naming and documentation of the internal hash register. It is not limited to multicast, but also used for multiple IA. * Dump complete configuration register when debug traces are enabled. * Debug output when multiple IA bit is set during CmdConfigure. * Debug output when frames are received because multiple IA bit is set, or when they are ignored although it is set. 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>
* eepro100: Add a dev field to eeprom new/free functionsAlex Williamson2010-07-061-2/+2
| | | | | | | This allows us to create a more meaningful savevm string. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* savevm: Add DeviceState paramAlex Williamson2010-07-061-2/+2
| | | | | | | | | | When available, we'd like to be able to access the DeviceState when registering a savevm. For buses with a get_dev_path() function, this will allow us to create more unique savevm id strings. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Move stdbool.hPaul Brook2010-06-131-1/+0
| | | | | | | Move inclusion of stdbool.h to common header files, instead of including in an ad-hoc manner. Signed-off-by: Paul Brook <paul@codesourcery.com>
* eepro100: convert to new capability APIMichael S. Tsirkin2010-04-111-13/+9
| | | | | | | | Using new pci_add_capability_at_offset makes eepro100 code cleaner. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Stefan Weil <weil@mail.berlios.de>
* eepro100: fix PCI interrupt pin configuration regressionStefan Weil2010-04-071-0/+3
| | | | | | | | | | | | | | Commit 15e89f5916c9e82347cbd1fd416db3e348bab426 removed this setting, but it is still needed. Without this patch, e100 device drivers using interrupts don't work with qemu. See other nic emulations which also set the PCI interrupt pin. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* eepro100: fix mapping of flash memoryStefan Weil2010-04-071-5/+5
| | | | | Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* eepro100: Set power management capability using pci_reserve_capabilityStefan Weil2010-04-071-21/+18
| | | | | | | | | pci_add_capability automatically updates PCI status and PCI capability pointer, so use it. Use pci_reserve_capability to make the new capability appear at the correct offset. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* eepro100: Set configuration bit for standard TCBStefan Weil2010-04-061-0/+3
| | | | | | | | For some devices, this bit is always set. For the others, it is set by default. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* eepro100: Add new device variant i82801Stefan Weil2010-04-061-0/+15
| | | | | | | This ethernet device is used in Toshiba Tecra 8200 notebooks. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* eepro100: Simplified device instantiationStefan Weil2010-04-061-280/+167
| | | | | | | | | By using a private device info structure (as suggested by Gerd Hoffmann), handling of the different device variants becomes much easier. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* eepro100: Simplify status handlingStefan Weil2010-04-061-4/+4
| | | | | | | Includes a minor STATUS_NOT_OK -> 0 tweak. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* eepro100: Don't allow writing SCBStatusStefan Weil2010-04-061-44/+5
| | | | | | | | | | | | | SCBStatus is readonly, but most drivers which were derived from the old Linux eepro100.c do a word write to this address when they want to acknowledge interrupts. So we have to mask these writes here. The patch also removes old unused code for status read / write. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* eepro100: address pci todo's, use pci_set_xxMichael S. Tsirkin2010-03-151-62/+32
| | | | | | | | | | eepro100 uses macros which rely on a specific local variable name (pci_conf) which is scary. Some of the uses are wrong or unnecessary, remove them. The rest are small in number, open-code them using pci_set_xx functions. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* eepro100: Keep includes sortedStefan Weil2010-03-031-1/+1
| | | | | | | | | I always try to keep standard includes sorted and add a comment why they are there (so they can be removed when they are no longer needed). Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
OpenPOWER on IntegriCloud