46 #include "debug/IPI.hh" 47 #include "debug/Tsunami.hh" 53 #include "params/TsunamiCChip.hh" 85 case sizeof(uint64_t):
86 pkt->
setLE<uint64_t>(0);
90 pkt->
setLE(
dim[(daddr >> 4) & 0x3F]);
96 pkt->
setLE(
dir[(daddr >> 4) & 0x3F]);
105 panic(
"TSDEV_CC_MTR not implemeted\n");
109 (pkt->
req->contextId() & 0x3));
151 panic(
"TSDEV_CC_PRBEN not implemented\n");
157 panic(
"TSDEV_CC_IICx not implemented\n");
163 panic(
"TSDEV_CC_MPRx not implemented\n");
172 panic(
"default in cchip read reached, accessing 0x%x\n");
176 case sizeof(uint32_t):
177 case sizeof(uint16_t):
178 case sizeof(uint8_t):
180 panic(
"invalid access size(?) for tsunami register!\n");
182 DPRINTF(
Tsunami,
"Tsunami CChip: read regnum=%#x size=%d data=%lld\n",
197 assert(pkt->
getSize() ==
sizeof(uint64_t));
202 bool supportedWrite =
false;
207 int number = (daddr >> 4) & 0x3F;
213 olddim =
dim[number];
214 olddir =
dir[number];
215 dim[number] = pkt->
getLE<uint64_t>();
219 bitvector =
ULL(1) <<
x;
221 if ((
dim[number] & bitvector) != (olddim & bitvector))
224 if ((
dim[number] & bitvector) && (dir[number] & bitvector))
229 " interrupt to cpu %d\n", number);
231 else if ((olddir & bitvector) &&
232 !(dir[number] & bitvector))
239 " dir interrupt to cpu %d\n", number);
249 panic(
"TSDEV_CC_CSR write\n");
251 panic(
"TSDEV_CC_MTR write not implemented\n");
254 ipreq = (pkt->
getLE<uint64_t>() >> 12) & 0xF;
258 supportedWrite =
true;
263 ipintr = (pkt->
getLE<uint64_t>() >> 8) & 0xF;
266 supportedWrite =
true;
271 itintr = (pkt->
getLE<uint64_t>() >> 4) & 0xF;
274 supportedWrite =
true;
278 if (pkt->
getLE<uint64_t>() & 0x10000000)
279 supportedWrite =
true;
282 panic(
"TSDEV_CC_MISC write not implemented\n");
289 panic(
"TSDEV_CC_AARx write not implemeted\n");
308 olddim =
dim[number];
309 olddir =
dir[number];
310 dim[number] = pkt->
getLE<uint64_t>();
312 for (
int x = 0;
x < 64;
x++) {
313 bitvector =
ULL(1) <<
x;
315 if ((
dim[number] & bitvector) != (olddim & bitvector)) {
317 if ((
dim[number] & bitvector) &&
318 (dir[number] & bitvector)) {
322 "posting dir interrupt to cpu 0\n");
323 }
else if ((olddir & bitvector) &&
324 !(dir[number] & bitvector)) {
330 " dir interrupt to cpu %d\n",
x);
342 panic(
"TSDEV_CC_DIR write not implemented\n");
344 panic(
"TSDEV_CC_DRIR write not implemented\n");
346 panic(
"TSDEV_CC_PRBEN write not implemented\n");
351 panic(
"TSDEV_CC_IICx write not implemented\n");
356 panic(
"TSDEV_CC_MPRx write not implemented\n");
367 panic(
"default in cchip read reached, accessing 0x%x\n");
381 for (
int cpunum=0; cpunum < numcpus; cpunum++) {
383 uint64_t cpumask =
ULL(1) << cpunum;
384 if (ipintr & cpumask) {
386 if (
ipint & cpumask) {
390 DPRINTF(IPI,
"clear IPI IPI cpu=%d\n", cpunum);
392 warn(
"clear IPI for CPU=%d, but NO IPI\n", cpunum);
398 panic(
"Big IPI Clear, but not processors indicated\n");
408 for (
int i=0;
i < numcpus;
i++) {
409 uint64_t cpumask =
ULL(1) <<
i;
410 if (itintr & cpumask &
itint) {
417 panic(
"Big ITI Clear, but not processors indicated\n");
428 for (
int cpunum=0; cpunum < numcpus; cpunum++) {
430 uint64_t cpumask =
ULL(1) << cpunum;
431 if (ipreq & cpumask) {
433 if (!(
ipint & cpumask)) {
437 DPRINTF(IPI,
"send IPI cpu=%d\n", cpunum);
439 warn(
"post IPI for CPU=%d, but IPI already\n", cpunum);
444 panic(
"Big IPI Request, but not processors indicated\n");
455 for (
int i = 0;
i < size;
i++) {
456 uint64_t cpumask =
ULL(1) <<
i;
457 if (!(cpumask &
itint)) {
468 uint64_t bitvector =
ULL(1) << interrupt;
473 for (
int i=0;
i < size;
i++) {
475 if (
dim[
i] & bitvector) {
478 "interrupt %d\n",
i, interrupt);
486 uint64_t bitvector =
ULL(1) << interrupt;
490 if (
drir & bitvector)
493 for (
int i=0;
i < size;
i++) {
494 if (
dir[
i] & bitvector) {
497 "interrupt %d\n",
i, interrupt);
529 TsunamiCChipParams::create()
#define panic(...)
This implements a cprintf based panic() function.
Emulation of the Tsunami CChip CSRs.
Tsunami * tsunami
pointer to the tsunami object.
void postDRIR(uint32_t interrupt)
post an interrupt to the CPU.
void postRTC()
post an RTC interrupt to the CPU
void post(int cpu_id, int int_num, int index)
void reqIPI(uint64_t ipreq)
request an interrupt be posted to the CPU.
uint64_t drir
This register contains bits for each PCI interrupt that can occur.
TsunamiCChip(const Params *p)
Initialize the Tsunami CChip by setting all of the device register to 0.
Top level class for Tsunami Chipset emulation.
uint64_t ipint
Indicator of which CPUs have an IPI interrupt.
static const int Max_CPUs
Max number of CPUs in a Tsunami.
uint64_t dim[Tsunami::Max_CPUs]
The dims are device interrupt mask registers.
TsunamiCChipParams Params
void clearIPI(uint64_t ipintr)
post an ipi interrupt to the CPU.
TsunamiCChip * cchip
Pointer to the Tsunami CChip.
void setLE(T v)
Set the value in the data pointer to v as little endian.
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
RequestPtr req
A pointer to the original request.
#define UNSERIALIZE_SCALAR(scalar)
Addr pioSize
Size that the device's address range.
void makeAtomicResponse()
uint64_t Tick
Tick count type.
void serialize(CheckpointOut &cp) const override
Serialize an object.
Declaration of top level class for the Tsunami chipset.
std::vector< ThreadContext * > threadContexts
#define SERIALIZE_ARRAY(member, size)
void clearITI(uint64_t itintr)
clear a timer interrupt previously posted to the CPU.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
#define ULL(N)
uint64_t constant
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
#define SERIALIZE_SCALAR(scalar)
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
#define UNSERIALIZE_ARRAY(member, size)
Tsunami CChip CSR Emulation.
Declaration of the Packet class.
std::ostream CheckpointOut
Tick pioDelay
Delay that the device experinces on an access.
uint64_t dir[Tsunami::Max_CPUs]
The dirs are device interrupt registers.
T getLE() const
Get the data in the packet byte swapped from little endian to host endian.
void clearDRIR(uint32_t interrupt)
clear an interrupt previously posted to the CPU.
void clear(int cpu_id, int int_num, int index)
uint64_t itint
Indicator of which CPUs have an RTC interrupt.
Addr pioAddr
Address that the device listens to.