gem5  [DEVELOP-FOR-23.0]
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
amdgpu_nbio.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2023 Advanced Micro Devices, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  *
15  * 3. Neither the name of the copyright holder nor the names of its
16  * contributors may be used to endorse or promote products derived from this
17  * software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  *
31  */
32 
33 #ifndef __DEV_AMDGPU_AMDGPU_NBIO__
34 #define __DEV_AMDGPU_AMDGPU_NBIO__
35 
36 #include <unordered_map>
37 
38 #include "base/types.hh"
39 #include "mem/packet.hh"
40 
41 namespace gem5
42 {
43 
44 class AMDGPUDevice;
45 
56 #define AMDGPU_MM_INDEX 0x00000
57 #define AMDGPU_MM_INDEX_HI 0x00018
58 #define AMDGPU_MM_DATA 0x00004
59 #define AMDGPU_PCIE_DATA_REG 0x0003c
60 
61 // Message bus related to psp
62 #define AMDGPU_MP0_SMN_C2PMSG_33 0x58184
63 #define AMDGPU_MP0_SMN_C2PMSG_35 0x5818c
64 #define AMDGPU_MP0_SMN_C2PMSG_64 0x58200
65 #define AMDGPU_MP0_SMN_C2PMSG_69 0x58214
66 #define AMDGPU_MP0_SMN_C2PMSG_70 0x58218
67 #define AMDGPU_MP0_SMN_C2PMSG_71 0x5821c
68 #define AMDGPU_MP0_SMN_C2PMSG_81 0x58244
69 
70 // Device specific invalidation engines used during initialization
71 #define VEGA10_INV_ENG17_ACK1 0x0a318
72 #define VEGA10_INV_ENG17_ACK2 0x69c18
73 #define VEGA10_INV_ENG17_SEM1 0x0a288
74 #define VEGA10_INV_ENG17_SEM2 0x69b88
75 
76 #define MI100_INV_ENG17_ACK1 0x0a318
77 #define MI100_INV_ENG17_ACK2 0x6a918
78 #define MI100_INV_ENG17_ACK3 0x76918
79 #define MI100_INV_ENG17_SEM1 0x0a288
80 #define MI100_INV_ENG17_SEM2 0x6a888
81 #define MI100_INV_ENG17_SEM3 0x76888
82 
83 #define MI200_INV_ENG17_ACK1 0x0a318
84 #define MI200_INV_ENG17_ACK2 0x6b018
85 #define MI200_INV_ENG17_SEM1 0x0a288
86 #define MI200_INV_ENG17_SEM2 0x6af88
87 
89 {
90  public:
91  AMDGPUNbio();
92 
93  void setGPUDevice(AMDGPUDevice *gpu_device);
94 
95  void readMMIO(PacketPtr pkt, Addr offset);
96  void writeMMIO(PacketPtr pkt, Addr offset);
97 
98  bool readFrame(PacketPtr pkt, Addr offset);
99  void writeFrame(PacketPtr pkt, Addr offset);
100 
101  private:
103 
104  /*
105  * Driver initialization sequence helper variables.
106  */
107  uint64_t mm_index_reg = 0;
108  std::unordered_map<uint32_t, uint32_t> triggered_reads;
109 
110  /*
111  * PSP variables used in initialization.
112  */
116  int psp_ring_size = 0;
117  int psp_ring_value = 0;
118 };
119 
120 } // namespace gem5
121 
122 #endif // __DEV_AMDGPU_AMDGPU_NBIO__
gem5::AMDGPUNbio::psp_ring_listen_addr
Addr psp_ring_listen_addr
Definition: amdgpu_nbio.hh:115
gem5::AMDGPUNbio::readMMIO
void readMMIO(PacketPtr pkt, Addr offset)
Definition: amdgpu_nbio.cc:54
gem5::AMDGPUNbio::psp_ring_value
int psp_ring_value
Definition: amdgpu_nbio.hh:117
gem5::AMDGPUNbio::psp_ring_size
int psp_ring_size
Definition: amdgpu_nbio.hh:116
packet.hh
gem5::AMDGPUNbio::psp_ring_dev_addr
Addr psp_ring_dev_addr
Definition: amdgpu_nbio.hh:114
gem5::AMDGPUNbio::psp_ring
Addr psp_ring
Definition: amdgpu_nbio.hh:113
gem5::Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:294
gem5::AMDGPUNbio::setGPUDevice
void setGPUDevice(AMDGPUDevice *gpu_device)
Definition: amdgpu_nbio.cc:48
gem5::ArmISA::offset
Bitfield< 23, 0 > offset
Definition: types.hh:144
gem5::AMDGPUDevice
Device model for an AMD GPU.
Definition: amdgpu_device.hh:62
gem5::AMDGPUNbio::AMDGPUNbio
AMDGPUNbio()
Definition: amdgpu_nbio.cc:41
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::AMDGPUNbio::readFrame
bool readFrame(PacketPtr pkt, Addr offset)
Definition: amdgpu_nbio.cc:151
gem5::AMDGPUNbio::mm_index_reg
uint64_t mm_index_reg
Definition: amdgpu_nbio.hh:107
types.hh
gem5::AMDGPUNbio::writeFrame
void writeFrame(PacketPtr pkt, Addr offset)
Definition: amdgpu_nbio.cc:164
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::AMDGPUNbio::writeMMIO
void writeMMIO(PacketPtr pkt, Addr offset)
Definition: amdgpu_nbio.cc:112
gem5::AMDGPUNbio
Definition: amdgpu_nbio.hh:88
gem5::AMDGPUNbio::triggered_reads
std::unordered_map< uint32_t, uint32_t > triggered_reads
Definition: amdgpu_nbio.hh:108
gem5::AMDGPUNbio::gpuDevice
AMDGPUDevice * gpuDevice
Definition: amdgpu_nbio.hh:102

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