gem5  v20.1.0.0
hsa_device.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2018 Advanced Micro Devices, Inc.
3  * All rights reserved.
4  *
5  * For use for simulation and test purposes only
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright notice,
11  * this list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright notice,
14  * this list of conditions and the following disclaimer in the documentation
15  * and/or other materials provided with the distribution.
16  *
17  * 3. Neither the name of the copyright holder nor the names of its
18  * contributors may be used to endorse or promote products derived from this
19  * software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  *
33  * Authors: Eric van Tassell
34  * Anthony Gutierrez
35  * Sooraj Puthoor
36  * Michael LeBeane
37  */
38 
39 #ifndef __DEV_HSA_HSA_DEVICE_HH__
40 #define __DEV_HSA_HSA_DEVICE_HH__
41 
42 #include "dev/dma_device.hh"
44 #include "params/HSADevice.hh"
45 
46 class HSADevice : public DmaDevice
47 {
48  public:
49  typedef HSADeviceParams Params;
50 
51  HSADevice(const Params *p) : DmaDevice(p), hsaPP(p->hsapp)
52  {
53  assert(hsaPP);
54  hsaPP->setDevice(this);
55  };
56 
58 
64  virtual void
65  submitDispatchPkt(void *raw_pkt, uint32_t qID, Addr host_pkt_addr)
66  {
67  fatal("%s does not accept dispatch packets\n", name());
68  }
69 
78  virtual void
79  submitVendorPkt(void *raw_pkt, uint32_t queue_id, Addr host_pkt_addr)
80  {
81  fatal("%s does not accept vendor specific packets\n", name());
82  }
83 
84  void dmaReadVirt(Addr host_addr, unsigned size, DmaCallback *cb,
85  void *data, Tick delay = 0);
86  void dmaWriteVirt(Addr host_addr, unsigned size, DmaCallback *cb,
87  void *data, Tick delay = 0);
88 
89  protected:
90  // Typedefing dmaRead and dmaWrite function pointer
91  typedef void (DmaDevice::*DmaFnPtr)(Addr, int, Event*, uint8_t*, Tick);
93  void dmaVirt(DmaFnPtr, Addr host_addr, unsigned size, DmaCallback *cb,
94  void *data, Tick delay = 0);
95  void translateOrDie(Addr vaddr, Addr &paddr);
96 };
97 
98 #endif // __DEV_HSA_HSA_DEVICE_HH__
HSADevice::hsaPP
HSAPacketProcessor * hsaPP
Definition: hsa_device.hh:92
fatal
#define fatal(...)
This implements a cprintf based fatal() function.
Definition: logging.hh:183
data
const char data[]
Definition: circlebuf.test.cc:42
HSADevice::DmaFnPtr
void(DmaDevice::* DmaFnPtr)(Addr, int, Event *, uint8_t *, Tick)
Definition: hsa_device.hh:91
hsa_packet_processor.hh
HSADevice::dmaWriteVirt
void dmaWriteVirt(Addr host_addr, unsigned size, DmaCallback *cb, void *data, Tick delay=0)
Definition: hsa_device.cc:58
Tick
uint64_t Tick
Tick count type.
Definition: types.hh:63
HSADevice::dmaReadVirt
void dmaReadVirt(Addr host_addr, unsigned size, DmaCallback *cb, void *data, Tick delay=0)
Definition: hsa_device.cc:51
HSAPacketProcessor::setDevice
void setDevice(HSADevice *dev)
Definition: hsa_packet_processor.cc:636
HSADevice::submitVendorPkt
virtual void submitVendorPkt(void *raw_pkt, uint32_t queue_id, Addr host_pkt_addr)
submitVendorPkt() accepts vendor specific packets from the HSA packet processor.
Definition: hsa_device.hh:79
dma_device.hh
HSADevice::submitDispatchPkt
virtual void submitDispatchPkt(void *raw_pkt, uint32_t qID, Addr host_pkt_addr)
submitDispatchPkt() accepts AQL dispatch packets from the HSA packet processor.
Definition: hsa_device.hh:65
HSAPacketProcessor
Definition: hsa_packet_processor.hh:212
Event
Definition: eventq.hh:246
MipsISA::vaddr
vaddr
Definition: pra_constants.hh:275
HSADevice::translateOrDie
void translateOrDie(Addr vaddr, Addr &paddr)
HSADevices will perform DMA operations on VAs, and because page faults are not currently supported fo...
Definition: hsa_device.cc:97
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
SimObject::name
virtual const std::string name() const
Definition: sim_object.hh:133
HSADevice::HSADevice
HSADevice(const Params *p)
Definition: hsa_device.hh:51
HSADevice::hsaPacketProc
HSAPacketProcessor & hsaPacketProc()
Definition: hsa_device.cc:45
DmaDevice
Definition: dma_device.hh:165
DmaCallback
DMA callback class.
Definition: dma_device.hh:220
HSADevice::dmaVirt
void dmaVirt(DmaFnPtr, Addr host_addr, unsigned size, DmaCallback *cb, void *data, Tick delay=0)
Definition: hsa_device.cc:65
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
HSADevice::Params
HSADeviceParams Params
Definition: hsa_device.hh:49
HSADevice
Definition: hsa_device.hh:46
DmaDevice::Params
DmaDeviceParams Params
Definition: dma_device.hh:171

Generated on Wed Sep 30 2020 14:02:11 for gem5 by doxygen 1.8.17