Debian Codegraph @

media_driver/agnostic/gen8/hw/mhw_mi_hwcmd_g8_X.h

raw
1 /*
2 * Copyright (c) 2017, 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 shall be included
12 * in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22 //!
23 //! \file mhw_mi_hwcmd_g8_X.h
24 //! \brief Auto-generated constructors for MHW and states.
25 //! \details This file may not be included outside of g8_X as other components
26 //! should use MHW interface to interact with MHW commands and states.
27 //!
28 #ifndef __MHW_MI_HWCMD_G8_X_H__
29 #define __MHW_MI_HWCMD_G8_X_H__
30
31 #pragma once
32
33 #include <cstdint>
34 #include <cstddef>
35
36 #pragma pack(1)
37
38 class mhw_mi_g8_X
39 {
40 public:
41 // Internal Macros
42 #define __CODEGEN_MAX(_a, _b) (((_a) > (_b)) ? (_a) : (_b))
43 #define __CODEGEN_BITFIELD(l, h) (h) - (l) + 1
44 #define __CODEGEN_OP_LENGTH_BIAS 2
45 #define __CODEGEN_OP_LENGTH(x) (uint32_t)((__CODEGEN_MAX(x, __CODEGEN_OP_LENGTH_BIAS)) - __CODEGEN_OP_LENGTH_BIAS)
46
47 static uint32_t GetOpLength(uint32_t uiLength) { return __CODEGEN_OP_LENGTH(uiLength); }
48
49 //!
50 //! \brief MI_BATCH_BUFFER_END
51 //! \details
52 //! The MI_BATCH_BUFFER_END command is used to terminate the execution of
53 //! commands stored in a batch buffer initiated using a
54 //! MI_BATCH_BUFFER_START command.
55 //!
56 struct MI_BATCH_BUFFER_END_CMD
57 {
58 union
59 {
60 //!< DWORD 0
61 struct
62 {
63 uint32_t Reserved0 : __CODEGEN_BITFIELD( 0, 22) ; //!< Reserved
64 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
65 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
66 };
67 uint32_t Value;
68 } DW0;
69
70 //! \name Local enumerations
71
72 enum MI_COMMAND_OPCODE
73 {
74 MI_COMMAND_OPCODE_MIBATCHBUFFEREND = 10, //!< No additional details
75 };
76
77 enum COMMAND_TYPE
78 {
79 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
80 };
81
82 //! \name Initializations
83
84 //! \brief Explicit member initialization function
85 MI_BATCH_BUFFER_END_CMD();
86
87 static const size_t dwSize = 1;
88 static const size_t byteSize = 4;
89 };
90
91 //!
92 //! \brief MI_NOOP
93 //! \details
94 //! The MI_NOOP command basically performs a "no operation" in the command
95 //! stream and is typically used to pad the command stream (e.g., in order
96 //! to pad out a batch buffer to a QWord boundary). However, there is one
97 //! minor (optional) function this command can perform - a 22-bit value can
98 //! be loaded into the MI NOPID register. This provides a general-purpose
99 //! command stream tagging ("breadcrumb") mechanism (e.g., to provide
100 //! sequencing information for a subsequent breakpoint interrupt).
101 //!
102 struct MI_NOOP_CMD
103 {
104 union
105 {
106 //!< DWORD 0
107 struct
108 {
109 uint32_t IdentificationNumber : __CODEGEN_BITFIELD( 0, 21) ; //!< Identification Number
110 uint32_t IdentificationNumberRegisterWriteEnable : __CODEGEN_BITFIELD(22, 22) ; //!< IDENTIFICATION_NUMBER_REGISTER_WRITE_ENABLE
111 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
112 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
113 };
114 uint32_t Value;
115 } DW0;
116
117 //! \name Local enumerations
118
119 //! \brief IDENTIFICATION_NUMBER_REGISTER_WRITE_ENABLE
120 //! \details
121 //! This field enables the value in the Identification Number field to be
122 //! written into the MI NOPID register. If disabled, that register is
123 //! unmodified - making this command an effective "no operation" function.
124 enum IDENTIFICATION_NUMBER_REGISTER_WRITE_ENABLE
125 {
126 IDENTIFICATION_NUMBER_REGISTER_WRITE_ENABLE_WRITETHENOPIDREGISTER = 1, //!< No additional details
127 };
128
129 enum MI_COMMAND_OPCODE
130 {
131 MI_COMMAND_OPCODE_MINOOP = 0, //!< No additional details
132 };
133
134 enum COMMAND_TYPE
135 {
136 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
137 };
138
139 //! \name Initializations
140
141 //! \brief Explicit member initialization function
142 MI_NOOP_CMD();
143
144 static const size_t dwSize = 1;
145 static const size_t byteSize = 4;
146 };
147
148 //!
149 //! \brief MI_ARB_CHECK
150 //! \details
151 //! The MI_ARB_CHECK is used to check for a change in arbitration. If
152 //! executed as part of a Ring Buffer the command checks the UHPTR valid bit
153 //! and if set the head of the ring will jump to the value of the head
154 //! pointer programmed in the UHPTR.
155 //!
156 //! This instruction cannot be placed in a batch buffer.
157 //!
158 //! If execlist is enabled, there is a pending execution list and this
159 //! command is parsed, then the command streamer will preempt the current
160 //! context and start executing the new execution list.
161 //!
162 struct MI_ARB_CHECK_CMD
163 {
164 union
165 {
166 //!< DWORD 0
167 struct
168 {
169 uint32_t Reserved0 : __CODEGEN_BITFIELD( 0, 22) ; //!< Reserved
170 uint32_t MiInstructionOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_INSTRUCTION_OPCODE
171 uint32_t MiInstructionType : __CODEGEN_BITFIELD(29, 31) ; //!< MI_INSTRUCTION_TYPE
172 };
173 uint32_t Value;
174 } DW0;
175
176 //! \name Local enumerations
177
178 enum MI_INSTRUCTION_OPCODE
179 {
180 MI_INSTRUCTION_OPCODE_MIARBCHECK = 5, //!< No additional details
181 };
182
183 enum MI_INSTRUCTION_TYPE
184 {
185 MI_INSTRUCTION_TYPE_MIINSTRUCTION = 0, //!< No additional details
186 };
187
188 //! \name Initializations
189
190 //! \brief Explicit member initialization function
191 MI_ARB_CHECK_CMD();
192
193 static const size_t dwSize = 1;
194 static const size_t byteSize = 4;
195 };
196
197 //!
198 //! \brief MI_LOAD_REGISTER_IMM
199 //! \details
200 //! The MI_LOAD_REGISTER_IMM command requests a write of up to a DWord
201 //! constant supplied in the command to the specified Register Offset (i.e.,
202 //! offset into Memory-Mapped Register Range). The register is loaded before
203 //! the next command is executed.
204 //! Any offset that is to a destination outside of the GT core will allow
205 //! the parser to continue once the cycle is at the GT boundry and not
206 //! destination.  Any other address will ensure the destination is updated
207 //! prior to parsing the next command
208 //!
209 struct MI_LOAD_REGISTER_IMM_CMD
210 {
211 union
212 {
213 //!< DWORD 0
214 struct
215 {
216 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
217 uint32_t ByteWriteDisables : __CODEGEN_BITFIELD( 8, 11) ; //!< Byte Write Disables
218 uint32_t Reserved12 : __CODEGEN_BITFIELD(12, 22) ; //!< Reserved
219 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
220 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
221 };
222 uint32_t Value;
223 } DW0;
224 union
225 {
226 //!< DWORD 1
227 struct
228 {
229 uint32_t Reserved32 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
230 uint32_t RegisterOffset : __CODEGEN_BITFIELD( 2, 22) ; //!< Register Offset
231 uint32_t Reserved55 : __CODEGEN_BITFIELD(23, 31) ; //!< Reserved
232 };
233 uint32_t Value;
234 } DW1;
235 union
236 {
237 //!< DWORD 2
238 struct
239 {
240 uint32_t DataDword ; //!< Data DWord
241 };
242 uint32_t Value;
243 } DW2;
244
245 //! \name Local enumerations
246
247 enum MI_COMMAND_OPCODE
248 {
249 MI_COMMAND_OPCODE_MILOADREGISTERIMM = 34, //!< No additional details
250 };
251
252 enum COMMAND_TYPE
253 {
254 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
255 };
256
257 //! \name Initializations
258
259 //! \brief Explicit member initialization function
260 MI_LOAD_REGISTER_IMM_CMD();
261
262 static const size_t dwSize = 3;
263 static const size_t byteSize = 12;
264 };
265
266 //!
267 //! \brief MI_LOAD_REGISTER_MEM
268 //! \details
269 //! The MI_LOAD_REGISTER_MEM command requests from a memory location and
270 //! stores that DWord to a register.
271 //!
272 //! The command temporarily halts commands that will cause cycles down the
273 //! 3D pipeline.
274 //!
275 //! The following addresses should NOT be used for MMIO writes:
276 //!
277 //! 0x8800 - 0x88FF
278 //!
279 //! >= 0xC0000
280 //!
281 //!
282 //!
283 //! Limited MMIO writes cycles to the Display Engine 0x40000-0xBFFFF) are
284 //! allowed, but must be spaced to allow only one pending at a time. This
285 //! can be done by issuing an SRM to the same address immediately after each
286 //! MMIO write.
287 //!
288 //! Any updates to the memory location exercised by this command must be
289 //! ensured to be coherent in memory prior to programming of this command.
290 //! This must be achieved by programming MI_ATOMIC (write to scratch space)
291 //! with "CS STALL" set prior to programming of this command.
292 //! Example:
293 //! MI_STORE_REGISTE_MEM (0x2288, 0x2CF0_0000)
294 //! ………
295 //! ………
296 //! MI_ATOMIC (MOV, Dummy data, Scratch Address)
297 //! MI_LOAD_REGISTER_MEM(0x2288, 0x2CF0_0000)
298 //!
299 //! This command should not be used within a non-privilege batch buffer to
300 //! access global virtual space, doing so will be treated as privilege
301 //! access violation. Refer "User Mode Privilege Command" in
302 //! MI_BATCH_BUFFER_START command section to know HW behavior on
303 //! encountering privilege access violation.
304 //!
305 //! This command is not allowed to update the privilege register range when
306 //! executed from a non-privilege batch buffer.
307 //!
308 //! Writes to the range 0x9400-0x97FF must be either be avoided, or
309 //! serialized with a read (e.g. STORE_REGISTER_MEM) between them.
310 //!
311 struct MI_LOAD_REGISTER_MEM_CMD
312 {
313 union
314 {
315 //!< DWORD 0
316 struct
317 {
318 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
319 uint32_t Reserved8 : __CODEGEN_BITFIELD( 8, 20) ; //!< Reserved
320 uint32_t AsyncModeEnable : __CODEGEN_BITFIELD(21, 21) ; //!< Async Mode Enable
321 uint32_t UseGlobalGtt : __CODEGEN_BITFIELD(22, 22) ; //!< Use Global GTT
322 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
323 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
324 };
325 uint32_t Value;
326 } DW0;
327 union
328 {
329 //!< DWORD 1
330 struct
331 {
332 uint32_t Reserved32 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
333 uint32_t RegisterAddress : __CODEGEN_BITFIELD( 2, 22) ; //!< Register Address
334 uint32_t Reserved55 : __CODEGEN_BITFIELD(23, 31) ; //!< Reserved
335 };
336 uint32_t Value;
337 } DW1;
338 union
339 {
340 //!< DWORD 2..3
341 struct
342 {
343 uint64_t Reserved64 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
344 uint64_t MemoryAddress : __CODEGEN_BITFIELD( 2, 63) ; //!< Memory Address
345 };
346 uint32_t Value[2];
347 } DW2_3;
348
349 //! \name Local enumerations
350
351 enum MI_COMMAND_OPCODE
352 {
353 MI_COMMAND_OPCODE_MILOADREGISTERMEM = 41, //!< No additional details
354 };
355
356 enum COMMAND_TYPE
357 {
358 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
359 };
360
361 //! \name Initializations
362
363 //! \brief Explicit member initialization function
364 MI_LOAD_REGISTER_MEM_CMD();
365
366 static const size_t dwSize = 4;
367 static const size_t byteSize = 16;
368 };
369
370 //!
371 //! \brief MI_LOAD_REGISTER_REG
372 //! \details
373 //! The MI_LOAD_REGISTER_REG command reads from a source register location
374 //! and writes that value to a destination register location.
375 //! Any offset that is to a destination outside of the GT core will allow
376 //! the parser to continue once the cycle is at the GT boundry and not
377 //! destination.  Any other address will ensure the destination is updated
378 //! prior to parsing the next command
379 //!
380 //! The command temporarily halts commands that will cause cycles down the
381 //! 3D pipeline.
382 //!
383 //! Destination register with mask implemented (Ex: some
384 //! registers have bits [31:16] as mask bits and bits[15:0] as data) will
385 //! not get updated unless the value read from source register has the bits
386 //! corresponding to the mask bits set. Note that any mask implemented
387 //! register when read returns "0" for the bits corresponding to mask
388 //! location. When the source and destination are mask implemented
389 //! registers, destination register will not get updated with the source
390 //! register contents.
391 //!
392 //! This command is not allowed to update the privilege register range when
393 //! executed from a non-privilege batch buffer.
394 //!
395 //! MI_LOAD_REGISTER_REG must not be used to access registers outside GT
396 //! (MMIO >= 40000h) on BDW-A stepping.
397 //!
398 //! Writes to the range 0x9400-0x97FF must be either be avoided, or
399 //! serialized with a read (e.g. STORE_REGISTER_MEM) between them.
400 //!
401 struct MI_LOAD_REGISTER_REG_CMD
402 {
403 union
404 {
405 //!< DWORD 0
406 struct
407 {
408 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
409 uint32_t Reserved8 : __CODEGEN_BITFIELD( 8, 22) ; //!< Reserved
410 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
411 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
412 };
413 uint32_t Value;
414 } DW0;
415 union
416 {
417 //!< DWORD 1
418 struct
419 {
420 uint32_t Reserved32 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
421 uint32_t SourceRegisterAddress : __CODEGEN_BITFIELD( 2, 22) ; //!< Source Register Address
422 uint32_t Reserved55 : __CODEGEN_BITFIELD(23, 31) ; //!< Reserved
423 };
424 uint32_t Value;
425 } DW1;
426 union
427 {
428 //!< DWORD 2
429 struct
430 {
431 uint32_t Reserved64 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
432 uint32_t DestinationRegisterAddress : __CODEGEN_BITFIELD( 2, 22) ; //!< Destination Register Address
433 uint32_t Reserved87 : __CODEGEN_BITFIELD(23, 31) ; //!< Reserved
434 };
435 uint32_t Value;
436 } DW2;
437
438 //! \name Local enumerations
439
440 enum MI_COMMAND_OPCODE
441 {
442 MI_COMMAND_OPCODE_MILOADREGISTERREG = 42, //!< No additional details
443 };
444
445 enum COMMAND_TYPE
446 {
447 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
448 };
449
450 //! \name Initializations
451
452 //! \brief Explicit member initialization function
453 MI_LOAD_REGISTER_REG_CMD();
454
455 static const size_t dwSize = 3;
456 static const size_t byteSize = 12;
457 };
458
459 //!
460 //! \brief MI_STORE_REGISTER_MEM
461 //! \details
462 //! The MI_STORE_REGISTER_MEM command requests a register read from a
463 //! specified memory mapped register location in the device and store of
464 //! that DWord to memory. The register address is specified along with the
465 //! command to perform the read.
466 //!
467 //!
468 //! The command temporarily halts command execution.
469 //!
470 //! The memory address for the write is snooped on the host bus.
471 //!
472 //! This command should not be used from within a "non-privilege" batch
473 //! buffer to access global virtual space. doing so will be treated as
474 //! privilege access violation. Refer "User Mode Privilege Command" in
475 //! MI_BATCH_BUFFER_START command section to know HW behavior on
476 //! encountering privilege access violation. This command can be used within
477 //! ring buffers and/or "privilege" batch buffers to access global virtual
478 //! space.
479 //!
480 //! This command will cause undefined data to be written to memory if given
481 //! register addresses for the PGTBL_CTL_0 or FENCE registers.
482 //!
483 //!
484 //!
485 //! MI_STORE_REGISTER_MEM must not be used to access registers outside GT
486 //! (MMIO >= 40000h) on BDW-A stepping.
487 //!
488 //! Source: BlitterCS, VideoCS, VideoEnhancementCS
489 //! The source MMIO offset must be limited to any MMIO that is not
490 //! replicated due to multiple slice configurations.  If slice zero is
491 //! disabled, then any MMIO read from this command streamer to a register
492 //! replicated in the slice will cause a return value of zero.
493 //!
494 struct MI_STORE_REGISTER_MEM_CMD
495 {
496 union
497 {
498 //!< DWORD 0
499 struct
500 {
501 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
502 uint32_t Reserved8 : __CODEGEN_BITFIELD( 8, 21) ; //!< Reserved
503 uint32_t UseGlobalGtt : __CODEGEN_BITFIELD(22, 22) ; //!< Use Global GTT
504 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
505 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
506 };
507 uint32_t Value;
508 } DW0;
509 union
510 {
511 //!< DWORD 1
512 struct
513 {
514 uint32_t Reserved32 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
515 uint32_t RegisterAddress : __CODEGEN_BITFIELD( 2, 22) ; //!< Register Address
516 uint32_t Reserved55 : __CODEGEN_BITFIELD(23, 31) ; //!< Reserved
517 };
518 uint32_t Value;
519 } DW1;
520 union
521 {
522 //!< DWORD 2..3
523 struct
524 {
525 uint64_t Reserved64 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
526 uint64_t MemoryAddress : __CODEGEN_BITFIELD( 2, 63) ; //!< Memory Address
527 };
528 uint32_t Value[2];
529 } DW2_3;
530
531 //! \name Local enumerations
532
533 enum MI_COMMAND_OPCODE
534 {
535 MI_COMMAND_OPCODE_MISTOREREGISTERMEM = 36, //!< No additional details
536 };
537
538 enum COMMAND_TYPE
539 {
540 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
541 };
542
543 //! \name Initializations
544
545 //! \brief Explicit member initialization function
546 MI_STORE_REGISTER_MEM_CMD();
547
548 static const size_t dwSize = 4;
549 static const size_t byteSize = 16;
550 };
551
552 //!
553 //! \brief MI_BATCH_BUFFER_START
554 //! \details
555 //! The MI_BATCH_BUFFER_START command is used to initiate the execution of
556 //! commands stored in a batch buffer. For restrictions on the location of
557 //! batch buffers, see Batch Buffers in the Device Programming Interface
558 //! chapter of MI Functions.The batch buffer can be specified as secure or
559 //! non-secure, determining the operations considered valid when initiated
560 //! from within the buffer and any attached (chained) batch buffers. See
561 //! Batch Buffer Protection in the Device Programming Interface chapter of
562 //! MI Functions.
563 //!
564 struct MI_BATCH_BUFFER_START_CMD
565 {
566 union
567 {
568 //!< DWORD 0
569 struct
570 {
571 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
572 uint32_t AddressSpaceIndicator : __CODEGEN_BITFIELD( 8, 8) ; //!< ADDRESS_SPACE_INDICATOR
573 uint32_t Reserved9 : __CODEGEN_BITFIELD( 9, 21) ; //!< Reserved
574 uint32_t SecondLevelBatchBuffer : __CODEGEN_BITFIELD(22, 22) ; //!< _2ND_LEVEL_BATCH_BUFFER
575 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
576 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
577 };
578 uint32_t Value;
579 } DW0;
580 union
581 {
582 //!< DWORD 1
583 struct
584 {
585 uint32_t Reserved32 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
586 uint32_t BatchBufferStartAddress : __CODEGEN_BITFIELD( 2, 31) ; //!< Batch Buffer Start Address
587 };
588 uint32_t Value;
589 } DW1;
590 union
591 {
592 //!< DWORD 2
593 struct
594 {
595 uint32_t BatchBufferStartAddressHigh : __CODEGEN_BITFIELD( 0, 15) ; //!< Batch Buffer Start Address High
596 uint32_t Reserved80 : __CODEGEN_BITFIELD(16, 31) ; //!< Reserved
597 };
598 uint32_t Value;
599 } DW2;
600
601 //! \name Local enumerations
602
603 //! \brief ADDRESS_SPACE_INDICATOR
604 //! \details
605 //! <p>Batch buffers accessed via PPGTT are considered as non-privileged.
606 //! Certain operations
607 //! (e.g., MI_STORE_DATA_IMM commands to GGTT memory) are prohibited
608 //! within non-privileged
609 //! buffers. More details mentioned in User Mode Privileged command
610 //! section. When
611 //! MI_BATCH_BUFFER_START command is executed from within a batch
612 //! buffer (i.e., is a "chained"
613 //! or "second level" batch buffer command), the current active batch
614 //! buffer's "Address Space
615 //! Indicator" and this field determine the "Address Space Indicator"
616 //! of the next buffer in the chain.</p>
617 //! <ul>
618 //! <li>Chained or Second level batch buffer can be in GGTT or PPGTT
619 //! if the parent batch buffer is in GGTT.</li>
620 //! <li>Chained or Second level batch buffer can only be in PPGTT if
621 //! the parent batch buffer is in PPGTT. This is enforced by Hardware.</li>
622 //! </ul>
623 enum ADDRESS_SPACE_INDICATOR
624 {
625 ADDRESS_SPACE_INDICATOR_GGTT = 0, //!< This batch buffer is located in GGTT memory and is privileged.
626 ADDRESS_SPACE_INDICATOR_PPGTT = 1, //!< This batch buffer is located in PPGTT memory and is Non-Privileged.
627 };
628
629 //! \brief _2ND_LEVEL_BATCH_BUFFER
630 //! \details
631 //! The command streamer contains 3 storage elements; 1 for the ring head
632 //! address, 1 for the batch head address, and 1 for the 2nd level batch
633 //! head address. When performing batch buffer chaining, hardware simply
634 //! updates the head pointer of the 1st level batch address storage. There
635 //! is no stack in hardware. When this bit is set, hardware uses the 2nd
636 //! level batch head address storage element. Upon MI_BATCH_BUFFER_END, it
637 //! will automatically return to the 1st (traditional) level batch buffer
638 //! address. this allows hardware to mimic a simple 3 level stack.
639 enum _2ND_LEVEL_BATCH_BUFFER
640 {
641 _2ND_LEVEL_BATCH_BUFFER_1STLEVELBATCH = 0, //!< Place the batch buffer address in the 1st (traditional) level batch address storage element
642 _2ND_LEVEL_BATCH_BUFFER_2NDLEVELBATCH = 1, //!< Place the batch buffer address in the 2nd level batch address storage element
643 };
644
645 enum MI_COMMAND_OPCODE
646 {
647 MI_COMMAND_OPCODE_MIBATCHBUFFERSTART = 49, //!< No additional details
648 };
649
650 enum COMMAND_TYPE
651 {
652 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
653 };
654
655 //! \name Initializations
656
657 //! \brief Explicit member initialization function
658 MI_BATCH_BUFFER_START_CMD();
659
660 static const size_t dwSize = 3;
661 static const size_t byteSize = 12;
662 };
663
664 //!
665 //! \brief MI_SET_PREDICATE
666 //! \details
667 //! This command sets the Predication Check for the subsequent commands in
668 //! the command buffer except for MI_SET_PREDICATE itself. Render Command
669 //! Streamer NOOPs the following commands based on the PREDICATE_ENABLE from
670 //! MI_SET_PREDICATE, MI_SET_PREDICATE_RESULT and MI_SET_PREDICATE_RESULT_2
671 //! status. Resource Streamer doesn't take any action of parsing
672 //! MI_SET_PREDICATE, this command is similar to any other command which is
673 //! not meant for resource streamer.
674 //!
675 //! Executing MI_SET_PREDICATE command sets PREDICATE_ENABLE bits in MI_MODE
676 //! register, MI_MODE register gets render context save restored.
677 //!
678 //! MI_SET_PREDICATE predication scope must be confined within a Batch
679 //! Buffer to set of commands.
680 //! MI_SET_PREDICATE with Predicate Enable Must always have a
681 //! corresponding MI_SET_PREDICATE with Predicate Disable within the same
682 //! Batch Buffer.
683 //! MI_ARB_CHK command must be programmed outside the Predication Scope of
684 //! MI_SET_PREDICATE.
685 //! MI_SET_PREDICATE Predication Scope must not involve any RC6 triggering
686 //! events.
687 //!
688 //!
689 //! Only the following command(s) can be programmed between the
690 //! MI_SET_PREDICATE command enabled for predication: 3DSTATE_URB_VS
691 //! 3DSTATE_URB_HS 3DSTATE_URB_DS 3DSTATE_URB_GS
692 //! 3DSTATE_PUSH_CONSTANT_ALLOC_VS 3DSTATE_PUSH_CONSTANT_ALLOC_HS
693 //! 3DSTATE_PUSH_CONSTANT_ALLOC_DS 3DSTATE_PUSH_CONSTANT_ALLOC_GS
694 //! 3DSTATE_PUSH_CONSTANT_ALLOC_PS MI_LOAD_REGISTER_IMM MEDIA_VFE_STATE
695 //! MEDIA_OBJECT MEDIA_OBJJECT_WALKER MEDIA_INTERFACE_DESCRIPTOR_LOAD
696 //! 3DSTATE_WM_HZ_OP
697 //!
698 struct MI_SET_PREDICATE_CMD
699 {
700 union
701 {
702 //!< DWORD 0
703 struct
704 {
705 uint32_t PredicateEnable : __CODEGEN_BITFIELD( 0, 3) ; //!< PREDICATE_ENABLE
706 uint32_t Reserved4 : __CODEGEN_BITFIELD( 4, 22) ; //!< Reserved
707 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
708 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
709 };
710 uint32_t Value;
711 } DW0;
712
713 //! \name Local enumerations
714
715 //! \brief PREDICATE_ENABLE
716 //! \details
717 //! This field sets the predication logic in render command streamer when
718 //! parsed. Predicate Disable is the default mode of operation.
719 enum PREDICATE_ENABLE
720 {
721 PREDICATE_ENABLE_NOOPNEVER = 0, //!< Predication is Disabled and RCS will process commands as usual.
722 PREDICATE_ENABLE_NOOPONRESULT2CLEAR = 1, //!< Following Commands will be NOOPED by RCS only if the MI_PREDICATE_RESULT_2 is clear.
723 PREDICATE_ENABLE_NOOPONRESULT2SET = 2, //!< Following Commands will be NOOPED by RCS only if the MI_PREDICATE_RESULT_2 is set.
724 PREDICATE_ENABLE_NOOPONRESULTCLEAR = 3, //!< Following Commands will be NOOPED by RCS only if the MI_PREDICATE_RESULT is clear.
725 PREDICATE_ENABLE_NOOPONRESULTSET = 4, //!< Following Commands will be NOOPED by RCS only if the MI_PREDICATE_RESULT is set.
726 PREDICATE_ENABLE_EXECUTEWHENONESLICEENABLED = 5, //!< Following Commands will be Executed by RCS only when one slice is enabled.
727 PREDICATE_ENABLE_EXECUTEWHENTWOSLICESAREENABLED = 6, //!< Following Commands will be Executed by RCS only when two slices are enabled.
728 PREDICATE_ENABLE_EXECUTEWHENTHREESLICESAREENABLED = 7, //!< Following Commands will be Executed by RCS only when all the three slices are enabled.
729 PREDICATE_ENABLE_NOOPALWAYS = 15, //!< Following Commands will be NOOPED by RCS unconditionally.
730 };
731
732 enum MI_COMMAND_OPCODE
733 {
734 MI_COMMAND_OPCODE_MISETPREDICATE = 1, //!< No additional details
735 };
736
737 enum COMMAND_TYPE
738 {
739 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
740 };
741
742 //! \name Initializations
743
744 //! \brief Explicit member initialization function
745 MI_SET_PREDICATE_CMD();
746
747 static const size_t dwSize = 1;
748 static const size_t byteSize = 4;
749 };
750
751 //!
752 //! \brief MI_COPY_MEM_MEM
753 //! \details
754 //! The MI_COPY_MEM_MEM command reads a DWord from memory and stores the
755 //! value of that DWord to back to memory. The source and destination
756 //! addresses are specified in the command. The command temporarily halts
757 //! command execution.
758 //!
759 //! This command should not be used within a "non-privileged" batch buffer
760 //! to access global virtual space; doing so will be treated as privilege
761 //! access violation. Refer to the "User Mode Privilege Command" in
762 //! MI_BATCH_BUFFER_START command section to learn more about HW behavior on
763 //! encountering a privilege access violation.
764 //!
765 //! This command can be used within ring buffers and/or privilege batch
766 //! buffers to access global virtual space.
767 //!
768 //! This command can cause a hang when run concurrently with a submission of
769 //! an execution list of the same ID and Force Restore is not set in the
770 //! Context Descriptor Format. A sequence of MI_LOAD_REG_MEM and
771 //! MI_STORE_REG_MEM with temporary GPR registers must be used in place of
772 //! this command or all submissions would require Force Restore enabled.
773 //!
774 struct MI_COPY_MEM_MEM_CMD
775 {
776 union
777 {
778 //!< DWORD 0
779 struct
780 {
781 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
782 uint32_t Reserved8 : __CODEGEN_BITFIELD( 8, 20) ; //!< Reserved
783 uint32_t UseGlobalGttDestination : __CODEGEN_BITFIELD(21, 21) ; //!< USE_GLOBAL_GTT_DESTINATION
784 uint32_t UseGlobalGttSource : __CODEGEN_BITFIELD(22, 22) ; //!< USE_GLOBAL_GTT_SOURCE
785 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
786 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
787 };
788 uint32_t Value;
789 } DW0;
790 union
791 {
792 //!< DWORD 1..2
793 struct
794 {
795 uint64_t Reserved32 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
796 uint64_t DestinationMemoryAddress : __CODEGEN_BITFIELD( 2, 63) ; //!< Destination Memory Address
797 };
798 uint32_t Value[2];
799 } DW1_2;
800 union
801 {
802 //!< DWORD 3..4
803 struct
804 {
805 uint64_t Reserved96 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
806 uint64_t SourceMemoryAddress : __CODEGEN_BITFIELD( 2, 63) ; //!< Source Memory Address
807 };
808 uint32_t Value[2];
809 } DW3_4;
810
811 //! \name Local enumerations
812
813 //! \brief USE_GLOBAL_GTT_DESTINATION
814 //! \details
815 //! It is allowed for this bit to be set when executing this command from a
816 //! privileged (secure) batch buffer or ring buffer. This bit must be clear
817 //! when programmed from within a non-privileged batch buffer. This bit must
818 //! be 1 if the Per Process GTT Enable bit is clear.
819 enum USE_GLOBAL_GTT_DESTINATION
820 {
821 USE_GLOBAL_GTT_DESTINATION_PERPROCESSGRAPHICSADDRESS = 0, //!< No additional details
822 USE_GLOBAL_GTT_DESTINATION_GLOBALGRAPHICSADDRESS = 1, //!< This command will use the global GTT to translate the Address and this command must be executing from a privileged (secure) batch buffer.
823 };
824
825 //! \brief USE_GLOBAL_GTT_SOURCE
826 //! \details
827 //! It is allowed for this bit to be set when executing this command from a
828 //! privileged (secure) batch buffer or ring buffer. This bit must be clear
829 //! when programmed from within a non-privileged batch buffer. This bit must
830 //! be 1 if the Per Process GTT Enable bit is clear.
831 enum USE_GLOBAL_GTT_SOURCE
832 {
833 USE_GLOBAL_GTT_SOURCE_PERPROCESSGRAPHICSADDRESS = 0, //!< No additional details
834 USE_GLOBAL_GTT_SOURCE_GLOBALGRAPHICSADDRESS = 1, //!< This command will use the global GTT to translate the Address and this command must be executing from a privileged (secure) batch buffer.
835 };
836
837 enum MI_COMMAND_OPCODE
838 {
839 MI_COMMAND_OPCODE_MIMEMTOMEM = 46, //!< No additional details
840 };
841
842 enum COMMAND_TYPE
843 {
844 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
845 };
846
847 //! \name Initializations
848
849 //! \brief Explicit member initialization function
850 MI_COPY_MEM_MEM_CMD();
851
852 static const size_t dwSize = 5;
853 static const size_t byteSize = 20;
854 };
855
856 //!
857 //! \brief MI_STORE_DATA_IMM
858 //! \details
859 //! The MI_STORE_DATA_IMM command requests a write of the QWord or DWord
860 //! constant supplied in the packet to the specified Memory Address. This
861 //! command also supports writing to consecutive dword or qword memory
862 //! locations form the starting address. As the write targets a System
863 //! Memory Address, the write operation is coherent with the CPU cache
864 //! (i.e., the processor cache is snooped).
865 //!
866 //! This command can be used for general software synchronization through
867 //! variables in cacheable memory (i.e., where software does not need to
868 //! poll un-cached memory or device registers).
869 //!
870 //! This command simply initiates the write operation with command execution
871 //! proceeding normally. Although the write operation is guaranteed to
872 //! complete "eventually", there is no mechanism to synchronize command
873 //! execution with the completion (or even initiation) of these operations.
874 //!
875 //! This command should not be used within a non_privilege batch buffer to
876 //! access global virtual space, doing so will be treated as privilege
877 //! access violation. Refer "User Mode Privilege Command" in
878 //! MI_BATCH_BUFFER_START command section to know HW behavior on
879 //! encountering privilege access violation.
880 //!
881 struct MI_STORE_DATA_IMM_CMD
882 {
883 union
884 {
885 //!< DWORD 0
886 struct
887 {
888 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 9) ; //!< DWORD_LENGTH
889 uint32_t Reserved10 : __CODEGEN_BITFIELD(10, 20) ; //!< Reserved
890 uint32_t StoreQword : __CODEGEN_BITFIELD(21, 21) ; //!< STORE_QWORD
891 uint32_t UseGlobalGtt : __CODEGEN_BITFIELD(22, 22) ; //!< Use Global GTT
892 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
893 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
894 };
895 uint32_t Value;
896 } DW0;
897 union
898 {
899 //!< DWORD 1..2
900 struct
901 {
902 uint64_t Reserved32 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
903 uint64_t DestinationAddress : __CODEGEN_BITFIELD( 2, 63) ; //!< Destination Address
904 };
905 uint32_t Value[2];
906 } DW1_2;
907 union
908 {
909 //!< DWORD 3
910 struct
911 {
912 uint32_t DataDword0 ; //!< Data DWord 0
913 };
914 uint32_t Value;
915 } DW3;
916 union
917 {
918 //!< DWORD 4
919 struct
920 {
921 uint32_t DataDword1 ; //!< Data DWord 1
922 };
923 uint32_t Value;
924 } DW4;
925
926 //! \name Local enumerations
927
928 enum STORE_QWORD
929 {
930 STORE_QWORD_STOREDWORD = 0, //!< If set, this command generates dword writes to memory. Number of dwords generated depends upon the number of 'Data Dword' programmed in the command. If 'x' number of data dwords are programmed in the command it results in 'x' dword writes to memory.
931 STORE_QWORD_STOREQWORD = 1, //!< If set, this command generates Qword writes to memory, two 'Data Dword' are paired to form a Qword. Number of qwords generated depends upon the number of 'Data Dword' programmed in the command. If 'x' number of data dwords are programmed in the command it results in 'x/2' qword writes to memory.
932 };
933
934 enum MI_COMMAND_OPCODE
935 {
936 MI_COMMAND_OPCODE_MISTOREDATAIMM = 32, //!< No additional details
937 };
938
939 enum COMMAND_TYPE
940 {
941 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
942 };
943
944 //! \name Initializations
945
946 //! \brief Explicit member initialization function
947 MI_STORE_DATA_IMM_CMD();
948
949 static const size_t dwSize = 5;
950 static const size_t byteSize = 20;
951 };
952
953 //!
954 //! \brief MI_SEMAPHORE_SIGNAL
955 //! \details
956 //! This command is used to signal the target engine stating the memory
957 //! semaphore update occurrence to one of its contexts with Target Context
958 //! ID. MI_SEMPHORE_SIGNAL and MI_SEMAPHORE_WAIT together replace the
959 //! MI_SEMAPHORE_MBOX command on BDW. MI_ATOMIC (non-posted) command will be
960 //! programmed prior to this command to update the semaphore data in memory.
961 //!
962 //! MI_SEMAPHORE_SIGNAL and MI_SEMAPHORE_WAIT command in signal mode must
963 //! not be enabled. However limited validation can be done for Semaphore
964 //! wait in signal mode with soft reset flows, FLR and idle power saving
965 //! features disabled.
966 //!
967 //! [VideoCS2] Semaphore signal to render command stream from the second
968 //! video command streamer must be replaced with an MI_LOAD_REGISTER_IMM
969 //! with the address of 0x343c with the data value the same as the Target
970 //! Context ID.
971 //!
972 //! [All Command Streamers]: When a semaphore signal is received by a target
973 //! command streamer while context switch is in progress due to semaphore
974 //! wait unsuccessful in signal mode, and the received semaphore signal is
975 //! for the context getting switched out, Command Streamer might not forward
976 //! the semaphore signal to GUC. As a result GUC might see a context with a
977 //! switch reason as Semaphore Wait, for which it may never receive any
978 //! semaphore signal; hence GUC might not schedule the same context forever.
979 //! Since this issue is only applicable when MI_SEMAPHORE_WAIT is used in
980 //! signal mode, SW has to WA this issue by doing one of the below:
981 //!
982 //! SW WA:
983 //!
984 //! 1. Scheduler on encountering a Context Waiting for semaphore signal to
985 //! occur for a long time can assume above scenario could have occurred and
986 //! do one of the below:
987 //!
988 //! a. Evaluate the semaphore wait condition based on the contexts PPHWSP
989 //! semaphore wait details and re-schedule it, if the semaphore wait
990 //! condition is satisfied.
991 //! b. Schedule the context to HW and let HW evaluate the condition and take
992 //! appropriate action.
993 //!
994 //! OR
995 //!
996 //!
997 //! 2. Scheduler not to use MI_SEMAPHORE_WAIT in signal mode.
998 //!
999 //!
1000 //! Option 1 is preferred so that limited validation can be done for
1001 //! MI_SEMAPHORE_WAIT in signal mode on stepping's on which this issue is
1002 //! not fixed.
1003 //!
1004 //! Example describing the scenarios causing issue:
1005 //! RCS is executing Context-A.
1006 //! RCS has parsed MI_SEMAPHORE_WAIT in signal mode and has made memory
1007 //! request to fetch the semaphore data.
1008 //! BCS in the meantime update semaphore memory location for Context-A.
1009 //! BCS generates Semaphore Signal with Context ID as Context-A to RCS.
1010 //! RCS receives semaphore signal from BCS for Context-A.
1011 //! RCS receives the memory data and semaphore wait is un-successful (RCS
1012 //! must have sampled memory before BCS has updated the memory) resulting in
1013 //! context switch due to Wait on Semaphore.
1014 //! RCS ignores the semaphore signal received from BCS and also doesn't
1015 //! forward it to GUC.
1016 //! RCS switches out context-A with Wait on Semaphore as context switch
1017 //! reason.
1018 //! GUC process the context switch reason for Context-A, waits for semaphore
1019 //! signal for context-A to reschedule it which it will never receive as RCS
1020 //! has dropped it.
1021 //!
1022 //! [All Command Streamers]: When SW intends to use semaphore signaling
1023 //! between Command streamers, it must avoid lite restores in HW by
1024 //! programming "Force Restore" bit to ‘1’ in context descriptor during
1025 //! context submission, this is required to avoid known HW issue.
1026 //!
1027 struct MI_SEMAPHORE_SIGNAL_CMD
1028 {
1029 union
1030 {
1031 //!< DWORD 0
1032 struct
1033 {
1034 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
1035 uint32_t Reserved8 : __CODEGEN_BITFIELD( 8, 14) ; //!< Reserved
1036 uint32_t TargetEngineSelect : __CODEGEN_BITFIELD(15, 17) ; //!< TARGET_ENGINE_SELECT
1037 uint32_t Reserved18 : __CODEGEN_BITFIELD(18, 22) ; //!< Reserved
1038 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
1039 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
1040 };
1041 uint32_t Value;
1042 } DW0;
1043 union
1044 {
1045 //!< DWORD 1
1046 struct
1047 {
1048 uint32_t TargetContextId ; //!< Target Context ID
1049 };
1050 uint32_t Value;
1051 } DW1;
1052
1053 //! \name Local enumerations
1054
1055 //! \brief TARGET_ENGINE_SELECT
1056 //! \details
1057 //! This field selects the target engine to which SIGNAL will be send to.
1058 enum TARGET_ENGINE_SELECT
1059 {
1060 TARGET_ENGINE_SELECT_RCS = 0, //!< No additional details
1061 TARGET_ENGINE_SELECT_VCS0 = 1, //!< No additional details
1062 TARGET_ENGINE_SELECT_BCS = 2, //!< No additional details
1063 TARGET_ENGINE_SELECT_VECS = 3, //!< No additional details
1064 TARGET_ENGINE_SELECT_VCS1 = 4, //!< No additional details
1065 };
1066
1067 enum MI_COMMAND_OPCODE
1068 {
1069 MI_COMMAND_OPCODE_MISEMAPHORESIGNAL = 27, //!< No additional details
1070 };
1071
1072 enum COMMAND_TYPE
1073 {
1074 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
1075 };
1076
1077 //! \name Initializations
1078
1079 //! \brief Explicit member initialization function
1080 MI_SEMAPHORE_SIGNAL_CMD();
1081
1082 static const size_t dwSize = 2;
1083 static const size_t byteSize = 8;
1084 };
1085
1086 //!
1087 //! \brief MI_SEMAPHORE_WAIT
1088 //! \details
1089 //! This command supports memory based Semaphore WAIT. Memory based
1090 //! semaphores will be used for synchronization between the Producer and the
1091 //! Consumer contexts. Producer and Consumer Contexts could be running on
1092 //! different engines or on the same engine inside GT. Running on the same
1093 //! engine is only possible when execlists are enabled. Producer Context
1094 //! implements a Signal and Consumer context implements a Wait.
1095 //! Command Streamer on parsing this command fetches data from the Semaphore
1096 //! Address mentioned in this command and compares it with the inline
1097 //! Semaphore Data Dword.
1098 //!
1099 //! If comparison passes, the command streamer moves to the next command.
1100 //!
1101 //! When execlists are enabled, if comparison fails Command streamer
1102 //! switches out the context. Context switch can be inhibited by setting
1103 //! "Inhibit Synchronous Context Switch" in CTXT_SR_CTL register.
1104 //!
1105 //! In ring buffer mode of scheduling or Execlist with "Inhibit Synchronous
1106 //! context Switch", if comparison fails, Command Streamer evaluates the
1107 //! Compare Operation based on the Wait Mode until the compare operation is
1108 //! true or Wait is canceled by SW.
1109 //!
1110 //! Exec-List Scheduling: CS generates semaphore wait interrupt to the
1111 //! scheduler when MI_SEMAPHORE_WAIT command is un-successful and when
1112 //! "Inhibit Synchronous Context Switch" is set. Scheduler can use this
1113 //! interrupt to preempt the context waiting on semaphore wait.
1114 //!
1115 //! Ring Buffer Scheduling: CS generates semaphore wait interrupt to the
1116 //! scheduler when MI_SEMAPHORE_WAIT command is un-successful. This is for
1117 //! debug mode
1118 //!
1119 //!
1120 //!
1121 //! MI_SEMPHORE_SIGNAL and MI_SEMAPHORE_WAIT together replace the
1122 //! MI_SEMAPHORE_MBOX command on DevBDW.
1123 //!
1124 //! [All Command Streamers]:When a semaphore signal is received by a target
1125 //! command streamer while context switch is in progress due to semaphore
1126 //! wait unsuccessful in signal mode, and the received semaphore signal is
1127 //! for the context getting switched out, Command Streamer might not forward
1128 //! the semaphore signal to GUC. As a result GUC might see a context with a
1129 //! switch reason as Semaphore Wait, for which it may never receive any
1130 //! semaphore signal; hence GUC might not schedule the same context forever.
1131 //! Since this issue is only applicable when MI_SEMAPHORE_WAIT is used in
1132 //! signal mode, SW has to WA this issue by doing one of the below: SW Work
1133 //! Around:
1134 //!
1135 //!
1136 //! Scheduler on encountering a Context Waiting for semaphore signal to
1137 //! occur for a long time can assume above scenario could have occurred and
1138 //! do one of the below:
1139 //!
1140 //! <li type="a">Evaluate the semaphore wait condition based on the contexts
1141 //! PPHWSP semaphore wait details and re-schedule it, if the semaphore wait
1142 //! condition is satisfied. b. Schedule the context to HW and let HW
1143 //! evaluate the condition and take appropriate action. OR
1144 //!
1145 //!
1146 //! 2. Scheduler not to use MI_SEMAPHORE_WAIT in signal mode.
1147 //!
1148 //!
1149 //! Option 1 is preferred so that limited validation can be done for
1150 //! MI_SEMAPHORE_WAIT in signal mode on stepping's on which this issue is
1151 //! not fixed. Example describing the scenarios causing issue: RCS is
1152 //! executing Context-A. RCS has parsed MI_SEMAPHORE_WAIT in signal mode and
1153 //! has made memory request to fetch the semaphore data. BCS in the meantime
1154 //! update semaphore memory location for Context-A. BCS generates Semaphore
1155 //! Signal with Context ID as Context-A to RCS. RCS receives semaphore
1156 //! signal from BCS for Context-A. RCS receives the memory data and
1157 //! semaphore wait is un-successful (RCS must have sampled memory before BCS
1158 //! has updated the memory) resulting in context switch due to Wait on
1159 //! Semaphore. RCS ignores the semaphore signal received from BCS and also
1160 //! doesn't forward it to GUC. RCS switches out context-A with Wait on
1161 //! Semaphore as context switch reason. GUC process the context switch
1162 //! reason for Context-A, waits for semaphore signal for context-A to
1163 //! reschedule it which it will never receive as RCS has dropped it.
1164 //!
1165 //! [BlitterCS, VideoCS, VideoEnhancementCS, VideoCS2: Command Streamers
1166 //! Only]: Inhibit Synchronous Context Switch in CTXT_SR_CTL (Bit 3 of
1167 //! register 0x22244 for BCS, 0x12244 for VCS, 0x1A244 for VECS, 0x1C244 for
1168 //! VCS2) register must be set when in Ring mode scheduling.
1169 //!
1170 //! [BlitterCS, VideoCS, VideoEnhancementCS, VideoCS2: Command Streamers
1171 //! Only]: IDLE sequence disable in PSMI_CTRL (Bit 0 of register 0x22050 for
1172 //! BCS, 0x12050 for VCS, 0x1A050 for VECS, 0x1C050 for VCS2) register must
1173 //! be set when in Ring mode scheduling and prior to this command with
1174 //! signal mode in the field Wait Mode is enabled. The IDLE sequence must be
1175 //! re-enabled after the MI_SEMAPHORE_WAIT to allow the engine to go IDLE.
1176 //!
1177 //! [Ring Buffer Mode Of scheduling] [BlitterCS, VideoCS,
1178 //! VideoEnhancementCS, VideoCS2: Command Streamers Only]: HW loses Page
1179 //! Directory (PPGTT) information on becoming IDLE. SW must always program
1180 //! the PD information following MI_SEMAPHORE_WAIT command. This will ensure
1181 //! Page Directory information gets reprogrammed after exiting IDLE flow
1182 //! triggered on MI_SEMAPHORE_WAIT command. Alternatively SW can disable
1183 //! IDLE flows on MI_SEMAPHORE_WAIT by setting "Semaphore Wait Event IDLE
1184 //! Message Disable" bit in "BCS_ECOSKPD" register.
1185 //!
1186 struct MI_SEMAPHORE_WAIT_CMD
1187 {
1188 union
1189 {
1190 //!< DWORD 0
1191 struct
1192 {
1193 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
1194 uint32_t Reserved8 : __CODEGEN_BITFIELD( 8, 11) ; //!< Reserved
1195 uint32_t CompareOperation : __CODEGEN_BITFIELD(12, 14) ; //!< COMPARE_OPERATION
1196 uint32_t WaitMode : __CODEGEN_BITFIELD(15, 15) ; //!< WAIT_MODE
1197 uint32_t Reserved16 : __CODEGEN_BITFIELD(16, 21) ; //!< Reserved
1198 uint32_t MemoryType : __CODEGEN_BITFIELD(22, 22) ; //!< MEMORY_TYPE
1199 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
1200 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
1201 };
1202 uint32_t Value;
1203 } DW0;
1204 union
1205 {
1206 //!< DWORD 1
1207 struct
1208 {
1209 uint32_t SemaphoreDataDword ; //!< Semaphore Data Dword
1210 };
1211 uint32_t Value;
1212 } DW1;
1213 union
1214 {
1215 //!< DWORD 2..3
1216 struct
1217 {
1218 uint64_t Reserved64 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
1219 uint64_t SemaphoreAddress : __CODEGEN_BITFIELD( 2, 63) ; //!< Semaphore Address
1220 };
1221 uint32_t Value[2];
1222 } DW2_3;
1223
1224 //! \name Local enumerations
1225
1226 //! \brief COMPARE_OPERATION
1227 //! \details
1228 //! This field specifies the operation that will be executed to create the
1229 //! result that will either allow the context to continue or wait.
1230 enum COMPARE_OPERATION
1231 {
1232 COMPARE_OPERATION_SADGREATERTHANSDD = 0, //!< If Indirect fetched data is greater than inline data then continue.
1233 COMPARE_OPERATION_SADGREATERTHANOREQUALSDD = 1, //!< If Indirect fetched data is greater than or equal to inline data then continue.
1234 COMPARE_OPERATION_SADLESSTHANSDD = 2, //!< If Indirect fetched data is less than inline data then continue.
1235 COMPARE_OPERATION_SADLESSTHANOREQUALSDD = 3, //!< If Indirect fetched data is less than or equal to inline data then continue.
1236 COMPARE_OPERATION_SADEQUALSDD = 4, //!< If Indirect fetched data is equalto inline data then continue.
1237 COMPARE_OPERATION_SADNOTEQUALSDD = 5, //!< If Indirect fetched data is not equal to inline data then continue.
1238 };
1239
1240 //! \brief WAIT_MODE
1241 //! \details
1242 //! This bit specifies the WAIT behavior when the semaphore comparison fails
1243 //! and before the context is switched out.
1244 enum WAIT_MODE
1245 {
1246 WAIT_MODE_SIGNALMODE = 0, //!< In this mode HW will reacquire the semaphore data from memory on receiving SIGNAL with the same Context ID. In ring buffer mode of scheduling Context ID associated with SIGNAL is ignored and always treated as a match.
1247 WAIT_MODE_POLLINGMODE = 1, //!< In this mode HW periodically reads the semaphore data from memory for comparison until it is context switched out. Periodicity will be mentioned in a SEMA_WAIT_POLL register.
1248 };
1249
1250 //! \brief MEMORY_TYPE
1251 //! \details
1252 //! This bit will be ignored and treated as if clear when executing from a
1253 //! non-privileged batch buffer. It is allowed for this bit to be clear when
1254 //! executing this command from a privileged (secure) batch buffer. This bit
1255 //! <i>must</i> be 1 if the <b>Per Process GTT Enable</b> bit is clear.
1256 enum MEMORY_TYPE
1257 {
1258 MEMORY_TYPE_PERPROCESSGRAPHICSADDRESS = 0, //!< No additional details
1259 MEMORY_TYPE_GLOBALGRAPHICSADDRESS = 1, //!< This command will use the global GTT to translate the Address and this command must beexecuting from a privileged (secure) batch buffer.
1260 };
1261
1262 enum MI_COMMAND_OPCODE
1263 {
1264 MI_COMMAND_OPCODE_MISEMAPHOREWAIT = 28, //!< No additional details
1265 };
1266
1267 enum COMMAND_TYPE
1268 {
1269 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
1270 };
1271
1272 //! \name Initializations
1273
1274 //! \brief Explicit member initialization function
1275 MI_SEMAPHORE_WAIT_CMD();
1276
1277 static const size_t dwSize = 4;
1278 static const size_t byteSize = 16;
1279 };
1280
1281 //!
1282 //! \brief MI_CONDITIONAL_BATCH_BUFFER_END
1283 //! \details
1284 //! The MI_CONDITIONAL_BATCH_BUFFER_END command is used to conditionally
1285 //! terminate the execution of commands stored in a batch buffer initiated
1286 //! using a MI_BATCH_BUFFER_START command. Termination of second level batch
1287 //! buffer due to this command will also terminate the parent/first level
1288 //! batch buffer.
1289 //!
1290 //! This command is only valid with a 1st level batch buffer (bit 22 in
1291 //! MI_BATCH_BUFFER_START is set to 0).
1292 //!
1293 struct MI_CONDITIONAL_BATCH_BUFFER_END_CMD
1294 {
1295 union
1296 {
1297 //!< DWORD 0
1298 struct
1299 {
1300 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
1301 uint32_t Reserved8 : __CODEGEN_BITFIELD( 8, 20) ; //!< Reserved
1302 uint32_t CompareSemaphore : __CODEGEN_BITFIELD(21, 21) ; //!< COMPARE_SEMAPHORE
1303 uint32_t UseGlobalGtt : __CODEGEN_BITFIELD(22, 22) ; //!< USE_GLOBAL_GTT
1304 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
1305 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
1306 };
1307 uint32_t Value;
1308 } DW0;
1309 union
1310 {
1311 //!< DWORD 1
1312 struct
1313 {
1314 uint32_t CompareDataDword ; //!< Compare Data Dword
1315 };
1316 uint32_t Value;
1317 } DW1;
1318 union
1319 {
1320 //!< DWORD 2
1321 struct
1322 {
1323 uint32_t Reserved64 : __CODEGEN_BITFIELD( 0, 2) ; //!< Reserved
1324 uint32_t CompareAddress : __CODEGEN_BITFIELD( 3, 31) ; //!< Compare Address
1325 };
1326 uint32_t Value;
1327 } DW2;
1328 union
1329 {
1330 //!< DWORD 3
1331 struct
1332 {
1333 uint32_t CompareAddressHigh : __CODEGEN_BITFIELD( 0, 15) ; //!< Compare Address High
1334 uint32_t Reserved112 : __CODEGEN_BITFIELD(16, 31) ; //!< Reserved
1335 };
1336 uint32_t Value;
1337 } DW3;
1338
1339 //! \name Local enumerations
1340
1341 //! \brief COMPARE_SEMAPHORE
1342 //! \details
1343 //! If set, the value from the Compare Data Dword is compared to the value
1344 //! from the Compare Address in memory. If the value at Compare Address is
1345 //! greater than the Compare Data Dword, execution of current command buffer
1346 //! should continue.If clear, no comparison takes place.
1347 enum COMPARE_SEMAPHORE
1348 {
1349 COMPARE_SEMAPHORE_DEFAULTVAUEDESC = 0, //!< No additional details
1350 };
1351
1352 //! \brief USE_GLOBAL_GTT
1353 //! \details
1354 //! If set, this command will use the global GTT to translate the Compare
1355 //! Address and this command must be executing from a privileged (secure)
1356 //! batch buffer. If clear, the PPGTT will be used to translate the Compare
1357 //! Address.
1358 enum USE_GLOBAL_GTT
1359 {
1360 USE_GLOBAL_GTT_DEFAULTVAUEDESC = 0, //!< No additional details
1361 };
1362
1363 enum MI_COMMAND_OPCODE
1364 {
1365 MI_COMMAND_OPCODE_MICONDITIONALBATCHBUFFEREND = 54, //!< No additional details
1366 };
1367
1368 enum COMMAND_TYPE
1369 {
1370 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
1371 };
1372
1373 //! \name Initializations
1374
1375 //! \brief Explicit member initialization function
1376 MI_CONDITIONAL_BATCH_BUFFER_END_CMD();
1377
1378 static const size_t dwSize = 4;
1379 static const size_t byteSize = 16;
1380 };
1381
1382 //!
1383 //! \brief MI_ATOMIC
1384 //! \details
1385 //! MI_ATOMIC is used to carry atomic operation on data in graphics memory.
1386 //! Atomic operations are supported on data granularity of 4B, 8B and 16B.
1387 //! The atomic operation leads to a read-modify-write operation on the data
1388 //! in graphics memory with the option of returning value. The data in
1389 //! graphics memory is modified by doing arithmetic and logical operation
1390 //! with the inline/indirect data provided with the MI_ATOMIC command.
1391 //! Inline/Indirect provided in the command can be one or two operands based
1392 //! on the atomic operation. Ex: Atomic-Compare operation needs two operands
1393 //! while Atomic-Add operation needs single operand and Atomic-increment
1394 //! requires no operand. Refer "Atomics" sub-section under "L3 Cache and
1395 //! URB" section for detailed atomic operations supported. Atomic operations
1396 //! can be enabled to return value by setting "Return Data Control" field in
1397 //! the command, return data is stored to CS_GPR registers.
1398 //! CS_GPR4/5 registers are updated with memory Return Data based on the
1399 //! "Data Size". Each GPR register is qword in size and occupies two MMIO
1400 //! registers.
1401 //! Note: Any references to CS_GPR registers in the command should be
1402 //! understood as the CS_GPR registers belonging to the corresponding
1403 //! engines *CS_GPR registers.
1404 //!
1405 //!
1406 //! Indirect Source Operands:
1407 //!
1408 //! Operand1 is sourced from [CS_GPR1, CS_GPR0]
1409 //!
1410 //! Operand2 is sourced from [CS_GPR3, CS_GPR2]
1411 //!
1412 //! Read return Data is stored in [CS_GPR_5, CS_GPR4]
1413 //!
1414 //! When "Data Size" is QWORD or DWORD only CS_GPR4 (Qword) is updated with
1415 //! the qword data returned from memory. When the data size is OCTWORD
1416 //! CS_GPR4/5 are updated with the OCTWORD data returned from memory.
1417 //! CS_GPR4 is loaded with lower qword returned from memory and CS_GPR5 is
1418 //! loaded with upper qword returned from memory.
1419 //!
1420 //! When Inline Data mode is not set, Dwords 3..10 must not be included as
1421 //! part of the command. Dword Length field in the header must be programmed
1422 //! accordingly.
1423 //! When Inline Data Mode is set, Dwords3..10 must be included based on the
1424 //! Data Size field of the header. Both Operand-1 and Operand-2 dwords must
1425 //! be programmed based on the Data Size field. Operand-2 must be programmed
1426 //! to 0x0 if the atomic operation doesn't require it. Dword Length field in
1427 //! the header must be programmed accordingly.
1428 //!
1429 //!
1430 //!
1431 struct MI_ATOMIC_CMD
1432 {
1433 union
1434 {
1435 //!< DWORD 0
1436 struct
1437 {
1438 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
1439 uint32_t AtomicOpcode : __CODEGEN_BITFIELD( 8, 15) ; //!< ATOMIC OPCODE
1440 uint32_t ReturnDataControl : __CODEGEN_BITFIELD(16, 16) ; //!< Return Data Control
1441 uint32_t CsStall : __CODEGEN_BITFIELD(17, 17) ; //!< CS STALL
1442 uint32_t InlineData : __CODEGEN_BITFIELD(18, 18) ; //!< Inline Data
1443 uint32_t DataSize : __CODEGEN_BITFIELD(19, 20) ; //!< DATA_SIZE
1444 uint32_t Reserved21 : __CODEGEN_BITFIELD(21, 21) ; //!< Reserved
1445 uint32_t MemoryType : __CODEGEN_BITFIELD(22, 22) ; //!< MEMORY_TYPE
1446 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
1447 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
1448 };
1449 uint32_t Value;
1450 } DW0;
1451 union
1452 {
1453 //!< DWORD 1
1454 struct
1455 {
1456 uint32_t Reserved32 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
1457 uint32_t MemoryAddress : __CODEGEN_BITFIELD( 2, 31) ; //!< Memory Address
1458 };
1459 uint32_t Value;
1460 } DW1;
1461 union
1462 {
1463 //!< DWORD 2
1464 struct
1465 {
1466 uint32_t MemoryAddressHigh : __CODEGEN_BITFIELD( 0, 15) ; //!< Memory Address High
1467 uint32_t Reserved80 : __CODEGEN_BITFIELD(16, 31) ; //!< Reserved
1468 };
1469 uint32_t Value;
1470 } DW2;
1471 union
1472 {
1473 //!< DWORD 3
1474 struct
1475 {
1476 uint32_t Operand1DataDword0 ; //!< Operand1 Data Dword 0
1477 };
1478 uint32_t Value;
1479 } DW3;
1480 union
1481 {
1482 //!< DWORD 4
1483 struct
1484 {
1485 uint32_t Operand2DataDword0 ; //!< Operand2 Data Dword 0
1486 };
1487 uint32_t Value;
1488 } DW4;
1489 union
1490 {
1491 //!< DWORD 5
1492 struct
1493 {
1494 uint32_t Operand1DataDword1 ; //!< Operand1 Data Dword 1
1495 };
1496 uint32_t Value;
1497 } DW5;
1498 union
1499 {
1500 //!< DWORD 6
1501 struct
1502 {
1503 uint32_t Operand2DataDword1 ; //!< Operand2 Data Dword 1
1504 };
1505 uint32_t Value;
1506 } DW6;
1507 union
1508 {
1509 //!< DWORD 7
1510 struct
1511 {
1512 uint32_t Operand1DataDword2 ; //!< Operand1 Data Dword 2
1513 };
1514 uint32_t Value;
1515 } DW7;
1516 union
1517 {
1518 //!< DWORD 8
1519 struct
1520 {
1521 uint32_t Operand2DataDword2 ; //!< Operand2 Data Dword 2
1522 };
1523 uint32_t Value;
1524 } DW8;
1525 union
1526 {
1527 //!< DWORD 9
1528 struct
1529 {
1530 uint32_t Operand1DataDword3 ; //!< Operand1 Data Dword 3
1531 };
1532 uint32_t Value;
1533 } DW9;
1534 union
1535 {
1536 //!< DWORD 10
1537 struct
1538 {
1539 uint32_t Operand2DataDword3 ; //!< Operand2 Data Dword 3
1540 };
1541 uint32_t Value;
1542 } DW10;
1543
1544 //! \name Local enumerations
1545
1546 //! \brief DATA_SIZE
1547 //! \details
1548 //! This field indicates the size of the operand in dword/qword/octword on
1549 //! which atomic operation will be performed. Data size must match with the
1550 //! Atomic Opcode. Operation Data size could be 4B, 8B or 16B
1551 enum DATA_SIZE
1552 {
1553 DATA_SIZE_DWORD = 0, //!< Operand size used by Atomic Operation is DWORD.
1554 DATA_SIZE_QWORD = 1, //!< Operand Size used by Atomic Operation is QWORD.
1555 DATA_SIZE_OCTWORD = 2, //!< Operand Size used by Atomic Operation is OCTWORD.
1556 };
1557
1558 //! \brief MEMORY_TYPE
1559 //! \details
1560 //! This bit will be ignored and treated as if clear when executing from a
1561 //! non-privileged batch buffer. It is allowed for this bit to be clear when
1562 //! executing this command from a privileged (secure) batch buffer. This bit
1563 //! must be 1 if the <b>Per Process GTT Enable</b> bit is clear.
1564 enum MEMORY_TYPE
1565 {
1566 MEMORY_TYPE_PERPROCESSGRAPHICSADDRESS = 0, //!< No additional details
1567 MEMORY_TYPE_GLOBALGRAPHICSADDRESS = 1, //!< This command will use the global GTT to translate the Address and this command must be executing from a privileged (secure) batch buffer.
1568 };
1569
1570 enum MI_COMMAND_OPCODE
1571 {
1572 MI_COMMAND_OPCODE_MIATOMIC = 47, //!< No additional details
1573 };
1574
1575 enum COMMAND_TYPE
1576 {
1577 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
1578 };
1579
1580 //! \name Initializations
1581
1582 //! \brief Explicit member initialization function
1583 MI_ATOMIC_CMD();
1584
1585 static const size_t dwSize = 11;
1586 static const size_t byteSize = 44;
1587 };
1588
1589 //!
1590 //! \brief MI_MATH
1591 //! \details
1592 //! The MI_MATH command allows software to send instructions to the ALU in
1593 //! the Command Streamer. This command is the means by which the ALU is
1594 //! accessed. ALU instructions form the data payload of the MI_MATH command.
1595 //! An ALU instruction takes one DWord in size. The MI_MATH DWord Length is
1596 //! programmed based on the number of ALU instructions included, limited
1597 //! only by the max DWord Length supported. When the command streamer parses
1598 //! an MI_MATH command, it sends the included ALU instructions to the ALU.
1599 //! The ALU processes any instruction in a single clock. See the ALU section
1600 //! for more details.
1601 //!
1602 struct MI_MATH_CMD
1603 {
1604 union
1605 {
1606 //!< DWORD 0
1607 struct
1608 {
1609 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
1610 uint32_t Reserved8 : __CODEGEN_BITFIELD( 8, 22) ; //!< Reserved
1611 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
1612 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
1613 };
1614 uint32_t Value;
1615 } DW0;
1616
1617 //! \name Local enumerations
1618
1619 enum MI_COMMAND_OPCODE
1620 {
1621 MI_COMMAND_OPCODE_MIMATH = 26, //!< No additional details
1622 };
1623
1624 enum COMMAND_TYPE
1625 {
1626 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
1627 };
1628
1629 //! \name Initializations
1630
1631 //! \brief Explicit member initialization function
1632 MI_MATH_CMD();
1633
1634 static const size_t dwSize = 1;
1635 static const size_t byteSize = 4;
1636 };
1637
1638 //!
1639 //! \brief MI_FLUSH_DW
1640 //! \details
1641 //! The MI_FLUSH_DW command is used to perform an internal "flush"
1642 //! operation. The parser pauses on an internal flush until all drawing
1643 //! engines have completed any pending operations. In addition, this command
1644 //! can also be used to:Flush any dirty data to memory. Invalidate the TLB
1645 //! cache inside the hardware Usage note: After this command is completed
1646 //! with a Store DWord enabled, CPU access to graphics memory will be
1647 //! coherent (assuming the Render Cache flush is not inhibited).
1648 //!
1649 struct MI_FLUSH_DW_CMD
1650 {
1651 union
1652 {
1653 //!< DWORD 0
1654 struct
1655 {
1656 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 5) ; //!< DWORD_LENGTH
1657 uint32_t Reserved6 : __CODEGEN_BITFIELD( 6, 6) ; //!< Content Protection App ID
1658 uint32_t VideoPipelineCacheInvalidate : __CODEGEN_BITFIELD( 7, 7) ; //!< Video Pipeline Cache invalidate
1659 uint32_t NotifyEnable : __CODEGEN_BITFIELD( 8, 8) ; //!< Notify Enable
1660 uint32_t Reserved9 : __CODEGEN_BITFIELD( 9, 13) ; //!< Reserved
1661 uint32_t PostSyncOperation : __CODEGEN_BITFIELD(14, 15) ; //!< POST_SYNC_OPERATION
1662 uint32_t Reserved16 : __CODEGEN_BITFIELD(16, 17) ; //!< Reserved
1663 uint32_t TlbInvalidate : __CODEGEN_BITFIELD(18, 18) ; //!< TLB Invalidate
1664 uint32_t Reserved19 : __CODEGEN_BITFIELD(19, 20) ; //!< Reserved
1665 uint32_t StoreDataIndex : __CODEGEN_BITFIELD(21, 21) ; //!< Store Data Index
1666 uint32_t Reserved22 : __CODEGEN_BITFIELD(22, 22) ; //!< Reserved
1667 uint32_t MiCommandOpcode : __CODEGEN_BITFIELD(23, 28) ; //!< MI_COMMAND_OPCODE
1668 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
1669 };
1670 uint32_t Value;
1671 } DW0;
1672 union
1673 {
1674 //!< DWORD 1..2
1675 struct
1676 {
1677 uint64_t Reserved32 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
1678 uint64_t DestinationAddressType : __CODEGEN_BITFIELD( 2, 2) ; //!< DESTINATION_ADDRESS_TYPE
1679 uint64_t Address : __CODEGEN_BITFIELD( 3, 47) ; //!< Address
1680 uint64_t Reserved80 : __CODEGEN_BITFIELD(48, 63) ; //!< Reserved
1681 };
1682 uint32_t Value[2];
1683 } DW1_2;
1684 union
1685 {
1686 //!< DWORD 3..4
1687 struct
1688 {
1689 uint64_t ImmediateData ; //!< Immediate Data
1690 };
1691 uint32_t Value[2];
1692 } DW3_4;
1693
1694 //! \name Local enumerations
1695
1696 //! \brief POST_SYNC_OPERATION
1697 //! \details
1698 //! BitFieldDesc
1699 enum POST_SYNC_OPERATION
1700 {
1701 POST_SYNC_OPERATION_NOWRITE = 0, //!< No write occurs as a result of this instruction. This can be used to implement a "trap" operation, etc.
1702 POST_SYNC_OPERATION_WRITEIMMEDIATEDATA = 1, //!< HW implicitly detects the Data size to be Qword or Dword to be written to memory based on the command dword length programmed . When Dword Length indicates Qword, Writes the QWord containing Immediate Data Low, High DWs to the Destination Address . When Dword Length indicates Dword, Writes the DWord containing Immediate Data Low to the Destination Address
1703 POST_SYNC_OPERATION_UNNAMED3 = 3, //!< Write the TIMESTAMP register to the Destination Address. The upper 28 bits of the TIMESTAMP register are tied to '0'.
1704 };
1705
1706 enum MI_COMMAND_OPCODE
1707 {
1708 MI_COMMAND_OPCODE_MIFLUSHDW = 38, //!< No additional details
1709 };
1710
1711 enum COMMAND_TYPE
1712 {
1713 COMMAND_TYPE_MICOMMAND = 0, //!< No additional details
1714 };
1715
1716 //! \brief DESTINATION_ADDRESS_TYPE
1717 //! \details
1718 //! Defines address space of Destination Address
1719 enum DESTINATION_ADDRESS_TYPE
1720 {
1721 DESTINATION_ADDRESS_TYPE_PPGTT = 0, //!< Use PPGTT address space for DW write
1722 DESTINATION_ADDRESS_TYPE_GGTT = 1, //!< Use GGTT address space for DW write
1723 };
1724
1725 //! \name Initializations
1726
1727 //! \brief Explicit member initialization function
1728 MI_FLUSH_DW_CMD();
1729
1730 static const size_t dwSize = 5;
1731 static const size_t byteSize = 20;
1732 };
1733
1734 //!
1735 //! \brief PIPE_CONTROL
1736 //! \details
1737 //! The PIPE_CONTROL command is used to effect the synchronization described
1738 //! above.
1739 //!
1740 struct PIPE_CONTROL_CMD
1741 {
1742 union
1743 {
1744 //!< DWORD 0
1745 struct
1746 {
1747 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 7) ; //!< DWORD_LENGTH
1748 uint32_t Reserved8 : __CODEGEN_BITFIELD( 8, 15) ; //!< Reserved
1749 uint32_t Command3DSubOpcode : __CODEGEN_BITFIELD(16, 23) ; //!< _3D_COMMAND_SUB_OPCODE
1750 uint32_t Command3DOpcode : __CODEGEN_BITFIELD(24, 26) ; //!< _3D_COMMAND_OPCODE
1751 uint32_t CommandSubtype : __CODEGEN_BITFIELD(27, 28) ; //!< COMMAND_SUBTYPE
1752 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
1753 };
1754 uint32_t Value;
1755 } DW0;
1756 union
1757 {
1758 //!< DWORD 1
1759 struct
1760 {
1761 uint32_t DepthCacheFlushEnable : __CODEGEN_BITFIELD( 0, 0) ; //!< DEPTH_CACHE_FLUSH_ENABLE
1762 uint32_t StallAtPixelScoreboard : __CODEGEN_BITFIELD( 1, 1) ; //!< STALL_AT_PIXEL_SCOREBOARD
1763 uint32_t StateCacheInvalidationEnable : __CODEGEN_BITFIELD( 2, 2) ; //!< State Cache Invalidation Enable
1764 uint32_t ConstantCacheInvalidationEnable : __CODEGEN_BITFIELD( 3, 3) ; //!< Constant Cache Invalidation Enable
1765 uint32_t VfCacheInvalidationEnable : __CODEGEN_BITFIELD( 4, 4) ; //!< VF Cache Invalidation Enable
1766 uint32_t DcFlushEnable : __CODEGEN_BITFIELD( 5, 5) ; //!< DC Flush Enable
1767 uint32_t Reserved38 : __CODEGEN_BITFIELD( 6, 6) ; //!< Reserved
1768 uint32_t PipeControlFlushEnable : __CODEGEN_BITFIELD( 7, 7) ; //!< Pipe Control Flush Enable
1769 uint32_t NotifyEnable : __CODEGEN_BITFIELD( 8, 8) ; //!< Notify Enable
1770 uint32_t IndirectStatePointersDisable : __CODEGEN_BITFIELD( 9, 9) ; //!< Indirect State Pointers Disable
1771 uint32_t TextureCacheInvalidationEnable : __CODEGEN_BITFIELD(10, 10) ; //!< Texture Cache Invalidation Enable
1772 uint32_t InstructionCacheInvalidateEnable : __CODEGEN_BITFIELD(11, 11) ; //!< Instruction Cache Invalidate Enable
1773 uint32_t RenderTargetCacheFlushEnable : __CODEGEN_BITFIELD(12, 12) ; //!< RENDER_TARGET_CACHE_FLUSH_ENABLE
1774 uint32_t DepthStallEnable : __CODEGEN_BITFIELD(13, 13) ; //!< DEPTH_STALL_ENABLE
1775 uint32_t PostSyncOperation : __CODEGEN_BITFIELD(14, 15) ; //!< POST_SYNC_OPERATION
1776 uint32_t GenericMediaStateClear : __CODEGEN_BITFIELD(16, 16) ; //!< Generic Media State Clear
1777 uint32_t Reserved49 : __CODEGEN_BITFIELD(17, 17) ; //!< Reserved
1778 uint32_t TlbInvalidate : __CODEGEN_BITFIELD(18, 18) ; //!< TLB Invalidate
1779 uint32_t GlobalSnapshotCountReset : __CODEGEN_BITFIELD(19, 19) ; //!< GLOBAL_SNAPSHOT_COUNT_RESET
1780 uint32_t CommandStreamerStallEnable : __CODEGEN_BITFIELD(20, 20) ; //!< Command Streamer Stall Enable
1781 uint32_t StoreDataIndex : __CODEGEN_BITFIELD(21, 21) ; //!< Store Data Index
1782 uint32_t Reserved54 : __CODEGEN_BITFIELD(22, 22) ; //!< Reserved
1783 uint32_t LriPostSyncOperation : __CODEGEN_BITFIELD(23, 23) ; //!< LRI_POST_SYNC_OPERATION
1784 uint32_t DestinationAddressType : __CODEGEN_BITFIELD(24, 24) ; //!< DESTINATION_ADDRESS_TYPE
1785 uint32_t Reserved57 : __CODEGEN_BITFIELD(25, 31) ; //!< Reserved
1786 };
1787 uint32_t Value;
1788 } DW1;
1789 union
1790 {
1791 //!< DWORD 2
1792 struct
1793 {
1794 uint32_t Reserved64 : __CODEGEN_BITFIELD( 0, 1) ; //!< Reserved
1795 uint32_t Address : __CODEGEN_BITFIELD( 2, 31) ; //!< Address
1796 };
1797 uint32_t Value;
1798 } DW2;
1799 union
1800 {
1801 //!< DWORD 3
1802 struct
1803 {
1804 uint32_t AddressHigh ; //!< Address High
1805 };
1806 uint32_t Value;
1807 } DW3;
1808 union
1809 {
1810 //!< DWORD 4..5
1811 struct
1812 {
1813 uint64_t ImmediateData ; //!< Immediate Data
1814 };
1815 uint32_t Value[2];
1816 } DW4_5;
1817
1818 //! \name Local enumerations
1819
1820 enum _3D_COMMAND_SUB_OPCODE
1821 {
1822 _3D_COMMAND_SUB_OPCODE_PIPECONTROL = 0, //!< No additional details
1823 };
1824
1825 enum _3D_COMMAND_OPCODE
1826 {
1827 _3D_COMMAND_OPCODE_PIPECONTROL = 2, //!< No additional details
1828 };
1829
1830 enum COMMAND_SUBTYPE
1831 {
1832 COMMAND_SUBTYPE_GFXPIPE3D = 3, //!< No additional details
1833 };
1834
1835 enum COMMAND_TYPE
1836 {
1837 COMMAND_TYPE_GFXPIPE = 3, //!< No additional details
1838 };
1839
1840 //! \brief DEPTH_CACHE_FLUSH_ENABLE
1841 //! \details
1842 //! Setting this bit enables flushing (i.e. writing back the dirty lines to
1843 //! memory and invalidating the tags) of depth related caches. This bit
1844 //! applies to HiZ cache, Stencil cache and depth cache.
1845 enum DEPTH_CACHE_FLUSH_ENABLE
1846 {
1847 DEPTH_CACHE_FLUSH_ENABLE_FLUSHDISABLED = 0, //!< Depth relates caches (HiZ, Stencil and Depth) are NOT flushed.
1848 DEPTH_CACHE_FLUSH_ENABLE_FLUSHENABLED = 1, //!< Depth relates caches (HiZ, Stencil and Depth) are flushed.
1849 };
1850
1851 //! \brief STALL_AT_PIXEL_SCOREBOARD
1852 //! \details
1853 //! Defines the behavior of PIPE_CONTROL command at the pixel scoreboard.
1854 enum STALL_AT_PIXEL_SCOREBOARD
1855 {
1856 STALL_AT_PIXEL_SCOREBOARD_DISABLE = 0, //!< Stall at the pixel scoreboard is disabled.
1857 STALL_AT_PIXEL_SCOREBOARD_ENABLE = 1, //!< Stall at the pixel scoreboard is enabled.
1858 };
1859
1860 //! \brief RENDER_TARGET_CACHE_FLUSH_ENABLE
1861 //! \details
1862 //! <p>Setting this bit will force Render Cache to be flushed to memory
1863 //! prior to this synchronization point completing. This bit must be set for
1864 //! all write fence sync operations to assure that results from operations
1865 //! initiated prior to this command are visible in memory once software
1866 //! observes this synchronization.</p>
1867 enum RENDER_TARGET_CACHE_FLUSH_ENABLE
1868 {
1869 RENDER_TARGET_CACHE_FLUSH_ENABLE_DISABLEFLUSH = 0, //!< Render Target Cache is NOT flushed.
1870 RENDER_TARGET_CACHE_FLUSH_ENABLE_ENABLEFLUSH = 1, //!< Render Target Cache is flushed.
1871 };
1872
1873 //! \brief DEPTH_STALL_ENABLE
1874 //! \details
1875 //! <p>This bit must be set when obtaining a "visible pixel" count to
1876 //! preclude the possible inclusion in the PS_DEPTH_COUNT value written to
1877 //! memory of some fraction of pixels from objects initiated after the
1878 //! PIPE_CONTROL command.</p>
1879 enum DEPTH_STALL_ENABLE
1880 {
1881 DEPTH_STALL_ENABLE_DISABLE = 0, //!< 3D pipeline will not stall subsequent primitives at the Depth Test stage.
1882 DEPTH_STALL_ENABLE_ENABLE = 1, //!< 3D pipeline will stall any subsequent primitives at the Depth Test stage until the Sync and Post-Sync operations complete.
1883 };
1884
1885 //! \brief POST_SYNC_OPERATION
1886 //! \details
1887 //! This field specifies an optional action to be taken upon completion of
1888 //! the synchronization operation.
1889 enum POST_SYNC_OPERATION
1890 {
1891 POST_SYNC_OPERATION_NOWRITE = 0, //!< No write occurs as a result of this instruction. This can be used to implement a "trap" operation, etc.
1892 POST_SYNC_OPERATION_WRITEIMMEDIATEDATA = 1, //!< Write the QWord containing Immediate Data Low, High DWs to the Destination Address
1893 POST_SYNC_OPERATION_WRITEPSDEPTHCOUNT = 2, //!< Write the 64-bit PS_DEPTH_COUNT register to the Destination Address
1894 POST_SYNC_OPERATION_WRITETIMESTAMP = 3, //!< Write the 64-bit TIMESTAMP register(i.e. "Reported Timestamp Count" 0x2358 for render pipe) to the Destination Address.
1895 };
1896
1897 //! \brief GLOBAL_SNAPSHOT_COUNT_RESET
1898 //! \details
1899 //! <p>This debug mode bit must not be exercised on any product.</p>
1900 enum GLOBAL_SNAPSHOT_COUNT_RESET
1901 {
1902 GLOBAL_SNAPSHOT_COUNT_RESET_DONTRESET = 0, //!< Do not reset the snapshot counts or Statistics Counters.
1903 GLOBAL_SNAPSHOT_COUNT_RESET_RESET = 1, //!< Reset the snapshot count in Gen4 for all the units and reset the Statistics Counters except as noted above.
1904 };
1905
1906 //! \brief LRI_POST_SYNC_OPERATION
1907 //! \details
1908 //! This bit caues a post sync operation with an LRI (Load Register
1909 //! Immediate) operation. If this bit is set then the Post-Sync Operation
1910 //! field must be cleared.
1911 enum LRI_POST_SYNC_OPERATION
1912 {
1913 LRI_POST_SYNC_OPERATION_NOLRIOPERATION = 0, //!< No LRI operation occurs as a result of this instruction. The Post-Sync Operation field is valid and may be used to specify an operation.
1914 LRI_POST_SYNC_OPERATION_MMIOWRITEIMMEDIATEDATA = 1, //!< Write the DWord contained in Immediate Data Low (DW3) to the MMIO offset specifed in the Address field.
1915 };
1916
1917 //! \brief DESTINATION_ADDRESS_TYPE
1918 //! \details
1919 //! Defines address space of Destination Address
1920 enum DESTINATION_ADDRESS_TYPE
1921 {
1922 DESTINATION_ADDRESS_TYPE_PPGTT = 0, //!< Use PPGTT address space for DW write
1923 DESTINATION_ADDRESS_TYPE_GGTT = 1, //!< Use GGTT address space for DW write
1924 };
1925
1926 //! \name Initializations
1927
1928 //! \brief Explicit member initialization function
1929 PIPE_CONTROL_CMD();
1930
1931 static const size_t dwSize = 6;
1932 static const size_t byteSize = 24;
1933 };
1934
1935 //!
1936 //! \brief MFX_WAIT
1937 //! \details
1938 //! This command can be considered the same as an MI_NOOP except that the
1939 //! command parser will not parse the next command until the following
1940 //! happens AVC or VC1 BSD mode: The command will stall the parser until
1941 //! completion of the BSD object
1942 //! IT, encoder, and MPEG2 BSD mode: The command will stall the parser
1943 //! until the object package is sent down the pipelineThis command should be
1944 //! used to ensure the preemption enable window occurs during the time the
1945 //! object command is being executed down the pipeline.
1946 //!
1947 //!
1948 struct MFX_WAIT_CMD
1949 {
1950 union
1951 {
1952 //!< DWORD 0
1953 struct
1954 {
1955 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 5) ; //!< DWORD_LENGTH
1956 uint32_t Reserved6 : __CODEGEN_BITFIELD( 6, 7) ; //!< Reserved
1957 uint32_t MfxSyncControlFlag : __CODEGEN_BITFIELD( 8, 8) ; //!< MFX Sync Control Flag
1958 uint32_t Reserved9 : __CODEGEN_BITFIELD( 9, 15) ; //!< Reserved
1959 uint32_t SubOpcode : __CODEGEN_BITFIELD(16, 26) ; //!< SUB_OPCODE
1960 uint32_t CommandSubtype : __CODEGEN_BITFIELD(27, 28) ; //!< COMMAND_SUBTYPE
1961 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
1962 };
1963 uint32_t Value;
1964 } DW0;
1965
1966 //! \name Local enumerations
1967
1968 enum SUB_OPCODE
1969 {
1970 SUB_OPCODE_MFXWAIT = 0, //!< No additional details
1971 };
1972
1973 enum COMMAND_SUBTYPE
1974 {
1975 COMMAND_SUBTYPE_MFXSINGLEDW = 1, //!< No additional details
1976 };
1977
1978 enum COMMAND_TYPE
1979 {
1980 COMMAND_TYPE_PARALLELVIDEOPIPE = 3, //!< No additional details
1981 };
1982
1983 //! \name Initializations
1984
1985 //! \brief Explicit member initialization function
1986 MFX_WAIT_CMD();
1987
1988 static const size_t dwSize = 1;
1989 static const size_t byteSize = 4;
1990 };
1991
1992 //!
1993 //! \brief MEDIA_STATE_FLUSH
1994 //! \details
1995 //! This command updates the Message Gateway state. In particular, it
1996 //! updates the state for a selected Interface Descriptor.
1997 //!
1998 //! This command can be considered same as a MI_Flush except that only media
1999 //! parser will get flushed instead of the entire 3D/media render pipeline.
2000 //! The command should be programmed prior to new Media state, curbe and/or
2001 //! interface descriptor commands when switching to a new context or
2002 //! programming new state for the same context. With this command, pipelined
2003 //! state change is allowed for the media pipe.
2004 //!
2005 //! Be cautious when using this command when child_present flag in the media
2006 //! state is enabled. This is because that CURBE state as well as Interface
2007 //! Descriptor state are shared between root threads and child threads.
2008 //! Changing these states while child threads are generated on the fly may
2009 //! cause unexpected behavior. Combining with MI_ARB_ON/OFF command, it is
2010 //! possible to support interruptability with the following command sequence
2011 //! where interrupt may be allowed only when MI_ARB_ON_OFF is ON:
2012 //!
2013 //! <pre>MEDIA_STATE_FLUSH
2014 //! VFE_STATE VFE will hold CS if watermark isn't met
2015 //! MI_ARB_OFF There must be at least one VFE command before this one
2016 //! MEDIA_OBJECT ... MI_ARB_ON</pre>
2017 //!
2018 struct MEDIA_STATE_FLUSH_CMD
2019 {
2020 union
2021 {
2022 //!< DWORD 0
2023 struct
2024 {
2025 uint32_t DwordLength : __CODEGEN_BITFIELD( 0, 15) ; //!< DWORD_LENGTH
2026 uint32_t Subopcode : __CODEGEN_BITFIELD(16, 23) ; //!< SUBOPCODE
2027 uint32_t MediaCommandOpcode : __CODEGEN_BITFIELD(24, 26) ; //!< MEDIA_COMMAND_OPCODE
2028 uint32_t Pipeline : __CODEGEN_BITFIELD(27, 28) ; //!< PIPELINE
2029 uint32_t CommandType : __CODEGEN_BITFIELD(29, 31) ; //!< COMMAND_TYPE
2030 };
2031 uint32_t Value;
2032 } DW0;
2033 union
2034 {
2035 //!< DWORD 1
2036 struct
2037 {
2038 uint32_t InterfaceDescriptorOffset : __CODEGEN_BITFIELD( 0, 5) ; //!< Interface Descriptor Offset
2039 uint32_t WatermarkRequired : __CODEGEN_BITFIELD( 6, 6) ; //!< Watermark Required
2040 uint32_t FlushToGo : __CODEGEN_BITFIELD( 7, 7) ; //!< Flush to GO
2041 uint32_t Reserved40 : __CODEGEN_BITFIELD( 8, 31) ; //!< Reserved
2042 };
2043 uint32_t Value;
2044 } DW1;
2045
2046 //! \name Local enumerations
2047
2048 enum SUBOPCODE
2049 {
2050 SUBOPCODE_MEDIASTATEFLUSHSUBOP = 4, //!< No additional details
2051 };
2052
2053 enum MEDIA_COMMAND_OPCODE
2054 {
2055 MEDIA_COMMAND_OPCODE_MEDIASTATEFLUSH = 0, //!< No additional details
2056 };
2057
2058 enum PIPELINE
2059 {
2060 PIPELINE_MEDIA = 2, //!< No additional details
2061 };
2062
2063 enum COMMAND_TYPE
2064 {
2065 COMMAND_TYPE_GFXPIPE = 3, //!< No additional details
2066 };
2067
2068 //! \name Initializations
2069
2070 //! \brief Explicit member initialization function
2071 MEDIA_STATE_FLUSH_CMD();
2072
2073 static const size_t dwSize = 2;
2074 static const size_t byteSize = 8;
2075 };
2076
2077 };
2078
2079 #pragma pack()
2080
2081 #endif // __MHW_MI_HWCMD_G8_X_H__