from m5.params import *
from m5.proxy import *
from m5.objects.Device import BasicPioDevice
-from m5.objects.X86IntPin import X86IntSourcePin
+from m5.objects.IntPin import IntSourcePin
class Cmos(BasicPioDevice):
type = 'Cmos'
cxx_header = "dev/x86/cmos.hh"
time = Param.Time('01/01/2012',
"System time to use ('Now' for actual time)")
- int_pin = Param.X86IntSourcePin(X86IntSourcePin(),
- 'Pin to signal RTC alarm interrupts to')
+ int_pin = IntSourcePin('Pin to signal RTC alarm interrupts to')
from m5.params import *
from m5.proxy import *
from m5.objects.Device import BasicPioDevice
-from m5.objects.X86IntPin import X86IntSourcePin
+from m5.objects.IntPin import IntSourcePin
from m5.objects.PS2 import *
class I8042(BasicPioDevice):
pio_addr = 0x0
data_port = Param.Addr('Data port address')
command_port = Param.Addr('Command/status port address')
- mouse_int_pin = Param.X86IntSourcePin(X86IntSourcePin(),
- 'Pin to signal the mouse has data')
- keyboard_int_pin = Param.X86IntSourcePin(X86IntSourcePin(),
- 'Pin to signal the keyboard has data')
+ mouse_int_pin = IntSourcePin('Pin to signal the mouse has data')
+ keyboard_int_pin = IntSourcePin('Pin to signal the keyboard has data')
keyboard = Param.PS2Device(PS2Keyboard(vnc=NULL), "PS/2 keyboard device")
mouse = Param.PS2Device(PS2Mouse(), "PS/2 mouse device")
from m5.params import *
from m5.proxy import *
from m5.objects.Device import BasicPioDevice
-from m5.objects.X86IntPin import X86IntSinkPin
+from m5.objects.IntPin import VectorIntSinkPin
class I82094AA(BasicPioDevice):
type = 'I82094AA'
"Latency for an interrupt to propagate through this device.")
external_int_pic = Param.I8259(NULL, "External PIC, if any")
- def pin(self, line):
- return X86IntSinkPin(device=self, number=line)
+ inputs = VectorIntSinkPin('The pins that drive this IO APIC')
from m5.params import *
from m5.proxy import *
from m5.objects.Device import BasicPioDevice
-from m5.objects.X86IntPin import X86IntSourcePin
+from m5.objects.IntPin import IntSourcePin
class I8254(BasicPioDevice):
type = 'I8254'
cxx_class = 'X86ISA::I8254'
cxx_header = "dev/x86/i8254.hh"
- int_pin = Param.X86IntSourcePin(X86IntSourcePin(),
- 'Pin to signal timer interrupts to')
+ int_pin = IntSourcePin('Pin to signal timer interrupts to')
from m5.params import *
from m5.proxy import *
from m5.objects.Device import BasicPioDevice
-from m5.objects.X86IntPin import X86IntSourcePin, X86IntSinkPin
+from m5.objects.IntPin import IntSourcePin, VectorIntSinkPin
class X86I8259CascadeMode(Enum):
map = {'I8259Master' : 0,
type = 'I8259'
cxx_class='X86ISA::I8259'
cxx_header = "dev/x86/i8259.hh"
- output = Param.X86IntSourcePin(X86IntSourcePin(),
- 'The pin this I8259 drives')
+ output = IntSourcePin('The pin this I8259 drives')
+ inputs = VectorIntSinkPin('The pins that drive this I8259')
mode = Param.X86I8259CascadeMode('How this I8259 is cascaded')
slave = Param.I8259(NULL, 'Slave I8259, if any')
-
- def pin(self, line):
- return X86IntSinkPin(device=self, number=line)
from m5.objects.I8259 import I8259
from m5.objects.Ide import IdeController
from m5.objects.PcSpeaker import PcSpeaker
-from m5.objects.X86IntPin import X86IntLine
from m5.SimObject import SimObject
def x86IOAddress(port):
ide.LegacyIOBase = x86IOAddress(0)
def attachIO(self, bus, dma_ports):
- # Route interupt signals
- self.int_lines = \
- [X86IntLine(source=self.pic1.output, sink=self.io_apic.pin(0)),
- X86IntLine(source=self.pic2.output, sink=self.pic1.pin(2)),
- X86IntLine(source=self.cmos.int_pin, sink=self.pic2.pin(0)),
- X86IntLine(source=self.pit.int_pin, sink=self.pic1.pin(0)),
- X86IntLine(source=self.pit.int_pin, sink=self.io_apic.pin(2)),
- X86IntLine(source=self.keyboard.keyboard_int_pin,
- sink=self.io_apic.pin(1)),
- X86IntLine(source=self.keyboard.mouse_int_pin,
- sink=self.io_apic.pin(12))]
+ # Route interrupt signals
+ self.pic1.output = self.io_apic.inputs[0]
+ self.pic2.output = self.pic1.inputs[2]
+ self.cmos.int_pin = self.pic2.inputs[0]
+ self.pit.int_pin = self.pic1.inputs[0]
+ self.pit.int_pin = self.io_apic.inputs[2]
+ self.keyboard.keyboard_int_pin = self.io_apic.inputs[1]
+ self.keyboard.mouse_int_pin = self.io_apic.inputs[12]
# Tell the devices about each other
self.pic1.slave = self.pic2
self.speaker.i8254 = self.pit
void
X86ISA::Cmos::X86RTC::handleEvent()
{
- assert(intPin);
- intPin->raise();
- //XXX This is a hack.
- intPin->lower();
+ for (auto *wire: intPin) {
+ wire->raise();
+ //XXX This is a hack.
+ wire->lower();
+ }
}
Tick
#ifndef __DEV_X86_CMOS_HH__
#define __DEV_X86_CMOS_HH__
+#include "dev/intpin.hh"
#include "dev/io_device.hh"
#include "dev/mc146818.hh"
#include "params/Cmos.hh"
namespace X86ISA
{
-class IntSourcePin;
-
class Cmos : public BasicPioDevice
{
protected:
class X86RTC : public MC146818
{
- protected:
- IntSourcePin * intPin;
public:
+ std::vector<::IntSourcePin<X86RTC> *> intPin;
+
X86RTC(EventManager *em, const std::string &n, const struct tm time,
- bool bcd, Tick frequency, IntSourcePin * _intPin) :
- MC146818(em, n, time, bcd, frequency), intPin(_intPin)
+ bool bcd, Tick frequency, int int_pin_count) :
+ MC146818(em, n, time, bcd, frequency)
{
+ for (int i = 0; i < int_pin_count; i++) {
+ intPin.push_back(new ::IntSourcePin<X86RTC>(
+ csprintf("%s.int_pin[%d]", n, i), i, this));
+ }
}
protected:
void handleEvent();
typedef CmosParams Params;
Cmos(const Params *p) : BasicPioDevice(p, 2), latency(p->pio_latency),
- rtc(this, "rtc", p->time, true, ULL(5000000000), p->int_pin)
+ rtc(this, name() + ".rtc", p->time, true, ULL(5000000000),
+ p->port_int_pin_connection_count)
{
memset(regs, 0, numRegs * sizeof(uint8_t));
address = 0;
}
+ Port &
+ getPort(const std::string &if_name, PortID idx=InvalidPortID) override
+ {
+ if (if_name == "int_pin")
+ return *rtc.intPin.at(idx);
+ else
+ return BasicPioDevice::getPort(if_name, idx);
+ }
+
Tick read(PacketPtr pkt) override;
Tick write(PacketPtr pkt) override;
latency(p->pio_latency),
dataPort(p->data_port), commandPort(p->command_port),
statusReg(0), commandByte(0), dataReg(0), lastCommand(NoCommand),
- mouseIntPin(p->mouse_int_pin), keyboardIntPin(p->keyboard_int_pin),
mouse(p->mouse), keyboard(p->keyboard)
{
fatal_if(!mouse, "The i8042 model requires a mouse instance");
commandByte.convertScanCodes = 1;
commandByte.passedSelfTest = 1;
commandByte.keyboardFullInt = 1;
+
+ for (int i = 0; i < p->port_keyboard_int_pin_connection_count; i++) {
+ keyboardIntPin.push_back(new ::IntSourcePin<I8042>(
+ csprintf("%s.keyboard_int_pin[%d]", name(), i), i, this));
+ }
+ for (int i = 0; i < p->port_mouse_int_pin_connection_count; i++) {
+ mouseIntPin.push_back(new ::IntSourcePin<I8042>(
+ csprintf("%s.mouse_int_pin[%d]", name(), i), i, this));
+ }
}
statusReg.mouseOutputFull = (mouse ? 1 : 0);
if (!mouse && commandByte.keyboardFullInt) {
DPRINTF(I8042, "Sending keyboard interrupt.\n");
- keyboardIntPin->raise();
- //This is a hack
- keyboardIntPin->lower();
+ for (auto *wire: keyboardIntPin) {
+ wire->raise();
+ //This is a hack
+ wire->lower();
+ }
} else if (mouse && commandByte.mouseFullInt) {
DPRINTF(I8042, "Sending mouse interrupt.\n");
- mouseIntPin->raise();
- //This is a hack
- mouseIntPin->lower();
+ for (auto *wire: mouseIntPin) {
+ wire->raise();
+ //This is a hack
+ wire->lower();
+ }
}
}
#include <deque>
+#include "dev/intpin.hh"
#include "dev/io_device.hh"
#include "dev/ps2/device.hh"
-#include "dev/x86/intdev.hh"
#include "params/I8042.hh"
namespace X86ISA
{
-class IntPin;
-
class I8042 : public BasicPioDevice
{
protected:
static const uint16_t NoCommand = (uint16_t)(-1);
uint16_t lastCommand;
- IntSourcePin *mouseIntPin;
- IntSourcePin *keyboardIntPin;
+ std::vector<::IntSourcePin<I8042> *> mouseIntPin;
+ std::vector<::IntSourcePin<I8042> *> keyboardIntPin;
PS2Device *mouse;
PS2Device *keyboard;
I8042(Params *p);
+ Port &
+ getPort(const std::string &if_name, PortID idx=InvalidPortID) override
+ {
+ if (if_name == "mouse_int_pin")
+ return *mouseIntPin.at(idx);
+ else if (if_name == "keyboard_int_pin")
+ return *keyboardIntPin.at(idx);
+ else
+ return BasicPioDevice::getPort(if_name, idx);
+ }
+
AddrRangeList getAddrRanges() const override;
Tick read(PacketPtr pkt) override;
redirTable[i] = entry;
pinStates[i] = false;
}
+
+ for (int i = 0; i < p->port_inputs_connection_count; i++)
+ inputs.push_back(new ::IntSinkPin<I82094AA>(
+ csprintf("%s.inputs[%d]", name(), i), i, this));
}
void
{
if (if_name == "int_master")
return intMasterPort;
- return BasicPioDevice::getPort(if_name, idx);
+ if (if_name == "inputs")
+ return *inputs.at(idx);
+ else
+ return BasicPioDevice::getPort(if_name, idx);
}
AddrRangeList
#include "base/bitunion.hh"
#include "dev/x86/intdev.hh"
+#include "dev/intpin.hh"
#include "dev/io_device.hh"
#include "params/I82094AA.hh"
RedirTableEntry redirTable[TableSize];
bool pinStates[TableSize];
+ std::vector<::IntSinkPin<I82094AA> *> inputs;
+
public:
typedef I82094AAParams Params;
Tick recvResponse(PacketPtr pkt) override;
- void signalInterrupt(int line) override;
- void raiseInterruptPin(int number) override;
- void lowerInterruptPin(int number) override;
+ void signalInterrupt(int line);
+ void raiseInterruptPin(int number);
+ void lowerInterruptPin(int number);
void serialize(CheckpointOut &cp) const override;
void unserialize(CheckpointIn &cp) override;
{
DPRINTF(I8254, "Interrupt from counter %d.\n", num);
if (num == 0) {
- intPin->raise();
- //XXX This is a hack.
- intPin->lower();
+ for (auto *wire: intPin) {
+ wire->raise();
+ //XXX This is a hack.
+ wire->lower();
+ }
}
}
#define __DEV_X86_I8254_HH__
#include "dev/intel_8254_timer.hh"
+#include "dev/intpin.hh"
#include "dev/io_device.hh"
#include "params/I8254.hh"
namespace X86ISA
{
-class IntSourcePin;
-
class I8254 : public BasicPioDevice
{
protected:
X86Intel8254Timer pit;
- IntSourcePin *intPin;
+ std::vector<::IntSourcePin<I8254> *> intPin;
void counterInterrupt(unsigned int num);
public:
typedef I8254Params Params;
+ Port &
+ getPort(const std::string &if_name, PortID idx=InvalidPortID) override
+ {
+ if (if_name == "int_pin")
+ return *intPin.at(idx);
+ else
+ return BasicPioDevice::getPort(if_name, idx);
+ }
+
const Params *
params() const
{
}
I8254(Params *p) : BasicPioDevice(p, 4), latency(p->pio_latency),
- pit(p->name, this), intPin(p->int_pin)
+ pit(p->name, this)
{
+ for (int i = 0; i < p->port_int_pin_connection_count; i++) {
+ intPin.push_back(new ::IntSourcePin<I8254>(csprintf(
+ "%s.int_pin[%d]", name(), i), i, this));
+ }
}
Tick read(PacketPtr pkt) override;
#include "mem/packet_access.hh"
X86ISA::I8259::I8259(Params * p)
- : BasicPioDevice(p, 2), IntDevice(this),
- latency(p->pio_latency), output(p->output),
+ : BasicPioDevice(p, 2),
+ latency(p->pio_latency),
mode(p->mode), slave(p->slave),
IRR(0), ISR(0), IMR(0),
readIRR(true), initControlWord(0), autoEOI(false)
{
- for (int i = 0; i < NumLines; i++)
- pinStates[i] = false;
+ for (int i = 0; i < p->port_output_connection_count; i++) {
+ output.push_back(new ::IntSourcePin<I8259>(
+ csprintf("%s.output[%d]", name(), i), i, this));
+ }
+
+ int in_count = p->port_inputs_connection_count;
+ panic_if(in_count >= NumLines,
+ "I8259 only supports 8 inputs, but there are %d.", in_count);
+ for (int i = 0; i < in_count; i++) {
+ inputs.push_back(new ::IntSinkPin<I8259>(
+ csprintf("%s.inputs[%d]", name(), i), i, this));
+ }
+
+ for (bool &state: pinStates)
+ state = false;
+}
+
+void
+X86ISA::I8259::init()
+{
+ BasicPioDevice::init();
+
+ for (auto *input: inputs)
+ pinStates[input->getId()] = input->state();
}
Tick
X86ISA::I8259::requestInterrupt(int line)
{
if (bits(ISR, 7, line) == 0) {
- if (output) {
+ if (!output.empty()) {
DPRINTF(I8259, "Propogating interrupt.\n");
- output->raise();
- //XXX This is a hack.
- output->lower();
+ for (auto *wire: output) {
+ wire->raise();
+ //XXX This is a hack.
+ wire->lower();
+ }
} else {
warn("Received interrupt but didn't have "
"anyone to tell about it.\n");
#ifndef __DEV_X86_I8259_HH__
#define __DEV_X86_I8259_HH__
-#include "dev/x86/intdev.hh"
+#include "dev/intpin.hh"
#include "dev/io_device.hh"
#include "enums/X86I8259CascadeMode.hh"
#include "params/I8259.hh"
namespace X86ISA
{
-class I8259 : public BasicPioDevice, public IntDevice
+class I8259 : public BasicPioDevice
{
protected:
static const int NumLines = 8;
bool pinStates[NumLines];
+ void init() override;
+
Tick latency;
- IntSourcePin *output;
+ std::vector<::IntSourcePin<I8259> *> output;
+ std::vector<::IntSinkPin<I8259> *> inputs;
Enums::X86I8259CascadeMode mode;
I8259 * slave;
I8259(Params * p);
+ Port &
+ getPort(const std::string &if_name, PortID idx=InvalidPortID) override
+ {
+ if (if_name == "inputs")
+ return *inputs.at(idx);
+ else if (if_name == "output")
+ return *output.at(idx);
+ else
+ return BasicPioDevice::getPort(if_name, idx);
+ }
+
Tick read(PacketPtr pkt) override;
Tick write(PacketPtr pkt) override;
IMR = 0x00;
}
- void signalInterrupt(int line) override;
- void raiseInterruptPin(int number) override;
- void lowerInterruptPin(int number) override;
+ void signalInterrupt(int line);
+ void raiseInterruptPin(int number);
+ void lowerInterruptPin(int number);
int getVector();
void serialize(CheckpointOut &cp) const override;