gem5  v21.1.0.2
gpu_nomali.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2016 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_NOMALI_GPU_HH__
39 #define __DEV_ARM_NOMALI_GPU_HH__
40 
41 #include <map>
42 
43 #include "dev/io_device.hh"
44 #include "libnomali/nomali.h"
45 
46 namespace gem5
47 {
48 
49 struct NoMaliGpuParams;
50 struct CustomNoMaliGpuParams;
51 class RealView;
52 
53 class NoMaliGpu : public PioDevice
54 {
55  public:
56  NoMaliGpu(const NoMaliGpuParams &p);
57  virtual ~NoMaliGpu();
58 
59  void init() override;
60 
61  public: /* Checkpointing */
62  void serialize(CheckpointOut &cp) const override;
63  void unserialize(CheckpointIn &cp) override;
64 
65  public: /* IO device interfaces */
66  Tick read(PacketPtr pkt) override;
67  Tick write(PacketPtr pkt) override;
68  AddrRangeList getAddrRanges() const override;
69 
70  protected: /* API wrappers/helpers */
77  void reset();
78 
80  uint32_t readReg(nomali_addr_t reg);
82  void writeReg(nomali_addr_t reg, uint32_t value);
83 
85  uint32_t readRegRaw(nomali_addr_t reg) const;
87  void writeRegRaw(nomali_addr_t reg, uint32_t value);
88 
95  bool intState(nomali_int_t intno);
96 
105  [[noreturn]] static void gpuPanic(nomali_error_t err, const char *msg);
112  static void panicOnErr(nomali_error_t err, const char *msg) {
113  if (err != NOMALI_E_OK)
114  gpuPanic(err, msg);
115  }
116 
117  protected: /* Callbacks */
131  virtual void onInterrupt(nomali_int_t intno, bool set);
132 
139  virtual void onReset();
140 
143  private: /* Callback helpers */
145  void setCallback(const nomali_callback_t &callback);
146 
158  static void _interrupt(nomali_handle_t h, void *usr,
159  nomali_int_t intno, int set);
160 
170  static void _reset(nomali_handle_t h, void *usr);
171 
172  protected:
174  const Addr pioAddr;
175 
178 
181  const std::map<nomali_int_t, uint32_t> interruptMap;
182 
184  nomali_info_t nomaliInfo;
185 
187  nomali_handle_t nomali;
188 };
189 
190 
192 {
193  public:
194  CustomNoMaliGpu(const CustomNoMaliGpuParams &p);
195  virtual ~CustomNoMaliGpu();
196 
197  protected:
198  void onReset() override;
199 
200  private:
202  std::map<nomali_addr_t, uint32_t> idRegs;
203 };
204 
205 } // namespace gem5
206 
207 #endif // __DEV_ARM_NOMALI_GPU_HH__
gem5::NoMaliGpu::NoMaliGpu
NoMaliGpu(const NoMaliGpuParams &p)
Definition: gpu_nomali.cc:58
gem5::NoMaliGpu::writeRegRaw
void writeRegRaw(nomali_addr_t reg, uint32_t value)
Wrapper around nomali_reg_write_raw().
Definition: gpu_nomali.cc:248
io_device.hh
gem5::NoMaliGpu::intState
bool intState(nomali_int_t intno)
Wrapper around nomali_int_state()
Definition: gpu_nomali.cc:256
gem5::PioDevice
This device is the base class which all devices senstive to an address range inherit from.
Definition: io_device.hh:102
gem5::CheckpointIn
Definition: serialize.hh:68
gem5::NoMaliGpu::onInterrupt
virtual void onInterrupt(nomali_int_t intno, bool set)
Interrupt callback from the NoMali library.
Definition: gpu_nomali.cc:274
gem5::ArmISA::err
Bitfield< 6 > err
Definition: misc_types.hh:750
gem5::NoMaliGpu::readReg
uint32_t readReg(nomali_addr_t reg)
Wrapper around nomali_reg_read().
Definition: gpu_nomali.cc:208
gem5::NoMaliGpu::_reset
static void _reset(nomali_handle_t h, void *usr)
Reset callback from the NoMali library.
Definition: gpu_nomali.cc:319
gem5::CustomNoMaliGpu
Definition: gpu_nomali.hh:191
gem5::NoMaliGpu::reset
void reset()
Wrapper around nomali_reset().
Definition: gpu_nomali.cc:198
gem5::NoMaliGpu::read
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: gpu_nomali.cc:150
gem5::NoMaliGpu::getAddrRanges
AddrRangeList getAddrRanges() const override
Every PIO device is obliged to provide an implementation that returns the address ranges the device r...
Definition: gpu_nomali.cc:192
gem5::NoMaliGpu::init
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: gpu_nomali.cc:117
gem5::NoMaliGpu::setCallback
void setCallback(const nomali_callback_t &callback)
Wrapper around nomali_set_callback()
Definition: gpu_nomali.cc:299
gem5::NoMaliGpu
Definition: gpu_nomali.hh:53
gem5::NoMaliGpu::_interrupt
static void _interrupt(nomali_handle_t h, void *usr, nomali_int_t intno, int set)
Interrupt callback from the NoMali library.
Definition: gpu_nomali.cc:310
gem5::NoMaliGpu::~NoMaliGpu
virtual ~NoMaliGpu()
Definition: gpu_nomali.cc:110
gem5::Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:283
gem5::MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:326
gem5::Tick
uint64_t Tick
Tick count type.
Definition: types.hh:58
gem5::NoMaliGpu::gpuPanic
static void gpuPanic(nomali_error_t err, const char *msg)
Format a NoMali error into an error message and panic.
Definition: gpu_nomali.cc:267
gem5::NoMaliGpu::onReset
virtual void onReset()
Reset callback from the NoMali library.
Definition: gpu_nomali.cc:293
gem5::NoMaliGpu::interruptMap
const std::map< nomali_int_t, uint32_t > interruptMap
Map between NoMali interrupt types and actual GIC interrupts.
Definition: gpu_nomali.hh:181
gem5::NoMaliGpu::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: gpu_nomali.cc:139
gem5::X86ISA::usr
Bitfield< 16 > usr
Definition: misc.hh:808
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::CustomNoMaliGpu::~CustomNoMaliGpu
virtual ~CustomNoMaliGpu()
Definition: gpu_nomali.cc:368
gem5::CustomNoMaliGpu::onReset
void onReset() override
Reset callback from the NoMali library.
Definition: gpu_nomali.cc:373
gem5::CustomNoMaliGpu::CustomNoMaliGpu
CustomNoMaliGpu(const CustomNoMaliGpuParams &p)
Definition: gpu_nomali.cc:327
gem5::X86ISA::reg
Bitfield< 5, 3 > reg
Definition: types.hh:92
gem5::NoMaliGpu::platform
RealView *const platform
Platform, used to discover GIC.
Definition: gpu_nomali.hh:177
gem5::RealView
Definition: realview.hh:59
gem5::NoMaliGpu::pioAddr
const Addr pioAddr
Device base address.
Definition: gpu_nomali.hh:174
gem5::CheckpointOut
std::ostream CheckpointOut
Definition: serialize.hh:66
std::list< AddrRange >
gem5::NoMaliGpu::writeReg
void writeReg(nomali_addr_t reg, uint32_t value)
Wrapper around nomali_reg_write().
Definition: gpu_nomali.cc:224
gem5::NoMaliGpu::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: gpu_nomali.cc:128
gem5::NoMaliGpu::nomaliInfo
nomali_info_t nomaliInfo
Cached information struct from the NoMali library.
Definition: gpu_nomali.hh:184
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::NoMaliGpu::write
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: gpu_nomali.cc:171
gem5::CustomNoMaliGpu::idRegs
std::map< nomali_addr_t, uint32_t > idRegs
Map between GPU registers and their custom reset values.
Definition: gpu_nomali.hh:202
gem5::NoMaliGpu::panicOnErr
static void panicOnErr(nomali_error_t err, const char *msg)
Panic if the NoMali returned an error, do nothing otherwise.
Definition: gpu_nomali.hh:112
gem5::NoMaliGpu::nomali
nomali_handle_t nomali
Handle of a NoMali library instance.
Definition: gpu_nomali.hh:187
gem5::NoMaliGpu::readRegRaw
uint32_t readRegRaw(nomali_addr_t reg) const
Wrapper around nomali_reg_read_raw().
Definition: gpu_nomali.cc:235

Generated on Tue Sep 21 2021 12:25:13 for gem5 by doxygen 1.8.17