gem5  v20.0.0.2
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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__
HSAPacketProcessor & hsaPacketProc()
Definition: hsa_device.cc:45
#define fatal(...)
This implements a cprintf based fatal() function.
Definition: logging.hh:171
HSAPacketProcessor * hsaPP
Definition: hsa_device.hh:92
void dmaVirt(DmaFnPtr, Addr host_addr, unsigned size, DmaCallback *cb, void *data, Tick delay=0)
Definition: hsa_device.cc:65
void dmaWriteVirt(Addr host_addr, unsigned size, DmaCallback *cb, void *data, Tick delay=0)
Definition: hsa_device.cc:58
void(DmaDevice::* DmaFnPtr)(Addr, int, Event *, uint8_t *, Tick)
Definition: hsa_device.hh:91
void dmaReadVirt(Addr host_addr, unsigned size, DmaCallback *cb, void *data, Tick delay=0)
Definition: hsa_device.cc:51
uint64_t Tick
Tick count type.
Definition: types.hh:61
void setDevice(HSADevice *dev)
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
HSADeviceParams Params
Definition: hsa_device.hh:49
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:140
DMA callback class.
Definition: dma_device.hh:220
virtual const std::string name() const
Definition: sim_object.hh:128
Definition: eventq.hh:246
Bitfield< 0 > p
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
HSADevice(const Params *p)
Definition: hsa_device.hh:51
const char data[]
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

Generated on Mon Jun 8 2020 15:45:10 for gem5 by doxygen 1.8.13