44#include "debug/GIC.hh"
45#include "debug/Interrupt.hh"
63 DPRINTF(GIC,
"copy dist 0x%x 0x%08x\n", daddr,
val);
64 to->writeDistributor(daddr,
val);
70 const ArmISA::Affinity &aff,
Addr daddr)
74 "copy redist (aff3: %d, aff2: %d, aff1: %d, aff0: %d) "
76 aff.aff3, aff.aff2, aff.aff1, aff.aff0, daddr,
val);
78 to->writeRedistributor(aff, daddr,
val);
84 const ArmISA::Affinity &aff,
89 "copy cpu (aff3: %d, aff2: %d, aff1: %d, aff0: %d) "
91 aff.aff3, aff.aff2, aff.aff1, aff.aff0,
94 to->writeCpu(aff, misc_reg,
val);
99 const ArmISA::Affinity &aff,
Addr daddr)
101 to->writeRedistributor(aff, daddr, 0xFFFFFFFF);
107 const ArmISA::Affinity &aff,
108 Addr daddr,
size_t size)
110 for (
auto a = daddr;
a < daddr + size;
a += 4)
117 Addr daddr,
size_t size)
119 for (
auto a = daddr;
a < daddr + size;
a += 4)
126 for (
auto a = daddr;
a < daddr + size;
a += 4)
127 to->writeDistributor(
a, 0xFFFFFFFF);
145 "Exceeding maximum number of PEs supported by GICv3: "
146 "using %u while maximum is %u.", threads,
params().cpu_max);
148 for (
int i = 0;
i < threads;
i++) {
163 for (
int i = 0;
i < threads;
i++) {
179 const size_t size = pkt->
getSize();
180 bool is_secure_access = pkt->
isSecure();
188 delay =
params().dist_pio_delay;
189 DPRINTF(GIC,
"Gicv3::read(): (distributor) context_id %d register %#x "
190 "size %d is_secure_access %d (value %#x)\n",
191 pkt->
req->contextId(), daddr, size, is_secure_access, resp);
196 resp = redist->
read(daddr, size, is_secure_access);
198 delay =
params().redist_pio_delay;
199 DPRINTF(GIC,
"Gicv3::read(): (redistributor %d) context_id %d "
200 "register %#x size %d is_secure_access %d (value %#x)\n",
202 is_secure_access, resp);
204 panic(
"Gicv3::read(): unknown address %#x\n",
addr);
207 pkt->
setUintX(resp, ByteOrder::little);
215 const size_t size = pkt->
getSize();
218 bool is_secure_access = pkt->
isSecure();
224 DPRINTF(GIC,
"Gicv3::write(): (distributor) context_id %d "
225 "register %#x size %d is_secure_access %d value %#x\n",
226 pkt->
req->contextId(), daddr, size, is_secure_access,
data);
228 delay =
params().dist_pio_delay;
233 DPRINTF(GIC,
"Gicv3::write(): (redistributor %d) context_id %d "
234 "register %#x size %d is_secure_access %d value %#x\n",
236 is_secure_access,
data);
238 redist->
write(daddr,
data, size, is_secure_access);
240 delay =
params().redist_pio_delay;
242 panic(
"Gicv3::write(): unknown address %#x\n",
addr);
285 tc->getCpuPtr()->postInterrupt(tc->threadId(), int_type, 0);
306 tc->getCpuPtr()->clearInterrupt(tc->threadId(), int_type, 0);
313 tc->getCpuPtr()->clearInterrupts(tc->threadId());
320 return tc->getCpuPtr()->checkInterrupts(tc->threadId());
333 if (redistributor->getAffinity() == aff) {
334 return redistributor;
345 "Address not pointing to a valid redistributor\n");
348 const uint32_t redistributor_id = daddr /
redistSize;
351 "Invalid redistributor_id!");
367 assert(redistributor);
368 return redistributor->read(daddr, 4,
false);
375 assert(cpu_interface);
376 return cpu_interface->readMiscReg(misc_reg);
389 assert(redistributor);
390 redistributor->write(daddr,
data,
sizeof(
data),
false);
398 assert(cpu_interface);
399 cpu_interface->setMiscReg(misc_reg,
data);
407 redistributor->copy(from,
to);
410 cpu_interface->copy(from,
to);
419 for (uint32_t redistributor_id = 0;
422 csprintf(
"redistributors.%i", redistributor_id));
424 for (uint32_t cpu_interface_id = 0;
427 csprintf(
"cpuInterface.%i", cpu_interface_id));
437 for (uint32_t redistributor_id = 0;
440 csprintf(
"redistributors.%i", redistributor_id));
442 for (uint32_t cpu_interface_id = 0;
445 csprintf(
"cpuInterface.%i", cpu_interface_id));
static void callClearStandByWfi(ThreadContext *tc)
Make a call to notify the power controller of STANDBYWFI deassertion.
void setGIC(BaseGic *gic)
Sets the pointer to the GIC.
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
const Params & params() const
ArmSystem * getSystem() const
void sendInt(uint32_t int_id)
void clearInt(uint32_t int_id)
void copy(Gicv3Registers *from, Gicv3Registers *to)
static const uint32_t ADDR_RANGE_SIZE
void write(Addr addr, uint64_t data, size_t size, bool is_secure_access)
uint64_t read(Addr addr, size_t size, bool is_secure_access)
uint32_t processorNumber() const
Gicv3CPUInterface * getCPUInterface() const
uint64_t read(Addr addr, size_t size, bool is_secure_access)
void write(Addr addr, uint64_t data, size_t size, bool is_secure_access)
static void clearRedistRegister(Gicv3Registers *to, const ArmISA::Affinity &aff, Addr daddr)
static void clearDistRange(Gicv3Registers *to, Addr daddr, size_t size)
static void copyRedistRange(Gicv3Registers *from, Gicv3Registers *to, const ArmISA::Affinity &aff, Addr daddr, size_t size)
static void copyDistRegister(Gicv3Registers *from, Gicv3Registers *to, Addr daddr)
virtual uint32_t readRedistributor(const ArmISA::Affinity &aff, Addr daddr)=0
static void copyCpuRegister(Gicv3Registers *from, Gicv3Registers *to, const ArmISA::Affinity &aff, ArmISA::MiscRegIndex misc_reg)
static void copyRedistRegister(Gicv3Registers *from, Gicv3Registers *to, const ArmISA::Affinity &aff, Addr daddr)
static void copyDistRange(Gicv3Registers *from, Gicv3Registers *to, Addr daddr, size_t size)
virtual uint32_t readDistributor(Addr daddr)=0
virtual RegVal readCpu(const ArmISA::Affinity &aff, ArmISA::MiscRegIndex misc_reg)=0
void writeRedistributor(const ArmISA::Affinity &aff, Addr daddr, uint32_t data) override
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
void clearPPInt(uint32_t int_id, uint32_t cpu) override
void unserialize(CheckpointIn &cp) override
Unserialize an object.
void serialize(CheckpointOut &cp) const override
Serialize an object.
void deassertInt(uint32_t cpu, ArmISA::InterruptTypes int_type)
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
bool supportsVersion(GicVersion version) override
Check if version supported.
friend class Gicv3Distributor
uint32_t readRedistributor(const ArmISA::Affinity &aff, Addr daddr) override
void writeCpu(const ArmISA::Affinity &aff, ArmISA::MiscRegIndex misc_reg, RegVal data) override
friend class Gicv3Redistributor
bool haveAsserted(uint32_t cpu) const
friend class Gicv3CPUInterface
void deassertAll(uint32_t cpu)
Gicv3CPUInterface * getCPUInterfaceByAffinity(const ArmISA::Affinity &aff) const
std::vector< Gicv3CPUInterface * > cpuInterfaces
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
Gicv3Redistributor * getRedistributorByAffinity(const ArmISA::Affinity &aff) const
void clearInt(uint32_t int_id) override
Clear an interrupt from a device that is connected to the GIC.
Gicv3Redistributor * getRedistributorByAddr(Addr address) const
uint32_t readDistributor(Addr daddr) override
void postInt(uint32_t cpu, ArmISA::InterruptTypes int_type)
std::vector< Gicv3Redistributor * > redistributors
void writeDistributor(Addr daddr, uint32_t data) override
void sendInt(uint32_t int_id) override
Post an interrupt from a device that is connected to the GIC.
RegVal readCpu(const ArmISA::Affinity &aff, ArmISA::MiscRegIndex misc_reg) override
void copyGicState(Gicv3Registers *from, Gicv3Registers *to)
Gicv3Distributor * distributor
void sendPPInt(uint32_t int_id, uint32_t cpu) override
Interface call for private peripheral interrupts.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
void setUintX(uint64_t w, ByteOrder endian)
Set the value in the word w after truncating it to the length of the packet and then byteswapping it ...
RequestPtr req
A pointer to the original request.
uint64_t getUintX(ByteOrder endian) const
Get the data in the packet byte swapped from the specified endianness and zero-extended to 64 bits.
void makeAtomicResponse()
AddrRange RangeSize(Addr start, Addr size)
bool contains(const Addr &a) const
Determine if the range contains an address.
Addr start() const
Get the start address of the range.
#define panic(...)
This implements a cprintf based panic() function.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
void serializeSection(CheckpointOut &cp, const char *name) const
Serialize an object into a new section.
void unserializeSection(CheckpointIn &cp, const char *name)
Unserialize an a child object.
const char *const miscRegName[]
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
std::ostream CheckpointOut
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
uint64_t Tick
Tick count type.
std::string csprintf(const char *format, const Args &...args)
Declaration of the Packet class.