gem5  v20.0.0.2
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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__
Bitfield< 0 > pwk
Bitfield< 27 > pc
EndBitUnion(UserDescFlags) struct UserDesc32
Definition: process.cc:152
Bitfield< 26 > pp
ThreadContext * getThreadContextByMPID(uint32_t mpid) const
Retrieves the thread context reference for a CPU core by MPID.
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
std::vector< PwrStatus > corePwrStatus
Per-core power status.
bool setWakeRequest(ThreadContext *const tc)
Triggered by the GIC when GICR_WAKER.ProcessorSleep is 1 and there are pending interrupts for the cor...
BitUnion32(PwrStatus) Bitfield< 30 > l1
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
Bitfield< 28 > wen
static constexpr uint32_t MPID_MSK
Mask for extracting the MPID from a 32-bit value.
ThreadContext is the external interface to all thread state for anything outside of the CPU...
Bitfield< 1 > pwfi
void powerCoreOn(ThreadContext *const tc, PwrStatus *const pwrs)
Powers on a core.
FVPBasePwrCtrl(FVPBasePwrCtrlParams *const params)
void powerCoreOff(ThreadContext *const tc, PwrStatus *const pwrs)
Powers off a core.
uint64_t Tick
Tick count type.
Definition: types.hh:61
const Params * params() const
Definition: io_device.hh:167
void startCoreUp(ThreadContext *const tc)
Starts a core up.
void setStandByWfi(ThreadContext *const tc)
Triggered by the ISA when a WFI instruction is executed and (1) there are no pending interrupts and (...
void clearWakeRequest(ThreadContext *const tc)
Triggered by the GIC when GICR_WAKER.ProcessorSleep becomes 0.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:140
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Definition: packet.hh:249
EndBitUnion(PwrStatus) enum Offset struct FVPBasePwrCtrl::Registers regs
void clearStandByWfi(ThreadContext *const tc)
Triggered when an interrupt is posted to the core.
Bitfield< 2 > l1
Definition: misc.hh:658
Bitfield< 29 > l0
PwrStatus * getCorePwrStatus(ThreadContext *const tc)
Retrieves the power status of a certain core and resizes the entries if needed.
Bitfield< 25, 24 > wk
ArmSystem & system
Reference to the arm system.
std::unordered_map< uint32_t, size_t > poweredCoresPerCluster
Number of powered cores per cluster.
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.

Generated on Mon Jun 8 2020 15:45:09 for gem5 by doxygen 1.8.13