38 #include "debug/I82094AA.hh" 46 lowestPriorityOffset(0),
47 intMasterPort(
name() +
".int_master", this, this, p->int_latency)
53 assert(p->apic_id < 0xff);
57 RedirTableEntry entry = 0;
64 for (
int i = 0;
i < p->port_inputs_connection_count;
i++)
78 "Int port not connected to anything!");
84 if (if_name ==
"int_master")
86 if (if_name ==
"inputs")
105 panic(
"Illegal read from I/O APIC.\n");
124 panic(
"Illegal write to I/O APIC.\n");
134 id =
bits(value, 31, 24);
135 }
else if (offset == 0x1) {
137 }
else if (offset == 0x2) {
139 }
else if (offset >= 0x10 && offset <= (0x10 +
TableSize * 2)) {
140 int index = (offset - 0x10) / 2;
149 warn(
"Access to undefined I/O APIC register %#x.\n", offset);
152 "Wrote %#x to I/O APIC register %#x .\n", value, offset);
161 }
else if (offset == 0x1) {
163 }
else if (offset == 0x2) {
164 result =
arbId << 24;
165 }
else if (offset >= 0x10 && offset <= (0x10 +
TableSize * 2)) {
166 int index = (offset - 0x10) / 2;
173 warn(
"Access to undefined I/O APIC register %#x.\n", offset);
176 "Read %#x from I/O APIC register %#x.\n", result, offset);
190 TriggerIntMessage message = 0;
191 message.destination = entry.dest;
192 if (entry.deliveryMode == DeliveryMode::ExtInt) {
194 message.vector = extIntPic->getVector();
196 message.vector = entry.vector;
198 message.deliveryMode = entry.deliveryMode;
199 message.destMode = entry.destMode;
200 message.level = entry.polarity;
201 message.trigger = entry.trigger;
204 if (message.destMode == 0) {
205 if (message.deliveryMode == DeliveryMode::LowestPriority) {
206 panic(
"Lowest priority delivery mode from the " 207 "IO APIC aren't supported in physical " 208 "destination mode.\n");
210 if (message.destination == 0xFF) {
211 for (
int i = 0;
i < numContexts;
i++) {
215 apics.push_back(message.destination);
218 for (
int i = 0;
i < numContexts;
i++) {
220 getCpuPtr()->getInterruptController(0);
221 auto *localApic =
dynamic_cast<Interrupts *
>(base_int);
223 message.destination) {
224 apics.push_back(localApic->getInitialApicId());
227 if (message.deliveryMode == DeliveryMode::LowestPriority &&
235 auto apicIt = apics.begin();
236 while (modOffset--) {
238 assert(apicIt != apics.end());
240 int selected = *apicIt;
242 apics.push_back(selected);
245 for (
auto id: apics) {
271 uint64_t* redirTableArray = (uint64_t*)
redirTable;
298 I82094AAParams::create()
#define panic(...)
This implements a cprintf based panic() function.
void signalInterrupt(int line)
Ports are used to interface objects to each other.
bool pinStates[TableSize]
const std::string & name()
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
void raiseInterruptPin(int number)
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
void setLE(T v)
Set the value in the data pointer to v as little endian.
ThreadContext * getThreadContext(ContextID tid) const
static const uint8_t TableSize
std::vector< IntSinkPin< I82094AA > * > inputs
#define UNSERIALIZE_SCALAR(scalar)
void serialize(CheckpointOut &cp) const override
Serialize an object.
std::string csprintf(const char *format, const Args &...args)
uint32_t readReg(uint8_t offset)
void makeAtomicResponse()
uint64_t Tick
Tick count type.
#define SERIALIZE_ARRAY(member, size)
unsigned numContexts() const
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
void lowerInterruptPin(int number)
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
virtual const std::string name() const
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
void writeReg(uint8_t offset, uint32_t value)
#define SERIALIZE_SCALAR(scalar)
EndBitUnion(RedirTableEntry) protected uint8_t regSel
#define UNSERIALIZE_ARRAY(member, size)
Declaration of the Packet class.
std::ostream CheckpointOut
IntMasterPort< I82094AA > intMasterPort
void unserialize(CheckpointIn &cp) override
Unserialize an object.
uint64_t lowestPriorityOffset
Tick pioDelay
Delay that the device experinces on an access.
RedirTableEntry redirTable[TableSize]
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
T getLE() const
Get the data in the packet byte swapped from little endian to host endian.
static PacketPtr buildIntTriggerPacket(int id, TriggerIntMessage message)
static const uint8_t APICVersion
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
bool isTimingMode() const
Is the system in timing mode?
T bits(T val, int first, int last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it...
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Addr pioAddr
Address that the device listens to.