i8259.cc (5698:584248437e4f) i8259.cc (5827:ac2c268bf4f1)
1/*
2 * Copyright (c) 2004-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 22 unchanged lines hidden (view full) ---

31#include "base/bitfield.hh"
32#include "dev/x86/i82094aa.hh"
33#include "dev/x86/i8259.hh"
34#include "mem/packet.hh"
35#include "mem/packet_access.hh"
36
37X86ISA::I8259::I8259(Params * p) : BasicPioDevice(p), IntDev(this),
38 latency(p->pio_latency), output(p->output),
1/*
2 * Copyright (c) 2004-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 22 unchanged lines hidden (view full) ---

31#include "base/bitfield.hh"
32#include "dev/x86/i82094aa.hh"
33#include "dev/x86/i8259.hh"
34#include "mem/packet.hh"
35#include "mem/packet_access.hh"
36
37X86ISA::I8259::I8259(Params * p) : BasicPioDevice(p), IntDev(this),
38 latency(p->pio_latency), output(p->output),
39 mode(p->mode), slave(NULL),
39 mode(p->mode), slave(p->slave),
40 IRR(0), ISR(0), IMR(0),
41 readIRR(true), initControlWord(0), autoEOI(false)
42{
40 IRR(0), ISR(0), IMR(0),
41 readIRR(true), initControlWord(0), autoEOI(false)
42{
43 if (output) {
44 I8259 * master;
45 master = dynamic_cast<I8259 *>(output->getDevice());
46 if (master)
47 master->setSlave(this);
48 I82094AA * ioApic;
49 ioApic = dynamic_cast<I82094AA *>(output->getDevice());
50 if (ioApic)
51 ioApic->setExtIntPic(this);
52 }
43 for (int i = 0; i < NumLines; i++)
44 pinStates[i] = false;
53 pioSize = 2;
54}
55
56Tick
57X86ISA::I8259::read(PacketPtr pkt)
58{
59 assert(pkt->getSize() == 1);
60 switch(pkt->getAddr() - pioAddr)

--- 171 unchanged lines hidden (view full) ---

232}
233
234void
235X86ISA::I8259::requestInterrupt(int line)
236{
237 if (bits(ISR, 7, line) == 0) {
238 if (output) {
239 DPRINTF(I8259, "Propogating interrupt.\n");
45 pioSize = 2;
46}
47
48Tick
49X86ISA::I8259::read(PacketPtr pkt)
50{
51 assert(pkt->getSize() == 1);
52 switch(pkt->getAddr() - pioAddr)

--- 171 unchanged lines hidden (view full) ---

224}
225
226void
227X86ISA::I8259::requestInterrupt(int line)
228{
229 if (bits(ISR, 7, line) == 0) {
230 if (output) {
231 DPRINTF(I8259, "Propogating interrupt.\n");
240 output->signalInterrupt();
232 output->raise();
233 //XXX This is a hack.
234 output->lower();
241 } else {
242 warn("Received interrupt but didn't have "
243 "anyone to tell about it.\n");
244 }
245 }
246}
247
248void

--- 6 unchanged lines hidden (view full) ---

255 if (bits(IMR, line)) {
256 DPRINTF(I8259, "Interrupt %d was masked.\n", line);
257 } else {
258 IRR |= 1 << line;
259 requestInterrupt(line);
260 }
261}
262
235 } else {
236 warn("Received interrupt but didn't have "
237 "anyone to tell about it.\n");
238 }
239 }
240}
241
242void

--- 6 unchanged lines hidden (view full) ---

249 if (bits(IMR, line)) {
250 DPRINTF(I8259, "Interrupt %d was masked.\n", line);
251 } else {
252 IRR |= 1 << line;
253 requestInterrupt(line);
254 }
255}
256
257void
258X86ISA::I8259::raiseInterruptPin(int number)
259{
260 if (number >= NumLines)
261 fatal("Line number %d doesn't exist. The max is %d.\n",
262 number, NumLines - 1);
263 if (!pinStates[number])
264 signalInterrupt(number);
265 pinStates[number] = true;
266}
267
268void
269X86ISA::I8259::lowerInterruptPin(int number)
270{
271 if (number >= NumLines)
272 fatal("Line number %d doesn't exist. The max is %d.\n",
273 number, NumLines - 1);
274 pinStates[number] = false;
275}
276
263int
264X86ISA::I8259::getVector()
265{
266 /*
267 * This code only handles one slave. Since that's how the PC platform
268 * always uses the 8259 PIC, there shouldn't be any need for more. If
269 * there -is- a need for more for some reason, "slave" can become a
270 * vector of slaves.

--- 22 unchanged lines hidden ---
277int
278X86ISA::I8259::getVector()
279{
280 /*
281 * This code only handles one slave. Since that's how the PC platform
282 * always uses the 8259 PIC, there shouldn't be any need for more. If
283 * there -is- a need for more for some reason, "slave" can become a
284 * vector of slaves.

--- 22 unchanged lines hidden ---