gem5  v22.1.0.0
fvp_base_pwr_ctrl.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 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
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions are
16  * met: redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer;
18  * redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in the
20  * documentation and/or other materials provided with the distribution;
21  * neither the name of the copyright holders nor the names of its
22  * contributors may be used to endorse or promote products derived from
23  * this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  */
37 
38 #ifndef __DEV_ARM_FVP_BASE_PWR_CTRL_HH__
39 #define __DEV_ARM_FVP_BASE_PWR_CTRL_HH__
40 
41 #include <unordered_map>
42 
43 #include "base/bitunion.hh"
44 #include "dev/io_device.hh"
45 
46 namespace gem5
47 {
48 
49 class ArmSystem;
50 struct FVPBasePwrCtrlParams;
51 class ThreadContext;
52 
59 {
60  public:
61  FVPBasePwrCtrl(const FVPBasePwrCtrlParams &params);
62 
69  void setStandByWfi(ThreadContext *const tc);
70 
77  void clearStandByWfi(ThreadContext *const tc);
78 
86  bool setWakeRequest(ThreadContext *const tc);
87 
92  void clearWakeRequest(ThreadContext *const tc);
93 
94  void startup() override;
95 
96  protected:
97  Tick read(PacketPtr pkt) override;
98  Tick write(PacketPtr pkt) override;
99 
100  private:
101  BitUnion32(PwrStatus)
102  Bitfield<30> l1;
103  Bitfield<29> l0;
104  Bitfield<28> wen;
105  Bitfield<27> pc;
106  Bitfield<26> pp;
107  Bitfield<25,24> wk;
108  Bitfield<1> pwfi;
109  Bitfield<0> pwk;
110  EndBitUnion(PwrStatus)
111 
112  enum Offset : Addr
113  {
114  PPOFFR = 0x00,
115  PPONR = 0x04,
116  PCOFFR = 0x08,
117  PWKUPR = 0x0c,
118  PSYSR = 0x10
119  };
120 
121  struct Registers
122  {
123  uint32_t ppoffr;
124  uint32_t pponr;
125  uint32_t pcoffr;
126  uint32_t pwkupr;
127  uint32_t psysr;
128  } regs;
129 
131  static constexpr uint32_t MPID_MSK = 0x00ffffff;
134 
140 
142  std::unordered_map<uint32_t, size_t> poweredCoresPerCluster;
143 
151  PwrStatus *getCorePwrStatus(ThreadContext *const tc);
152 
158  ThreadContext *getThreadContextByMPID(uint32_t mpid) const;
159 
166  void powerCoreOn(ThreadContext *const tc, PwrStatus *const pwrs);
167 
174  void powerCoreOff(ThreadContext *const tc, PwrStatus *const pwrs);
175 
182  void startCoreUp(ThreadContext *const tc);
183 
186 };
187 
188 } // namespace gem5
189 
190 #endif // __DEV_ARM_FVP_BASE_PWR_CTRL_HH__
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
void clearStandByWfi(ThreadContext *const tc)
Triggered when an interrupt is posted to the core.
bool setWakeRequest(ThreadContext *const tc)
Triggered by the GIC when GICR_WAKER.ProcessorSleep is 1 and there are pending interrupts for the cor...
std::vector< PwrStatus > corePwrStatus
Per-core power status.
EndBitUnion(PwrStatus) enum Offset struct gem5::FVPBasePwrCtrl::Registers regs
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
ThreadContext * getThreadContextByMPID(uint32_t mpid) const
Retrieves the thread context reference for a CPU core by MPID.
std::unordered_map< uint32_t, size_t > poweredCoresPerCluster
Number of powered cores per cluster.
BitUnion32(PwrStatus) Bitfield< 30 > l1
void powerCoreOff(ThreadContext *const tc, PwrStatus *const pwrs)
Powers off a core.
PwrStatus * getCorePwrStatus(ThreadContext *const tc)
Retrieves the power status of a certain core and resizes the entries if needed.
void setStandByWfi(ThreadContext *const tc)
Triggered by the ISA when a WFI instruction is executed and (1) there are no pending interrupts and (...
ArmSystem & system
Reference to the arm system.
Bitfield< 25, 24 > wk
void startup() override
startup() is the final initialization call before simulation.
FVPBasePwrCtrl(const FVPBasePwrCtrlParams &params)
void powerCoreOn(ThreadContext *const tc, PwrStatus *const pwrs)
Powers on a core.
static constexpr uint32_t MPID_MSK
Mask for extracting the MPID from a 32-bit value.
void clearWakeRequest(ThreadContext *const tc)
Triggered by the GIC when GICR_WAKER.ProcessorSleep becomes 0.
void startCoreUp(ThreadContext *const tc)
Starts a core up.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:294
ThreadContext is the external interface to all thread state for anything outside of the CPU.
const Params & params() const
Definition: sim_object.hh:176
Bitfield< 2 > l1
Definition: misc.hh:665
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
uint64_t Tick
Tick count type.
Definition: types.hh:58
EndBitUnion(PciCommandRegister) union PCIConfig
Definition: pcireg.h:65

Generated on Wed Dec 21 2022 10:22:32 for gem5 by doxygen 1.9.1