interrupts.cc (13229:b45254f2733a) interrupts.cc (14293:e8bb3f77458a)
1/*
2 * Copyright (c) 2012-2013 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

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

186 return regNum;
187}
188}
189
190Tick
191X86ISA::Interrupts::read(PacketPtr pkt)
192{
193 Addr offset = pkt->getAddr() - pioAddr;
1/*
2 * Copyright (c) 2012-2013 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

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

186 return regNum;
187}
188}
189
190Tick
191X86ISA::Interrupts::read(PacketPtr pkt)
192{
193 Addr offset = pkt->getAddr() - pioAddr;
194 //Make sure we're at least only accessing one register.
194 // Make sure we're at least only accessing one register.
195 if ((offset & ~mask(3)) != ((offset + pkt->getSize()) & ~mask(3)))
196 panic("Accessed more than one register at a time in the APIC!\n");
197 ApicRegIndex reg = decodeAddr(offset);
198 uint32_t val = htog(readReg(reg));
199 DPRINTF(LocalApic,
200 "Reading Local APIC register %d at offset %#x as %#x.\n",
201 reg, offset, val);
202 pkt->setData(((uint8_t *)&val) + (offset & mask(3)));
203 pkt->makeAtomicResponse();
204 return pioDelay;
205}
206
207Tick
208X86ISA::Interrupts::write(PacketPtr pkt)
209{
210 Addr offset = pkt->getAddr() - pioAddr;
195 if ((offset & ~mask(3)) != ((offset + pkt->getSize()) & ~mask(3)))
196 panic("Accessed more than one register at a time in the APIC!\n");
197 ApicRegIndex reg = decodeAddr(offset);
198 uint32_t val = htog(readReg(reg));
199 DPRINTF(LocalApic,
200 "Reading Local APIC register %d at offset %#x as %#x.\n",
201 reg, offset, val);
202 pkt->setData(((uint8_t *)&val) + (offset & mask(3)));
203 pkt->makeAtomicResponse();
204 return pioDelay;
205}
206
207Tick
208X86ISA::Interrupts::write(PacketPtr pkt)
209{
210 Addr offset = pkt->getAddr() - pioAddr;
211 //Make sure we're at least only accessing one register.
211 // Make sure we're at least only accessing one register.
212 if ((offset & ~mask(3)) != ((offset + pkt->getSize()) & ~mask(3)))
213 panic("Accessed more than one register at a time in the APIC!\n");
214 ApicRegIndex reg = decodeAddr(offset);
215 uint32_t val = regs[reg];
216 pkt->writeData(((uint8_t *)&val) + (offset & mask(3)));
217 DPRINTF(LocalApic,
218 "Writing Local APIC register %d at offset %#x as %#x.\n",
219 reg, offset, gtoh(val));

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

290X86ISA::Interrupts::init()
291{
292 //
293 // The local apic must register its address ranges on both its pio
294 // port via the basicpiodevice(piodevice) init() function and its
295 // int port that it inherited from IntDevice. Note IntDevice is
296 // not a SimObject itself.
297 //
212 if ((offset & ~mask(3)) != ((offset + pkt->getSize()) & ~mask(3)))
213 panic("Accessed more than one register at a time in the APIC!\n");
214 ApicRegIndex reg = decodeAddr(offset);
215 uint32_t val = regs[reg];
216 pkt->writeData(((uint8_t *)&val) + (offset & mask(3)));
217 DPRINTF(LocalApic,
218 "Writing Local APIC register %d at offset %#x as %#x.\n",
219 reg, offset, gtoh(val));

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

290X86ISA::Interrupts::init()
291{
292 //
293 // The local apic must register its address ranges on both its pio
294 // port via the basicpiodevice(piodevice) init() function and its
295 // int port that it inherited from IntDevice. Note IntDevice is
296 // not a SimObject itself.
297 //
298 BasicPioDevice::init();
298 PioDevice::init();
299 IntDevice::init();
300
301 // the slave port has a range so inform the connected master
302 intSlavePort.sendRangeChange();
303}
304
305
306Tick

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

343 regs[APIC_INTERRUPT_COMMAND_LOW] = low;
344 }
345 DPRINTF(LocalApic, "ICR is now idle.\n");
346 return 0;
347}
348
349
350AddrRangeList
299 IntDevice::init();
300
301 // the slave port has a range so inform the connected master
302 intSlavePort.sendRangeChange();
303}
304
305
306Tick

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

343 regs[APIC_INTERRUPT_COMMAND_LOW] = low;
344 }
345 DPRINTF(LocalApic, "ICR is now idle.\n");
346 return 0;
347}
348
349
350AddrRangeList
351X86ISA::Interrupts::getAddrRanges() const
352{
353 assert(cpu);
354 AddrRangeList ranges;
355 ranges.push_back(RangeSize(pioAddr, PageBytes));
356 return ranges;
357}
358
359
360AddrRangeList
351X86ISA::Interrupts::getIntAddrRange() const
352{
353 AddrRangeList ranges;
354 ranges.push_back(RangeEx(x86InterruptAddress(initialApicId, 0),
355 x86InterruptAddress(initialApicId, 0) +
356 PhysAddrAPICRangeSize));
357 return ranges;
358}

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

582 break;
583 }
584 regs[reg] = newVal;
585 return;
586}
587
588
589X86ISA::Interrupts::Interrupts(Params * p)
361X86ISA::Interrupts::getIntAddrRange() const
362{
363 AddrRangeList ranges;
364 ranges.push_back(RangeEx(x86InterruptAddress(initialApicId, 0),
365 x86InterruptAddress(initialApicId, 0) +
366 PhysAddrAPICRangeSize));
367 return ranges;
368}

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

592 break;
593 }
594 regs[reg] = newVal;
595 return;
596}
597
598
599X86ISA::Interrupts::Interrupts(Params * p)
590 : BasicPioDevice(p, PageBytes), IntDevice(this, p->int_latency),
600 : PioDevice(p), IntDevice(this, p->int_latency),
591 apicTimerEvent([this]{ processApicTimerEvent(); }, name()),
592 pendingSmi(false), smiVector(0),
593 pendingNmi(false), nmiVector(0),
594 pendingExtInt(false), extIntVector(0),
595 pendingInit(false), initVector(0),
596 pendingStartup(false), startupVector(0),
597 startedUp(false), pendingUnmaskableInt(false),
598 pendingIPIs(0), cpu(NULL),
601 apicTimerEvent([this]{ processApicTimerEvent(); }, name()),
602 pendingSmi(false), smiVector(0),
603 pendingNmi(false), nmiVector(0),
604 pendingExtInt(false), extIntVector(0),
605 pendingInit(false), initVector(0),
606 pendingStartup(false), startupVector(0),
607 startedUp(false), pendingUnmaskableInt(false),
608 pendingIPIs(0), cpu(NULL),
599 intSlavePort(name() + ".int_slave", this, this)
609 intSlavePort(name() + ".int_slave", this, this),
610 pioDelay(p->pio_latency)
600{
601 memset(regs, 0, sizeof(regs));
602 //Set the local apic DFR to the flat model.
603 regs[APIC_DESTINATION_FORMAT] = (uint32_t)(-1);
604 ISRV = 0;
605 IRRV = 0;
606}
607

--- 168 unchanged lines hidden ---
611{
612 memset(regs, 0, sizeof(regs));
613 //Set the local apic DFR to the flat model.
614 regs[APIC_DESTINATION_FORMAT] = (uint32_t)(-1);
615 ISRV = 0;
616 IRRV = 0;
617}
618

--- 168 unchanged lines hidden ---