Go to the documentation of this file.
47 #include "debug/Timer.hh"
50 #include "params/GenericTimer.hh"
51 #include "params/GenericTimerFrame.hh"
52 #include "params/GenericTimerMem.hh"
53 #include "params/SystemCounter.hh"
60 using namespace ArmISA;
74 "frequency not provided\n");
78 "SystemCounter::SystemCounter: Architecture states a maximum of 1004 "
79 "frequency table entries, limit surpassed\n");
88 fatal_if(!sys_cnt,
"SystemCounter::validateCounterRef: No valid system "
89 "counter, can't instantiate system timers\n");
95 DPRINTF(Timer,
"SystemCounter::enable: Counter enabled\n");
103 DPRINTF(Timer,
"SystemCounter::disable: Counter disabled\n");
131 warn(
"Explicit value set with counter enabled, UNKNOWNN result\n");
141 if (target_val > cur_val) {
142 uint64_t num_cycles =
143 std::ceil((target_val - cur_val) / ((
double)
_increment));
172 if (new_freq !=
_freq) {
178 uint64_t target_val =
value();
179 target_val += target_val % std::max(
_increment, new_incr);
188 DPRINTF(Timer,
"SystemCounter::freqUpdateCallback: Changing counter "
215 DPRINTF(Timer,
"SystemCounter::serialize: Serializing\n");
225 if (pending_freq_update) {
235 DPRINTF(Timer,
"SystemCounter::unserialize: Unserializing\n");
243 bool pending_freq_update;
245 if (pending_freq_update) {
246 Tick when_freq_update;
259 : _name(
name), _parent(parent), _systemCounter(sysctr),
260 _interrupt(interrupt),
261 _control(0), _counterLimit(0), _offset(0),
264 _systemCounter.registerListener(
this);
273 DPRINTF(Timer,
"Counter limit reached\n");
277 DPRINTF(Timer,
"Causing interrupt\n");
280 DPRINTF(Timer,
"Kvm mode; skipping simulated interrupt\n");
295 DPRINTF(Timer,
"Clearing interrupt\n");
329 if ((old_ctl.imask && !new_ctl.imask) ||
330 (!old_ctl.enable && new_ctl.enable))
333 else if ((!old_ctl.imask && new_ctl.imask) ||
334 (old_ctl.enable && !new_ctl.enable)) {
337 DPRINTF(Timer,
"Clearing interrupt\n");
407 systemCounter(*
p.counter),
411 fatal_if(!
p.system,
"GenericTimer::GenericTimer: No system specified, "
412 "can't instantiate architected timers\n");
421 for (
int i = 0;
i <
timers.size(); ++
i) {
433 static const unsigned OLD_CPU_MAX = 8;
436 warn(
"Checkpoint does not contain CPU count, assuming %i CPUs\n",
438 cpu_count = OLD_CPU_MAX;
446 fatal(
"The simulated system has been initialized with %d CPUs, "
447 "but the Generic Timer checkpoint expects %d CPUs. Consider "
448 "restoring the checkpoint specifying %d CPUs.",
452 for (
int i = 0;
i < cpu_count; ++
i) {
461 if (cpu_id >=
timers.size())
470 assert(
timers.size() < cpus);
473 const unsigned old_cpu_count(
timers.size());
475 for (
unsigned i = old_cpu_count;
i < cpus; ++
i) {
481 p.int_phys_s->get(tc),
482 p.int_phys_ns->get(tc),
484 p.int_hyp->get(tc)));
493 uint64_t old_evnten =
bits(old_cnt_ctl, 2);
507 }
else if (old_evnten && !
evnten) {
525 "does not match the system counter freq\n");
576 warn(
"Ignoring write to read only count register: %s\n",
651 return core.
cntkctl & 0x00000000ffffffff;
654 return core.
cnthctl & 0x00000000ffffffff;
731 cntfrq(parent.params().cntfrq),
732 threadContext(
system.threads[cpu]),
734 irqPhysNS(_irqPhysNS),
737 physS(
csprintf(
"%s.phys_s_timer%d", parent.
name(), cpu),
738 system, parent, parent.systemCounter,
743 system, parent, parent.systemCounter,
746 system, parent, parent.systemCounter,
749 system, parent, parent.systemCounter,
757 csprintf(
"%s.virt_event_gen%d", parent.name(), cpu)), 0, 0
765 eventStreamCallback();
766 schedNextEvent(physEvStream, physNS);
772 eventStreamCallback();
773 schedNextEvent(virtEvStream, virt);
780 threadContext->getCpuPtr()->wakeup(threadContext->threadId());
794 schedNextEvent(virtEvStream, virt);
795 schedNextEvent(physEvStream, physNS);
805 const bool phys_ev_scheduled = physEvStream.event.scheduled();
807 if (phys_ev_scheduled) {
808 const Tick phys_ev_when = physEvStream.event.when();
814 const bool virt_ev_scheduled = virtEvStream.event.scheduled();
816 if (virt_ev_scheduled) {
817 const Tick virt_ev_when = virtEvStream.event.when();
823 physS.serializeSection(cp,
"phys_s_timer");
824 physNS.serializeSection(cp,
"phys_ns_timer");
825 virt.serializeSection(cp,
"virt_timer");
826 hyp.serializeSection(cp,
"hyp_timer");
836 bool phys_ev_scheduled;
838 if (phys_ev_scheduled) {
841 parent.reschedule(physEvStream.event, phys_ev_when,
true);
846 bool virt_ev_scheduled;
848 if (virt_ev_scheduled) {
851 parent.reschedule(virtEvStream.event, virt_ev_when,
true);
856 physS.unserializeSection(cp,
"phys_s_timer");
857 physNS.unserializeSection(cp,
"phys_ns_timer");
858 virt.unserializeSection(cp,
"virt_timer");
859 hyp.unserializeSection(cp,
"hyp_timer");
866 parent.setMiscReg(
reg, cpu,
val);
872 RegVal value = parent.readMiscReg(
reg, cpu);
881 systemCounter(*
p.counter),
883 *
this, systemCounter,
p.int_phys->get()),
885 *
this, systemCounter,
894 accessBitsEl0 = 0x303;
895 addrRanges.push_back(timerEl0Range);
897 for (
auto &range : addrRanges)
952 accessBits =
data & 0x3f;
970 return accessBits.rvoff;
983 const size_t size = pkt->
getSize();
984 const bool is_sec = pkt->
isSecure();
986 "GenericTimerFrame::read: Invalid size %i\n", size);
997 panic(
"GenericTimerFrame::read: Invalid address: 0x%x\n",
addr);
1002 DPRINTF(Timer,
"GenericTimerFrame::read: 0x%x<-0x%x(%i) [S = %u]\n", resp,
1003 addr, size, is_sec);
1005 pkt->
setUintX(resp, ByteOrder::little);
1014 const size_t size = pkt->
getSize();
1015 const bool is_sec = pkt->
isSecure();
1017 "GenericTimerFrame::write: Invalid size %i\n", size);
1019 bool to_el0 =
false;
1020 const uint64_t
data = pkt->
getUintX(ByteOrder::little);
1028 panic(
"GenericTimerFrame::write: Invalid address: 0x%x\n",
addr);
1033 DPRINTF(Timer,
"GenericTimerFrame::write: 0x%x->0x%x(%i) [S = %u]\n",
data,
1034 addr, size, is_sec);
1050 if (!accessBits.rpct || (to_el0 && !accessBitsEl0.pcten))
1056 if (!accessBits.rpct || (to_el0 && !accessBitsEl0.pcten))
1062 if ((!accessBits.rfrq) ||
1063 (to_el0 && (!accessBitsEl0.pcten && !accessBitsEl0.vcten)))
1072 return accessBitsEl0;
1075 if (!accessBits.rwpt || (to_el0 && !accessBitsEl0.pten))
1081 if (!accessBits.rwpt || (to_el0 && !accessBitsEl0.pten))
1087 if (!accessBits.rwpt || (to_el0 && !accessBitsEl0.pten))
1092 if (!accessBits.rwpt || (to_el0 && !accessBitsEl0.pten))
1098 if (!accessBits.rvct || (to_el0 && !accessBitsEl0.vcten))
1104 if (!accessBits.rvct || (to_el0 && !accessBitsEl0.vcten))
1110 if (!accessBits.rvoff || (to_el0))
1116 if (!accessBits.rvoff || (to_el0))
1122 if (!accessBits.rwvt || (to_el0 && !accessBitsEl0.vten))
1128 if (!accessBits.rwvt || (to_el0 && !accessBitsEl0.vten))
1134 if (!accessBits.rwvt || (to_el0 && !accessBitsEl0.vten))
1140 if (!accessBits.rwvt || (to_el0 && !accessBitsEl0.vten))
1146 warn(
"GenericTimerFrame::timerRead: Unexpected address (0x%x:%i), "
1147 "assuming RAZ\n",
addr, size);
1154 bool is_sec,
bool to_el0)
1162 warn(
"GenericTimerFrame::timerWrite: RO reg (0x%x) [CNTPCT]\n",
1167 warn(
"GenericTimerFrame::timerWrite: RO reg (0x%x) [CNTFRQ]\n",
1180 if ((!accessBits.rwpt) || (to_el0 && !accessBitsEl0.pten))
1188 if ((!accessBits.rwpt) || (to_el0 && !accessBitsEl0.pten))
1195 if ((!accessBits.rwpt) || (to_el0 && !accessBitsEl0.pten))
1201 if ((!accessBits.rwpt) || (to_el0 && !accessBitsEl0.pten))
1207 warn(
"GenericTimerFrame::timerWrite: RO reg (0x%x) [CNTVCT]\n",
1211 warn(
"GenericTimerFrame::timerWrite: RO reg (0x%x) [CNTVOFF]\n",
1216 if ((!accessBits.rwvt) || (to_el0 && !accessBitsEl0.vten))
1224 if ((!accessBits.rwvt) || (to_el0 && !accessBitsEl0.vten))
1231 if ((!accessBits.rwvt) || (to_el0 && !accessBitsEl0.vten))
1237 if ((!accessBits.rwvt) || (to_el0 && !accessBitsEl0.vten))
1243 warn(
"GenericTimerFrame::timerWrite: Unexpected address (0x%x:%i), "
1244 "assuming WI\n",
addr, size);
1255 systemCounter(*
p.counter),
1260 for (
auto &range : addrRanges)
1262 fatal_if(frames.size() > MAX_TIMER_FRAMES,
1263 "GenericTimerMem::GenericTimerMem: Architecture states a maximum of "
1264 "8 memory-mapped timer frames, limit surpassed\n");
1266 for (
int i = 0;
i < frames.size();
i++) {
1267 uint32_t features = 0x1;
1269 if (frames[
i]->hasEl0View())
1280 "GenericTimerMem::validateFrameRange: Architecture states each "
1281 "register frame should be in a separate memory page, specified "
1282 "range base address [0x%x] is not compliant\n");
1288 return !
sys.haveSecurity() || is_sec;
1301 const size_t size = pkt->
getSize();
1302 const bool is_sec = pkt->
isSecure();
1304 "GenericTimerMem::read: Invalid size %i\n", size);
1314 panic(
"GenericTimerMem::read: Invalid address: 0x%x\n",
addr);
1316 DPRINTF(Timer,
"GenericTimerMem::read: 0x%x<-0x%x(%i) [S = %u]\n", resp,
1317 addr, size, is_sec);
1319 pkt->
setUintX(resp, ByteOrder::little);
1328 const size_t size = pkt->
getSize();
1329 const bool is_sec = pkt->
isSecure();
1331 "GenericTimerMem::write: Invalid size %i\n", size);
1333 const uint64_t
data = pkt->
getUintX(ByteOrder::little);
1341 panic(
"GenericTimerMem::write: Invalid address: 0x%x\n",
addr);
1343 DPRINTF(Timer,
"GenericTimerMem::write: 0x%x->0x%x(%i) [S = %u]\n",
data,
1344 addr, size, is_sec);
1356 case COUNTER_CTRL_CNTCR:
1376 for (
int i = 0;
i < (freq_table.size() - 1);
i++) {
1379 return freq_table[
i];
1381 warn(
"GenericTimerMem::counterCtrlRead: Unexpected address "
1382 "(0x%x:%i), assuming RAZ\n",
addr, size);
1396 case COUNTER_CTRL_CNTCR:
1405 warn(
"GenericTimerMem::counterCtrlWrite: Halt-on-debug is not "
1408 warn(
"GenericTimerMem::counterCtrlWrite: Counter Scaling is not "
1416 warn(
"GenericTimerMem::counterCtrlWrite: RO reg (0x%x) [CNTSR]\n",
1435 warn(
"GenericTimerMem::counterCtrlWrite: RO reg (0x%x) [CNTID]\n",
1442 for (
int i = 0;
i < (freq_table.size() - 1);
i++) {
1445 freq_table[
i] =
data;
1456 warn(
"GenericTimerMem::counterCtrlWrite: Unexpected address "
1457 "(0x%x:%i), assuming WI\n",
addr, size);
1469 warn(
"GenericTimerMem::counterStatusRead: Unexpected address "
1470 "(0x%x:%i), assuming RAZ\n",
addr, size);
1480 warn(
"GenericTimerMem::counterStatusWrite: RO reg (0x%x) [CNTCV]\n",
1484 warn(
"GenericTimerMem::counterStatusWrite: Unexpected address "
1485 "(0x%x:%i), assuming WI\n",
addr, size);
1499 uint32_t cntnsar = 0x0;
1500 for (
int i = 0;
i <
frames.size();
i++) {
1501 if (
frames[
i]->hasNonSecureAccess())
1502 cntnsar |= 0x1 <<
i;
1508 for (
int i = 0;
i <
frames.size();
i++) {
1514 bool hit =
addr == cntacr_off ||
addr == cntvoff_lo_off ||
1515 addr == cntvoff_hi_off;
1518 frames[
i]->hasNonSecureAccess();
1519 if (hit && !has_access)
return 0;
1520 if (
addr == cntacr_off)
1521 return frames[
i]->getAccessBits();
1522 if (
addr == cntvoff_lo_off ||
addr == cntvoff_hi_off) {
1523 return addr == cntvoff_lo_off ?
frames[
i]->getVirtOffset()
1524 :
frames[
i]->getVirtOffset() >> 32;
1527 warn(
"GenericTimerMem::timerCtrlRead: Unexpected address (0x%x:%i), "
1528 "assuming RAZ\n",
addr, size);
1541 "GenericTimerMem::timerCtrlWrite: CNTFRQ configured freq "
1542 "does not match the counter freq, ignoring\n");
1546 for (
int i = 0;
i <
frames.size();
i++) {
1548 if (
data & (0x1 <<
i))
1549 frames[
i]->setNonSecureAccess();
1553 warn(
"GenericTimerMem::timerCtrlWrite: RO reg (0x%x) [CNTTIDR]\n",
1557 for (
int i = 0;
i <
frames.size();
i++) {
1563 bool hit =
addr == cntacr_off ||
addr == cntvoff_lo_off ||
1564 addr == cntvoff_hi_off;
1567 frames[
i]->hasNonSecureAccess();
1568 if (hit && !has_access)
return;
1569 if (
addr == cntacr_off) {
1573 if (
addr == cntvoff_lo_off ||
addr == cntvoff_hi_off) {
1574 if (
addr == cntvoff_lo_off)
1584 warn(
"GenericTimerMem::timerCtrlWrite: Unexpected address "
1585 "(0x%x:%i), assuming WI\n",
addr, size);
static const Addr COUNTER_STATUS_CNTCV_LO
void unserialize(CheckpointIn &cp) override
Unserialize an object.
void setGenericTimer(GenericTimer *generic_timer)
Sets the pointer to the Generic Timer.
Tick curTick()
The universal simulation clock.
CoreTimers(GenericTimer &_parent, ArmSystem &system, unsigned cpu, ArmInterruptPin *_irqPhysS, ArmInterruptPin *_irqPhysNS, ArmInterruptPin *_irqVirt, ArmInterruptPin *_irqHyp)
#define fatal(...)
This implements a cprintf based fatal() function.
void counterCtrlWrite(Addr addr, size_t size, uint64_t data, bool is_sec)
GenericTimer & parent
Generic Timer parent reference.
Tick when() const
Get the time that the event is scheduled.
void notifyListeners(void) const
Notifies counting speed changes to listeners.
const AddrRange timerRange
void virtEventStreamCallback()
Addr start() const
Get the start address of the range.
bool hasNonSecureAccess() const
Indicates if non-secure accesses are allowed to this frame.
GenericTimerMem(const GenericTimerMemParams &p)
ArchTimerCtrl _control
Value of the control register ({CNTP/CNTHP/CNTV}_CTL).
uint64_t getUintX(ByteOrder endian) const
Get the data in the packet byte swapped from the specified endianness and zero-extended to 64 bits.
This device is the base class which all devices senstive to an address range inherit from.
#define UNSERIALIZE_SCALAR(scalar)
uint64_t _increment
Value increment in each counter cycle.
static const Addr TIMER_CNTV_CVAL_LO
GenericTimer(const Params &p)
void unserialize(CheckpointIn &cp) override
Unserialize an object.
static const Addr TIMER_CNTP_CVAL_LO
AddrRange RangeSize(Addr start, Addr size)
#define UNSERIALIZE_CONTAINER(member)
static const Addr TIMER_CTRL_CNTTIDR
void freqUpdateCallback()
Callback for the frequency update.
static const Addr TIMER_CNTVOFF_LO
static const Addr COUNTER_CTRL_CNTCV_LO
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
bool contains(const Addr &a) const
Determine if the range contains an address.
const AddrRange counterStatusRange
ArchTimer(const std::string &name, SimObject &parent, SystemCounter &sysctr, ArmInterruptPin *interrupt)
constexpr void replaceBits(T &val, unsigned first, unsigned last, B bit_val)
A convenience function to replace bits first to last of val with bit_val in place.
void serializeSection(CheckpointOut &cp, const char *name) const
Serialize an object into a new section.
static const Addr COUNTER_CTRL_CNTFID
static ExceptionLevel currEL(const ThreadContext *tc)
static const Addr TIMER_CNTP_TVAL
Tick Frequency
The simulated frequency of curTick(). (In ticks per second)
static const Addr TIMER_CNTVOFF_HI
virtual bool scheduleEvents()
static const Addr TIMER_CNTV_CVAL_HI
AddrRangeList getAddrRanges() const override
Every PIO device is obliged to provide an implementation that returns the address ranges the device r...
const char *const miscRegName[]
void unserialize(CheckpointIn &cp) override
Unserialize an object.
uint64_t counterCtrlRead(Addr addr, size_t size, bool is_sec) const
CNTControlBase (System counter control frame)
void updateCounter()
Timer settings or the offset has changed, re-evaluate trigger condition and raise interrupt if necess...
void schedule(Event &event, Tick when)
uint64_t counterStatusRead(Addr addr, size_t size) const
CNTReadBase (System counter status frame)
void setOffset(uint64_t val)
bool ELIsInHost(ThreadContext *tc, ExceptionLevel el)
Returns true if the current exception level el is executing a Host OS or an application of a Host OS ...
bool _enabled
Indicates if the counter is enabled.
std::string csprintf(const char *format, const Args &...args)
void timerWrite(Addr addr, size_t size, uint64_t data, bool is_sec, bool to_el0)
static const Addr TIMER_CNTPCT_HI
void registerListener(SystemCounterListener *listener)
Called from System Counter Listeners to register.
void serialize(CheckpointOut &cp) const override
Serialize an object.
Tick _period
Cached copy of the counter period (inverse of the frequency).
AddrRangeList addrRanges
All MMIO ranges GenericTimerFrame responds to.
void setVirtOffset(uint64_t new_offset)
Sets the virtual offset for this frame's virtual timer after a write to CNTVOFF.
static const Addr TIMER_CNTVCT_LO
static const Addr TIMER_CTRL_CNTVOFF_HI
uint32_t control() const
Sets the control register.
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
static const Addr COUNTER_CTRL_CNTSR
static const Addr TIMER_CNTPCT_LO
static const Addr TIMER_CNTVCT_HI
void setControl(uint32_t val)
const AddrRangeList addrRanges
All MMIO ranges GenericTimerMem responds to.
DrainState
Object drain/handover states.
static const Addr COUNTER_STATUS_CNTCV_HI
const AddrRange counterCtrlRange
SystemCounter & systemCounter
System counter reference.
ArmISA::CNTHCTL cnthctl
Hypervisor control register.
uint64_t eventTargetValue(uint64_t val) const
void serialize(CheckpointOut &cp) const override
Serialize an object.
Tick whenValue(uint64_t target_val)
Returns the tick at which a certain counter value is reached.
uint32_t _freq
Counter frequency (as specified by CNTFRQ).
CoreTimers & getTimers(int cpu_id)
ThreadContext is the external interface to all thread state for anything outside of the CPU.
static const Addr TIMER_CNTEL0ACR
virtual std::string name() const
void unserializeSection(CheckpointIn &cp, const char *name)
Unserialize an a child object.
Abstract class for elements whose events depend on the counting speed of the System Counter.
const Params & params() const
size_t activeFreqEntry() const
Returns the currently active frequency table entry.
GenericTimerFrame(const GenericTimerFrameParams &p)
bool hasReadableVoff() const
Indicates if CNTVOFF is readable for this frame.
EventFunctionWrapper event
SystemCounter & _systemCounter
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
RegVal readMiscReg(int misc_reg) override
Read a system register belonging to this device.
void notify(void) override
Called from the SystemCounter when a change in counting speed occurred Events should be rescheduled p...
uint32_t freq() const
Returns the counter frequency.
void counterStatusWrite(Addr addr, size_t size, uint64_t data)
size_t _activeFreqEntry
Currently selected entry in the table, its contents should match _freq.
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
uint64_t Tick
Tick count type.
virtual void clear()=0
Clear a signalled interrupt.
static const Addr TIMER_CNTV_CTL
static const Addr TIMER_CNTP_CTL
std::vector< GenericTimerFrame * > frames
Timer frame references.
#define UNSERIALIZE_OPT_SCALAR(scalar)
bool hasEl0View() const
Indicates if this frame implements a second EL0 view.
void counterLimitReached()
Called when the upcounter reaches the programmed value.
Tick whenValue(uint64_t target_val)
void setValue(uint64_t new_value)
Sets the value explicitly from writes to CNTCR.CNTCV.
bool valid() const
Determine if the range is valid.
static bool validateAccessPerm(ArmSystem &sys, bool is_sec)
Validates an MMIO access permissions.
void reschedule(Event &event, Tick when, bool always=false)
EndBitUnion(ArchTimerCtrl) const std SimObject & _parent
Name of this timer.
constexpr T insertBits(T val, unsigned first, unsigned last, B bit_val)
Returns val with bits first to last set to the LSBs of bit_val.
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
Abstract superclass for simulation objects.
@ Drained
Buffers drained, ready for serialization/handover.
RegVal readMiscReg(int misc_reg, unsigned cpu)
void updateTick(void)
Updates the update tick, normalizes to the lower cycle start tick.
EventFunctionWrapper _counterLimitReachedEvent
static const Addr TIMER_CNTV_TVAL
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
const std::string & name()
#define SERIALIZE_SCALAR(scalar)
static void validateFrameRange(const AddrRange &range)
Validates a Generic Timer register frame address range.
ArmSystem & system
ARM system containing this timer.
bool nonSecureAccess
Reports whether non-secure accesses are allowed to this frame.
const AddrRange timerCtrlRange
void setAccessBits(uint8_t data)
Updates the access bits after a write to CNTCTLBase.CNTACR.
void deschedule(Event &event)
uint64_t _offset
Offset relative to the physical timer (CNTVOFF)
static const Addr COUNTER_CTRL_CNTSCR
void setTimerValue(uint32_t val)
Sets the TimerValue view of the timer.
static const Addr TIMER_CTRL_CNTNSAR
std::vector< uint32_t > & freqTable()
Returns a reference to the frequency modes table.
uint32_t cnttidr
ID register for reporting features of implemented timer frames.
uint64_t timerRead(Addr addr, size_t size, bool is_sec, bool to_el0) const
CNTBase/CNTEL0Base (Memory-mapped timer frame)
#define warn_if(cond,...)
Conditional warning macro that checks the supplied condition and only prints a warning if the conditi...
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
void setNonSecureAccess()
Allows non-secure accesses after an enabling write to CNTCTLBase.CNTNSAR.
std::vector< SystemCounterListener * > _listeners
Listeners to changes in counting speed.
void timerCtrlWrite(Addr addr, size_t size, uint64_t data, bool is_sec)
uint64_t value() const
Returns the value of the counter which this timer relies on.
ArmISA::CNTKCTL cntkctl
Kernel control register.
ArchTimer physTimer
Physical and virtual timers.
std::vector< uint32_t > _freqTable
Frequency modes table with all possible frequencies for the counter.
uint64_t value()
Updates and returns the counter value.
void updateValue(void)
Updates the counter value.
uint64_t _value
Counter value (as specified in CNTCV).
static constexpr size_t MAX_FREQ_ENTRIES
Maximum architectural number of frequency table entries.
void paramOut(CheckpointOut &cp, const std::string &name, ExtMachInst const &machInst)
SystemCounter(const SystemCounterParams &p)
static const Addr TIMER_CTRL_CNTFRQ
SystemCounter & systemCounter
System counter reference.
static const Addr COUNTER_CTRL_CNTID
void setMiscReg(int misc_reg, unsigned cpu, RegVal val)
ArmInterruptPin *const _interrupt
SystemCounter & systemCounter
System counter reference.
#define SERIALIZE_CONTAINER(member)
void sendEvent(ThreadContext *tc)
Send an event (SEV) to a specific PE if there isn't already a pending event.
static void validateCounterRef(SystemCounter *sys_cnt)
Validates a System Counter reference.
virtual void setMiscReg(RegIndex misc_reg, RegVal val)=0
void makeResponse()
Take a request packet and modify it in place to be suitable for returning as a response to that reque...
void paramIn(CheckpointIn &cp, const std::string &name, ExtMachInst &machInst)
bool enabled() const
Indicates if the counter is enabled.
static const Addr TIMER_CNTFRQ
uint32_t cntfrq
System counter frequency as visible from this core.
AddrRangeList getAddrRanges() const override
Every PIO device is obliged to provide an implementation that returns the address ranges the device r...
void disable()
Disables the counter after a CNTCR.EN == 0.
EventFunctionWrapper _freqUpdateEvent
Frequency update event handling.
void freqUpdateSchedule(size_t new_freq_entry)
Schedules a counter frequency update after a CNTCR.FCREQ == 1 This complies with frequency transition...
static constexpr Addr PageBytes
void serialize(CheckpointOut &cp) const override
Serialize an object.
void eventStreamCallback() const
uint32_t timerValue() const
Returns the TimerValue view of the timer.
Generic representation of an Arm interrupt pin.
std::ostream CheckpointOut
virtual void raise()=0
Signal an interrupt.
static const Addr TIMER_CNTP_CVAL_HI
static const Addr TIMER_CTRL_CNTACR
Per-CPU architected timer.
void schedNextEvent(EventStream &ev_stream, ArchTimer &timer)
uint64_t _counterLimit
Programmed limit value for the upcounter ({CNTP/CNTHP/CNTV}_CVAL).
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
void unserialize(CheckpointIn &cp) override
Unserialize an object.
bool active() const
True if interrupt pin is active, false otherwise.
void notify(void) override
Called from the SystemCounter when a change in counting speed occurred Events should be rescheduled p...
static const Addr TIMER_CTRL_CNTVOFF_LO
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
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 ...
void setCompareValue(uint64_t val)
Sets the CompareValue view of the timer.
void serialize(CheckpointOut &cp) const override
Serialize an object.
void drainResume() override
Resume execution after a successful drain.
void setMiscReg(int misc_reg, RegVal val) override
Write to a system register belonging to this device.
void serialize(CheckpointOut &cp) const override
Serialize an object.
std::vector< std::unique_ptr< CoreTimers > > timers
Per-CPU physical architected timers.
void handleStream(CoreTimers::EventStream *ev_stream, ArchTimer *timer, RegVal old_cnt_ctl, RegVal cnt_ctl)
void createTimers(unsigned cpus)
static const Addr COUNTER_CTRL_CNTCV_HI
void physEventStreamCallback()
uint64_t compareValue() const
Returns the CompareValue view of the timer.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
bool scheduled() const
Determine if the current event is scheduled.
void enable()
Enables the counter after a CNTCR.EN == 1.
uint64_t timerCtrlRead(Addr addr, size_t size, bool is_sec) const
CNTCTLBase (Memory-mapped timer global control frame)
#define panic(...)
This implements a cprintf based panic() function.
uint8_t getAccessBits() const
Returns the access bits for this frame.
Tick _updateTick
Counter cycle start Tick when the counter status affecting its value has been updated.
uint64_t getVirtOffset() const
Returns the virtual offset for this frame if a virtual timer is implemented.
DrainState drain() override
Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are pa...
Generated on Tue Sep 21 2021 12:25:10 for gem5 by doxygen 1.8.17