34 #include "debug/I8259.hh"
44 readIRR(true), initControlWord(0), autoEOI(false)
54 switch(pkt->
getAddr() - pioAddr)
78 uint8_t
val = pkt->
get<uint8_t>();
79 switch (pkt->
getAddr() - pioAddr) {
82 DPRINTF(
I8259,
"Received initialization command word 1.\n");
84 edgeTriggered =
bits(val, 3);
86 edgeTriggered ?
"Edge" :
"Level");
87 cascadeMode = !
bits(val, 1);
89 cascadeMode ?
"Cascade" :
"Single");
90 expectICW4 =
bits(val, 0);
95 DPRINTF(
I8259,
"Expecting %d more bytes.\n", expectICW4 ? 3 : 2);
96 }
else if (
bits(val, 4, 3) == 0) {
98 switch (
bits(val, 7, 5)) {
101 "Subcommand: Rotate in auto-EOI mode (clear).\n");
106 DPRINTF(
I8259,
"Subcommand: Nonspecific EOI on line %d.\n",
116 int line =
bits(val, 2, 0);
117 DPRINTF(
I8259,
"Subcommand: Specific EIO on line %d.\n",
123 DPRINTF(
I8259,
"Subcommand: Rotate in auto-EOI mode (set).\n");
126 DPRINTF(
I8259,
"Subcommand: Rotate on nonspecific EOI.\n");
131 bits(val, 2, 0), (
bits(val, 2, 0) + 1) % 8);
134 DPRINTF(
I8259,
"Subcommand: Rotate on specific EOI.\n");
136 bits(val, 2, 0), (
bits(val, 2, 0) + 1) % 8);
139 }
else if (
bits(val, 4, 3) == 1) {
143 bits(val, 6) ?
"Set" :
"Clear");
146 readIRR =
bits(val, 0);
152 switch (initControlWord) {
159 DPRINTF(
I8259,
"Received initialization command word 2.\n");
160 vectorOffset = val & ~
mask(3);
162 vectorOffset, vectorOffset |
mask(3));
171 DPRINTF(
I8259,
"Received initialization command word 3.\n");
172 if (
mode == Enums::I8259Master) {
173 DPRINTF(
I8259,
"Slaves attached to IRQs:%s%s%s%s%s%s%s%s\n",
174 bits(val, 0) ?
" 0" :
"",
175 bits(val, 1) ?
" 1" :
"",
176 bits(val, 2) ?
" 2" :
"",
177 bits(val, 3) ?
" 3" :
"",
178 bits(val, 4) ?
" 4" :
"",
179 bits(val, 5) ?
" 5" :
"",
180 bits(val, 6) ?
" 6" :
"",
181 bits(val, 7) ?
" 7" :
"");
185 cascadeBits = val &
mask(3);
193 DPRINTF(
I8259,
"Received initialization command word 4.\n");
199 if (
bits(val, 3) == 0) {
201 }
else if (
bits(val, 2) == 0) {
206 autoEOI =
bits(val, 1);
208 autoEOI ?
"Automatic" :
"Normal");
240 warn(
"Received interrupt but didn't have "
241 "anyone to tell about it.\n");
249 DPRINTF(
I8259,
"Interrupt requested for line %d.\n", line);
250 if (line >= NumLines)
251 fatal(
"Line number %d doesn't exist. The max is %d.\n",
257 requestInterrupt(line);
264 DPRINTF(
I8259,
"Interrupt signal raised for pin %d.\n", number);
265 if (number >= NumLines)
266 fatal(
"Line number %d doesn't exist. The max is %d.\n",
267 number, NumLines - 1);
268 if (!pinStates[number])
269 signalInterrupt(number);
270 pinStates[number] =
true;
276 DPRINTF(
I8259,
"Interrupt signal lowered for pin %d.\n", number);
277 if (number >= NumLines)
278 fatal(
"Line number %d doesn't exist. The max is %d.\n",
279 number, NumLines - 1);
280 pinStates[number] =
false;
300 if (slave &&
bits(cascadeBits, line)) {
302 "provide the vector.\n");
303 return slave->getVector();
305 return line | vectorOffset;
345 I8259Params::create()
void set(T v, ByteOrder endian)
Set the value in the data pointer to v using the specified endianness.
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
static void output(const char *filename)
void lowerInterruptPin(int number) override
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
void serialize(CheckpointOut &cp) const override
Serialize an object.
T get(ByteOrder endian) const
Get the data in the packet byte swapped from the specified endianness.
#define UNSERIALIZE_SCALAR(scalar)
void raiseInterruptPin(int number) override
void makeAtomicResponse()
uint64_t Tick
Tick count type.
#define SERIALIZE_ARRAY(member, size)
static const int NumLines
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)
Declaration of the Packet class.
std::ostream CheckpointOut
int findMsbSet(uint64_t val)
Returns the bit position of the MSB that is set in the input.
void signalInterrupt(int line) override
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 SERIALIZE_ENUM(scalar)