gem5  v20.1.0.0
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 
39 #include "dev/arm/base_gic.hh"
40 #include "params/FastModelGIC.hh"
41 #include "params/SCFastModelGIC.hh"
42 #include "scx_evs_GIC.h"
45 
46 namespace FastModel
47 {
48 
49 // The fast model exports a class called scx_evs_GIC which represents
50 // the subsystem described in LISA+. This class specializes it to export gem5
51 // ports and interface with its peer gem5 GIC. The gem5 GIC inherits from the
52 // gem5 BaseGic class and implements its API, while this class actually does
53 // the work.
54 class SCGIC : public scx_evs_GIC
55 {
56  private:
57  // The unconnected CPU ports/sockets still need to be connected for TLM to
58  // be happy, so this module finds all unbound sockets, creates pair
59  // sockets for them to connect to, binds everything together, and
60  // implements the target interface with a dummy stub that will complain
61  // and crash gem5 if it ever gets called.
63  public svp_gicv3_comms::gicv3_comms_fw_if
64  {
65  protected:
66  typedef sc_core::sc_vector<
67  svp_gicv3_comms::gicv3_comms_initiator_socket<>> Initiators;
68  typedef sc_core::sc_vector<
69  svp_gicv3_comms::gicv3_comms_target_socket<>> Targets;
70 
72 
73  static int countUnbound(const Initiators &inits);
74 
75  public:
77 
78  // Stub out the terminated interface.
79  void sendTowardsCPU(uint8_t len, const uint8_t *data) override;
80  };
81 
82  std::unique_ptr<Terminator> terminator;
83  const SCFastModelGICParams &_params;
84 
85  public:
86  SCGIC(const SCFastModelGICParams &params, sc_core::sc_module_name _name);
87 
89 
90  void before_end_of_elaboration() override;
91 
92  void
93  end_of_elaboration() override
94  {
95  scx_evs_GIC::end_of_elaboration();
96  scx_evs_GIC::start_of_simulation();
97  }
98  void start_of_simulation() override {}
99  const SCFastModelGICParams &
101  {
102  return _params;
103  }
104 };
105 
106 // This class pairs with the one above to implement the receiving end of gem5's
107 // GIC API. It acts as an interface which passes work to the fast model GIC,
108 // and lets the fast model GIC interact with the rest of the system.
109 class GIC : public BaseGic
110 {
111  private:
113  64, svp_gicv3_comms::gicv3_comms_fw_if,
114  svp_gicv3_comms::gicv3_comms_bw_if, 1,
116 
120 
122 
123  public:
124  GIC(const FastModelGICParams &params);
125 
126  Port &getPort(const std::string &if_name,
127  PortID idx=InvalidPortID) override;
128 
129  void sendInt(uint32_t num) override;
130  void clearInt(uint32_t num) override;
131 
132  void sendPPInt(uint32_t num, uint32_t cpu) override;
133  void clearPPInt(uint32_t num, uint32_t cpu) override;
134 
135  bool supportsVersion(GicVersion version) override;
136 
137  AddrRangeList getAddrRanges() const override { return AddrRangeList(); }
138  Tick read(PacketPtr pkt) override { return 0; }
139  Tick write(PacketPtr pkt) override { return 0; }
140 };
141 
142 } // namespace FastModel
143 
144 #endif // __ARCH_ARM_FASTMODEL_GIC_GIC_HH__
sc_port_wrapper.hh
sc_core::SC_ONE_OR_MORE_BOUND
@ SC_ONE_OR_MORE_BOUND
Definition: sc_port.hh:69
FastModel::GIC::sendInt
void sendInt(uint32_t num) override
Post an interrupt from a device that is connected to the GIC.
Definition: gic.cc:328
FastModel::SCGIC::Terminator::targets
Targets targets
Definition: gic.hh:71
data
const char data[]
Definition: circlebuf.test.cc:42
FastModel::SCGIC::before_end_of_elaboration
void before_end_of_elaboration() override
Definition: gic.cc:293
FastModel::GIC::clearInt
void clearInt(uint32_t num) override
Clear an interrupt from a device that is connected to the GIC.
Definition: gic.cc:334
sc_core::sc_module
Definition: sc_module.hh:97
InvalidPortID
const PortID InvalidPortID
Definition: types.hh:238
FastModel::GIC::supportsVersion
bool supportsVersion(GicVersion version) override
Check if version supported.
Definition: gic.cc:352
FastModel::SCGIC::Terminator::Initiators
sc_core::sc_vector< svp_gicv3_comms::gicv3_comms_initiator_socket<> > Initiators
Definition: gic.hh:67
sc_module_name.hh
base_gic.hh
Tick
uint64_t Tick
Tick count type.
Definition: types.hh:63
PortID
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:237
SignalInterruptInitiatorSocket
Definition: signal_interrupt.hh:57
FastModel::SCGIC::Terminator::countUnbound
static int countUnbound(const Initiators &inits)
Definition: gic.cc:38
FastModel::GIC::sendPPInt
void sendPPInt(uint32_t num, uint32_t cpu) override
Interface call for private peripheral interrupts.
Definition: gic.cc:340
std::vector
STL vector class.
Definition: stl.hh:37
FastModel::SCGIC::Terminator::Targets
sc_core::sc_vector< svp_gicv3_comms::gicv3_comms_target_socket<> > Targets
Definition: gic.hh:69
FastModel::SCGIC::SCGIC
SCGIC(const SCFastModelGICParams &params, sc_core::sc_module_name _name)
Definition: gic.cc:70
FastModel::SCGIC::terminator
std::unique_ptr< Terminator > terminator
Definition: gic.hh:82
sc_core::sc_vector
Definition: sc_vector.hh:157
FastModel::GIC::read
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: gic.hh:138
FastModel::GIC::redistributors
std::vector< std::unique_ptr< TlmGicInitiator > > redistributors
Definition: gic.hh:119
FastModel::SCGIC::signalInterrupt
SignalInterruptInitiatorSocket signalInterrupt
Definition: gic.hh:88
AddrRangeList
std::list< AddrRange > AddrRangeList
Convenience typedef for a collection of address ranges.
Definition: addr_range.hh:618
FastModel::GIC::write
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: gic.hh:139
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:137
Port
Ports are used to interface objects to each other.
Definition: port.hh:56
FastModel::SCGIC::start_of_simulation
void start_of_simulation() override
Definition: gic.hh:98
sc_core::sc_module_name
Definition: sc_module_name.hh:41
amba_ports.hh
FastModel::GIC
Definition: gic.hh:109
FastModel
Definition: amba_from_tlm_bridge.cc:32
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:308
FastModel::GIC::ambaM
AmbaInitiator ambaM
Definition: gic.hh:117
BaseGic
Definition: base_gic.hh:62
sc_gem5::TlmInitiatorBaseWrapper
Definition: tlm_port_wrapper.hh:40
FastModel::SCGIC::Terminator::Terminator
Terminator(sc_core::sc_module_name _name, Initiators &inits)
Definition: gic.cc:47
Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:257
ArmISA::len
Bitfield< 18, 16 > len
Definition: miscregs_types.hh:439
FastModel::GIC::scGIC
SCGIC * scGIC
Definition: gic.hh:121
FastModel::GIC::ambaS
AmbaTarget ambaS
Definition: gic.hh:118
FastModel::SCGIC::params
const SCFastModelGICParams & params()
Definition: gic.hh:100
BaseGic::params
const Params * params() const
Definition: base_gic.cc:73
FastModel::GIC::clearPPInt
void clearPPInt(uint32_t num, uint32_t cpu) override
Definition: gic.cc:346
std::list< AddrRange >
FastModel::SCGIC::Terminator::sendTowardsCPU
void sendTowardsCPU(uint8_t len, const uint8_t *data) override
Definition: gic.cc:65
sc_gem5::TlmTargetBaseWrapper
Definition: tlm_port_wrapper.hh:44
FastModel::SCGIC
Definition: gic.hh:54
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:115
BaseGic::GicVersion
GicVersion
Definition: base_gic.hh:66
FastModel::GIC::GIC
GIC(const FastModelGICParams &params)
Definition: gic.cc:299
FastModel::SCGIC::Terminator
Definition: gic.hh:62
FastModel::SCGIC::end_of_elaboration
void end_of_elaboration() override
Definition: gic.hh:93
FastModel::SCGIC::_params
const SCFastModelGICParams & _params
Definition: gic.hh:83

Generated on Wed Sep 30 2020 14:01:58 for gem5 by doxygen 1.8.17