if ((offset & ~mask(3)) != ((offset + pkt->getSize()) & ~mask(3)))
panic("Accessed more than one register at a time in the APIC!\n");
ApicRegIndex reg = decodeAddr(offset);
- uint32_t val = htog(readReg(reg));
+ uint32_t val = htole(readReg(reg));
DPRINTF(LocalApic,
"Reading Local APIC register %d at offset %#x as %#x.\n",
reg, offset, val);
pkt->writeData(((uint8_t *)&val) + (offset & mask(3)));
DPRINTF(LocalApic,
"Writing Local APIC register %d at offset %#x as %#x.\n",
- reg, offset, gtoh(val));
- setReg(reg, gtoh(val));
+ reg, offset, letoh(val));
+ setReg(reg, letoh(val));
pkt->makeAtomicResponse();
return pioDelay;
}
void
X86ISA::Interrupts::init()
{
- //
- // The local apic must register its address ranges on its pio
- // port via the basicpiodevice(piodevice) init() function.
- PioDevice::init();
-
- // The slave port has a range, so inform the connected master.
- intSlavePort.sendRangeChange();
- // If the master port isn't connected, we can't send interrupts anywhere.
panic_if(!intMasterPort.isConnected(),
"Int port not connected to anything!");
+ panic_if(!pioPort.isConnected(),
+ "Pio port of %s not connected to anything!", name());
+
+ intSlavePort.sendRangeChange();
+ pioPort.sendRangeChange();
}
X86ISA::Interrupts::Interrupts(Params * p)
- : PioDevice(p),
+ : BaseInterrupts(p), sys(p->system), clockDomain(*p->clk_domain),
apicTimerEvent([this]{ processApicTimerEvent(); }, name()),
pendingSmi(false), smiVector(0),
pendingNmi(false), nmiVector(0),
pendingIPIs(0), cpu(NULL),
intSlavePort(name() + ".int_slave", this, this),
intMasterPort(name() + ".int_master", this, this, p->int_latency),
- pioDelay(p->pio_latency)
+ pioPort(this), pioDelay(p->pio_latency)
{
memset(regs, 0, sizeof(regs));
//Set the local apic DFR to the flat model.
regs[APIC_DESTINATION_FORMAT] = (uint32_t)(-1);
ISRV = 0;
IRRV = 0;
+
+ regs[APIC_VERSION] = (5 << 16) | 0x14;
}