[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH V6 03/32] pci: use PCI_SLOT() and PCI_FUNC().
From: |
Isaku Yamahata |
Subject: |
[Qemu-devel] [PATCH V6 03/32] pci: use PCI_SLOT() and PCI_FUNC(). |
Date: |
Fri, 30 Oct 2009 21:20:57 +0900 |
use PCI_SLOT() and PCI_FUNC() where appropriate instead of
direct use of bit operation.
Signed-off-by: Isaku Yamahata <address@hidden>
Acked-by: Michael S. Tsirkin <address@hidden>
---
hw/apb_pci.c | 10 ++++++----
hw/pci.c | 4 ++--
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/hw/apb_pci.c b/hw/apb_pci.c
index 43be7ce..1ea3e0d 100644
--- a/hw/apb_pci.c
+++ b/hw/apb_pci.c
@@ -261,11 +261,13 @@ PCIBus *pci_apb_init(target_phys_addr_t special_base,
0, 32);
pci_create_simple(d->host_state.bus, 0, "pbm");
/* APB secondary busses */
- *bus2 = pci_bridge_init(d->host_state.bus, 8, PCI_VENDOR_ID_SUN,
- PCI_DEVICE_ID_SUN_SIMBA, pci_apb_map_irq,
+ *bus2 = pci_bridge_init(d->host_state.bus, PCI_DEVFN(1, 0),
+ PCI_VENDOR_ID_SUN, PCI_DEVICE_ID_SUN_SIMBA,
+ pci_apb_map_irq,
"Advanced PCI Bus secondary bridge 1");
- *bus3 = pci_bridge_init(d->host_state.bus, 9, PCI_VENDOR_ID_SUN,
- PCI_DEVICE_ID_SUN_SIMBA, pci_apb_map_irq,
+ *bus3 = pci_bridge_init(d->host_state.bus, PCI_DEVFN(1, 1),
+ PCI_VENDOR_ID_SUN, PCI_DEVICE_ID_SUN_SIMBA,
+ pci_apb_map_irq,
"Advanced PCI Bus secondary bridge 2");
return d->host_state.bus;
diff --git a/hw/pci.c b/hw/pci.c
index e21098b..ce3329b 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -745,7 +745,7 @@ static void pci_info_device(PCIDevice *d)
const pci_class_desc *desc;
monitor_printf(mon, " Bus %2d, device %3d, function %d:\n",
- d->bus->bus_num, d->devfn >> 3, d->devfn & 7);
+ d->bus->bus_num, PCI_SLOT(d->devfn), PCI_FUNC(d->devfn));
class = le16_to_cpu(*((uint16_t *)(d->config + PCI_CLASS_DEVICE)));
monitor_printf(mon, " ");
desc = pci_class_descriptions;
@@ -1111,7 +1111,7 @@ static void pcibus_dev_print(Monitor *mon, DeviceState
*dev, int indent)
monitor_printf(mon, "%*sclass %s, addr %02x:%02x.%x, "
"pci id %04x:%04x (sub %04x:%04x)\n",
indent, "", ctxt,
- d->bus->bus_num, d->devfn >> 3, d->devfn & 7,
+ d->bus->bus_num, PCI_SLOT(d->devfn), PCI_FUNC(d->devfn),
le16_to_cpu(*((uint16_t *)(d->config + PCI_VENDOR_ID))),
le16_to_cpu(*((uint16_t *)(d->config + PCI_DEVICE_ID))),
le16_to_cpu(*((uint16_t *)(d->config +
PCI_SUBSYSTEM_VENDOR_ID))),
--
1.6.0.2
- [Qemu-devel] [PATCH V6 17/32] pci: 64bit bar support., (continued)
- [Qemu-devel] [PATCH V6 17/32] pci: 64bit bar support., Isaku Yamahata, 2009/10/30
- [Qemu-devel] [PATCH V6 16/32] pci: typedef pcibus_t as uint64_t instead of uint32_t., Isaku Yamahata, 2009/10/30
- [Qemu-devel] [PATCH V6 02/32] pci: introduce constant PCI_NUM_PINS for the number of interrupt pins, 4., Isaku Yamahata, 2009/10/30
- [Qemu-devel] [PATCH V6 14/32] pci: introduce pcibus_t to represent pci bus address/size instead of uint32_t, Isaku Yamahata, 2009/10/30
- [Qemu-devel] [PATCH V6 15/32] pci: introduce FMT_PCIBUS for printf format for pcibus_t., Isaku Yamahata, 2009/10/30
- [Qemu-devel] [PATCH V6 01/32] pci: fix PCI_DPRINTF() wrt variadic macro., Isaku Yamahata, 2009/10/30
- [Qemu-devel] [PATCH V6 18/32] pci: remove bus_num member from struct PCIBus., Isaku Yamahata, 2009/10/30
- [Qemu-devel] [PATCH V6 21/32] pci: move pci host stuff from pci.c to pci_host.c, Isaku Yamahata, 2009/10/30
- [Qemu-devel] [PATCH V6 27/32] pci: teach pci_default_config_write() ROM bar for normal/bridge device ., Isaku Yamahata, 2009/10/30
- [Qemu-devel] [PATCH V6 26/32] pci: use range helper functions., Isaku Yamahata, 2009/10/30
- [Qemu-devel] [PATCH V6 03/32] pci: use PCI_SLOT() and PCI_FUNC().,
Isaku Yamahata <=
- [Qemu-devel] [PATCH V6 09/32] pci: s/PCI_ADDRESS_SPACE_/PCI_BASE_ADDRESS_SPACE_/ to match pci_regs.h, Isaku Yamahata, 2009/10/30
- [Qemu-devel] [PATCH V6 12/32] pci_host.h: move functions in pci_host.h into .c file., Isaku Yamahata, 2009/10/30
- [Qemu-devel] [PATCH V6 04/32] pci: define a constant to represent a unmapped bar and use it., Isaku Yamahata, 2009/10/30
- [Qemu-devel] [PATCH V6 29/32] pci: cosmetic on pci_upadte_mappings(), Isaku Yamahata, 2009/10/30
- [Qemu-devel] [PATCH V6 22/32] pci_host: change the signature of pci_data_{read, write}., Isaku Yamahata, 2009/10/30
- [Qemu-devel] [PATCH V6 13/32] pci_host: consolidate pci config address access., Isaku Yamahata, 2009/10/30
- [Qemu-devel] [PATCH V6 23/32] vmstate: introduce VMSTATE_BUFFER_UNSAFE_INFO., Isaku Yamahata, 2009/10/30
- [Qemu-devel] [PATCH V6 24/32] pci: pcie host and mmcfg support., Isaku Yamahata, 2009/10/30
- [Qemu-devel] [PATCH V6 07/32] pci/bridge: clean up of pci_bridge_initfn(), Isaku Yamahata, 2009/10/30
- [Qemu-devel] [PATCH V6 31/32] pci: implement pci bridge filtering., Isaku Yamahata, 2009/10/30