gem5  [DEVELOP-FOR-23.0]
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
gic.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2019 Google, Inc.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met: redistributions of source code must retain the above copyright
7  * notice, this list of conditions and the following disclaimer;
8  * redistributions in binary form must reproduce the above copyright
9  * notice, this list of conditions and the following disclaimer in the
10  * documentation and/or other materials provided with the distribution;
11  * neither the name of the copyright holders nor the names of its
12  * contributors may be used to endorse or promote products derived from
13  * this software without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #ifndef __ARCH_ARM_FASTMODEL_GIC_GIC_HH__
29 #define __ARCH_ARM_FASTMODEL_GIC_GIC_HH__
30 
31 #pragma GCC diagnostic push
32 #pragma GCC diagnostic ignored "-Woverloaded-virtual"
33 #include <amba_pv.h>
34 #pragma GCC diagnostic pop
35 
36 #include <memory>
37 
41 #include "dev/arm/base_gic.hh"
42 #include "dev/intpin.hh"
43 #include "params/FastModelGIC.hh"
44 #include "params/SCFastModelGIC.hh"
45 #include "scx_evs_GIC.h"
48 
49 namespace gem5
50 {
51 
52 namespace fastmodel
53 {
54 
55 // The fast model exports a class called scx_evs_GIC which represents
56 // the subsystem described in LISA+. This class specializes it to export gem5
57 // ports and interface with its peer gem5 GIC. The gem5 GIC inherits from the
58 // gem5 BaseGic class and implements its API, while this class actually does
59 // the work.
60 class SCGIC : public scx_evs_GIC
61 {
62  private:
63  // The unconnected CPU ports/sockets still need to be connected for TLM to
64  // be happy, so this module finds all unbound sockets, creates pair
65  // sockets for them to connect to, binds everything together, and
66  // implements the target interface with a dummy stub that will complain
67  // and crash gem5 if it ever gets called.
69  public svp_gicv3_comms::gicv3_comms_fw_if
70  {
71  protected:
72  typedef sc_core::sc_vector<
73  svp_gicv3_comms::gicv3_comms_initiator_socket<>> Initiators;
74  typedef sc_core::sc_vector<
75  svp_gicv3_comms::gicv3_comms_target_socket<>> Targets;
76 
78 
79  static int countUnbound(const Initiators &inits);
80 
81  public:
83 
84  // Stub out the terminated interface.
85  void sendTowardsCPU(uint8_t len, const uint8_t *data) override;
86  };
87 
88  std::unique_ptr<Terminator> terminator;
89  const SCFastModelGICParams &_params;
90 
91  public:
92  SCGIC(const SCFastModelGICParams &p) : SCGIC(p, p.name.c_str()) {}
93  SCGIC(const SCFastModelGICParams &params, sc_core::sc_module_name _name);
94 
95  Port &gem5_getPort(const std::string &if_name, int idx) override;
96 
98 
102 
103  void before_end_of_elaboration() override;
104 
105  void
107  {
108  scx_evs_GIC::end_of_elaboration();
109  scx_evs_GIC::start_of_simulation();
110  }
111  void start_of_simulation() override {}
112  PARAMS(SCFastModelGIC);
113 };
114 
115 // This class pairs with the one above to implement the receiving end of gem5's
116 // GIC API. It acts as an interface which passes work to the fast model GIC,
117 // and lets the fast model GIC interact with the rest of the system.
118 class GIC : public BaseGic
119 {
120  private:
122  64, svp_gicv3_comms::gicv3_comms_fw_if,
123  svp_gicv3_comms::gicv3_comms_bw_if, 1,
125 
130 
132 
133  public:
134  GIC(const FastModelGICParams &params);
135 
136  Port &getPort(const std::string &if_name,
137  PortID idx=InvalidPortID) override;
138 
139  void sendInt(uint32_t num) override;
140  void clearInt(uint32_t num) override;
141 
142  void sendPPInt(uint32_t num, uint32_t cpu) override;
143  void clearPPInt(uint32_t num, uint32_t cpu) override;
144 
145  bool supportsVersion(GicVersion version) override;
146 
147  AddrRangeList getAddrRanges() const override { return AddrRangeList(); }
148  Tick read(PacketPtr pkt) override { return 0; }
149  Tick write(PacketPtr pkt) override { return 0; }
150 };
151 
152 } // namespace fastmodel
153 } // namespace gem5
154 
155 #endif // __ARCH_ARM_FASTMODEL_GIC_GIC_HH__
gem5::PortID
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:245
sc_port_wrapper.hh
gem5::fastmodel::GIC::ambaS
AmbaTarget ambaS
Definition: gic.hh:127
gem5::fastmodel::GIC::wakeRequestPorts
std::vector< std::unique_ptr< IntSourcePin< GIC > > > wakeRequestPorts
Definition: gic.hh:129
gem5::fastmodel::SCGIC::Terminator::Targets
sc_core::sc_vector< svp_gicv3_comms::gicv3_comms_target_socket<> > Targets
Definition: gic.hh:75
sc_core::SC_ONE_OR_MORE_BOUND
@ SC_ONE_OR_MORE_BOUND
Definition: sc_port.hh:69
gem5::fastmodel::SCGIC::SCGIC
SCGIC(const SCFastModelGICParams &p)
Definition: gic.hh:92
gem5::fastmodel::SCGIC::start_of_simulation
void start_of_simulation() override
Definition: gic.hh:111
gem5::fastmodel::SCGIC::Terminator::Initiators
sc_core::sc_vector< svp_gicv3_comms::gicv3_comms_initiator_socket<> > Initiators
Definition: gic.hh:73
data
const char data[]
Definition: circlebuf.test.cc:48
gem5::fastmodel::GIC::sendInt
void sendInt(uint32_t num) override
Post an interrupt from a device that is connected to the GIC.
Definition: gic.cc:369
gem5::fastmodel::SCGIC::gem5_getPort
Port & gem5_getPort(const std::string &if_name, int idx) override
Definition: gic.cc:307
sc_core::sc_module
Definition: sc_module.hh:101
gem5::AddrRangeList
std::list< AddrRange > AddrRangeList
Convenience typedef for a collection of address ranges.
Definition: addr_range.hh:57
gem5::fastmodel::SCGIC::before_end_of_elaboration
void before_end_of_elaboration() override
Definition: gic.cc:319
gem5::fastmodel::SCGIC::signalInterrupt
SignalInterruptInitiatorSocket signalInterrupt
Definition: gic.hh:97
sc_module_name.hh
base_gic.hh
gem5::fastmodel::GIC::scGIC
SCGIC * scGIC
Definition: gic.hh:131
std::vector
STL vector class.
Definition: stl.hh:37
signal_sender.hh
gem5::fastmodel::GIC::getPort
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Definition: gic.cc:345
sc_core::sc_vector
Definition: sc_vector.hh:158
gem5::InvalidPortID
const PortID InvalidPortID
Definition: types.hh:246
gem5::fastmodel::GIC::read
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: gic.hh:148
gem5::fastmodel::GIC::sendPPInt
void sendPPInt(uint32_t num, uint32_t cpu) override
Interface call for private peripheral interrupts.
Definition: gic.cc:381
gem5::fastmodel::GIC::clearInt
void clearInt(uint32_t num) override
Clear an interrupt from a device that is connected to the GIC.
Definition: gic.cc:375
gem5::fastmodel::SignalSender
Definition: signal_sender.hh:44
gem5::fastmodel::SCGIC::resetPort
SignalSender resetPort
Definition: gic.hh:100
gem5::fastmodel::GIC::supportsVersion
bool supportsVersion(GicVersion version) override
Check if version supported.
Definition: gic.cc:393
gem5::BaseGic
Definition: base_gic.hh:72
gem5::fastmodel::SCGIC::PARAMS
PARAMS(SCFastModelGIC)
gem5::VegaISA::p
Bitfield< 54 > p
Definition: pagetable.hh:70
gem5::Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:294
gem5::Tick
uint64_t Tick
Tick count type.
Definition: types.hh:58
len
uint16_t len
Definition: helpers.cc:62
sc_core::sc_module_name
Definition: sc_module_name.hh:41
gem5::BaseGic::params
const Params & params() const
Definition: base_gic.cc:78
gem5::fastmodel::GIC::redistributors
std::vector< std::unique_ptr< TlmGicInitiator > > redistributors
Definition: gic.hh:128
gem5::fastmodel::SCGIC::Terminator::targets
Targets targets
Definition: gic.hh:77
gem5::fastmodel::GIC::getAddrRanges
AddrRangeList getAddrRanges() const override
Every PIO device is obliged to provide an implementation that returns the address ranges the device r...
Definition: gic.hh:147
name
const std::string & name()
Definition: trace.cc:48
gem5::fastmodel::GIC::GIC
GIC(const FastModelGICParams &params)
Definition: gic.cc:325
amba_ports.hh
gem5::BaseGic::GicVersion
GicVersion
Definition: base_gic.hh:76
gem5::fastmodel::SCGIC::end_of_elaboration
void end_of_elaboration() override
Definition: gic.hh:106
gem5::fastmodel::GIC
Definition: gic.hh:118
gem5::fastmodel::GIC::write
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: gic.hh:149
gem5::fastmodel::SCGIC::Terminator::countUnbound
static int countUnbound(const Initiators &inits)
Definition: gic.cc:41
gem5::fastmodel::SCGIC
Definition: gic.hh:60
gem5::Port
Ports are used to interface objects to each other.
Definition: port.hh:61
sc_gem5::TlmInitiatorBaseWrapper
Definition: tlm_port_wrapper.hh:40
gem5::fastmodel::SCGIC::Terminator::Terminator
Terminator(sc_core::sc_module_name _name, Initiators &inits)
Definition: gic.cc:50
gem5::fastmodel::GIC::TlmGicInitiator
sc_gem5::TlmInitiatorBaseWrapper< 64, svp_gicv3_comms::gicv3_comms_fw_if, svp_gicv3_comms::gicv3_comms_bw_if, 1, sc_core::SC_ONE_OR_MORE_BOUND > TlmGicInitiator
Definition: gic.hh:124
intpin.hh
gem5::SignalInterruptInitiatorSocket
Definition: signal_interrupt.hh:60
gem5::fastmodel::SCGIC::Terminator
Definition: gic.hh:68
signal_receiver.hh
std::list< AddrRange >
gem5::fastmodel::SCGIC::wakeRequests
std::vector< std::unique_ptr< SignalReceiver > > wakeRequests
Definition: gic.hh:99
sc_gem5::TlmTargetBaseWrapper
Definition: tlm_port_wrapper.hh:44
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::fastmodel::GIC::ambaM
AmbaInitiator ambaM
Definition: gic.hh:126
gem5::fastmodel::SCGIC::Terminator::sendTowardsCPU
void sendTowardsCPU(uint8_t len, const uint8_t *data) override
Definition: gic.cc:68
gem5::fastmodel::SCGIC::poResetPort
SignalSender poResetPort
Definition: gic.hh:101
gem5::fastmodel::SCGIC::terminator
std::unique_ptr< Terminator > terminator
Definition: gic.hh:88
gem5::fastmodel::GIC::clearPPInt
void clearPPInt(uint32_t num, uint32_t cpu) override
Definition: gic.cc:387
gem5::fastmodel::SCGIC::_params
const SCFastModelGICParams & _params
Definition: gic.hh:89

Generated on Sun Jul 30 2023 01:56:47 for gem5 by doxygen 1.8.17