aboutsummaryrefslogtreecommitdiff
path: root/hw/pci.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2011-08-04 17:15:22 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2011-08-04 17:15:22 -0500
commit81e34a2401f7ffd519bb7f093e833cb48734169f (patch)
tree146a7b6eebbee1367453fde501d4462ac6d9f8b4 /hw/pci.c
parente06516f565dca3636a4cbef770b191a5fcdf63ab (diff)
parentcb4b4fde82b064472c13fb9d983ca36a70e560aa (diff)
Merge remote-tracking branch 'mst/for_anthony' into staging
Diffstat (limited to 'hw/pci.c')
-rw-r--r--hw/pci.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/hw/pci.c b/hw/pci.c
index 36db58be76..8621d3d2b1 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -1145,8 +1145,7 @@ uint32_t pci_default_read_config(PCIDevice *d,
uint32_t address, int len)
{
uint32_t val = 0;
- assert(len == 1 || len == 2 || len == 4);
- len = MIN(len, pci_config_size(d) - address);
+
memcpy(&val, d->config + address, len);
return le32_to_cpu(val);
}
@@ -1154,9 +1153,8 @@ uint32_t pci_default_read_config(PCIDevice *d,
void pci_default_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int l)
{
int i, was_irq_disabled = pci_irq_disabled(d);
- uint32_t config_size = pci_config_size(d);
- for (i = 0; i < l && addr + i < config_size; val >>= 8, ++i) {
+ for (i = 0; i < l; val >>= 8, ++i) {
uint8_t wmask = d->wmask[addr + i];
uint8_t w1cmask = d->w1cmask[addr + i];
assert(!(wmask & w1cmask));