#ifndef __DEV_X86_INTDEV_HH__
#define __DEV_X86_INTDEV_HH__
-#include <assert.h>
+#include <cassert>
+#include <list>
#include <string>
+#include "arch/x86/intmessage.hh"
#include "arch/x86/x86_traits.hh"
#include "mem/mem_object.hh"
#include "mem/mport.hh"
+#include "params/X86IntLine.hh"
+#include "params/X86IntSinkPin.hh"
+#include "params/X86IntSourcePin.hh"
#include "sim/sim_object.hh"
-#include "params/X86IntPin.hh"
namespace X86ISA {
+typedef std::list<int> ApicList;
+
class IntDev
{
protected:
{
}
- void getDeviceAddressRanges(AddrRangeList &resp, bool &snoop)
+ AddrRangeList getAddrRanges()
{
- snoop = false;
- device->getIntAddrRange(resp);
+ return device->getIntAddrRange();
}
Tick recvMessage(PacketPtr pkt)
return device->recvMessage(pkt);
}
- void recvStatusChange(Status status)
+ Tick recvResponse(PacketPtr pkt)
{
- if (status == RangeChange) {
- sendStatusChange(Port::RangeChange);
- }
+ return device->recvResponse(pkt);
}
+ // This is x86 focused, so if this class becomes generic, this would
+ // need to be moved into a subclass.
+ void sendMessage(ApicList apics,
+ TriggerIntMessage message, bool timing);
};
IntPort * intPort;
IntDev(MemObject * parent, Tick latency = 0)
{
if (parent != NULL) {
- intPort = new IntPort(parent->name() + ".int_port",
+ intPort = new IntPort(parent->name() + ".int_master",
parent, this, latency);
} else {
intPort = NULL;
virtual ~IntDev()
{}
+ virtual void init();
+
virtual void
signalInterrupt(int line)
{
panic("signalInterrupt not implemented.\n");
}
+ virtual void
+ raiseInterruptPin(int number)
+ {
+ panic("raiseInterruptPin not implemented.\n");
+ }
+
+ virtual void
+ lowerInterruptPin(int number)
+ {
+ panic("lowerInterruptPin not implemented.\n");
+ }
+
virtual Tick
recvMessage(PacketPtr pkt)
{
return 0;
}
- virtual void
- getIntAddrRange(AddrRangeList &range_list)
+ virtual Tick
+ recvResponse(PacketPtr pkt)
+ {
+ return 0;
+ }
+
+ virtual AddrRangeList
+ getIntAddrRange()
{
panic("intAddrRange not implemented.\n");
}
};
-class IntPin : public SimObject
+class IntSinkPin : public SimObject
{
- protected:
+ public:
IntDev * device;
- int line;
+ int number;
- public:
- typedef X86IntPinParams Params;
+ typedef X86IntSinkPinParams Params;
+
+ const Params *
+ params() const
+ {
+ return dynamic_cast<const Params *>(_params);
+ }
- IntDev *
- getDevice() const
+ IntSinkPin(Params *p) : SimObject(p),
+ device(dynamic_cast<IntDev *>(p->device)), number(p->number)
{
- return device;
+ assert(device);
}
+};
+
+class IntSourcePin : public SimObject
+{
+ protected:
+ std::vector<IntSinkPin *> sinks;
+
+ public:
+ typedef X86IntSourcePinParams Params;
const Params *
params() const
return dynamic_cast<const Params *>(_params);
}
- IntPin(Params *p) : SimObject(p),
- device(dynamic_cast<IntDev *>(p->device)), line(p->line)
+ void
+ addSink(IntSinkPin *sink)
{
- assert(device);
+ sinks.push_back(sink);
}
void
- signalInterrupt()
+ raise()
+ {
+ for (int i = 0; i < sinks.size(); i++) {
+ const IntSinkPin &pin = *sinks[i];
+ pin.device->raiseInterruptPin(pin.number);
+ }
+ }
+
+ void
+ lower()
+ {
+ for (int i = 0; i < sinks.size(); i++) {
+ const IntSinkPin &pin = *sinks[i];
+ pin.device->lowerInterruptPin(pin.number);
+ }
+ }
+
+ IntSourcePin(Params *p) : SimObject(p)
+ {}
+};
+
+class IntLine : public SimObject
+{
+ protected:
+ IntSourcePin *source;
+ IntSinkPin *sink;
+
+ public:
+ typedef X86IntLineParams Params;
+
+ const Params *
+ params() const
+ {
+ return dynamic_cast<const Params *>(_params);
+ }
+
+ IntLine(Params *p) : SimObject(p), source(p->source), sink(p->sink)
{
- device->signalInterrupt(line);
+ source->addSink(sink);
}
};
-}; // namespace X86ISA
+} // namespace X86ISA
#endif //__DEV_X86_INTDEV_HH__