[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 16/20] pci: kill goto in pci_update_mappings()
From: |
Isaku Yamahata |
Subject: |
[Qemu-devel] [PATCH 16/20] pci: kill goto in pci_update_mappings() |
Date: |
Thu, 12 Nov 2009 14:58:44 +0900 |
This patch kills nasty goto in pci_update_mappings().
Signed-off-by: Isaku Yamahata <address@hidden>
---
hw/pci.c | 54 ++++++++++++++++++++++++++++--------------------------
1 files changed, 28 insertions(+), 26 deletions(-)
diff --git a/hw/pci.c b/hw/pci.c
index cae3d53..2eff7fe 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -756,35 +756,37 @@ static void pci_update_mappings(PCIDevice *d)
new_addr = pci_get_long(d->config + pci_bar(d, i));
}
/* the ROM slot has a specific enable bit */
- if (i == PCI_ROM_SLOT && !(new_addr & PCI_ROM_ADDRESS_ENABLE))
- goto no_mem_map;
- new_addr = new_addr & ~(r->size - 1);
- last_addr = new_addr + r->size - 1;
- /* NOTE: we do not support wrapping */
- /* XXX: as we cannot support really dynamic
- mappings, we handle specific values as invalid
- mappings. */
- if (last_addr <= new_addr || new_addr == 0 ||
- last_addr == PCI_BAR_UNMAPPED ||
-
- /* Now pcibus_t is 64bit.
- * Check if 32 bit BAR wrap around explicitly.
- * Without this, PC ide doesn't work well.
- * TODO: remove this work around.
- */
- (!(r->type & PCI_BASE_ADDRESS_MEM_TYPE_64) &&
- last_addr >= UINT32_MAX) ||
-
- /*
- * OS is allowed to set BAR beyond its addressable
- * bits. For example, 32 bit OS can set 64bit bar
- * to >4G. Check it.
- */
- last_addr >= TARGET_PHYS_ADDR_MAX) {
+ if (i == PCI_ROM_SLOT &&
+ !(new_addr & PCI_ROM_ADDRESS_ENABLE)) {
new_addr = PCI_BAR_UNMAPPED;
+ } else {
+ new_addr = new_addr & ~(r->size - 1);
+ last_addr = new_addr + r->size - 1;
+ /* NOTE: we do not support wrapping */
+ /* XXX: as we cannot support really dynamic
+ mappings, we handle specific values as invalid
+ mappings. */
+ if (last_addr <= new_addr || new_addr == 0 ||
+ last_addr == PCI_BAR_UNMAPPED ||
+
+ /* Now pcibus_t is 64bit.
+ * Check if 32 bit BAR wrap around explicitly.
+ * Without this, PC ide doesn't work well.
+ * TODO: remove this work around.
+ */
+ (!(r->type & PCI_BASE_ADDRESS_MEM_TYPE_64) &&
+ last_addr >= UINT32_MAX) ||
+
+ /*
+ * OS is allowed to set BAR beyond its addressable
+ * bits. For example, 32 bit OS can set 64bit bar
+ * to >4G. Check it.
+ */
+ last_addr >= TARGET_PHYS_ADDR_MAX) {
+ new_addr = PCI_BAR_UNMAPPED;
+ }
}
} else {
- no_mem_map:
new_addr = PCI_BAR_UNMAPPED;
}
}
--
1.6.0.2
- [Qemu-devel] Re: [PATCH 03/20] pci: simplify pci_data_read(), pcie_mmcfg_data_read()., (continued)
- [Qemu-devel] [PATCH 05/20] pci: rename pci_addr_to_dev(), pcie_mmcfg_addr_to_dev()., Isaku Yamahata, 2009/11/12
- [Qemu-devel] [PATCH 11/20] pci: clean up of pci_init_wmask()., Isaku Yamahata, 2009/11/12
- [Qemu-devel] [PATCH 07/20] pci: remove pci_sub_bus() by open coding., Isaku Yamahata, 2009/11/12
- [Qemu-devel] [PATCH 18/20] pci: fix pci_config_get_io_base()., Isaku Yamahata, 2009/11/12
- [Qemu-devel] [PATCH 16/20] pci: kill goto in pci_update_mappings(),
Isaku Yamahata <=
- [Qemu-devel] [PATCH 14/20] pci: remove unused constants., Isaku Yamahata, 2009/11/12
- [Qemu-devel] [PATCH 19/20] pci: pci bridge related clean up., Isaku Yamahata, 2009/11/12
- [Qemu-devel] [PATCH 13/20] pci: move typedef, PCIHostState, PCIExpressHost to qemu-common.h., Isaku Yamahata, 2009/11/12