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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
* 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>
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>
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>
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>
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>
* 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>
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>
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>
* 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>
* 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>
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>
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>
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>
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>
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>
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>
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>
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>
The new devices added here are still not functional -
partially because some patches are still missing,
partially because I cannot test them. Nevertheless
they belong to the same family and will be supported
by this driver some day.
As soon as they work, they will also be added to hw/pci.c.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
A lot of entries are unused (they were added by copy + paste
from other drivers during development of eepro100.c).
Removing them from nic_save, nic_load makes any
old saved status incompatible, so a new version
for the virtual machine data was needed, too.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
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 99a0949b72.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>