summaryrefslogtreecommitdiff
path: root/dev/pcidev.cc
diff options
context:
space:
mode:
authorAli Saidi <saidi@eecs.umich.edu>2004-02-05 15:12:33 -0500
committerAli Saidi <saidi@eecs.umich.edu>2004-02-05 15:12:33 -0500
commit77a30ed48daec8fa8db2aaf955eda4e2384df912 (patch)
tree8170250aca0261919bf38e1d1648886f5be398c0 /dev/pcidev.cc
parent09c40bfe4376d12b933116e17b8175f34a194f67 (diff)
downloadgem5-77a30ed48daec8fa8db2aaf955eda4e2384df912.tar.xz
fixed mapping of device memory and i/o space
--HG-- extra : convert_revision : 9236c7f0aeb4d555880bdfdfa7f55cedf1cbb950
Diffstat (limited to 'dev/pcidev.cc')
-rw-r--r--dev/pcidev.cc28
1 files changed, 23 insertions, 5 deletions
diff --git a/dev/pcidev.cc b/dev/pcidev.cc
index 13663b32c..342561750 100644
--- a/dev/pcidev.cc
+++ b/dev/pcidev.cc
@@ -47,6 +47,7 @@
#include "sim/builder.hh"
#include "sim/param.hh"
#include "sim/universe.hh"
+#include "dev/tsunamireg.h"
using namespace std;
@@ -176,21 +177,38 @@ PciDev::WriteConfig(int offset, int size, uint32_t data)
if(config.data[offset] & 0x1) {
*(uint32_t *)&config.data[offset] = (word_value & ~0x3) |
(config.data[offset] & 0x3);
- if (word_value) {
+
+ if (word_value & ~0x1) {
// It's never been set
if (BARAddrs[barnum] == 0)
- AddMapping(word_value, BARSize[barnum]-1, MMU);
+ AddMapping((word_value & ~0x1) + TSUNAMI_PCI0_IO,
+ BARSize[barnum]-1, MMU);
else
ChangeMapping(BARAddrs[barnum], BARSize[barnum]-1,
- word_value, BARSize[barnum]-1, MMU);
- BARAddrs[barnum] = word_value;
+ (word_value & ~0x1) + TSUNAMI_PCI0_IO,
+ BARSize[barnum]-1, MMU);
+ BARAddrs[barnum] = (word_value & ~0x1) + TSUNAMI_PCI0_IO;
}
} else {
// This is memory space, bottom four bits are read only
*(uint32_t *)&config.data[offset] = (word_value & ~0xF) |
(config.data[offset] & 0xF);
- }
+
+ if (word_value & ~0x3) {
+ // It's never been set
+ if (BARAddrs[barnum] == 0)
+ AddMapping((word_value & ~0x3) + TSUNAMI_PCI0_MEMORY,
+ BARSize[barnum]-1, MMU);
+ else
+ ChangeMapping(BARAddrs[barnum], BARSize[barnum]-1,
+ (word_value & ~0x3) +
+ TSUNAMI_PCI0_MEMORY,
+ BARSize[barnum]-1, MMU);
+ BARAddrs[barnum] = (word_value & ~0x3) +
+ TSUNAMI_PCI0_MEMORY;
+ }
+ }
}
break;