summaryrefslogtreecommitdiff
path: root/dev/io_device.hh
diff options
context:
space:
mode:
authorAli Saidi <saidi@eecs.umich.edu>2006-03-29 17:37:41 -0500
committerAli Saidi <saidi@eecs.umich.edu>2006-03-29 17:37:41 -0500
commit35faf09bcce4eaac5d6899d7e371b2506d1b256f (patch)
treead93a7953130d4be1e911a469452b7f8e3f5ee6a /dev/io_device.hh
parentd46d3d6811822d218c137cd6d991e6b4981811d6 (diff)
parent62f5d7dd3ffbbb33e8371af589eaa69280bd017a (diff)
downloadgem5-35faf09bcce4eaac5d6899d7e371b2506d1b256f.tar.xz
Merge zizzer:/bk/newmem
into zeep.eecs.umich.edu:/z/saidi/work/m5.newmem --HG-- extra : convert_revision : 5ab4ce9f6ec7af326d8906060ae3558cfd67ca08
Diffstat (limited to 'dev/io_device.hh')
-rw-r--r--dev/io_device.hh53
1 files changed, 50 insertions, 3 deletions
diff --git a/dev/io_device.hh b/dev/io_device.hh
index ba16372cc..e2565cfdc 100644
--- a/dev/io_device.hh
+++ b/dev/io_device.hh
@@ -192,20 +192,40 @@ class PioDevice : public SimObject
/** Pure virtual function that the device must implement. Called when a read
* command is recieved by the port. */
- virtual bool read(Packet &pkt) = 0;
+ virtual Tick read(Packet &pkt) = 0;
/** Pure virtual function that the device must implement. Called when a
* write command is recieved by the port. */
- virtual bool write(Packet &pkt) = 0;
+ virtual Tick write(Packet &pkt) = 0;
public:
- PioDevice(const std::string &name, Platform *p);
+ /** Params struct which is extended through each device based on the
+ * parameters it needs. Since we are re-writing everything, we might as well
+ * start from the bottom this time. */
+
+ struct Params
+ {
+ std::string name;
+ Platform *platform;
+ };
+ protected:
+ Params *_params;
+
+ public:
+ const Params *params() const { return _params; }
+
+ PioDevice(Params *params)
+ : SimObject(params()->name), platform(params()->platform)
+ {}
virtual ~PioDevice();
virtual Port *getPort(const std::string &if_name)
{
if (if_name == "pio")
+ if (pioPort != NULL)
+ panic("pio port already connected to.");
+ pioPort = new PioPort(this, params()->platform);
return pioPort;
else
return NULL;
@@ -214,6 +234,33 @@ class PioDevice : public SimObject
};
+class BasicPioDevice : public PioDevice
+{
+ public:
+ struct Params
+ {
+ Addr pio_addr;
+ Tick pio_delay;
+ };
+
+ protected:
+ /** Address that the device listens to. */
+ Addr pioAddr;
+
+ /** Size that the device's address range. */
+ Addr pioSize = 0;
+
+ /** Delay that the device experinces on an access. */
+ Tick pioDelay;
+
+ public:
+ BasePioDevice(Params *p)
+ : PioDevice(p), pioAddr(p->pio_addr), pioDelay(p->pioDelay)
+ {}
+
+ virtual void addressRanges(AddrRangeList &range_list, bool &owner);
+};
+
class DmaDevice : public PioDevice
{
protected: