2 * Copyright © 2007-2017 Intel Corporation
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:
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
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
25 #ifndef INTEL_AUB_WRITE
26 #define INTEL_AUB_WRITE
31 #include "dev/gen_device_info.h"
33 struct aub_ppgtt_table
{
35 struct aub_ppgtt_table
*subtables
[512];
41 /* Set if you want extra logging */
42 FILE *verbose_log_file
;
45 struct gen_device_info devinfo
;
49 struct aub_ppgtt_table pml4
;
52 void aub_file_init(struct aub_file
*aub
, FILE *file
, uint16_t pci_id
);
53 void aub_file_finish(struct aub_file
*aub
);
55 static inline bool aub_use_execlists(const struct aub_file
*aub
)
57 return aub
->devinfo
.gen
>= 8;
60 uint32_t aub_gtt_size(struct aub_file
*aub
);
63 aub_write_reloc(const struct gen_device_info
*devinfo
, void *p
, uint64_t v
)
65 if (devinfo
->gen
>= 8) {
66 /* From the Broadwell PRM Vol. 2a,
67 * MI_LOAD_REGISTER_MEM::MemoryAddress:
69 * "This field specifies the address of the memory
70 * location where the register value specified in the
71 * DWord above will read from. The address specifies
72 * the DWord location of the data. Range =
73 * GraphicsVirtualAddress[63:2] for a DWord register
74 * GraphicsAddress [63:48] are ignored by the HW and
75 * assumed to be in correct canonical form [63:48] ==
78 * In practice, this will always mean the top bits are zero
79 * because of the GTT size limitation of the aubdump tool.
81 const int shift
= 63 - 47;
82 *(uint64_t *)p
= (((int64_t)v
) << shift
) >> shift
;
88 void aub_write_header(struct aub_file
*aub
, const char *app_name
);
89 void aub_map_ppgtt(struct aub_file
*aub
, uint64_t start
, uint64_t size
);
90 void aub_write_trace_block(struct aub_file
*aub
,
91 uint32_t type
, void *virtual,
92 uint32_t size
, uint64_t gtt_offset
);
93 void aub_write_exec(struct aub_file
*aub
, uint64_t batch_addr
,
94 uint64_t offset
, int ring_flag
);
96 #endif /* INTEL_AUB_WRITE */