[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH V6 26/32] pci: use range helper functions.
From: |
Isaku Yamahata |
Subject: |
[Qemu-devel] [PATCH V6 26/32] pci: use range helper functions. |
Date: |
Fri, 30 Oct 2009 21:21:20 +0900 |
clean up pci_default_write_config() by the range helper functions.
Suggested by Michael S. Tsirkin <address@hidden>
Cc: Michael S. Tsirkin <address@hidden>
Signed-off-by: Isaku Yamahata <address@hidden>
---
hw/pci.c | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/hw/pci.c b/hw/pci.c
index 67133b6..d9fd564 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -699,19 +699,15 @@ uint32_t pci_default_read_config(PCIDevice *d,
void pci_default_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int l)
{
- uint8_t orig[PCI_CONFIG_SPACE_SIZE];
int i;
uint32_t config_size = pci_config_size(d);
- /* not efficient, but simple */
- memcpy(orig, d->config, PCI_CONFIG_SPACE_SIZE);
for(i = 0; i < l && addr < config_size; val >>= 8, ++i, ++addr) {
uint8_t wmask = d->wmask[addr];
d->config[addr] = (d->config[addr] & ~wmask) | (val & wmask);
}
- if (memcmp(orig + PCI_BASE_ADDRESS_0, d->config + PCI_BASE_ADDRESS_0, 24)
- || ((orig[PCI_COMMAND] ^ d->config[PCI_COMMAND])
- & (PCI_COMMAND_MEMORY | PCI_COMMAND_IO)))
+ if (ranges_overlap(addr, l, PCI_BASE_ADDRESS_0, 24) ||
+ range_covers_byte(addr, l, PCI_COMMAND))
pci_update_mappings(d);
}
--
1.6.0.2
- [Qemu-devel] [PATCH V6 11/32] pci: make pci_bar() aware of header type 1., (continued)
- [Qemu-devel] [PATCH V6 11/32] pci: make pci_bar() aware of header type 1., Isaku Yamahata, 2009/10/30
- [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 <=
- [Qemu-devel] [PATCH V6 03/32] pci: use PCI_SLOT() and PCI_FUNC()., Isaku Yamahata, 2009/10/30
- [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