gem5  v22.1.0.0
mhu.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_CSS_MHU_H__
39 #define __DEV_ARM_CSS_MHU_H__
40 
41 #include "dev/arm/doorbell.hh"
42 #include "dev/io_device.hh"
43 
44 namespace gem5
45 {
46 
47 struct Ap2ScpDoorbellParams;
48 class ArmInterruptPin;
49 class MHU;
50 struct MHUParams;
51 class Scp;
52 struct Scp2ApDoorbellParams;
53 
54 class MhuDoorbell : public Doorbell
55 {
56  public:
57  friend class MHU;
58 
59  MhuDoorbell(const DoorbellParams &p)
60  : Doorbell(p), channel(0)
61  {}
62 
63  void set(uint32_t val) { update(channel | val); }
64  void clear(uint32_t val) { update(channel & ~val); }
65 
66  protected:
67  void update(uint32_t new_val);
68 
69  virtual void raiseInterrupt() = 0;
70  virtual void clearInterrupt() = 0;
71 
72  uint32_t channel;
73 };
74 
76 {
77  public:
78  Scp2ApDoorbell(const Scp2ApDoorbellParams &p);
79 
80  void raiseInterrupt() override;
81  void clearInterrupt() override;
82 
83  private:
85 };
86 
88 {
89  public:
90  Ap2ScpDoorbell(const Ap2ScpDoorbellParams &p);
91 
92  void setScp(Scp *_scp) { scp = _scp; }
93 
94  void raiseInterrupt() override;
95  void clearInterrupt() override;
96 
97  private:
98  Scp *scp;
99 };
100 
102 class MHU : public BasicPioDevice
103 {
104  public:
105  enum
106  {
114 
117  CPU_INTR_L_SET = 0x108,
120  CPU_INTR_H_SET = 0x128,
122 
124  SCP_INTR_S_SET = 0x208,
127  CPU_INTR_S_SET = 0x308,
129 
130  MHU_SCFG = 0x400,
131 
132  PID4 = 0xfd0,
133  PID0 = 0xfe0,
134  PID1 = 0xfe4,
135  PID2 = 0xfe8,
136  PID3 = 0xfec,
137 
138  COMPID0 = 0xff0,
139  COMPID1 = 0xff4,
140  COMPID2 = 0xff8,
141  COMPID3 = 0xffc
142  };
143 
144  // Secure Violation Interrupt: used when accessing
145  // a secure channel in non secure mode
146  static const uint32_t SVI_INT = 0x80000000;
147 
148  MHU(const MHUParams &p);
149 
150  AddrRangeList getAddrRanges() const override;
151 
152  Tick read(PacketPtr pkt) override;
153  Tick write(PacketPtr pkt) override;
154 
155  uint32_t read32(const Addr addr, bool secure_access);
156 
160 
164 
165  // MHU.PIDn, MHU.COMPIDn registers
166  uint32_t pid[5];
167  uint32_t compid[4];
168 
169  uint32_t scfg;
170 };
171 
172 } // namespace gem5
173 
174 #endif // __DEV_ARM_CSS_MHU_H__
void clearInterrupt() override
Definition: mhu.cc:241
void setScp(Scp *_scp)
Definition: mhu.hh:92
void raiseInterrupt() override
Definition: mhu.cc:235
Ap2ScpDoorbell(const Ap2ScpDoorbellParams &p)
Definition: mhu.cc:55
Generic representation of an Arm interrupt pin.
Definition: base_gic.hh:200
Generic doorbell interface.
Definition: doorbell.hh:54
Message Handling Unit.
Definition: mhu.hh:103
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: mhu.cc:151
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: mhu.cc:83
uint32_t compid[4]
Definition: mhu.hh:167
Scp2ApDoorbell * scpHigh
Definition: mhu.hh:158
static const uint32_t SVI_INT
Definition: mhu.hh:146
Ap2ScpDoorbell * apLow
Definition: mhu.hh:161
Scp2ApDoorbell * scpSec
Definition: mhu.hh:159
uint32_t scfg
Definition: mhu.hh:169
@ COMPID0
Definition: mhu.hh:138
@ SCP_INTR_H_SET
Definition: mhu.hh:112
@ SCP_INTR_S_SET
Definition: mhu.hh:124
@ PID1
Definition: mhu.hh:134
@ CPU_INTR_H_SET
Definition: mhu.hh:120
@ SCP_INTR_S_CLEAR
Definition: mhu.hh:125
@ SCP_INTR_S_STAT
Definition: mhu.hh:123
@ SCP_INTR_H_CLEAR
Definition: mhu.hh:113
@ PID0
Definition: mhu.hh:133
@ CPU_INTR_L_SET
Definition: mhu.hh:117
@ PID4
Definition: mhu.hh:132
@ CPU_INTR_S_SET
Definition: mhu.hh:127
@ CPU_INTR_L_STAT
From Application Processor to SCP.
Definition: mhu.hh:116
@ CPU_INTR_H_CLEAR
Definition: mhu.hh:121
@ SCP_INTR_H_STAT
Definition: mhu.hh:111
@ SCP_INTR_L_SET
Definition: mhu.hh:109
@ CPU_INTR_S_CLEAR
Definition: mhu.hh:128
@ CPU_INTR_H_STAT
Definition: mhu.hh:119
@ CPU_INTR_L_CLEAR
Definition: mhu.hh:118
@ CPU_INTR_S_STAT
Definition: mhu.hh:126
@ PID2
Definition: mhu.hh:135
@ COMPID1
Definition: mhu.hh:139
@ MHU_SCFG
Definition: mhu.hh:130
@ SCP_INTR_L_STAT
From SCP to Application Processor.
Definition: mhu.hh:108
@ PID3
Definition: mhu.hh:136
@ SCP_INTR_L_CLEAR
Definition: mhu.hh:110
@ COMPID3
Definition: mhu.hh:141
@ COMPID2
Definition: mhu.hh:140
uint32_t read32(const Addr addr, bool secure_access)
Definition: mhu.cc:98
Ap2ScpDoorbell * apHigh
Definition: mhu.hh:162
Ap2ScpDoorbell * apSec
Definition: mhu.hh:163
AddrRangeList getAddrRanges() const override
Every PIO device is obliged to provide an implementation that returns the address ranges the device r...
Definition: mhu.cc:77
MHU(const MHUParams &p)
Definition: mhu.cc:59
Scp2ApDoorbell * scpLow
Definition: mhu.hh:157
uint32_t pid[5]
Definition: mhu.hh:166
MhuDoorbell(const DoorbellParams &p)
Definition: mhu.hh:59
virtual void raiseInterrupt()=0
void update(uint32_t new_val)
Definition: mhu.cc:209
void set(uint32_t val)
Definition: mhu.hh:63
void clear(uint32_t val)
Definition: mhu.hh:64
virtual void clearInterrupt()=0
uint32_t channel
Definition: mhu.hh:72
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:294
void raiseInterrupt() override
Definition: mhu.cc:223
Scp2ApDoorbell(const Scp2ApDoorbellParams &p)
Definition: mhu.cc:51
ArmInterruptPin * interrupt
Definition: mhu.hh:84
void clearInterrupt() override
Definition: mhu.cc:229
Definition: scp.hh:49
Bitfield< 54 > p
Definition: pagetable.hh:70
Bitfield< 63 > val
Definition: misc.hh:776
Bitfield< 3 > addr
Definition: types.hh:84
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

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