summaryrefslogtreecommitdiff
path: root/hw/eepro100.c
AgeCommit message (Collapse)AuthorFilesLines
2010-04-11eepro100: convert to new capability APIMichael S. Tsirkin1-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>
2010-04-07eepro100: fix PCI interrupt pin configuration regressionStefan Weil1-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>
2010-04-07eepro100: fix mapping of flash memoryStefan Weil1-5/+5
Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-04-07eepro100: Set power management capability using pci_reserve_capabilityStefan Weil1-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>
2010-04-06eepro100: Set configuration bit for standard TCBStefan Weil1-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>
2010-04-06eepro100: Add new device variant i82801Stefan Weil1-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>
2010-04-06eepro100: Simplified device instantiationStefan Weil1-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>
2010-04-06eepro100: Simplify status handlingStefan Weil1-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>
2010-04-06eepro100: Don't allow writing SCBStatusStefan Weil1-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>
2010-03-15eepro100: address pci todo's, use pci_set_xxMichael S. Tsirkin1-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>
2010-03-03eepro100: Keep includes sortedStefan Weil1-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>
2010-03-03eepro100: Remove C++ commentsStefan Weil1-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>
2010-03-03eepro100: Add diagnose commandStefan Weil1-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>
2010-03-03eepro100: New function for reading command blockStefan Weil1-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>
2010-03-03eepro100: Use tx.statusStefan Weil1-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>
2010-03-03eepro100: Prettify code (no functional changes)Stefan Weil1-4/+4
* Fix indentation. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-03-03eepro100: Fix CU Start commandStefan Weil1-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>
2010-03-03eepro100: Support RNR interruptStefan Weil1-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>
2010-03-03eepro100: Replace variable name to fix a compiler warningStefan Weil1-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>
2010-03-03eepro100: Use symbolic names for bits in EEPROM idStefan Weil1-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>
2010-03-03eepro100: Remove old unused codeStefan Weil1-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>
2010-03-03eepro100: Use symbolic names and BIT macros in binary operationsStefan Weil1-19/+33
Instead of magic numbers like 0x8000, symbolic names are used for the SCB command and status bits. There are too many configuration bits to use symbolic names there, too. Using the BIT macro is a little help when comparing code and documentation. For the same reason, some other constants were replaced by the BITS macro. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-03-03eepro100: Add device descriptionsStefan Weil1-0/+12
Add descriptions for all devices. These descriptions are shown when users call qemu -device ? Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-03-03eepro100: Update copyright noticeStefan Weil1-5/+5
Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-03-03eepro100: Add TODO listStefan Weil1-0/+8
Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-03-03eepro100: Support gpxe boot for all eepro100 devicesStefan Weil1-1/+12
Only two boot ROM files are needed for all devices. * Add these GPXE ROM files using new naming convention (as discussed on qemu-devel). Both files were created with http://rom-o-matic.net/, PCI vendor / device ids as in ROM filenames and option BANNER_TIMEOUT = 0. * Remove old PXE ROM file for i82559er. It was replaced by gpxe-eepro100-80861209.rom. * Update pc-bios/README (and sort entries). Full support still needs additional eepro100 fixes. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-03-03eepro100: Fix PXE bootStefan Weil1-6/+14
The phy handling was wrong for PXE, GPXE boot: GPXE's eepro100 driver did not detect a valid link. This is fixed here. 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>
2010-03-03eepro100: Add missing SCB register namesStefan Weil1-6/+10
Some system control block registers were addressed using their offset value. Use symbolic names now and clean the documentation. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-03-03eepro100: Fix compiler errors from debug messagesStefan Weil1-6/+7
When debug output was enabled (by defining DEBUG_EEPRO100), some debug messages resulted in a compiler error. This is fixed here. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-01-19eepro100: Fix multicast supportStefan Weil1-13/+39
* Handling of multicast list was missing. * Multicast all was missing. * Promiscuous mode for multicast frames was wrong. This patch is a step to synchronize my maintainer version of eepro100.c (git://repo.or.cz/qemu/ar7.git) with the version integrated in QEMU. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-01-19eepro100: Restructure code (new function tx_command)Stefan Weil1-94/+99
Handling of transmit commands is rather complex, so about 80 lines of code were moved from function action_command to the new function tx_command. The two new values "tx" and "cb_address" in the eepro100 status structure made this possible without passing too many parameters. In addition, the moved code was cleaned a little bit: old comments marked with //~ were removed, C++ style comments were replaced by C style comments, C++ like variable declarations after code were reordered. Simplified mode is still broken. Nor did I fix endianess issues. Both problems will be fixed in additional patches (which need this one). Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-01-13eepro100: Update ROM file supportStefan Weil1-10/+1
Use new way to associate ROM files to devices. Currently, there is only a ROM file for i82559er included in QEMU, so the patch does not add .romfile for the other devices. When flexible mode is fixed in eepro100, adding more ROM files will be possible. It should be possible to create them from pxe-i82559er.bin, because etherboot uses the same driver for all eepro100 devices (only PCI ids differ). Maybe it is even possible to create a single pxe-i8255x.bin which supports all eepro100 devices (not supported with current etherboot). Signed-off-by: Stefan Weil <weil@mail.berlios.de> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-01-13eepro100: Fix initial value for PCI_STATUSStefan Weil1-3/+1
The numerical value was wrong (0x2800 instead of 0x0280) which indeed did not make sense. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2009-12-23eepro100: symbolic names for pci registersMichael S. Tsirkin1-17/+32
No functional changes. I verified that the generated binary does not change in meaningful ways. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Juan Quintela <quintela@redhat.com> Acked-by: Glauber Costa <glommer@gmail.com>
2009-12-03eepro100: Improve debug messagesStefan Weil1-3/+3
* buf was too small for longer register names. * Use consistent upper case for nouns in register names. * Use better name for array with e100 register names. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03eepro100: Allocate a larger buffer for regname()David Benjamin1-1/+1
This should avoid truncating the register name when debugging. Signed-off-by: David Benjamin <davidben@mit.edu> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03net: convert eepro100 to NICStateMark McLoughlin1-19/+24
Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-12eepro100: Add missing .exit initialisationStefan Weil1-0/+9
Some devices did not have an initialisation value for entry ".exit". This is fixed here. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-12eepro100: Fix boot ROM supportStefan Weil1-0/+11
* Rename pxe-eepro100.bin to pxe-i82559er.bin. The other devices supported by eepro100.c need additional pxe boot ROM images. * Call rom_add_option during initialisation. The code won't work with two or more different eepro100 devices, because it only adds one option ROM, but this use case is perhaps never needed. Using this patch, model=i82559er at least works partially. For full support, more eepro100 patches are needed (will follow later, can be fetched from ar7 branch of QEMU). Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09eepro100: Improve support for different devicesStefan Weil1-25/+143
* Add device properties (size of statistical data, extended tcb support) to EEPRO100State and set these values for the different devices. * Fix PCI configuration for existing devices. * Add initialisation code for missing devices. * Remove function device_supports_eTxCB. It is no longer needed. * Fix dump of statistical data. It now respects the real size of the statistical data. An endianess issue was fixed here, too. * CU_SHOWSTATS, CU_DUMPSTATS now write a completion value after the statistical data. There is no need to keep this value in eepro100_stats_t, so member "complete" could be removed. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09pci: introduce FMT_PCIBUS for printf format for pcibus_t.Isaku Yamahata1-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>
2009-11-09pci: introduce pcibus_t to represent pci bus address/size instead of uint32_tIsaku Yamahata1-2/+2
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>
2009-11-09pci: s/PCI_ADDRESS_SPACE_/PCI_BASE_ADDRESS_SPACE_/ to match pci_regs.hIsaku Yamahata1-8/+10
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>
2009-10-27eepro100: port to vmstateJuan Quintela1-134/+60
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-27eepro100: use qdev properties for configuration.Gerd Hoffmann1-14/+64
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-27eepro100: Restructure codeStefan Weil1-24/+30
This patch only moves about 150 lines of code from function eepro100_cu_command to a new function action_command. A goto statement was replaced by a for loop. There are no functional changes. Nor did I change comments starting with // (they will be removed by future patches). Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-15eepro100: Remove unused device status entriesStefan Weil1-74/+20
Once upon the time when QEMU hacking was fun there was a brave knight who wanted to have a driver for a special intel nic. So he started by cloning ne2000.c which also meant that the new born eepro100.c was immediately three years old. Other knights who also wanted to have fun and take their part in the battle thought that it would be a good idea to remove stupid code which says "missing nic load, missing nic save". They saved everything they saw, man and women, ne2000 code and runtime address offsets, and put all saved elements in a prison called vm data. When the first knight came back and noticed the unhappy prisoners, he wanted to set them free. But the keepers of the keys told him that they would have to stay there forever for compatibility reasons. So our brave knight now takes a new effort to save the souls of the poor prisoners by removing their names. Their bodies will have to rot in the dungeons of compatibility forever, watched by the keepers of the keys. Patchworks-ID: 35635 Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-06eepro100: support 16 bit read from SCBCmd (== 2)=?UTF-8?q?Reimar=20D=C3=B6ffinger?=1-0/+1
This is necessary to support OpenBSD 4.2 install, without this change it triggers an assert. Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05Set revision in eeprom correctly for 82557 versions.=?UTF-8?q?Reimar=20D=C3=B6ffinger?=1-0/+2
This is necessary to make FreeBSD recognize the device as 82557 - otherwise its driver will use unsupported features and fail to work. Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05eepro100: Don't allow guests to fail assertionsKevin Wolf1-11/+35
The idea of using assert() for input validation is rather questionable. Let's remove it from eepro100, so that guests need to find more interesting ways if they want to crash qemu. This patch replaces asserts that are directly dependent on guest-accessible data by other means of error handling. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>