Merge zizzer:/bk/m5
[gem5.git] / dev / baddev.hh
index 29fc5f44d766110c282cceeb00fd121eea470c08..b7b67e31afcd88a5f316dac6f8a19c283dd04f43 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003 The Regents of The University of Michigan
+ * Copyright (c) 2004-2005 The Regents of The University of Michigan
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-/* @file
+/** @file
  * This devices just panics when touched. For example if you have a
  * kernel that touches the frame buffer which isn't allowed.
  */
 
-#ifndef __BADDEV_HH__
-#define __BADDEV_HH__
+#ifndef __DEV_BADDEV_HH__
+#define __DEV_BADDEV_HH__
 
-#include "mem/functional_mem/mmap_device.hh"
+#include "base/range.hh"
+#include "dev/io_device.hh"
 
 /**
  * BadDevice
  * the user that the kernel they are running has unsupported
  * options (i.e. frame buffer)
  */
-class BadDevice : public MmapDevice
+class BadDevice : public PioDevice
 {
   private:
+    Addr addr;
+    static const Addr size = 0xf;
 
-      std::string devname;
-  protected:
+    std::string devname;
 
   public:
-    /**
-      * The default constructor.
+     /**
+      * Constructor for the Baddev Class.
+      * @param name name of the object
+      * @param a base address of the write
+      * @param mmu the memory controller
+      * @param hier object to store parameters universal the device hierarchy
+      * @param bus The bus that this device is attached to
+      * @param devicename device that is not implemented
       */
-    BadDevice(const std::string &name, Addr addr, Addr mask,
-              MemoryController *mmu, const std::string &devicename);
+    BadDevice(const std::string &name, Addr a, MemoryController *mmu,
+              HierParams *hier, Bus *bus, const std::string &devicename);
 
-    virtual Fault read(MemReqPtr &req, uint8_t *data);
-    virtual Fault write(MemReqPtr &req, const uint8_t *data);
+    /**
+      * On a read event we just panic aand hopefully print a
+      * meaningful error message.
+      * @param req Contains the address to read from.
+      * @param data A pointer to write the read data to.
+      * @return The fault condition of the access.
+      */
+    virtual Fault * read(MemReqPtr &req, uint8_t *data);
 
+    /**
+      * On a write event we just panic aand hopefully print a
+      * meaningful error message.
+      * @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);
 
+    /**
+     * Return how long this access will take.
+     * @param req the memory request to calcuate
+     * @return Tick when the request is done
+     */
+    Tick cacheAccess(MemReqPtr &req);
 };
 
-#endif // __BADDEV_HH__
+#endif // __DEV_BADDEV_HH__