intdev.cc revision 6045:214461cb8abe
1/*
2 * Copyright (c) 2008 The Regents of The University of Michigan
3 * All rights reserved.
4 *
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.
15 *
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.
27 *
28 * Authors: Gabe Black
29 */
30
31#include "dev/x86/intdev.hh"
32
33void
34X86ISA::IntDev::IntPort::sendMessage(TriggerIntMessage message, bool timing)
35{
36    if (DeliveryMode::isReserved(message.deliveryMode)) {
37        fatal("Tried to use reserved delivery mode %d\n",
38                message.deliveryMode);
39    } else if (DTRACE(IntDev)) {
40        DPRINTF(IntDev, "Delivery mode is: %s.\n",
41                DeliveryMode::names[message.deliveryMode]);
42        DPRINTF(IntDev, "Vector is %#x.\n", message.vector);
43    }
44    if (message.destMode == 0) {
45        DPRINTF(IntDev,
46                "Sending interrupt to APIC ID %d.\n", message.destination);
47        PacketPtr pkt = buildIntRequest(message.destination, message);
48        if (timing)
49            sendMessageTiming(pkt, latency);
50        else
51            sendMessageAtomic(pkt);
52    } else {
53        DPRINTF(IntDev, "Sending interrupts to APIC IDs:"
54                "%s%s%s%s%s%s%s%s\n",
55                bits((int)message.destination, 0) ? " 0": "",
56                bits((int)message.destination, 1) ? " 1": "",
57                bits((int)message.destination, 2) ? " 2": "",
58                bits((int)message.destination, 3) ? " 3": "",
59                bits((int)message.destination, 4) ? " 4": "",
60                bits((int)message.destination, 5) ? " 5": "",
61                bits((int)message.destination, 6) ? " 6": "",
62                bits((int)message.destination, 7) ? " 7": ""
63                );
64        uint8_t dests = message.destination;
65        uint8_t id = 0;
66        while(dests) {
67            if (dests & 0x1) {
68                PacketPtr pkt = buildIntRequest(id, message);
69                if (timing)
70                    sendMessageTiming(pkt, latency);
71                else
72                    sendMessageAtomic(pkt);
73            }
74            dests >>= 1;
75            id++;
76        }
77    }
78}
79
80X86ISA::IntSourcePin *
81X86IntSourcePinParams::create()
82{
83    return new X86ISA::IntSourcePin(this);
84}
85
86X86ISA::IntSinkPin *
87X86IntSinkPinParams::create()
88{
89    return new X86ISA::IntSinkPin(this);
90}
91
92X86ISA::IntLine *
93X86IntLineParams::create()
94{
95    return new X86ISA::IntLine(this);
96}
97