summaryrefslogtreecommitdiff
path: root/hw/pci.h
AgeCommit message (Collapse)AuthorFilesLines
2011-03-28pci: replace the magic, 256, for the maximum of devfnIsaku Yamahata1-0/+1
Introduce symbol PCI_SLOT_MAX for the # of slots, and replace the magic, 256. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2011-02-12pci: add creation functions that may failBlue Swirl1-0/+4
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-01-20pci: deassert intx on reset.Isaku Yamahata1-0/+2
deassert intx on device reset. So far pci_device_reset() is used for system reset. In that case, interrupt controller is reset at the same time so that all irq is are deasserted. But now pci bus reset/flr is supported, and in that case irq needs to be disabled explicitly. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2011-01-10pci: allow devices being tagged as not hotpluggable.Gerd Hoffmann1-0/+3
This patch adds a field to PCIDeviceInfo to tag devices as being not hotpluggable. Any attempt to plug-in or -out such a device will throw an error. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-12-24pci: introduce a helper function to convert qdev id to PCIDeviceIsaku Yamahata1-0/+1
This patch introduce a helper function to get PCIDevice from qdev id. This function will be used later. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-12-22pcie: add flr supportIsaku Yamahata1-0/+1
Support flr: trigger device reset on flr config write. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-12-17pci: add ich9 pci idAlexander Graf1-0/+1
We need a PCI ID for our new AHCI adapter. I just picked an ICH-9 because that's the one in the Q35 chipset. This patch adds a PCI ID define for an ICH-9 AHCI adapter. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-12-09pci: untangle pci/msi dependencyMichael S. Tsirkin1-3/+0
msi depends on pci but pci should not depend on msi. The only dependency we have is a recent addition of pci_msi_ functions, IMO they add little enough to open-code in the small number of users. Follow-up patches add more cleanups. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2010-12-09pci: make command SERR bit writableIsaku Yamahata1-0/+4
pcie aer needs SERR bit to be writable, and the PCI spec requires this as well. For compatibility, introduce compat global property command_serr_enable and make this bit readonly for a pre 0.14 pc machine. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-11-22pci: use qdev reset framework for pci bus resetIsaku Yamahata1-0/+1
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-11-16pci: allow hotplug removal of cold-plugged devicesMichael S. Tsirkin1-1/+9
This patch fixes hot unplug of cold plugged devices (those present at system start), which got broken by 5beb8ad503c88a76f2b8106c3b74b4ce485a60e1 . Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Cam Macdonell <cam@cs.ualberta.ca> Tested-by: Cam Macdonell <cam@cs.ualberta.ca> Reported-by: Cam Macdonell <cam@cs.ualberta.ca>.
2010-10-27Merge branch 'pci' into for_anthonyMichael S. Tsirkin1-11/+94
2010-10-19pcie: helper functions for pcie capability and extended capabilityIsaku Yamahata1-0/+5
This patch implements helper functions for pci express capability and pci express extended capability allocation. NOTE: presence detection depends on pci_qdev_init() change. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-10-19msi: implements msiIsaku Yamahata1-3/+7
implements msi related functions. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-10-19pci: introduce helper function to handle msi-x and msi.Isaku Yamahata1-0/+3
this patch implements helper functions to handle msi-x and msi uniformly. They will be used later. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-10-19pci: introduce helper functions to test-and-{clear, set} mask in ↵Isaku Yamahata1-0/+70
configuration space This patch introduces helper functions to test-and-{clear, set} mask in configuration space. pci_{byte, word, long, quad}_test_and_{clear, set}_mask(). They will be used later. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-09-20pci: implement RW1C register framework.Isaku Yamahata1-0/+3
Implement RW1C register framework. With this patch, it would be easy to implement W1C(Write 1 to Clear) register by just setting w1cmask. Later RW1C register will be used by pcie. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-09-18Introduce range.hBlue Swirl1-29/+0
Extract range functions from pci.h. These will be used by later patches by non-PCI devices. Adjust current users. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-13pci: improve signature of pci_register_bar().Isaku Yamahata1-1/+1
Make type uint8_t from int because PCIIORegion::type is uint8_t. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2010-09-07pci: make pci_parse_devfn() aware of func.Isaku Yamahata1-0/+2
make pci_parse_devfn() aware of func. With func = NULL it behave as before. This will be used later. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-09-07pci: consolidate pci_add_capability_at_offset() into pci_add_capability().Isaku Yamahata1-3/+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>
2010-07-22pci/bridge: split out pci bridge code into pci_bridge.c from pci.cIsaku Yamahata1-4/+1
Move pci bridge related code into pci_bridge.c from pci.c for further enhancement. pci.c is big enough now, so split it out. No code change but exporting some accesser functions. In fact, few pci bridge functions stays in pci.c. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-07-11pci_bridge: make pci bridge aware of pci multi function bit.Isaku Yamahata1-1/+2
make pci bridge aware of pci multi function property and let pci generic code to set the bit. Cc: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-11pci: introduce multifunction property.Isaku Yamahata1-0/+9
introduce multifunction property. Also introduce new convenient device creation function which will be used later. For bisectability this patch doesn't do anything, but sets the property resulting in no functional changes. Actual changes will be introduced by later patch. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-11pci: remove PCIDeviceInfo::header_typeIsaku Yamahata1-2/+6
replace PCIDeviceInfo::header_type with is_bridge as suggested by Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-11pci: insert assert that auto-assigned-address function is single function ↵Isaku Yamahata1-0/+1
device. Auto-assigned-address pci function (passing devfn = -1) is always single function. This patch adds assert() to guarantee that auto-assigned-address function is always single function device at function = 0. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-31pci-hotplug: make them aware of pci domain.Isaku Yamahata1-0/+1
add helper function which converts root bus to pci domain. make them aware of pci domain. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-05-31pci.h: remove unused constants.Isaku Yamahata1-11/+0
So remove unused constants, PCI_STATUS_RESERVED_MASK_LO, PCI_STATUS_RESERVED_MASK_HI, PCI_COMMAND_RESERVED, PCI_COMMAND_RESERVED_MASK_HI. They were used once, but they aren't used anymore. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-05-31pci: add const to pci_is_express(), pci_config_size().Isaku Yamahata1-2/+2
add const to pci_is_express(), pci_config_size(). Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-05-15pci hotplug: add argument to pci hot plug callback.Isaku Yamahata1-2/+2
Add argument, DeviceState*, to pci hot plug callback. The argument will be used later to remove global variable. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-04-11pci: add API to add capability at a known offsetMichael S. Tsirkin1-0/+2
Unlike virtio, device emulations need to add pci capabilities at known offsets to match real hardware. Make this possible by adding an appropriate API. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-03-08adding helper pci functionsIzik Eidus1-0/+18
Signed-off-by: Izik Eidus <ieidus@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-02-14pci: move pcibus_t to qemu-commonMichael S. Tsirkin1-1/+0
move pcibus_t to qemu-common.h to simplify header dependencies. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-01-26PCI: Convert pci_info() to QObjectLuiz Capitulino1-1/+3
The returned QObject is a QList of all buses. Each bus is represented by a QDict, which has a key with a QList of all PCI devices attached to it. Each device is represented by a QDict. As has happended to other complex conversions, it's hard to split this commit as part of it are new functions which are called by each other. IMPORTANT: support for printing PCI bridge attached devices is NOT part of this commit, it's going to be added by the next commit, as it's untested. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-01-13pci: Add missing 'const' in argument to pci_get_xxxStefan Weil1-7/+7
pci_get_byte, pci_get_word, pci_get_long and pci_get_quad all take a const uint8_t pointer, because they only read the configuration data. Their prototypes should reflect this fact. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-01-11pci: allow loading roms via fw_cfg.Gerd Hoffmann1-0/+1
This patch adds a pci bus property 'rombar' which specifies whenever the pci rom should be loaded via pci rom bar (default) or via fw_cfg. The later can be used for compatibility with older qemu versions where no pci rom bar is present. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-01-06Merge remote branch 'mst/for_anthony' into stagingAnthony Liguori1-70/+3
2009-12-25PCI: make pci_mem_base privateBlue Swirl1-2/+2
Make pci_mem_base private to PCIBus. Add a function to set it. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-12-23pci: use pci_regs.hIsaku Yamahata1-74/+3
include pci_regs.h and remove duplicated defines. And remove unused PCI_REVISION and PCI_SUBDEVICE_ID. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2009-12-23pci: s/PCI_SUBVENDOR_ID/PCI_SUBSYSTEM_VENDOR_ID/gIsaku Yamahata1-1/+1
To match Linux PCI register definition, rename PCI_SUBVENDOR_ID to PCI_SUBSYSTEM_VENDOR_ID. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2009-12-23pci: remove unused macroMichael S. Tsirkin1-1/+0
PCI_STATUS_DEVSEL is unused, and it also has a different name in pci_regs.h Remove. 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-23pci: add another devsel macroMichael S. Tsirkin1-0/+1
will be used by ensoniq emulation 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-23pci: add more status bitsMichael S. Tsirkin1-0/+2
will be used by eepro100. 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-23pcnet: switch to symbolic names for pci registersMichael S. Tsirkin1-0/+1
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>
2009-12-23Revert "Revert "pci: interrupt disable bit support""Michael S. Tsirkin1-0/+1
This reverts commit d587e0787153f0224a6140c5015609963ceaabfb.
2009-12-18pci romfiles: add property, add default to PCIDeviceInfoGerd Hoffmann1-2/+4
This patch adds a romfile property to the pci bus. It allows to specify a romfile to load into the rom bar of the pci device. The default value comes from a new field in PCIDeviceInfo. The property allows to change the file and also to disable the rom loading using an empty string. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-18Support PCI based option rom loadingAnthony Liguori1-0/+5
Currently, we preload option roms into the option rom space in memory. This prevents DDIM from functioning correctly which severely limits the number of roms we can support. This patch introduces a pci_add_option_rom() which registers the PCI_ROM_ADDRESS bar which points to our option rom. It also converts over the cirrus vga adapter, the rtl8139, virtio, and the e1000 to use this new mechanism. The result is that PXE boot functions even with three unique types of cards. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-18Revert "pci: interrupt disable bit support"Anthony Liguori1-1/+0
This reverts commit 0ea5709a32085f7d14901a09d12bd35f9b267607. Per discussion with Michael Tsirkin, this is too risky for 0.12 Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-07pci: interrupt disable bit supportMichael S. Tsirkin1-0/+1
Interrupt disable bit is mandatory in PCI spec. Implement it to make devices spec compliant. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Isaku Yamahata <yamahata@valinux.co.jp>
2009-12-07pci: interrupt status bit implementationMichael S. Tsirkin1-0/+1
interrupt status is a mandatory feature in PCI spec, so devices must implement it to be spec compliant. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Isaku Yamahata <yamahata@valinux.co.jp>