generic_timer.hh (10847:1826ee736709) generic_timer.hh (10905:a6ca6831e775)
1/*
2 * Copyright (c) 2013, 2015 ARM Limited
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 44 unchanged lines hidden (view full) ---

53/// ARM, Issue C, Chapter 17).
54
55class Checkpoint;
56class GenericTimerParams;
57class GenericTimerMemParams;
58
59/// Global system counter. It is shared by the architected timers.
60/// @todo: implement memory-mapped controls
1/*
2 * Copyright (c) 2013, 2015 ARM Limited
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 44 unchanged lines hidden (view full) ---

53/// ARM, Issue C, Chapter 17).
54
55class Checkpoint;
56class GenericTimerParams;
57class GenericTimerMemParams;
58
59/// Global system counter. It is shared by the architected timers.
60/// @todo: implement memory-mapped controls
61class SystemCounter
61class SystemCounter : public Serializable
62{
63 protected:
64 /// Counter frequency (as specified by CNTFRQ).
65 uint64_t _freq;
66 /// Cached copy of the counter period (inverse of the frequency).
67 Tick _period;
68 /// Tick when the counter was reset.
69 Tick _resetTick;

--- 18 unchanged lines hidden (view full) ---

88 void setFreq(uint32_t freq);
89
90 /// Returns the counter period.
91 Tick period() const { return _period; }
92
93 void setKernelControl(uint32_t val) { _regCntkctl = val; }
94 uint32_t getKernelControl() { return _regCntkctl; }
95
62{
63 protected:
64 /// Counter frequency (as specified by CNTFRQ).
65 uint64_t _freq;
66 /// Cached copy of the counter period (inverse of the frequency).
67 Tick _period;
68 /// Tick when the counter was reset.
69 Tick _resetTick;

--- 18 unchanged lines hidden (view full) ---

88 void setFreq(uint32_t freq);
89
90 /// Returns the counter period.
91 Tick period() const { return _period; }
92
93 void setKernelControl(uint32_t val) { _regCntkctl = val; }
94 uint32_t getKernelControl() { return _regCntkctl; }
95
96 void serialize(std::ostream &os) const;
97 void unserialize(Checkpoint *cp, const std::string &section);
96 void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE;
97 void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE;
98
99 private:
100 // Disable copying
101 SystemCounter(const SystemCounter &c);
102};
103
104/// Per-CPU architected timer.
98
99 private:
100 // Disable copying
101 SystemCounter(const SystemCounter &c);
102};
103
104/// Per-CPU architected timer.
105class ArchTimer
105class ArchTimer : public Serializable
106{
107 public:
108 class Interrupt
109 {
110 public:
111 Interrupt(BaseGic &gic, unsigned irq)
112 : _gic(gic), _ppi(false), _irq(irq), _cpu(0) {}
113

--- 70 unchanged lines hidden (view full) ---

184 void setControl(uint32_t val);
185
186 uint64_t offset() const { return _offset; }
187 void setOffset(uint64_t val);
188
189 /// Returns the value of the counter which this timer relies on.
190 uint64_t value() const;
191
106{
107 public:
108 class Interrupt
109 {
110 public:
111 Interrupt(BaseGic &gic, unsigned irq)
112 : _gic(gic), _ppi(false), _irq(irq), _cpu(0) {}
113

--- 70 unchanged lines hidden (view full) ---

184 void setControl(uint32_t val);
185
186 uint64_t offset() const { return _offset; }
187 void setOffset(uint64_t val);
188
189 /// Returns the value of the counter which this timer relies on.
190 uint64_t value() const;
191
192 void serialize(std::ostream &os) const;
193 void unserialize(Checkpoint *cp, const std::string &section);
192 void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE;
193 void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE;
194
195 private:
196 // Disable copying
197 ArchTimer(const ArchTimer &t);
198};
199
200class GenericTimer : public SimObject
201{
202 public:
203 GenericTimer(GenericTimerParams *p);
204
194
195 private:
196 // Disable copying
197 ArchTimer(const ArchTimer &t);
198};
199
200class GenericTimer : public SimObject
201{
202 public:
203 GenericTimer(GenericTimerParams *p);
204
205 void serialize(std::ostream &os) M5_ATTR_OVERRIDE;
206 void unserialize(Checkpoint *cp, const std::string &sec) M5_ATTR_OVERRIDE;
205 void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE;
206 void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE;
207
208 public:
209 void setMiscReg(int misc_reg, unsigned cpu, ArmISA::MiscReg val);
210 ArmISA::MiscReg readMiscReg(int misc_reg, unsigned cpu);
211
212 protected:
213 struct CoreTimers {
214 CoreTimers(GenericTimer &parent, unsigned cpu,

--- 59 unchanged lines hidden (view full) ---

274 unsigned cpu;
275};
276
277class GenericTimerMem : public PioDevice
278{
279 public:
280 GenericTimerMem(GenericTimerMemParams *p);
281
207
208 public:
209 void setMiscReg(int misc_reg, unsigned cpu, ArmISA::MiscReg val);
210 ArmISA::MiscReg readMiscReg(int misc_reg, unsigned cpu);
211
212 protected:
213 struct CoreTimers {
214 CoreTimers(GenericTimer &parent, unsigned cpu,

--- 59 unchanged lines hidden (view full) ---

274 unsigned cpu;
275};
276
277class GenericTimerMem : public PioDevice
278{
279 public:
280 GenericTimerMem(GenericTimerMemParams *p);
281
282 void serialize(std::ostream &os) M5_ATTR_OVERRIDE;
283 void unserialize(Checkpoint *cp, const std::string &sec) M5_ATTR_OVERRIDE;
282 void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE;
283 void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE;
284
285 public: // PioDevice
286 AddrRangeList getAddrRanges() const M5_ATTR_OVERRIDE { return addrRanges; }
287 Tick read(PacketPtr pkt) M5_ATTR_OVERRIDE;
288 Tick write(PacketPtr pkt) M5_ATTR_OVERRIDE;
289
290 protected:
291 uint64_t ctrlRead(Addr addr, size_t size) const;

--- 43 unchanged lines hidden ---
284
285 public: // PioDevice
286 AddrRangeList getAddrRanges() const M5_ATTR_OVERRIDE { return addrRanges; }
287 Tick read(PacketPtr pkt) M5_ATTR_OVERRIDE;
288 Tick write(PacketPtr pkt) M5_ATTR_OVERRIDE;
289
290 protected:
291 uint64_t ctrlRead(Addr addr, size_t size) const;

--- 43 unchanged lines hidden ---