46#include "debug/Checkpoint.hh"
47#include "debug/Timer.hh"
65 for (
int i = 0;
i <
sys->threads.size();
i++) {
67 std::stringstream oss;
68 oss <<
name() <<
".timer" <<
i;
71 new Timer(oss.str(),
this,
73 p.int_watchdog->get(tc)));
90 watchdogZeroEvent([
this]{ watchdogAtZero(); },
name())
101 DPRINTF(
Timer,
"Reading from CpuLocalTimer at offset: %#x\n", daddr);
108 panic(
"Tried to read CpuLocalTimer at offset %#x that doesn't exist\n", daddr);
117 DPRINTF(
Timer,
"Reading from CpuLocalTimer at offset: %#x\n", daddr);
125 DPRINTF(
Timer,
"Event schedule for timer %d, clock=%d, prescale=%d\n",
131 pkt->
setLE<uint32_t>(time);
144 "Event schedule for watchdog %d, clock=%d, prescale=%d\n",
148 time = (time /
parent->clockPeriod()) >>
151 pkt->
setLE<uint32_t>(time);
163 panic(
"Tried to read from WatchdogDisableRegister\n");
166 panic(
"Tried to read CpuLocalTimer at offset %#x\n", daddr);
178 DPRINTF(
Timer,
"Writing to CpuLocalTimer at offset: %#x\n", daddr);
185 panic(
"Tried to write CpuLocalTimer at offset %#x that doesn't exist\n", daddr);
193 DPRINTF(
Timer,
"Writing to CpuLocalTimer at offset: %#x\n", daddr);
261 panic(
"Tried to write CpuLocalTimer timer at offset %#x\n", daddr);
278 DPRINTF(
Timer,
"-- Event was already schedule, de-scheduling\n");
296 DPRINTF(
Timer,
"-- Event was already schedule, de-scheduling\n");
343 fatal(
"gem5 ARM Model does not support true watchdog operation!\n");
361 DPRINTF(Checkpoint,
"Serializing Arm CpuLocalTimer\n");
382 Tick timer_event_time;
383 if (timer_is_in_event){
387 Tick watchdog_event_time;
388 if (watchdog_is_in_event){
397 DPRINTF(Checkpoint,
"Unserializing Arm CpuLocalTimer\n");
399 uint32_t timer_control_serial;
402 uint32_t watchdog_control_serial;
415 bool timer_is_in_event;
417 bool watchdog_is_in_event;
420 Tick timer_event_time;
421 if (timer_is_in_event){
425 Tick watchdog_event_time;
426 if (watchdog_is_in_event) {
437 for (
int i = 0;
i <
sys->threads.size();
i++)
444 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()