intdev.cc revision 6064:46d327d42036
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        }
53    } else {
54        DPRINTF(IntDev, "Sending interrupts to APIC IDs:"
55                "%s%s%s%s%s%s%s%s\n",
56                bits((int)message.destination, 0) ? " 0": "",
57                bits((int)message.destination, 1) ? " 1": "",
58                bits((int)message.destination, 2) ? " 2": "",
59                bits((int)message.destination, 3) ? " 3": "",
60                bits((int)message.destination, 4) ? " 4": "",
61                bits((int)message.destination, 5) ? " 5": "",
62                bits((int)message.destination, 6) ? " 6": "",
63                bits((int)message.destination, 7) ? " 7": ""
64                );
65        uint8_t dests = message.destination;
66        uint8_t id = 0;
67        while(dests) {
68            if (dests & 0x1) {
69                PacketPtr pkt = buildIntRequest(id, message);
70                if (timing)
71                    sendMessageTiming(pkt, latency);
72                else
73                    sendMessageAtomic(pkt);
74            }
75            dests >>= 1;
76            id++;
77        }
78    }
79}
80
81X86ISA::IntSourcePin *
82X86IntSourcePinParams::create()
83{
84    return new X86ISA::IntSourcePin(this);
85}
86
87X86ISA::IntSinkPin *
88X86IntSinkPinParams::create()
89{
90    return new X86ISA::IntSinkPin(this);
91}
92
93X86ISA::IntLine *
94X86IntLineParams::create()
95{
96    return new X86ISA::IntLine(this);
97}
98