diff options
author | Nathan Binkert <binkertn@umich.edu> | 2004-11-13 17:05:13 -0500 |
---|---|---|
committer | Nathan Binkert <binkertn@umich.edu> | 2004-11-13 17:05:13 -0500 |
commit | 9f8db6f4465c57b949504ecc2d4b5e321c4e3602 (patch) | |
tree | 057baf9eaf51f31056e6fbfb5557e57de199971b | |
parent | 4760ae46c6f9236bc5c5b45be9f9b059e6594958 (diff) | |
download | gem5-9f8db6f4465c57b949504ecc2d4b5e321c4e3602.tar.xz |
don't handle device specific configuration stuff in the base
class. While we're at it, very minor formatting.
--HG--
extra : convert_revision : b7c719f92ece7234838434294b33833289adbada
-rw-r--r-- | dev/pcidev.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/dev/pcidev.cc b/dev/pcidev.cc index 0c64bcb94..d156b6a02 100644 --- a/dev/pcidev.cc +++ b/dev/pcidev.cc @@ -72,6 +72,9 @@ PciDev::PciDev(Params *p) void PciDev::ReadConfig(int offset, int size, uint8_t *data) { + if (offset >= PCI_DEVICE_SPECIFIC) + panic("Device specific PCI config space not implemented!\n"); + switch(size) { case sizeof(uint32_t): memcpy((uint8_t*)data, config.data + offset, sizeof(uint32_t)); @@ -107,6 +110,9 @@ PciDev::ReadConfig(int offset, int size, uint8_t *data) void PciDev::WriteConfig(int offset, int size, uint32_t data) { + if (offset >= PCI_DEVICE_SPECIFIC) + panic("Device specific PCI config space not implemented!\n"); + uint32_t barnum; union { @@ -181,7 +187,8 @@ PciDev::WriteConfig(int offset, int size, uint32_t data) // This is I/O Space, bottom two bits are read only if(htoa(config.data[offset]) & 0x1) { - *(uint32_t *)&config.data[offset] = htoa((word_value & ~0x3) | + *(uint32_t *)&config.data[offset] = + htoa((word_value & ~0x3) | (htoa(config.data[offset]) & 0x3)); if (word_value & ~0x1) { @@ -203,7 +210,8 @@ PciDev::WriteConfig(int offset, int size, uint32_t data) } else { // This is memory space, bottom four bits are read only - *(uint32_t *)&config.data[offset] = htoa((word_value & ~0xF) | + *(uint32_t *)&config.data[offset] = + htoa((word_value & ~0xF) | (htoa(config.data[offset]) & 0xF)); if (word_value & ~0x3) { |