base: add the FmtStackTrace debug option
[gem5.git] / src / dev / x86 / i8254.hh
index 49ea271e94ea9f0578f0c9a5253c536f35f16277..084da8ed7523a3b383cf58c26ed7a44d6860c0dd 100644 (file)
 #define __DEV_X86_I8254_HH__
 
 #include "dev/intel_8254_timer.hh"
+#include "dev/intpin.hh"
 #include "dev/io_device.hh"
 #include "params/I8254.hh"
 
 namespace X86ISA
 {
 
-class IntSourcePin;
-
 class I8254 : public BasicPioDevice
 {
   protected:
@@ -61,16 +60,25 @@ class I8254 : public BasicPioDevice
         {}
     };
 
-    
+
     X86Intel8254Timer pit;
 
-    IntSourcePin *intPin;
-    
+    std::vector<IntSourcePin<I8254> *> intPin;
+
     void counterInterrupt(unsigned int num);
 
   public:
     typedef I8254Params Params;
 
+    Port &
+    getPort(const std::string &if_name, PortID idx=InvalidPortID) override
+    {
+        if (if_name == "int_pin")
+            return *intPin.at(idx);
+        else
+            return BasicPioDevice::getPort(if_name, idx);
+    }
+
     const Params *
     params() const
     {
@@ -78,12 +86,16 @@ class I8254 : public BasicPioDevice
     }
 
     I8254(Params *p) : BasicPioDevice(p, 4), latency(p->pio_latency),
-            pit(p->name, this), intPin(p->int_pin)
+            pit(p->name, this)
     {
+        for (int i = 0; i < p->port_int_pin_connection_count; i++) {
+            intPin.push_back(new IntSourcePin<I8254>(csprintf(
+                            "%s.int_pin[%d]", name(), i), i, this));
+        }
     }
-    Tick read(PacketPtr pkt);
+    Tick read(PacketPtr pkt) override;
 
-    Tick write(PacketPtr pkt);
+    Tick write(PacketPtr pkt) override;
 
     bool
     outputHigh(unsigned int num)
@@ -109,8 +121,10 @@ class I8254 : public BasicPioDevice
         pit.writeControl(val);
     }
 
-    virtual void serialize(std::ostream &os);
-    virtual void unserialize(Checkpoint *cp, const std::string &section);
+    void serialize(CheckpointOut &cp) const override;
+    void unserialize(CheckpointIn &cp) override;
+
+    void startup() override;
 
 };