[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 09/10] pci: set PCI multi-function bit appropriately
From: |
Isaku Yamahata |
Subject: |
[Qemu-devel] [PATCH 09/10] pci: set PCI multi-function bit appropriately. |
Date: |
Thu, 17 Jun 2010 15:15:51 +0900 |
set PCI multi-function bit appropriately.
Signed-off-by: Isaku Yamahata <address@hidden>
---
changes v1 -> v2:
don't set header type register in configuration space.
---
hw/pci.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/hw/pci.c b/hw/pci.c
index 5316aa5..ee391dc 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -607,6 +607,30 @@ static void pci_init_wmask_bridge(PCIDevice *d)
pci_set_word(d->wmask + PCI_BRIDGE_CONTROL, 0xffff);
}
+static void pci_init_multifunction(PCIBus *bus, PCIDevice *dev)
+{
+ uint8_t slot = PCI_SLOT(dev->devfn);
+ uint8_t func_max = 8;
+ uint8_t func;
+
+ for (func = 0; func < func_max; ++func) {
+ if (bus->devices[PCI_DEVFN(slot, func)]) {
+ break;
+ }
+ }
+ if (func == func_max) {
+ return;
+ }
+
+ for (func = 0; func < func_max; ++func) {
+ if (bus->devices[PCI_DEVFN(slot, func)]) {
+ bus->devices[PCI_DEVFN(slot, func)]->config[PCI_HEADER_TYPE] |=
+ PCI_HEADER_TYPE_MULTI_FUNCTION;
+ }
+ }
+ dev->config[PCI_HEADER_TYPE] |= PCI_HEADER_TYPE_MULTI_FUNCTION;
+}
+
static void pci_config_alloc(PCIDevice *pci_dev)
{
int config_size = pci_config_size(pci_dev);
@@ -660,6 +684,7 @@ static PCIDevice *do_pci_register_device(PCIDevice
*pci_dev, PCIBus *bus,
if (is_bridge) {
pci_init_wmask_bridge(pci_dev);
}
+ pci_init_multifunction(bus, pci_dev);
if (!config_read)
config_read = pci_default_read_config;
--
1.6.6.1
- [Qemu-devel] [PATCH 08/10] pci: remove PCIDeviceInfo::header_type, (continued)
- [Qemu-devel] [PATCH 08/10] pci: remove PCIDeviceInfo::header_type, Isaku Yamahata, 2010/06/17
- [Qemu-devel] [PATCH 04/10] pci_bridge: introduce pci bridge layer., Isaku Yamahata, 2010/06/17
- [Qemu-devel] [PATCH 03/10] pci: fix pci_bus_reset() with 64bit BAR and several clean ups., Isaku Yamahata, 2010/06/17
- [Qemu-devel] [PATCH 01/10] pci_bridge: split out pci bridge code into pci_bridge.c from pci.c, Isaku Yamahata, 2010/06/17
- [Qemu-devel] [PATCH 02/10] qdev: export qdev_reset() for later use., Isaku Yamahata, 2010/06/17
- [Qemu-devel] [PATCH 06/10] pci: eliminate work around in pci_device_reset()., Isaku Yamahata, 2010/06/17
- [Qemu-devel] [PATCH 09/10] pci: set PCI multi-function bit appropriately.,
Isaku Yamahata <=
- [Qemu-devel] Re: [PATCH 09/10] pci: set PCI multi-function bit appropriately., Michael S. Tsirkin, 2010/06/17
- [Qemu-devel] Re: [PATCH 09/10] pci: set PCI multi-function bit appropriately., Isaku Yamahata, 2010/06/17
- [Qemu-devel] Re: [PATCH 09/10] pci: set PCI multi-function bit appropriately., Michael S. Tsirkin, 2010/06/18
- Re: [Qemu-devel] Re: [PATCH 09/10] pci: set PCI multi-function bit appropriately., Isaku Yamahata, 2010/06/18
- Re: [Qemu-devel] Re: [PATCH 09/10] pci: set PCI multi-function bit appropriately., Michael S. Tsirkin, 2010/06/18
- Re: [Qemu-devel] Re: [PATCH 09/10] pci: set PCI multi-function bit appropriately., Jamie Lokier, 2010/06/18
- Re: [Qemu-devel] Re: [PATCH 09/10] pci: set PCI multi-function bit appropriately., Michael S. Tsirkin, 2010/06/20
[Qemu-devel] [PATCH 10/10] pci: don't overwrite multi functio bit in pci header type., Isaku Yamahata, 2010/06/17
[Qemu-devel] Re: [PATCH 00/10] pci: pci to pci bridge clean up and enhancement, Michael S. Tsirkin, 2010/06/17