From 62f5d7dd3ffbbb33e8371af589eaa69280bd017a Mon Sep 17 00:00:00 2001 From: Ali Saidi Date: Wed, 29 Mar 2006 17:37:25 -0500 Subject: move stuff around so PageShift is defined before it is needed don't ever include a file while in a namespace start of making alpha console new memsystem happy Make a BasePioDevice which is what all the simple Pio devices will inherit from add a description of when the data pointer will have memory arch/alpha/isa_traits.hh: don't ever include a file while in a namespace dev/alpha_console.cc: dev/alpha_console.hh: start of making alpha console new memsystem happy dev/io_device.cc: dev/io_device.hh: Make a BasePioDevice which is what all the simple Pio devices will inherit from mem/packet.hh: add a description of when the data pointer will have memory --HG-- extra : convert_revision : 495c0915541f9cad3eb42891e60b4ecbee7952bf --- dev/io_device.hh | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 3 deletions(-) (limited to 'dev/io_device.hh') 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: -- cgit v1.2.3