Go to the documentation of this file.
48 #include "debug/Timer.hh"
51 #include "params/GenericTimer.hh"
52 #include "params/GenericTimerFrame.hh"
53 #include "params/GenericTimerMem.hh"
54 #include "params/SystemCounter.hh"
61 using namespace ArmISA;
75 "frequency not provided\n");
79 "SystemCounter::SystemCounter: Architecture states a maximum of 1004 "
80 "frequency table entries, limit surpassed\n");
89 fatal_if(!sys_cnt,
"SystemCounter::validateCounterRef: No valid system "
90 "counter, can't instantiate system timers\n");
96 DPRINTF(Timer,
"SystemCounter::enable: Counter enabled\n");
104 DPRINTF(Timer,
"SystemCounter::disable: Counter disabled\n");
132 warn(
"Explicit value set with counter enabled, UNKNOWNN result\n");
142 if (target_val > cur_val) {
143 uint64_t num_cycles =
144 std::ceil((target_val - cur_val) / ((
double)
_increment));
173 if (new_freq !=
_freq) {
179 uint64_t target_val =
value();
180 target_val += target_val % std::max(
_increment, new_incr);
189 DPRINTF(Timer,
"SystemCounter::freqUpdateCallback: Changing counter "
216 DPRINTF(Timer,
"SystemCounter::serialize: Serializing\n");
226 if (pending_freq_update) {
236 DPRINTF(Timer,
"SystemCounter::unserialize: Unserializing\n");
244 bool pending_freq_update;
246 if (pending_freq_update) {
247 Tick when_freq_update;
260 : _name(
name), _parent(parent), _systemCounter(sysctr),
261 _interrupt(interrupt),
262 _control(0), _counterLimit(0), _offset(0),
265 _systemCounter.registerListener(
this);
274 DPRINTF(Timer,
"Counter limit reached\n");
278 DPRINTF(Timer,
"Causing interrupt\n");
281 DPRINTF(Timer,
"Kvm mode; skipping simulated interrupt\n");
296 DPRINTF(Timer,
"Clearing interrupt\n");
330 if ((old_ctl.imask && !new_ctl.imask) ||
331 (!old_ctl.enable && new_ctl.enable))
334 else if ((!old_ctl.imask && new_ctl.imask) ||
335 (old_ctl.enable && !new_ctl.enable)) {
338 DPRINTF(Timer,
"Clearing interrupt\n");
408 systemCounter(*
p.counter),
412 fatal_if(!
p.system,
"GenericTimer::GenericTimer: No system specified, "
413 "can't instantiate architected timers\n");
422 for (
int i = 0;
i <
timers.size(); ++
i) {
434 static const unsigned OLD_CPU_MAX = 8;
437 warn(
"Checkpoint does not contain CPU count, assuming %i CPUs\n",
439 cpu_count = OLD_CPU_MAX;
447 fatal(
"The simulated system has been initialized with %d CPUs, "
448 "but the Generic Timer checkpoint expects %d CPUs. Consider "
449 "restoring the checkpoint specifying %d CPUs.",
453 for (
int i = 0;
i < cpu_count; ++
i) {
462 if (cpu_id >=
timers.size())
471 assert(
timers.size() < cpus);
474 const unsigned old_cpu_count(
timers.size());
476 for (
unsigned i = old_cpu_count;
i < cpus; ++
i) {
482 p.int_phys_s->get(tc),
483 p.int_phys_ns->get(tc),
485 p.int_hyp->get(tc)));
494 uint64_t old_evnten =
bits(old_cnt_ctl, 2);
508 }
else if (old_evnten && !
evnten) {
526 "does not match the system counter freq\n");
577 warn(
"Ignoring write to read only count register: %s\n",
652 return core.
cntkctl & 0x00000000ffffffff;
655 return core.
cnthctl & 0x00000000ffffffff;
732 cntfrq(parent.params().cntfrq),
733 cntkctl(0), cnthctl(0),
734 threadContext(
system.threads[cpu]),
736 irqPhysNS(_irqPhysNS),
739 physS(
csprintf(
"%s.phys_s_timer%d", parent.
name(), cpu),
740 system, parent, parent.systemCounter,
745 system, parent, parent.systemCounter,
748 system, parent, parent.systemCounter,
751 system, parent, parent.systemCounter,
759 csprintf(
"%s.virt_event_gen%d", parent.name(), cpu)), 0, 0
767 eventStreamCallback();
768 schedNextEvent(physEvStream, physNS);
774 eventStreamCallback();
775 schedNextEvent(virtEvStream, virt);
782 threadContext->getCpuPtr()->wakeup(threadContext->threadId());
796 schedNextEvent(virtEvStream, virt);
797 schedNextEvent(physEvStream, physNS);
807 const bool phys_ev_scheduled = physEvStream.event.scheduled();
809 if (phys_ev_scheduled) {
810 const Tick phys_ev_when = physEvStream.event.when();
816 const bool virt_ev_scheduled = virtEvStream.event.scheduled();
818 if (virt_ev_scheduled) {
819 const Tick virt_ev_when = virtEvStream.event.when();
825 physS.serializeSection(cp,
"phys_s_timer");
826 physNS.serializeSection(cp,
"phys_ns_timer");
827 virt.serializeSection(cp,
"virt_timer");
828 hyp.serializeSection(cp,
"hyp_timer");
838 bool phys_ev_scheduled;
840 if (phys_ev_scheduled) {
843 parent.reschedule(physEvStream.event, phys_ev_when,
true);
848 bool virt_ev_scheduled;
850 if (virt_ev_scheduled) {
853 parent.reschedule(virtEvStream.event, virt_ev_when,
true);
858 physS.unserializeSection(cp,
"phys_s_timer");
859 physNS.unserializeSection(cp,
"phys_ns_timer");
860 virt.unserializeSection(cp,
"virt_timer");
861 hyp.unserializeSection(cp,
"hyp_timer");
868 parent.setMiscReg(
reg, cpu,
val);
874 RegVal value = parent.readMiscReg(
reg, cpu);
883 systemCounter(*
p.counter),
885 *
this, systemCounter,
p.int_phys->get()),
887 *
this, systemCounter,
896 accessBitsEl0 = 0x303;
897 addrRanges.push_back(timerEl0Range);
899 for (
auto &range : addrRanges)
954 accessBits =
data & 0x3f;
972 return accessBits.rvoff;
985 const size_t size = pkt->
getSize();
986 const bool is_sec = pkt->
isSecure();
988 "GenericTimerFrame::read: Invalid size %i\n", size);
999 panic(
"GenericTimerFrame::read: Invalid address: 0x%x\n",
addr);
1004 DPRINTF(Timer,
"GenericTimerFrame::read: 0x%x<-0x%x(%i) [S = %u]\n", resp,
1005 addr, size, is_sec);
1007 pkt->
setUintX(resp, ByteOrder::little);
1016 const size_t size = pkt->
getSize();
1017 const bool is_sec = pkt->
isSecure();
1019 "GenericTimerFrame::write: Invalid size %i\n", size);
1021 bool to_el0 =
false;
1022 const uint64_t
data = pkt->
getUintX(ByteOrder::little);
1030 panic(
"GenericTimerFrame::write: Invalid address: 0x%x\n",
addr);
1035 DPRINTF(Timer,
"GenericTimerFrame::write: 0x%x->0x%x(%i) [S = %u]\n",
data,
1036 addr, size, is_sec);
1052 if (!accessBits.rpct || (to_el0 && !accessBitsEl0.pcten))
1058 if (!accessBits.rpct || (to_el0 && !accessBitsEl0.pcten))
1064 if ((!accessBits.rfrq) ||
1065 (to_el0 && (!accessBitsEl0.pcten && !accessBitsEl0.vcten)))
1074 return accessBitsEl0;
1077 if (!accessBits.rwpt || (to_el0 && !accessBitsEl0.pten))
1083 if (!accessBits.rwpt || (to_el0 && !accessBitsEl0.pten))
1089 if (!accessBits.rwpt || (to_el0 && !accessBitsEl0.pten))
1094 if (!accessBits.rwpt || (to_el0 && !accessBitsEl0.pten))
1100 if (!accessBits.rvct || (to_el0 && !accessBitsEl0.vcten))
1106 if (!accessBits.rvct || (to_el0 && !accessBitsEl0.vcten))
1112 if (!accessBits.rvoff || (to_el0))
1118 if (!accessBits.rvoff || (to_el0))
1124 if (!accessBits.rwvt || (to_el0 && !accessBitsEl0.vten))
1130 if (!accessBits.rwvt || (to_el0 && !accessBitsEl0.vten))
1136 if (!accessBits.rwvt || (to_el0 && !accessBitsEl0.vten))
1142 if (!accessBits.rwvt || (to_el0 && !accessBitsEl0.vten))
1148 warn(
"GenericTimerFrame::timerRead: Unexpected address (0x%x:%i), "
1149 "assuming RAZ\n",
addr, size);
1156 bool is_sec,
bool to_el0)
1164 warn(
"GenericTimerFrame::timerWrite: RO reg (0x%x) [CNTPCT]\n",
1169 warn(
"GenericTimerFrame::timerWrite: RO reg (0x%x) [CNTFRQ]\n",
1182 if ((!accessBits.rwpt) || (to_el0 && !accessBitsEl0.pten))
1190 if ((!accessBits.rwpt) || (to_el0 && !accessBitsEl0.pten))
1197 if ((!accessBits.rwpt) || (to_el0 && !accessBitsEl0.pten))
1203 if ((!accessBits.rwpt) || (to_el0 && !accessBitsEl0.pten))
1209 warn(
"GenericTimerFrame::timerWrite: RO reg (0x%x) [CNTVCT]\n",
1213 warn(
"GenericTimerFrame::timerWrite: RO reg (0x%x) [CNTVOFF]\n",
1218 if ((!accessBits.rwvt) || (to_el0 && !accessBitsEl0.vten))
1226 if ((!accessBits.rwvt) || (to_el0 && !accessBitsEl0.vten))
1233 if ((!accessBits.rwvt) || (to_el0 && !accessBitsEl0.vten))
1239 if ((!accessBits.rwvt) || (to_el0 && !accessBitsEl0.vten))
1245 warn(
"GenericTimerFrame::timerWrite: Unexpected address (0x%x:%i), "
1246 "assuming WI\n",
addr, size);
1257 systemCounter(*
p.counter),
1262 for (
auto &range : addrRanges)
1264 fatal_if(frames.size() > MAX_TIMER_FRAMES,
1265 "GenericTimerMem::GenericTimerMem: Architecture states a maximum of "
1266 "8 memory-mapped timer frames, limit surpassed\n");
1268 for (
int i = 0;
i < frames.size();
i++) {
1269 uint32_t features = 0x1;
1271 if (frames[
i]->hasEl0View())
1282 "GenericTimerMem::validateFrameRange: Architecture states each "
1283 "register frame should be in a separate memory page, specified "
1284 "range base address [0x%x] is not compliant\n");
1290 return !
sys.has(ArmExtension::SECURITY) || is_sec;
1303 const size_t size = pkt->
getSize();
1304 const bool is_sec = pkt->
isSecure();
1306 "GenericTimerMem::read: Invalid size %i\n", size);
1316 panic(
"GenericTimerMem::read: Invalid address: 0x%x\n",
addr);
1318 DPRINTF(Timer,
"GenericTimerMem::read: 0x%x<-0x%x(%i) [S = %u]\n", resp,
1319 addr, size, is_sec);
1321 pkt->
setUintX(resp, ByteOrder::little);
1330 const size_t size = pkt->
getSize();
1331 const bool is_sec = pkt->
isSecure();
1333 "GenericTimerMem::write: Invalid size %i\n", size);
1335 const uint64_t
data = pkt->
getUintX(ByteOrder::little);
1343 panic(
"GenericTimerMem::write: Invalid address: 0x%x\n",
addr);
1345 DPRINTF(Timer,
"GenericTimerMem::write: 0x%x->0x%x(%i) [S = %u]\n",
data,
1346 addr, size, is_sec);
1358 case COUNTER_CTRL_CNTCR:
1378 for (
int i = 0;
i < (freq_table.size() - 1);
i++) {
1381 return freq_table[
i];
1383 warn(
"GenericTimerMem::counterCtrlRead: Unexpected address "
1384 "(0x%x:%i), assuming RAZ\n",
addr, size);
1398 case COUNTER_CTRL_CNTCR:
1407 warn(
"GenericTimerMem::counterCtrlWrite: Halt-on-debug is not "
1410 warn(
"GenericTimerMem::counterCtrlWrite: Counter Scaling is not "
1418 warn(
"GenericTimerMem::counterCtrlWrite: RO reg (0x%x) [CNTSR]\n",
1437 warn(
"GenericTimerMem::counterCtrlWrite: RO reg (0x%x) [CNTID]\n",
1444 for (
int i = 0;
i < (freq_table.size() - 1);
i++) {
1447 freq_table[
i] =
data;
1458 warn(
"GenericTimerMem::counterCtrlWrite: Unexpected address "
1459 "(0x%x:%i), assuming WI\n",
addr, size);
1471 warn(
"GenericTimerMem::counterStatusRead: Unexpected address "
1472 "(0x%x:%i), assuming RAZ\n",
addr, size);
1482 warn(
"GenericTimerMem::counterStatusWrite: RO reg (0x%x) [CNTCV]\n",
1486 warn(
"GenericTimerMem::counterStatusWrite: Unexpected address "
1487 "(0x%x:%i), assuming WI\n",
addr, size);
1501 uint32_t cntnsar = 0x0;
1502 for (
int i = 0;
i <
frames.size();
i++) {
1503 if (
frames[
i]->hasNonSecureAccess())
1504 cntnsar |= 0x1 <<
i;
1510 for (
int i = 0;
i <
frames.size();
i++) {
1516 bool hit =
addr == cntacr_off ||
addr == cntvoff_lo_off ||
1517 addr == cntvoff_hi_off;
1520 frames[
i]->hasNonSecureAccess();
1521 if (hit && !has_access)
return 0;
1522 if (
addr == cntacr_off)
1523 return frames[
i]->getAccessBits();
1524 if (
addr == cntvoff_lo_off ||
addr == cntvoff_hi_off) {
1525 return addr == cntvoff_lo_off ?
frames[
i]->getVirtOffset()
1526 :
frames[
i]->getVirtOffset() >> 32;
1529 warn(
"GenericTimerMem::timerCtrlRead: Unexpected address (0x%x:%i), "
1530 "assuming RAZ\n",
addr, size);
1543 "GenericTimerMem::timerCtrlWrite: CNTFRQ configured freq "
1544 "does not match the counter freq, ignoring\n");
1548 for (
int i = 0;
i <
frames.size();
i++) {
1550 if (
data & (0x1 <<
i))
1551 frames[
i]->setNonSecureAccess();
1555 warn(
"GenericTimerMem::timerCtrlWrite: RO reg (0x%x) [CNTTIDR]\n",
1559 for (
int i = 0;
i <
frames.size();
i++) {
1565 bool hit =
addr == cntacr_off ||
addr == cntvoff_lo_off ||
1566 addr == cntvoff_hi_off;
1569 frames[
i]->hasNonSecureAccess();
1570 if (hit && !has_access)
return;
1571 if (
addr == cntacr_off) {
1575 if (
addr == cntvoff_lo_off ||
addr == cntvoff_hi_off) {
1576 if (
addr == cntvoff_lo_off)
1586 warn(
"GenericTimerMem::timerCtrlWrite: Unexpected address "
1587 "(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 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
ExceptionLevel currEL(const ThreadContext *tc)
Returns the current Exception Level (EL) of the provided ThreadContext.
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 Wed May 4 2022 12:13:55 for gem5 by doxygen 1.8.17