gem5  v22.1.0.0
system_hub.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021 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 #include "dev/amdgpu/system_hub.hh"
33 
34 #include "mem/port.hh"
35 
36 namespace gem5
37 {
38 
39 void
41 {
42  ResponseEvent *dmaRespEvent = new ResponseEvent(callback);
43  Tick delay = 0;
44 
45  if (pkt->isWrite()) {
46  dmaWrite(pkt->getAddr(), pkt->getSize(), dmaRespEvent,
47  pkt->getPtr<uint8_t>(), 0, 0, delay);
48  } else {
49  assert(pkt->isRead());
50  dmaRead(pkt->getAddr(), pkt->getSize(), dmaRespEvent,
51  pkt->getPtr<uint8_t>(), 0, 0, delay);
52  }
53 }
54 
55 void
57 {
58 }
59 
61  : callback(_callback)
62 {
63  // Delete this event after process is called
65 }
66 
67 void
69 {
70  callback->process();
71 }
72 
75 {
76  AddrRangeList ranges;
77  return ranges;
78 }
79 
80 } // namespace gem5
void sendRequest(PacketPtr pkt, Event *callback)
Definition: system_hub.cc:40
AddrRangeList getAddrRanges() const override
Every PIO device is obliged to provide an implementation that returns the address ranges the device r...
Definition: system_hub.cc:74
void dmaResponse(PacketPtr pkt)
Definition: system_hub.cc:56
void dmaWrite(Addr addr, int size, Event *event, uint8_t *data, uint32_t sid, uint32_t ssid, Tick delay=0)
Definition: dma_device.hh:214
void dmaRead(Addr addr, int size, Event *event, uint8_t *data, uint32_t sid, uint32_t ssid, Tick delay=0)
Definition: dma_device.hh:228
static const FlagsType AutoDelete
Definition: eventq.hh:107
void setFlags(Flags _flags)
Definition: eventq.hh:328
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:294
bool isRead() const
Definition: packet.hh:592
T * getPtr()
get a pointer to the data ptr.
Definition: packet.hh:1212
Addr getAddr() const
Definition: packet.hh:805
bool isWrite() const
Definition: packet.hh:593
unsigned getSize() const
Definition: packet.hh:815
Port Object Declaration.
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
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