[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH V5 26/29] pci: use helper function in pci_default_wr
From: |
Isaku Yamahata |
Subject: |
[Qemu-devel] [PATCH V5 26/29] pci: use helper function in pci_default_write_config() |
Date: |
Fri, 9 Oct 2009 15:28:59 +0900 |
use helper function in pci_default_write_config() to
check whether the configuration space is changed.
Signed-off-by: Isaku Yamahata <address@hidden>
---
hw/pci.c | 23 +++++++++--------------
hw/pci.h | 1 +
2 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/hw/pci.c b/hw/pci.c
index ece429f..37c2eed 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -692,21 +692,16 @@ 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)
||
- memcmp(orig + PCI_ROM_ADDRESS, d->config + PCI_ROM_ADDRESS, 4))
- || ((orig[PCI_COMMAND] ^ d->config[PCI_COMMAND])
- & (PCI_COMMAND_MEMORY | PCI_COMMAND_IO)))
+ struct pci_config_update update;
+
+ pci_write_config_init(&update, d, addr, val, l);
+ pci_write_config_update(&update);
+ if (pci_config_changed(&update,
+ PCI_BASE_ADDRESS_0, PCI_BASE_ADDRESS_5 + 4) ||
+ pci_config_changed_with_size(&update, PCI_ROM_ADDRESS, 4) ||
+ pci_config_changed_with_size(&update, PCI_COMMAND, 1)) {
pci_update_mappings(d);
+ }
}
void pci_dev_write_config(PCIDevice *pci_dev,
diff --git a/hw/pci.h b/hw/pci.h
index 2896b0e..59c65fc 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -112,6 +112,7 @@ typedef struct PCIIORegion {
#define PCI_HEADER_TYPE_CARDBUS 2
#define PCI_HEADER_TYPE_MULTI_FUNCTION 0x80
#define PCI_BASE_ADDRESS_0 0x10 /* 32 bits */
+#define PCI_BASE_ADDRESS_5 0x24 /* 32 bits */
#define PCI_BASE_ADDRESS_SPACE_IO 0x01
#define PCI_BASE_ADDRESS_SPACE_MEMORY 0x00
#define PCI_BASE_ADDRESS_MEM_TYPE_MASK 0x06
--
1.6.0.2
- [Qemu-devel] [PATCH V5 24/29] pci: fix pci_default_write_config(), (continued)
- [Qemu-devel] [PATCH V5 24/29] pci: fix pci_default_write_config(), Isaku Yamahata, 2009/10/09
- [Qemu-devel] [PATCH V5 25/29] pci: add helper functions for pci config write function., Isaku Yamahata, 2009/10/09
- [Qemu-devel] [PATCH V5 20/29] pci: move pci host stuff from pci.c to pci_host.c, Isaku Yamahata, 2009/10/09
- [Qemu-devel] [PATCH V5 06/29] pci: use helper functions to access pci config space., Isaku Yamahata, 2009/10/09
- [Qemu-devel] [PATCH V5 19/29] pci: split out ioport address parsing from pci configuration access logic., Isaku Yamahata, 2009/10/09
- [Qemu-devel] [PATCH V5 26/29] pci: use helper function in pci_default_write_config(),
Isaku Yamahata <=
- [Qemu-devel] [PATCH V5 13/29] pci: introduce pcibus_t to represent pci bus address/size instead of uint32_t, Isaku Yamahata, 2009/10/09
- [Qemu-devel] [PATCH V5 16/29] pci: 64bit bar support., Isaku Yamahata, 2009/10/09
[Qemu-devel] [PATCH V5 22/29] vmstate: add VMSTATE_ARRAY_POINTER for pointer to array., Isaku Yamahata, 2009/10/09
[Qemu-devel] [PATCH V5 23/29] pci: pcie host and mmcfg support., Isaku Yamahata, 2009/10/09