gem5  v20.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 class ArmSystem;
47 class FVPBasePwrCtrlParams;
48 class ThreadContext;
49 
56 {
57  public:
58  FVPBasePwrCtrl(FVPBasePwrCtrlParams *const params);
59 
66  void setStandByWfi(ThreadContext *const tc);
67 
74  void clearStandByWfi(ThreadContext *const tc);
75 
83  bool setWakeRequest(ThreadContext *const tc);
84 
89  void clearWakeRequest(ThreadContext *const tc);
90 
91  void init() override;
92 
93  protected:
94  Tick read(PacketPtr pkt) override;
95  Tick write(PacketPtr pkt) override;
96 
97  private:
98  BitUnion32(PwrStatus)
99  Bitfield<30> l1;
100  Bitfield<29> l0;
101  Bitfield<28> wen;
102  Bitfield<27> pc;
103  Bitfield<26> pp;
104  Bitfield<25,24> wk;
105  Bitfield<1> pwfi;
106  Bitfield<0> pwk;
107  EndBitUnion(PwrStatus)
108 
109  enum Offset : Addr {
110  PPOFFR = 0x00,
111  PPONR = 0x04,
112  PCOFFR = 0x08,
113  PWKUPR = 0x0c,
114  PSYSR = 0x10
115  };
116 
117  struct Registers {
118  uint32_t ppoffr;
119  uint32_t pponr;
120  uint32_t pcoffr;
121  uint32_t pwkupr;
122  uint32_t psysr;
123  } regs;
124 
126  static constexpr uint32_t MPID_MSK = 0x00ffffff;
129 
135 
137  std::unordered_map<uint32_t, size_t> poweredCoresPerCluster;
138 
146  PwrStatus *getCorePwrStatus(ThreadContext *const tc);
147 
153  ThreadContext *getThreadContextByMPID(uint32_t mpid) const;
154 
161  void powerCoreOn(ThreadContext *const tc, PwrStatus *const pwrs);
162 
169  void powerCoreOff(ThreadContext *const tc, PwrStatus *const pwrs);
170 
177  void startCoreUp(ThreadContext *const tc);
178 
181 };
182 
183 #endif // __DEV_ARM_FVP_BASE_PWR_CTRL_HH__
FVPBasePwrCtrl::powerCoreOn
void powerCoreOn(ThreadContext *const tc, PwrStatus *const pwrs)
Powers on a core.
Definition: fvp_base_pwr_ctrl.cc:268
FVPBasePwrCtrl::wk
Bitfield< 25, 24 > wk
Definition: fvp_base_pwr_ctrl.hh:104
FVPBasePwrCtrl::system
ArmSystem & system
Reference to the arm system.
Definition: fvp_base_pwr_ctrl.hh:180
io_device.hh
FVPBasePwrCtrl::write
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: fvp_base_pwr_ctrl.cc:160
FVPBasePwrCtrl::wen
Bitfield< 28 > wen
Definition: fvp_base_pwr_ctrl.hh:101
FVPBasePwrCtrl::clearWakeRequest
void clearWakeRequest(ThreadContext *const tc)
Triggered by the GIC when GICR_WAKER.ProcessorSleep becomes 0.
Definition: fvp_base_pwr_ctrl.cc:112
FVPBasePwrCtrl::pp
Bitfield< 26 > pp
Definition: fvp_base_pwr_ctrl.hh:103
FVPBasePwrCtrl::Registers::ppoffr
uint32_t ppoffr
Definition: fvp_base_pwr_ctrl.hh:118
FVPBasePwrCtrl::WK_COLD
@ WK_COLD
Definition: fvp_base_pwr_ctrl.hh:128
Tick
uint64_t Tick
Tick count type.
Definition: types.hh:63
FVPBasePwrCtrl::BitUnion32
BitUnion32(PwrStatus) Bitfield< 30 > l1
FVPBasePwrCtrl::read
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: fvp_base_pwr_ctrl.cc:123
std::vector< PwrStatus >
FVPBasePwrCtrl::clearStandByWfi
void clearStandByWfi(ThreadContext *const tc)
Triggered when an interrupt is posted to the core.
Definition: fvp_base_pwr_ctrl.cc:84
FVPBasePwrCtrl::Registers::pwkupr
uint32_t pwkupr
Definition: fvp_base_pwr_ctrl.hh:121
FVPBasePwrCtrl::setStandByWfi
void setStandByWfi(ThreadContext *const tc)
Triggered by the ISA when a WFI instruction is executed and (1) there are no pending interrupts and (...
Definition: fvp_base_pwr_ctrl.cc:71
FVPBasePwrCtrl::MPID_MSK
static constexpr uint32_t MPID_MSK
Mask for extracting the MPID from a 32-bit value.
Definition: fvp_base_pwr_ctrl.hh:126
FVPBasePwrCtrl
Definition: fvp_base_pwr_ctrl.hh:55
FVPBasePwrCtrl::powerCoreOff
void powerCoreOff(ThreadContext *const tc, PwrStatus *const pwrs)
Powers off a core.
Definition: fvp_base_pwr_ctrl.cc:287
ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Definition: thread_context.hh:88
FVPBasePwrCtrl::l0
Bitfield< 29 > l0
Definition: fvp_base_pwr_ctrl.hh:100
FVPBasePwrCtrl::Registers::pponr
uint32_t pponr
Definition: fvp_base_pwr_ctrl.hh:119
bitunion.hh
FVPBasePwrCtrl::Registers::pcoffr
uint32_t pcoffr
Definition: fvp_base_pwr_ctrl.hh:120
FVPBasePwrCtrl::WK_PPONR
@ WK_PPONR
Definition: fvp_base_pwr_ctrl.hh:128
FVPBasePwrCtrl::WK_RESET
@ WK_RESET
Definition: fvp_base_pwr_ctrl.hh:128
FVPBasePwrCtrl::pwk
Bitfield< 0 > pwk
Definition: fvp_base_pwr_ctrl.hh:106
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
BasicPioDevice::params
const Params * params() const
Definition: io_device.hh:167
FVPBasePwrCtrl::setWakeRequest
bool setWakeRequest(ThreadContext *const tc)
Triggered by the GIC when GICR_WAKER.ProcessorSleep is 1 and there are pending interrupts for the cor...
Definition: fvp_base_pwr_ctrl.cc:95
FVPBasePwrCtrl::init
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: fvp_base_pwr_ctrl.cc:61
ArmSystem
Definition: system.hh:59
FVPBasePwrCtrl::poweredCoresPerCluster
std::unordered_map< uint32_t, size_t > poweredCoresPerCluster
Number of powered cores per cluster.
Definition: fvp_base_pwr_ctrl.hh:137
X86ISA::l1
Bitfield< 2 > l1
Definition: misc.hh:658
Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:257
BasicPioDevice
Definition: io_device.hh:150
FVPBasePwrCtrl::pc
Bitfield< 27 > pc
Definition: fvp_base_pwr_ctrl.hh:102
FVPBasePwrCtrl::getCorePwrStatus
PwrStatus * getCorePwrStatus(ThreadContext *const tc)
Retrieves the power status of a certain core and resizes the entries if needed.
Definition: fvp_base_pwr_ctrl.cc:250
FVPBasePwrCtrl::Registers
Definition: fvp_base_pwr_ctrl.hh:117
FVPBasePwrCtrl::getThreadContextByMPID
ThreadContext * getThreadContextByMPID(uint32_t mpid) const
Retrieves the thread context reference for a CPU core by MPID.
Definition: fvp_base_pwr_ctrl.cc:258
FVPBasePwrCtrl::FVPBasePwrCtrl
FVPBasePwrCtrl(FVPBasePwrCtrlParams *const params)
Definition: fvp_base_pwr_ctrl.cc:50
FVPBasePwrCtrl::pwfi
Bitfield< 1 > pwfi
Definition: fvp_base_pwr_ctrl.hh:105
FVPBasePwrCtrl::corePwrStatus
std::vector< PwrStatus > corePwrStatus
Per-core power status.
Definition: fvp_base_pwr_ctrl.hh:134
FVPBasePwrCtrl::Registers::psysr
uint32_t psysr
Definition: fvp_base_pwr_ctrl.hh:122
FVPBasePwrCtrl::WK_GICWR
@ WK_GICWR
Definition: fvp_base_pwr_ctrl.hh:128
EndBitUnion
EndBitUnion(UserDescFlags) struct UserDesc32
Definition: process.cc:149
FVPBasePwrCtrl::regs
EndBitUnion(PwrStatus) enum Offset struct FVPBasePwrCtrl::Registers regs
FVPBasePwrCtrl::startCoreUp
void startCoreUp(ThreadContext *const tc)
Starts a core up.
Definition: fvp_base_pwr_ctrl.cc:302

Generated on Wed Sep 30 2020 14:02:10 for gem5 by doxygen 1.8.17