34 #include "debug/I8259.hh" 41 latency(p->pio_latency),
44 readIRR(true), initControlWord(0), autoEOI(false)
46 for (
int i = 0;
i < p->port_output_connection_count;
i++) {
51 int in_count = p->port_inputs_connection_count;
53 "I8259 only supports 8 inputs, but there are %d.", in_count);
54 for (
int i = 0;
i < in_count;
i++) {
69 pinStates[input->getId()] = input->state();
100 uint8_t
val = pkt->
getLE<uint8_t>();
104 DPRINTF(
I8259,
"Received initialization command word 1.\n");
118 }
else if (
bits(val, 4, 3) == 0) {
120 switch (
bits(val, 7, 5)) {
123 "Subcommand: Rotate in auto-EOI mode (clear).\n");
128 DPRINTF(
I8259,
"Subcommand: Nonspecific EOI on line %d.\n",
138 int line =
bits(val, 2, 0);
139 DPRINTF(
I8259,
"Subcommand: Specific EIO on line %d.\n",
145 DPRINTF(
I8259,
"Subcommand: Rotate in auto-EOI mode (set).\n");
148 DPRINTF(
I8259,
"Subcommand: Rotate on nonspecific EOI.\n");
153 bits(val, 2, 0), (
bits(val, 2, 0) + 1) % 8);
156 DPRINTF(
I8259,
"Subcommand: Rotate on specific EOI.\n");
158 bits(val, 2, 0), (
bits(val, 2, 0) + 1) % 8);
161 }
else if (
bits(val, 4, 3) == 1) {
165 bits(val, 6) ?
"Set" :
"Clear");
181 DPRINTF(
I8259,
"Received initialization command word 2.\n");
193 DPRINTF(
I8259,
"Received initialization command word 3.\n");
194 if (
mode == Enums::I8259Master) {
195 DPRINTF(
I8259,
"Slaves attached to IRQs:%s%s%s%s%s%s%s%s\n",
196 bits(val, 0) ?
" 0" :
"",
197 bits(val, 1) ?
" 1" :
"",
198 bits(val, 2) ?
" 2" :
"",
199 bits(val, 3) ?
" 3" :
"",
200 bits(val, 4) ?
" 4" :
"",
201 bits(val, 5) ?
" 5" :
"",
202 bits(val, 6) ?
" 6" :
"",
203 bits(val, 7) ?
" 7" :
"");
215 DPRINTF(
I8259,
"Received initialization command word 4.\n");
221 if (
bits(val, 3) == 0) {
223 }
else if (
bits(val, 2) == 0) {
230 autoEOI ?
"Automatic" :
"Normal");
258 for (
auto *wire:
output) {
264 warn(
"Received interrupt but didn't have " 265 "anyone to tell about it.\n");
273 DPRINTF(
I8259,
"Interrupt requested for line %d.\n", line);
275 fatal(
"Line number %d doesn't exist. The max is %d.\n",
288 DPRINTF(
I8259,
"Interrupt signal raised for pin %d.\n", number);
290 fatal(
"Line number %d doesn't exist. The max is %d.\n",
300 DPRINTF(
I8259,
"Interrupt signal lowered for pin %d.\n", number);
302 fatal(
"Line number %d doesn't exist. The max is %d.\n",
326 "provide the vector.\n");
369 I8259Params::create()
#define fatal(...)
This implements a cprintf based fatal() function.
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Tick read(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 serialize(CheckpointOut &cp) const override
Serialize an object.
void setLE(T v)
Set the value in the data pointer to v as little endian.
#define UNSERIALIZE_SCALAR(scalar)
std::vector< IntSinkPin< I8259 > * > inputs
std::string csprintf(const char *format, const Args &...args)
void makeAtomicResponse()
uint64_t Tick
Tick count type.
#define SERIALIZE_ARRAY(member, size)
static const int NumLines
virtual const std::string name() const
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
#define SERIALIZE_SCALAR(scalar)
#define UNSERIALIZE_ENUM(scalar)
#define UNSERIALIZE_ARRAY(member, size)
void raiseInterruptPin(int number)
Enums::X86I8259CascadeMode mode
Declaration of the Packet class.
std::ostream CheckpointOut
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
int findMsbSet(uint64_t val)
Returns the bit position of the MSB that is set in the input.
T getLE() const
Get the data in the packet byte swapped from little endian to host endian.
std::vector< IntSourcePin< I8259 > * > output
void signalInterrupt(int line)
void lowerInterruptPin(int number)
void requestInterrupt(int line)
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.
#define SERIALIZE_ENUM(scalar)