46#include "debug/Checkpoint.hh"
47#include "debug/Timer.hh"
51#include "params/CpuLocalTimer.hh"
66 for (
int i = 0;
i <
sys->threads.size();
i++) {
68 std::stringstream oss;
69 oss <<
name() <<
".timer" <<
i;
72 new Timer(oss.str(),
this,
74 p.int_watchdog->get(tc)));
91 watchdogZeroEvent([
this]{ watchdogAtZero(); },
name())
102 DPRINTF(
Timer,
"Reading from CpuLocalTimer at offset: %#x\n", daddr);
109 panic(
"Tried to read CpuLocalTimer at offset %#x that doesn't exist\n", daddr);
118 DPRINTF(
Timer,
"Reading from CpuLocalTimer at offset: %#x\n", daddr);
126 DPRINTF(
Timer,
"Event schedule for timer %d, clock=%d, prescale=%d\n",
132 pkt->
setLE<uint32_t>(time);
145 "Event schedule for watchdog %d, clock=%d, prescale=%d\n",
149 time = (time /
parent->clockPeriod()) >>
152 pkt->
setLE<uint32_t>(time);
164 panic(
"Tried to read from WatchdogDisableRegister\n");
167 panic(
"Tried to read CpuLocalTimer at offset %#x\n", daddr);
179 DPRINTF(
Timer,
"Writing to CpuLocalTimer at offset: %#x\n", daddr);
186 panic(
"Tried to write CpuLocalTimer at offset %#x that doesn't exist\n", daddr);
194 DPRINTF(
Timer,
"Writing to CpuLocalTimer at offset: %#x\n", daddr);
262 panic(
"Tried to write CpuLocalTimer timer at offset %#x\n", daddr);
279 DPRINTF(
Timer,
"-- Event was already schedule, de-scheduling\n");
297 DPRINTF(
Timer,
"-- Event was already schedule, de-scheduling\n");
344 fatal(
"gem5 ARM Model does not support true watchdog operation!\n");
362 DPRINTF(Checkpoint,
"Serializing Arm CpuLocalTimer\n");
383 Tick timer_event_time;
384 if (timer_is_in_event){
388 Tick watchdog_event_time;
389 if (watchdog_is_in_event){
398 DPRINTF(Checkpoint,
"Unserializing Arm CpuLocalTimer\n");
400 uint32_t timer_control_serial;
403 uint32_t watchdog_control_serial;
416 bool timer_is_in_event;
418 bool watchdog_is_in_event;
421 Tick timer_event_time;
422 if (timer_is_in_event){
426 Tick watchdog_event_time;
427 if (watchdog_is_in_event) {
438 for (
int i = 0;
i <
sys->threads.size();
i++)
445 for (
int i = 0;
i <
sys->threads.size();
i++)
Base class for ARM GIC implementations.
Generic representation of an Arm interrupt pin.
Addr pioAddr
Address that the device listens to.
BasicPioDevice(const Params &p, Addr size)
Tick pioDelay
Delay that the device experinces on an access.
Addr pioSize
Size that the device's address range.
friend class CpuLocalTimer
void serialize(CheckpointOut &cp) const override
Serialize an object.
bool rawIntTimer
If timer has caused an interrupt.
uint32_t watchdogLoadValue
void restartTimerCounter(uint32_t val)
Restart the counter ticking at val.
WatchdogCtrl watchdogControl
EndBitUnion(WatchdogCtrl) protected CpuLocalTimer * parent
Pointer to parent class.
Timer(const std::string &name, CpuLocalTimer *_parent, ArmInterruptPin *int_timer, ArmInterruptPin *int_watchdog)
void write(PacketPtr pkt, Addr daddr)
Handle write for a single timer.
EventFunctionWrapper watchdogZeroEvent
uint32_t timerLoadValue
Value to load into counters when periodic mode reaches 0.
void timerAtZero()
Called when the counter reaches 0.
ArmInterruptPin * intWatchdog
EventFunctionWrapper timerZeroEvent
TimerCtrl timerControl
Control register as specified above.
void read(PacketPtr pkt, Addr daddr)
Handle read for a single timer.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
uint32_t watchdogDisableReg
bool pendingIntTimer
If an interrupt is currently pending.
void restartWatchdogCounter(uint32_t val)
ArmInterruptPin * intTimer
Interrupt to cause/clear.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
void serialize(CheckpointOut &cp) const override
Serialize an object.
std::vector< std::unique_ptr< Timer > > localTimer
Timers that do the actual work.
Tick read(PacketPtr pkt) override
Handle a read to the device.
Tick write(PacketPtr pkt) override
Handle a write to the device.
CpuLocalTimer(const Params &p)
The constructor for RealView just registers itself with the MMU.
void init() override
Inits the local timers.
void setLE(T v)
Set the value in the data pointer to v as little endian.
RequestPtr req
A pointer to the original request.
void makeAtomicResponse()
T getLE() const
Get the data in the packet byte swapped from little endian to host endian.
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
ThreadContext is the external interface to all thread state for anything outside of the CPU.
#define panic(...)
This implements a cprintf based panic() function.
#define fatal(...)
This implements a cprintf based fatal() function.
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 Params & params() const
Copyright (c) 2024 Arm Limited All rights reserved.
Tick curTick()
The universal simulation clock.
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.
int ContextID
Globally unique thread context ID.
std::string csprintf(const char *format, const Args &...args)
Declaration of the Packet class.
#define UNSERIALIZE_SCALAR(scalar)
#define SERIALIZE_SCALAR(scalar)
This implements the cpu local timer from the Cortex-A9 MPCore Technical Reference Manual rev r2p2 (AR...
const std::string & name()