1 /*
2  * Copyright © 2018 Intel Corporation
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21  * IN THE SOFTWARE.
22  *
23  */
24 
25 #ifndef INTEL_AUB_READ
26 #define INTEL_AUB_READ
27 
28 #include <stdint.h>
29 
30 #include "dev/intel_device_info.h"
31 #include "drm-uapi/i915_drm.h"
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 struct aub_read {
38    /* Caller's data */
39    void *user_data;
40 
41    void (*error)(void *user_data, const void *aub_data, const char *msg);
42 
43    void (*info)(void *user_data, int pci_id, const char *app_name);
44 
45    void (*local_write)(void *user_data, uint64_t phys_addr, const void *data, uint32_t data_len);
46    void (*phys_write)(void *user_data, uint64_t phys_addr, const void *data, uint32_t data_len);
47    void (*ggtt_write)(void *user_data, uint64_t phys_addr, const void *data, uint32_t data_len);
48    void (*ggtt_entry_write)(void *user_data, uint64_t phys_addr,
49                             const void *data, uint32_t data_len);
50 
51    void (*reg_write)(void *user_data, uint32_t reg_offset, uint32_t reg_value);
52 
53    void (*ring_write)(void *user_data, enum drm_i915_gem_engine_class engine,
54                       const void *data, uint32_t data_len);
55    void (*execlist_write)(void *user_data, enum drm_i915_gem_engine_class engine,
56                           uint64_t context_descriptor);
57 
58    /* Reader's data */
59    uint32_t render_elsp[4];
60    int render_elsp_index;
61    uint32_t video_elsp[4];
62    int video_elsp_index;
63    uint32_t blitter_elsp[4];
64    int blitter_elsp_index;
65 
66    struct intel_device_info devinfo;
67 };
68 
69 int aub_read_command(struct aub_read *read, const void *data, uint32_t data_len);
70 
71 #ifdef __cplusplus
72 }
73 #endif
74 
75 #endif /* INTEL_AUB_READ */
76