summaryrefslogtreecommitdiff
path: root/dev/pciconfigall.hh
diff options
context:
space:
mode:
authorAli Saidi <saidi@eecs.umich.edu>2004-05-30 17:45:46 -0400
committerAli Saidi <saidi@eecs.umich.edu>2004-05-30 17:45:46 -0400
commit9d0aa1399157bd90436409a7596377b4591a2d4a (patch)
tree1b2fb62a8ce54801572ca863cdf16d566633ef1f /dev/pciconfigall.hh
parentac27e69ef9e8d0791bd62f2f912f51f22529a32b (diff)
downloadgem5-9d0aa1399157bd90436409a7596377b4591a2d4a.tar.xz
Cleaned up and commented code. I think we are ready to merge with head.
dev/baddev.hh: dev/pcidev.hh: dev/tsunami.hh: dev/tsunami_cchip.hh: dev/tsunami_io.hh: dev/tsunami_pchip.hh: Added doxygen comments dev/pciconfigall.hh: Added doxygen comments. Made the hlist of devices private and provided members to modify the data. dev/pcidev.cc: updated for change in pciconfigall dev/tsunami_pchip.cc: Deleted commented out code we don't need kern/linux/linux_syscalls.cc: Simplified the number -> name conversion. kern/linux/linux_syscalls.hh: Removed StandardNumber and replaced with Number. kern/linux/linux_system.cc: kern/linux/linux_system.hh: LinuxSkipIdeDelay50msEvent was simply the same as the SkipFunc event, so I removed it. Same with with LinuxSkipFuncEvent. --HG-- extra : convert_revision : 1508c335f87d90373f5772f3a0407ea13e858d7e
Diffstat (limited to 'dev/pciconfigall.hh')
-rw-r--r--dev/pciconfigall.hh60
1 files changed, 55 insertions, 5 deletions
diff --git a/dev/pciconfigall.hh b/dev/pciconfigall.hh
index 6df1e2fe7..6a31a9e73 100644
--- a/dev/pciconfigall.hh
+++ b/dev/pciconfigall.hh
@@ -37,8 +37,8 @@
#include "mem/functional_mem/functional_memory.hh"
#include "dev/pcireg.h"
-#define MAX_PCI_DEV 32
-#define MAX_PCI_FUNC 8
+static const uint32_t MAX_PCI_DEV = 32;
+static const uint32_t MAX_PCI_FUNC = 8;
class PciDev;
@@ -55,22 +55,72 @@ class PciConfigAll : public FunctionalMemory
Addr addr;
static const Addr size = 0xffffff;
- public:
/**
* Pointers to all the devices that are registered with this
* particular config space.
*/
PciDev* devices[MAX_PCI_DEV][MAX_PCI_FUNC];
+ public:
/**
- * The default constructor.
- */
+ * Constructor for PCIConfigAll
+ * @param name name of the object
+ * @param a base address of the write
+ * @param mmu the memory controller
+ */
PciConfigAll(const std::string &name, Addr a, MemoryController *mmu);
+
+ /**
+ * Check if a device exists.
+ * @param pcidev PCI device to check
+ * @param pcifunc PCI function to check
+ * @return true if device exists, false otherwise
+ */
+ bool deviceExists(uint32_t pcidev, uint32_t pcifunc)
+ { return devices[pcidev][pcifunc] != NULL ? true : false; }
+
+ /**
+ * Registers a device with the config space object.
+ * @param pcidev PCI device to register
+ * @param pcifunc PCI function to register
+ * @param device device to register
+ */
+ void registerDevice(uint8_t pcidev, uint8_t pcifunc, PciDev *device)
+ { devices[pcidev][pcifunc] = device; }
+
+ /**
+ * Read something in PCI config space. If the device does not exist
+ * -1 is returned, if the device does exist its PciDev::ReadConfig (or the
+ * virtual function that overrides) it is called.
+ * @param req Contains the address of the field to read.
+ * @param data Return the field read.
+ * @return The fault condition of the access.
+ */
virtual Fault read(MemReqPtr &req, uint8_t *data);
+
+ /**
+ * Write to PCI config spcae. If the device does not exit the simulator
+ * panics. If it does it is passed on the PciDev::WriteConfig (or the virtual
+ * function that overrides it).
+ * @param req Contains the address to write to.
+ * @param data The data to write.
+ * @return The fault condition of the access.
+ */
+
virtual Fault write(MemReqPtr &req, const uint8_t *data);
+ /**
+ * Serialize this object to the given output stream.
+ * @param os The stream to serialize to.
+ */
virtual void serialize(std::ostream &os);
+
+ /**
+ * Reconstruct the state of this object from a checkpoint.
+ * @param cp The checkpoint use.
+ * @param section The section name of this object
+ */
virtual void unserialize(Checkpoint *cp, const std::string &section);
};