X86: Make code that sends an interrupt from the IO APIC available for IPIs.
authorGabe Black <gblack@eecs.umich.edu>
Sun, 19 Apr 2009 09:42:19 +0000 (02:42 -0700)
committerGabe Black <gblack@eecs.umich.edu>
Sun, 19 Apr 2009 09:42:19 +0000 (02:42 -0700)
src/dev/x86/SConscript
src/dev/x86/i82094aa.cc
src/dev/x86/intdev.cc
src/dev/x86/intdev.hh

index e7543dfdf27ef27a96bb9eda58012a7e11124559..37b292f00a6f7076946f9cfb97a6dab540ad94d8 100644 (file)
@@ -67,3 +67,4 @@ if env['FULL_SYSTEM'] and env['TARGET_ISA'] == 'x86':
 
     SimObject('X86IntPin.py')
     Source('intdev.cc')
+    TraceFlag('IntDev')
index d160fcb2491524dd670e8330c6966530cdcf4c29..2656a21f90791b192cc4c6fb0514cc7c44e4075b 100644 (file)
@@ -162,54 +162,7 @@ X86ISA::I82094AA::signalInterrupt(int line)
         message.destMode = entry.destMode;
         message.level = entry.polarity;
         message.trigger = entry.trigger;
-
-        if (DeliveryMode::isReserved(entry.deliveryMode)) {
-            fatal("Tried to use reserved delivery mode "
-                    "for IO APIC entry %d.\n", line);
-        } else if (DTRACE(I82094AA)) {
-            DPRINTF(I82094AA, "Delivery mode is: %s.\n",
-                    DeliveryMode::names[entry.deliveryMode]);
-            DPRINTF(I82094AA, "Vector is %#x.\n", message.vector);
-        }
-
-        if (entry.destMode == 0) {
-            DPRINTF(I82094AA,
-                    "Sending interrupt to APIC ID %d.\n", entry.dest);
-            PacketPtr pkt = buildIntRequest(entry.dest, message);
-            if (sys->getMemoryMode() == Enums::timing)
-                intPort->sendMessageTiming(pkt, latency);
-            else if (sys->getMemoryMode() == Enums::atomic)
-                intPort->sendMessageAtomic(pkt);
-            else
-                panic("Unrecognized memory mode.\n");
-        } else {
-            DPRINTF(I82094AA, "Sending interrupts to APIC IDs:"
-                    "%s%s%s%s%s%s%s%s\n",
-                    bits((int)entry.dest, 0) ? " 0": "",
-                    bits((int)entry.dest, 1) ? " 1": "",
-                    bits((int)entry.dest, 2) ? " 2": "",
-                    bits((int)entry.dest, 3) ? " 3": "",
-                    bits((int)entry.dest, 4) ? " 4": "",
-                    bits((int)entry.dest, 5) ? " 5": "",
-                    bits((int)entry.dest, 6) ? " 6": "",
-                    bits((int)entry.dest, 7) ? " 7": ""
-                    );
-            uint8_t dests = entry.dest;
-            uint8_t id = 0;
-            while(dests) {
-                if (dests & 0x1) {
-                    PacketPtr pkt = buildIntRequest(id, message);
-                    if (sys->getMemoryMode() == Enums::timing)
-                        intPort->sendMessageTiming(pkt, latency);
-                    else if (sys->getMemoryMode() == Enums::atomic)
-                        intPort->sendMessageAtomic(pkt);
-                    else
-                        panic("Unrecognized memory mode.\n");
-                }
-                dests >>= 1;
-                id++;
-            }
-        }
+        intPort->sendMessage(message, sys->getMemoryMode() == Enums::timing);
     }
 }
 
index e386687a977b986da20b89ba4871c6a361345ba8..3b29eb7bf76e1985abf48bbccc04f8656b4b7e53 100644 (file)
 
 #include "dev/x86/intdev.hh"
 
+void
+X86ISA::IntDev::IntPort::sendMessage(TriggerIntMessage message, bool timing)
+{
+    if (DeliveryMode::isReserved(message.deliveryMode)) {
+        fatal("Tried to use reserved delivery mode %d\n",
+                message.deliveryMode);
+    } else if (DTRACE(IntDev)) {
+        DPRINTF(IntDev, "Delivery mode is: %s.\n",
+                DeliveryMode::names[message.deliveryMode]);
+        DPRINTF(IntDev, "Vector is %#x.\n", message.vector);
+    }
+    if (message.destMode == 0) {
+        DPRINTF(IntDev,
+                "Sending interrupt to APIC ID %d.\n", message.destination);
+        PacketPtr pkt = buildIntRequest(message.destination, message);
+        if (timing)
+            sendMessageTiming(pkt, latency);
+        else
+            sendMessageAtomic(pkt);
+    } else {
+        DPRINTF(IntDev, "Sending interrupts to APIC IDs:"
+                "%s%s%s%s%s%s%s%s\n",
+                bits((int)message.destination, 0) ? " 0": "",
+                bits((int)message.destination, 1) ? " 1": "",
+                bits((int)message.destination, 2) ? " 2": "",
+                bits((int)message.destination, 3) ? " 3": "",
+                bits((int)message.destination, 4) ? " 4": "",
+                bits((int)message.destination, 5) ? " 5": "",
+                bits((int)message.destination, 6) ? " 6": "",
+                bits((int)message.destination, 7) ? " 7": ""
+                );
+        uint8_t dests = message.destination;
+        uint8_t id = 0;
+        while(dests) {
+            if (dests & 0x1) {
+                PacketPtr pkt = buildIntRequest(id, message);
+                if (timing)
+                    sendMessageTiming(pkt, latency);
+                else
+                    sendMessageAtomic(pkt);
+            }
+            dests >>= 1;
+            id++;
+        }
+    }
+}
+
 X86ISA::IntSourcePin *
 X86IntSourcePinParams::create()
 {
index ca8e7eea529f5f9f71bfa35a6f52da3dd55b1f0e..e95c720585968b5e34fa2163f20701923b9ec0f3 100644 (file)
@@ -35,6 +35,7 @@
 #include <string>
 
 #include "arch/x86/x86_traits.hh"
+#include "arch/x86/intmessage.hh"
 #include "mem/mem_object.hh"
 #include "mem/mport.hh"
 #include "sim/sim_object.hh"
@@ -70,6 +71,10 @@ class IntDev
             return device->recvMessage(pkt);
         }
 
+        // This is x86 focused, so if this class becomes generic, this would
+        // need to be moved into a subclass.
+        void sendMessage(TriggerIntMessage message, bool timing);
+
         void recvStatusChange(Status status)
         {
             if (status == RangeChange) {