summaryrefslogtreecommitdiffstats
path: root/hw/apb_pci.c
Commit message (Collapse)AuthorAgeFilesLines
* apb_pci: convert PCI space to memory APIBlue Swirl2011-09-041-5/+8
| | | | | | | | | Add a new memory space for PCI instead of using system memory. This also fixes a bug where VGA region vga.chain4 is accidentally mapped to 0xa0000 instead of 0x1ff000a0000. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* apb_pci: convert to memory APIAvi Kivity2011-08-221-47/+37Star
| | | | | Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* pci: pass I/O address space to new PCI busAvi Kivity2011-08-081-0/+1
| | | | | | | | | This lets us register BARs in the I/O address space. 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>
* pci: pass address space to pci bus when createdAvi Kivity2011-07-291-0/+2
| | | | | | | | | This is now done sloppily, via get_system_memory(). Eventually callers will be converted to stop using that. 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>
* apb_pci: convert to PCIDeviceInfo to initialize idsIsaku Yamahata2011-06-121-7/+6Star
| | | | | | | Use PCIDeviceInfo to initialize ids. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* Make simple io mem handler endian awareAlexander Graf2010-12-111-1/+2
| | | | | | | | | As an alternative to the 3 individual handlers, there is also a simplified io mem hook function. To be consistent, let's add an endianness parameter there too. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Add endianness as io mem parameterAlexander Graf2010-12-111-2/+4
| | | | | | | | | | | | | 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>
* pci_bridge: introduce pci bridge library.Isaku Yamahata2010-09-071-13/+42
| | | | | | | | | | introduce pci bridge library. convert apb bridge and dec p2p bridge to use new pci bridge library. save/restore is supported as a side effect. This is also preparation for pci express root/upstream/downstream port. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* pci/bridge: split out pci bridge code into pci_bridge.c from pci.cIsaku Yamahata2010-07-221-0/+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>
* pci: set PCI multi-function bit appropriately.Isaku Yamahata2010-07-111-3/+0Star
| | | | | | | | | | | | | | | Set PCI multi-function bit according to multifunction property. PCI address, devfn ,is exported to users as addr property, so users can populate pci function(PCIDevice in qemu) at arbitrary devfn. It means each function(PCIDevice) don't know whether pci device (PCIDevice[8]) is multi function or not. So this patch allows user to set multifunction bit via property and checks whether multifunction bit is set correctly. Cc: Juan Quintela <quintela@redhat.com> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* pci_bridge: make pci bridge aware of pci multi function bit.Isaku Yamahata2010-07-111-2/+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>
* pci: remove PCIDeviceInfo::header_typeIsaku Yamahata2010-07-111-1/+1
| | | | | | | | 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>
* pci: don't overwrite multi functio bit in pci header type.Isaku Yamahata2010-07-111-2/+0Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* blockdev: Collect block device code in new blockdev.cMarkus Armbruster2010-06-041-0/+1
| | | | | | | Anything that moves hundreds of lines out of vl.c can't be all bad. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* sparc64: clean up pci bridge mapIgor V. Kovalenko2010-05-261-23/+26
| | | | | | | | | | - remove unused host state and store pci bus pointer only - do not map host state access into unused 1fe.10000000 range - reorder pci region registration - assign pci i/o region to isa_mem_base Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* apb: don't use any static stateBlue Swirl2010-05-121-4/+3Star
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Fix Sparc64 buildBlue Swirl2010-03-211-1/+1
| | | | | | 952760bb7bce7fbfe0afcf04fee268745f297b87 missed one change. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* apc_pci: simplify using rwhandlerMichael S. Tsirkin2010-02-221-61/+13Star
| | | | | | | Use rwhandler to simplify apb_pci. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* apb_pci: minor cleanupMichael S. Tsirkin2010-02-221-4/+2Star
| | | | | | | | | pci_data_write ignores high 8 bit in address, so there seems to be no need to set them in apb_pci. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* sparc64: use PCI accessors for APB/PBMBlue Swirl2010-02-141-11/+15
| | | | | | | | | | Remove useless set to zero lines. Latency programming should be done by BIOS, reset value is zero. Add revision to APB, don't enable PCI_COMMAND_MASTER and set status according to APB specification. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* sparc64: implement basic IOMMU/interrupt handlingBlue Swirl2010-01-301-22/+142
| | | | | | Also add reset control. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Sparc64: byte swap IO port accessBlue Swirl2010-01-291-4/+4
| | | | | | This requires an updated OpenBIOS image. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* PCI: fix bridge configurationBlue Swirl2010-01-261-0/+1
| | | | | | | | PCI bridges' qdev info structures must indicate bridge header type, otherwise critical bridge registers (esp. PCI_PRIMARY_BUS, PCI_SECONDARY_BUS, PCI_SUBORDINATE_BUS) will not be writable. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Sparc64: fix PCI probe problemsBlue Swirl2010-01-221-12/+7Star
| | | | | | | | | Byte swap PCI config values. Remove old bogus PCI config mechanism so that device 0:0.0 can be probed. This requires OpenBIOS r667. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Sparc64: Fix PCI config accessor orderBlue Swirl2010-01-121-4/+4
| | | | | | Fix by Igor Kovalenko. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Sparc64: enable real access to PCI configuration spaceBlue Swirl2010-01-111-3/+85
| | | | | | Leave the bogus access method used by OpenBIOS in place for now. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Sparc64: increase APB register rangeBlue Swirl2010-01-101-2/+2
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Sparc64: move APB PCI memory base to correct locationBlue Swirl2009-12-271-0/+2
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* pci: move apb specific stuff to apb_pci.cMichael S. Tsirkin2009-12-021-0/+22
| | | | | | | | | pci code had a TODO to move apb specific pci bridge initialization to apb_pci. Implement this and remove the TODO. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* pci: shorten pci_host_{conf, data}_register_xxx function a bit.Isaku Yamahata2009-12-011-2/+2
| | | | | | | | | pci_host_data_register_io_memory and its variants are too long a bit. So shorten them. Now they are pci_host_{conf, data}_register_{mmio, mmio_noswap, ioport}() Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* pci: pci.h cleanup: move out stuff not in pci.cMichael S. Tsirkin2009-12-011-0/+1
| | | | | | | | pci.h declares some functions which aren't defined in pci.h. Clean up moving things to appropriate headers, and update all users. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* pci_host: consolidate pci config address access.Isaku Yamahata2009-11-091-42/+1Star
| | | | | | | consolidate pci_config address access into pci_host.c Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* pci_host.h: move functions in pci_host.h into .c file.Isaku Yamahata2009-11-091-17/+2Star
| | | | | | | | | | | | | | | | | | | | | | split static functions in pci_host.h into pci_host.c and pci_host_template.h. Later a structures declared in pci_host.h, PCIHostState, will be used. However pci_host.h doesn't allow to include itself easily. This patches addresses it. pci_host.h includes functions which are instantiated in .c by including pci_host.h with typedefing pci_addr_t. pci_addr_t is per pci host bridge and is typedef'ed to uint32_t for ioio or target_phys_addr_t for mmio in .c file. That prevents from including pci_host.h to use PCIHostState because of requiring type, pci_addr_t. Its purpose to include is to instantiate io function for mmio or ioio depending on which pci host bridge requires ioio or mmio. To avoid including code, we always instantiate both version. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* pci: use PCI_SLOT() and PCI_FUNC().Isaku Yamahata2009-11-091-4/+6
| | | | | | | | | use PCI_SLOT() and PCI_FUNC() where appropriate instead of direct use of bit operation. 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>
* Add some chipset doc linksBlue Swirl2009-10-131-0/+9
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* New qdev_init_nofail()Markus Armbruster2009-10-071-1/+1
| | | | | | | | | | | | | | | | | | | Like qdev_init(), but terminate program via hw_error() instead of returning an error value. Use it instead of qdev_init() where terminating the program on failure is okay, either because it's during machine construction, or because we know that failure can't happen. Because relying in the latter is somewhat unclean, and the former is not always obvious, it would be nice to go back to qdev_init() in the not-so-obvious cases, only with proper error handling. I'm leaving that for another day, because it involves making sure that error values are properly checked by all callers. Patchworks-ID: 35168 Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Revert "Get rid of _t suffix"Anthony Liguori2009-10-011-13/+13
| | | | | | | | | | | | 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-13/+13
| | | | | | | Some not so obvious bits, slirp and Xen were left alone for the time being. Signed-off-by: malc <av1474@comtv.ru>
* ioports: remove unused env parameter and compile only onceBlue Swirl2009-09-201-6/+6
| | | | | | | The CPU state parameter is not used, remove it and adjust callers. Now we can compile ioport.c once for all targets. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Sparc64: make system bus parent of PCI busBlue Swirl2009-09-131-1/+1
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* We want the argument pass to set_irq to be opaqueJuan Quintela2009-09-041-1/+3
| | | | | | | piix_pci want to pass more things that the pic 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-281-2/+4
| | | | | | | | | | | | | | | | | | 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-8/+8
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Sparc64: convert APB to qdevBlue Swirl2009-07-211-32/+71
| | | | | | Thanks to Igor Kovalenko for a bugfix. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Revert "Fix the PCI header type of APB"Blue Swirl2009-07-111-1/+1
| | | | This reverts commit e8d2a88755b849bdadaf80d19e342eade3c017bc.
* use constant IOPORTS_MASK instead of 0xffff.Isaku Yamahata2009-07-091-6/+6
| | | | | Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Fix the PCI header type of APBBlue Swirl2009-07-051-1/+1
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Remove io_index argument from cpu_register_io_memory()Avi Kivity2009-06-161-4/+4
| | | | | | | | | 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>
* Add common BusStatePaul Brook2009-05-231-1/+2
| | | | | | | | | | | Implement and use a common device bus state. The main side-effect is that creating a bus and attaching it to a parent device are no longer separate operations. For legacy code we allow a NULL parent, but that should go away eventually. Also tweak creation code to veriry theat a device in on the right bus. Signed-off-by: Paul Brook <paul@codesourcery.com>
* Replace gcc variadic macro extension with C99 versionBlue Swirl2009-05-131-3/+3
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>