amdgpu_ih.h revision 1.1.1.1 1 /* $NetBSD: amdgpu_ih.h,v 1.1.1.1 2018/08/27 01:34:44 riastradh Exp $ */
2
3 /*
4 * Copyright 2014 Advanced Micro Devices, Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
23 *
24 */
25
26 #ifndef __AMDGPU_IH_H__
27 #define __AMDGPU_IH_H__
28
29 struct amdgpu_device;
30
31 /*
32 * R6xx+ IH ring
33 */
34 struct amdgpu_ih_ring {
35 struct amdgpu_bo *ring_obj;
36 volatile uint32_t *ring;
37 unsigned rptr;
38 unsigned ring_size;
39 uint64_t gpu_addr;
40 uint32_t ptr_mask;
41 atomic_t lock;
42 bool enabled;
43 unsigned wptr_offs;
44 unsigned rptr_offs;
45 u32 doorbell_index;
46 bool use_doorbell;
47 bool use_bus_addr;
48 dma_addr_t rb_dma_addr; /* only used when use_bus_addr = true */
49 };
50
51 struct amdgpu_iv_entry {
52 unsigned src_id;
53 unsigned src_data;
54 unsigned ring_id;
55 unsigned vm_id;
56 unsigned pas_id;
57 const uint32_t *iv_entry;
58 };
59
60 int amdgpu_ih_ring_init(struct amdgpu_device *adev, unsigned ring_size,
61 bool use_bus_addr);
62 void amdgpu_ih_ring_fini(struct amdgpu_device *adev);
63 int amdgpu_ih_process(struct amdgpu_device *adev);
64
65 #endif
66