summaryrefslogtreecommitdiffstats
path: root/hw/pcnet.c
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* Split out common pcnet codePaul Brook2010-11-271-307/+4
| | | | | | | | The core pcnet emulation code is used by both the PCI "pcnet" device and the SPARC "lance" device. Split the common code frm the PCI code so that that can be configures independantly. Signed-off-by: Paul Brook <paul@codesourcery.com>
* pcnet: Do not receive external frames in loopback modeJan Kiszka2010-11-211-2/+3
| | | | | | | | | | While not explicitly stated in the spec, it was observed on real systems that enabling loopback testing on the pcnet controller disables reception of external frames. And some legacy software relies on it, so provide this behavior. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* pcnet: address TODOsMichael S. Tsirkin2010-07-111-14/+2
| | | | | | | | pcnet enables memory/io on init, which does not make sense as BAR values are wrong. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Tested-by: Jan Kiszka <jan.kiszka@siemens.com>
* pci: don't overwrite multi functio bit in pci header type.Isaku Yamahata2010-07-111-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't overwrite pci header type. Otherwise, multi function bit which pci_init_header_type() sets appropriately is lost. Anyway PCI_HEADER_TYPE_NORMAL is zero, so it is unnecessary to zero which is already zero cleared. how to test: run qemu and issue info pci to see whether a device in question is normal device, not pci-to-pci bridge. This is handy because guest os isn't required. tested changes: The following files are covered by using following commands. sparc64-softmmu apb_pci.c, vga-pci.c, cmd646.c, ne2k_pci.c, sun4u.c ppc-softmmu grackle_pci.c, cmd646.c, ne2k_pci.c, vga-pci.c, macio.c ppc-softmmu -M mac99 unin_pci.c(uni-north, uni-north-agp) ppc64-softmmu pci-ohci, ne2k_pci, vga-pci, unin_pci.c(u3-agp) x86_64-softmmu acpi_piix4.c, ide/piix.c, piix_pci.c -vga vmware vmware_vga.c -watchdog i6300esb wdt_i6300esb.c -usb usb-uhci.c -sound ac97 ac97.c -nic model=rtl8139 rtl8139.c -nic model=pcnet pcnet.c -balloon virtio virtio-pci.c: untested changes: The following changes aren't tested. prep_pci.c: ppc-softmmu -M prep should cover, but core dumped. unin_pci.c(uni-north-pci): the caller is commented out. openpic.c: the caller is commented out in ppc_prep.c Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* pcnet: make subsystem vendor id match hardwareMichael S. Tsirkin2010-03-151-0/+3
| | | | | | | | | | | | | | | | | | Real pcnet device (AT2450) apparently has subsystem device and vendor id set to 0, this is out of spec (which requires that vendor id is obtained from PCI SIG) but windows xp driver seems to need this in order to associate. qemu sets pci subsystem id to qumranet/qemu since d350d97d196a632b6c7493acf07a061017fc6f7d, debian does not yet have this patch. https://bugzilla.redhat.com/show_bug.cgi?id=521247 Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Anthony Liguori <aliguori@us.ibm.com>
* pcnet APROMWE bit location (retry)Chris Kilgour2010-03-081-1/+1
| | | | | | | According to AMD document 21485D pp.141, APROMWE is bit 8 of BCR2. Signed-off-by: Christopher Kilgour <techie@whiterocker.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* pcnet: remove dead nested assignment, spotted by clangBlue Swirl2010-01-131-1/+1
| | | | | | | | | Although the value stored to 'addr' is used in the enclosing expression, the value is never actually read from 'addr'. Probably a typo. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* pcnet: switch to symbolic names for pci registersMichael S. Tsirkin2009-12-231-9/+17
| | | | | | | | | No functional changes. I verified that the generated 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>
* 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 pcnet to NICStateMark McLoughlin2009-12-031-20/+23
| | | | | Signed-off-by: Mark McLoughlin <markmc@redhat.com> 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-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>
* 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>
* sparc32 (mostly): remove unneeded calls to device resetBlue Swirl2009-11-071-1/+0
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* pcnet: port to vmstateJuan Quintela2009-10-271-69/+37
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* pcnet: split away lance.c (sparc32 code).Gerd Hoffmann2009-10-271-145/+9
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* pcnet: use qdev properties for configuration.Gerd Hoffmann2009-10-271-17/+50
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* pcnet: Extend hardware resetJan Kiszka2009-10-151-0/+3
| | | | | | | | | Update the IRQ state and stop the poll timer on reset. Moreover, register the reset function with qemu. Patchworks-ID: 35462 Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* pcnet: Restart poll timer on pcnet_startJan Kiszka2009-10-081-0/+1
| | | | | | | | | Just like we call into pcnet_poll_timer on stop, we need to call it on start to trigger the setup of the poll timer. Patchworks-ID: 35313 Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* pcnet: Drop unused recv_pos fieldJan Kiszka2009-10-081-13/+8
| | | | | | | | | | This state field was never used, simply remained 0. Drop it from the PCNetState and update the save/restore code accordingly, keeping backward compatibility. Patchworks-ID: 35314 Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* pci: move unregister from PCIDevice to PCIDeviceInfoGerd Hoffmann2009-10-051-2/+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-29/+29
| | | | | | | | | | | | 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-29/+29
| | | | | | | Some not so obvious bits, slirp and Xen were left alone for the time being. Signed-off-by: malc <av1474@comtv.ru>
* Unexport ticks_per_sec variable. Create get_ticks_per_sec() functionJuan Quintela2009-09-111-1/+1
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* pcnet: Add pci_pcnet_{save/load} functions, then remove PCNetState pci_dev fieldJuan Quintela2009-08-271-13/+26
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* pcnet: remove useless casts This are casts to the very type of the functionJuan Quintela2009-08-271-6/+6
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* pcnet: Change casts to DO_UPCAST() for PCIPCNetStateJuan Quintela2009-08-271-4/+4
| | | | | 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-5/+6
| | | | | | | | | | | | | | | | | | 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>
* Make CPURead/WriteFunc structure 'const'Blue Swirl2009-08-251-10/+10
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* qdev/prop: convert pcnet.c to helper macros.Gerd Hoffmann2009-08-101-6/+2
| | | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-Id:
* qdev: rework device properties.Gerd Hoffmann2009-07-161-3/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is a major overhaul of the device properties. The properties are saved directly in the device state struct now, the linked list of property values is gone. Advantages: * We don't have to maintain the list with the property values. * The value in the property list and the value actually used by the device can't go out of sync any more (used to happen for the pci.devfn == -1 case) because there is only one place where the value is stored. * A record describing the property is required now, you can't set random properties any more. There are bus-specific and device-specific properties. The former should be used for properties common to all bus drivers. Typical use case is bus addressing, i.e. pci.devfn and i2c.address. Properties have a PropertyInfo struct attached with name, size and function pointers to parse and print properties. A few common property types have PropertyInfos defined in qdev-properties.c. Drivers are free to implement their own very special property parsers if needed. Properties can have default values. If unset they are zero-filled. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev: update pci device registration.Gerd Hoffmann2009-07-091-1/+7
| | | | | | | | | Makes pci_qdev_register take a PCIDeviceInfo struct instead of a bunch of parameters. Also adds config_read and config_write callbacks to PCIDeviceInfo, so drivers needing these can be converted to the qdev device API too. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* Rename pci_register_io_region() to pci_register_bar()Avi Kivity2009-06-161-2/+2
| | | | | | | | This function is used to manage a PCI BAR, so make the more generic pci_register_io_region() available to other uses. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Remove io_index argument from cpu_register_io_memory()Avi Kivity2009-06-161-2/+2
| | | | | | | | | The parameter is always zero except when registering the three internal io regions (ROM, unassigned, notdirty). Remove the parameter to reduce the API's power, thus facilitating future change. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: add return value to packet receive handlerMark McLoughlin2009-06-091-2/+5
| | | | | | | This allows us to handle queue full conditions rather than dropping the packet on the floor. Signed-off-by: Mark McLoughlin <markmc@redhat.com>
* net: pass VLANClientState* as first arg to receive handlersMark McLoughlin2009-06-091-5/+5
| | | | | | Give static type checking a chance to catch errors. Signed-off-by: Mark McLoughlin <markmc@redhat.com>
* net: re-name vc->fd_read() to vc->receive()Mark McLoughlin2009-06-091-1/+1
| | | | | | | | | VLANClientState's fd_read() handler doesn't read from file descriptors, it adds a buffer to the client's receive queue. Re-name the handlers to make things a little less confusing. Signed-off-by: Mark McLoughlin <markmc@redhat.com>
* net: add fd_readv() handler to qemu_new_vlan_client() argsMark McLoughlin2009-06-091-1/+1
| | | | | | | This, apparently, is the style we prefer - all VLANClientState should be an argument to qemu_new_vlan_client(). Signed-off-by: Mark McLoughlin <markmc@redhat.com>
* Remove qdev irq sink handlingPaul Brook2009-05-261-1/+1
| | | | | | | We have both IRQ sinks and GPIO inputs. These are in principle exactly the same thing, so remove the former. Signed-off-by: Paul Brook <paul@codesourcery.com>
* Fix lance segfaultsPaul Brook2009-05-221-3/+6
| | | | Signed-off-by: Paul Brook <paul@codesourcery.com>
* PCI network qdev conversionPaul Brook2009-05-141-69/+64
| | | | Signed-off-by: Paul Brook <paul@codesourcery.com>
* use PCI_HEADER_TYPE.Isaku Yamahata2009-05-031-1/+1
| | | | | | use symbolic value instead of 0x0e and related value. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
* Pci nic: pci_register_device can failChris Wright2009-05-011-0/+4
| | | | | | | | | | | The pci_register_device() call in PCI nic initialization routines can fail. Handle this failure and propagate a meaningful error message to the user instead of generating a SEGV. Cc: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Chris Wright <chrisw@sous-sol.org> Signed-off-by: Avi Kivity <avi@qumranet.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Introduce VLANClientState::cleanup() (Mark McLoughlin)aliguori2009-04-171-9/+49
| | | | | | | | | | | We're currently leaking memory and file descriptors on device hot-unplug. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7150 c046a42c-6fe2-441c-8c8c-71466251a162
* pcnet: Avoid double conversion via PHYSADDRaurel322009-04-081-10/+10
| | | | | | | | | | | | rdra and tdra are already kept converted in the pcnet state structure. Avoid converting derivatives a second time. The same case with the local variable xmit_cxda: it already contains a converted cxda address. This issue only causes troubles when using the pcnet in 16-bit legacy mode. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7049 c046a42c-6fe2-441c-8c8c-71466251a162
* qemu: return PCIDevice on net device init and record devfn (Marcelo Tosatti)aliguori2009-02-111-1/+2
| | | | | | | | | | | | | | Change the PCI network drivers init functions to return the PCIDev, to inform which slot has been hot-plugged. Also record PCIDevice structure on NICInfo to locate for release on hot-removal. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6593 c046a42c-6fe2-441c-8c8c-71466251a162
* hw: remove error handling from qemu_malloc() callers (Avi Kivity)aliguori2009-02-051-2/+0
| | | | | | | | Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6529 c046a42c-6fe2-441c-8c8c-71466251a162
* Add and use #defines for PCI device classesblueswir12009-02-011-2/+1
| | | | | | | | | | | | | This patch adds and uses #defines for PCI device classes and subclases, using a new pci_config_set_class() function, similar to the recently added pci_config_set_vendor_id() and pci_config_set_device_id(). Change since v1: fixed compilation of hw/sun4u.c Signed-off-by: Stuart Brady <stuart.brady@gmail.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6491 c046a42c-6fe2-441c-8c8c-71466251a162
* Define PCI vendor and device IDs in pci.h (Stuart Brady)aliguori2009-01-261-2/+2
| | | | | | | | | | | | | | | This patch defines PCI vendor and device IDs in pci.h (matching those from Linux's pci_ids.h), and uses those definitions where appropriate. Change from v1: Introduces pci_config_set_vendor_id() / pci_config_set_device_id() accessors as suggested by Anthony Liguori. Signed-off-by: Stuart Brady <stuart.brady@gmail.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6442 c046a42c-6fe2-441c-8c8c-71466251a162
OpenPOWER on IntegriCloud