44 #include "config/the_isa.hh"
47 #include "debug/IPI.hh"
48 #include "debug/Tsunami.hh"
54 #include "params/TsunamiCChip.hh"
58 using namespace TheISA;
89 case sizeof(uint64_t):
90 pkt->
set<uint64_t>(0);
94 pkt->
set(
dim[(daddr >> 4) & 0x3F]);
100 pkt->
set(
dir[(daddr >> 4) & 0x3F]);
109 panic(
"TSDEV_CC_MTR not implemeted\n");
155 panic(
"TSDEV_CC_PRBEN not implemented\n");
161 panic(
"TSDEV_CC_IICx not implemented\n");
167 panic(
"TSDEV_CC_MPRx not implemented\n");
176 panic(
"default in cchip read reached, accessing 0x%x\n");
180 case sizeof(uint32_t):
181 case sizeof(uint16_t):
182 case sizeof(uint8_t):
184 panic(
"invalid access size(?) for tsunami register!\n");
186 DPRINTF(
Tsunami,
"Tsunami CChip: read regnum=%#x size=%d data=%lld\n",
187 regnum, pkt->
getSize(), pkt->
get<uint64_t>());
201 assert(pkt->
getSize() ==
sizeof(uint64_t));
205 bool supportedWrite =
false;
210 int number = (daddr >> 4) & 0x3F;
216 olddim =
dim[number];
217 olddir =
dir[number];
218 dim[number] = pkt->
get<uint64_t>();
222 bitvector =
ULL(1) <<
x;
224 if ((
dim[number] & bitvector) != (olddim & bitvector))
227 if ((
dim[number] & bitvector) && (dir[number] & bitvector))
231 " interrupt to cpu %d\n", number);
233 else if ((olddir & bitvector) &&
234 !(dir[number] & bitvector))
240 " dir interrupt to cpu %d\n", number);
250 panic(
"TSDEV_CC_CSR write\n");
252 panic(
"TSDEV_CC_MTR write not implemented\n");
255 ipreq = (pkt->
get<uint64_t>() >> 12) & 0xF;
259 supportedWrite =
true;
264 ipintr = (pkt->
get<uint64_t>() >> 8) & 0xF;
267 supportedWrite =
true;
272 itintr = (pkt->
get<uint64_t>() >> 4) & 0xF;
275 supportedWrite =
true;
279 if (pkt->
get<uint64_t>() & 0x10000000)
280 supportedWrite =
true;
283 panic(
"TSDEV_CC_MISC write not implemented\n");
290 panic(
"TSDEV_CC_AARx write not implemeted\n");
309 olddim =
dim[number];
310 olddir =
dir[number];
311 dim[number] = pkt->
get<uint64_t>();
313 for (
int x = 0;
x < 64;
x++)
315 bitvector =
ULL(1) <<
x;
317 if ((
dim[number] & bitvector) != (olddim & bitvector))
320 if ((
dim[number] & bitvector) && (dir[number] & bitvector))
325 else if ((olddir & bitvector) &&
326 !(dir[number] & bitvector))
332 " dir interrupt to cpu %d\n",
345 panic(
"TSDEV_CC_DIR write not implemented\n");
347 panic(
"TSDEV_CC_DRIR write not implemented\n");
349 panic(
"TSDEV_CC_PRBEN write not implemented\n");
354 panic(
"TSDEV_CC_IICx write not implemented\n");
359 panic(
"TSDEV_CC_MPRx write not implemented\n");
370 panic(
"default in cchip read reached, accessing 0x%x\n");
384 for (
int cpunum=0; cpunum < numcpus; cpunum++) {
386 uint64_t cpumask =
ULL(1) << cpunum;
387 if (ipintr & cpumask) {
389 if (
ipint & cpumask) {
392 DPRINTF(IPI,
"clear IPI IPI cpu=%d\n", cpunum);
395 warn(
"clear IPI for CPU=%d, but NO IPI\n", cpunum);
400 panic(
"Big IPI Clear, but not processors indicated\n");
410 for (
int i=0;
i < numcpus;
i++) {
411 uint64_t cpumask =
ULL(1) <<
i;
412 if (itintr & cpumask &
itint) {
420 panic(
"Big ITI Clear, but not processors indicated\n");
430 for (
int cpunum=0; cpunum < numcpus; cpunum++) {
432 uint64_t cpumask =
ULL(1) << cpunum;
433 if (ipreq & cpumask) {
435 if (!(
ipint & cpumask)) {
438 DPRINTF(IPI,
"send IPI cpu=%d\n", cpunum);
441 warn(
"post IPI for CPU=%d, but IPI already\n", cpunum);
446 panic(
"Big IPI Request, but not processors indicated\n");
456 for (
int i = 0;
i <
size;
i++) {
457 uint64_t cpumask =
ULL(1) <<
i;
458 if (!(cpumask &
itint)) {
477 if (
dim[
i] & bitvector) {
480 "interrupt %d\n",
i, interrupt);
492 if (
drir & bitvector)
496 if (
dir[
i] & bitvector) {
499 "interrupt %d\n",
i, interrupt);
531 TsunamiCChipParams::create()
void set(T v, ByteOrder endian)
Set the value in the data pointer to v using the specified endianness.
Emulation of the Tsunami CChip CSRs.
Tsunami * tsunami
pointer to the tsunami object.
ContextID contextId() const
Accessor function for context ID.
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.
T get(ByteOrder endian) const
Get the data in the packet byte swapped from the specified endianness.
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
#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)
const RequestPtr req
A pointer to the original request.
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.
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.