summaryrefslogtreecommitdiffstats
path: root/hw/eepro100.c
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* eepro100: Remove C++ commentsStefan Weil2010-03-031-59/+126
| | | | | | | | | | C++ comments are unwanted, so this is fixed here. * Replace C++ comments by C comments. * Put code which was deactivated by a C++ comment in #if 0...#endif. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* eepro100: Add diagnose commandStefan Weil2010-03-031-0/+5
| | | | | | | | | | Real hardware would run an internal self-test. The emulation just returns a passed status. Original patch was from Reimar Döffinger, thanks. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* eepro100: New function for reading command blockStefan Weil2010-03-031-14/+28
| | | | | | | | | | | Move code which reads the command block to the new function read_cb. The patch also fixes some endianess issues related to the command block and moves declarations of local variables to the beginning of the block. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* eepro100: Use tx.statusStefan Weil2010-03-031-3/+3
| | | | | | | | | There is no need for a local variable "status". Using tx.status makes it clearer which status is addressed. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* eepro100: Prettify code (no functional changes)Stefan Weil2010-03-031-4/+4
| | | | | | | * Fix indentation. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* eepro100: Fix CU Start commandStefan Weil2010-03-031-6/+6
| | | | | | | CU Start is allowed when the CU is in the idle or suspended state. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* eepro100: Support RNR interruptStefan Weil2010-03-031-3/+10
| | | | | | | | | | The RNR interrupt is triggered under these conditions: * the RU is not ready to receive a frame due to missing resources * the RU is ready and a RU abort command was requested Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* eepro100: Replace variable name to fix a compiler warningStefan Weil2010-03-031-6/+6
| | | | | | | | When compiling with -Wshadow, gcc gives a warning which is fixed by renaming stat -> status. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* eepro100: Use symbolic names for bits in EEPROM idStefan Weil2010-03-031-1/+16
| | | | | | | V2 - Use UPPER_CASE for enum values Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* eepro100: Remove old unused codeStefan Weil2010-03-031-18/+0
| | | | | | | This code is no longer needed. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
OpenPOWER on IntegriCloud