2 * Copyright (c) 2008 The Regents of The University of Michigan
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #ifndef __DEV_X86_INTDEV_HH__
32 #define __DEV_X86_INTDEV_HH__
37 #include "arch/x86/x86_traits.hh"
38 #include "arch/x86/intmessage.hh"
39 #include "mem/mem_object.hh"
40 #include "mem/mport.hh"
41 #include "sim/sim_object.hh"
42 #include "params/X86IntSourcePin.hh"
43 #include "params/X86IntSinkPin.hh"
44 #include "params/X86IntLine.hh"
51 class IntPort : public MessagePort
57 IntPort(const std::string &_name, MemObject * _parent,
58 IntDev *dev, Tick _latency) :
59 MessagePort(_name, _parent), device(dev), latency(_latency)
63 void getDeviceAddressRanges(AddrRangeList &resp, bool &snoop)
66 device->getIntAddrRange(resp);
69 Tick recvMessage(PacketPtr pkt)
71 return device->recvMessage(pkt);
74 // This is x86 focused, so if this class becomes generic, this would
75 // need to be moved into a subclass.
76 void sendMessage(TriggerIntMessage message, bool timing);
78 void recvStatusChange(Status status)
80 if (status == RangeChange) {
81 sendStatusChange(Port::RangeChange);
90 IntDev(MemObject * parent, Tick latency = 0)
93 intPort = new IntPort(parent->name() + ".int_port",
94 parent, this, latency);
104 signalInterrupt(int line)
106 panic("signalInterrupt not implemented.\n");
110 raiseInterruptPin(int number)
112 panic("raiseInterruptPin not implemented.\n");
116 lowerInterruptPin(int number)
118 panic("lowerInterruptPin not implemented.\n");
122 recvMessage(PacketPtr pkt)
124 panic("recvMessage not implemented.\n");
129 getIntAddrRange(AddrRangeList &range_list)
131 panic("intAddrRange not implemented.\n");
135 class IntSinkPin : public SimObject
141 typedef X86IntSinkPinParams Params;
146 return dynamic_cast<const Params *>(_params);
149 IntSinkPin(Params *p) : SimObject(p),
150 device(dynamic_cast<IntDev *>(p->device)), number(p->number)
156 class IntSourcePin : public SimObject
159 std::vector<IntSinkPin *> sinks;
162 typedef X86IntSourcePinParams Params;
167 return dynamic_cast<const Params *>(_params);
171 addSink(IntSinkPin *sink)
173 sinks.push_back(sink);
179 for (int i = 0; i < sinks.size(); i++) {
180 const IntSinkPin &pin = *sinks[i];
181 pin.device->raiseInterruptPin(pin.number);
188 for (int i = 0; i < sinks.size(); i++) {
189 const IntSinkPin &pin = *sinks[i];
190 pin.device->lowerInterruptPin(pin.number);
194 IntSourcePin(Params *p) : SimObject(p)
198 class IntLine : public SimObject
201 IntSourcePin *source;
205 typedef X86IntLineParams Params;
210 return dynamic_cast<const Params *>(_params);
213 IntLine(Params *p) : SimObject(p), source(p->source), sink(p->sink)
215 source->addSink(sink);
219 }; // namespace X86ISA
221 #endif //__DEV_X86_INTDEV_HH__