| 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 |
#include <vector> |
| 24 |
#include "cm_test.h" |
| 25 |
|
| 26 |
// The kernel names is "DoNothing" on all Gen platforms. |
| 27 |
static uint8_t BROADWELL_DONOTHING_ISA[] |
| 28 |
= {0x43, 0x49, 0x53, 0x41, 0x03, 0x06, 0x01, 0x00, 0x09, 0x44, 0x6f, 0x4e, 0x6f, |
| 29 |
0x74, 0x68, 0x69, 0x6e, 0x67, 0x30, 0x00, 0x00, 0x00, 0x67, 0x01, 0x00, 0x00, |
| 30 |
0x42, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x97, 0x01, 0x00, |
| 31 |
0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, |
| 32 |
0x44, 0x6f, 0x4e, 0x6f, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x00, 0x6e, 0x75, 0x6c, |
| 33 |
0x6c, 0x00, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x78, 0x00, 0x74, 0x68, |
| 34 |
0x72, 0x65, 0x61, 0x64, 0x5f, 0x79, 0x00, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, |
| 35 |
0x69, 0x64, 0x5f, 0x78, 0x00, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, |
| 36 |
0x5f, 0x79, 0x00, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x5f, 0x7a, |
| 37 |
0x00, 0x74, 0x73, 0x63, 0x00, 0x72, 0x30, 0x00, 0x61, 0x72, 0x67, 0x00, 0x72, |
| 38 |
0x65, 0x74, 0x76, 0x61, 0x6c, 0x00, 0x73, 0x70, 0x00, 0x66, 0x70, 0x00, 0x68, |
| 39 |
0x77, 0x5f, 0x69, 0x64, 0x00, 0x73, 0x72, 0x30, 0x00, 0x63, 0x72, 0x30, 0x00, |
| 40 |
0x63, 0x65, 0x30, 0x00, 0x64, 0x62, 0x67, 0x30, 0x00, 0x63, 0x6f, 0x6c, 0x6f, |
| 41 |
0x72, 0x00, 0x54, 0x30, 0x00, 0x54, 0x31, 0x00, 0x54, 0x32, 0x00, 0x54, 0x33, |
| 42 |
0x00, 0x54, 0x32, 0x35, 0x32, 0x00, 0x54, 0x32, 0x35, 0x35, 0x00, 0x53, 0x33, |
| 43 |
0x31, 0x00, 0x56, 0x33, 0x32, 0x00, 0x56, 0x33, 0x33, 0x00, 0x44, 0x6f, 0x4e, |
| 44 |
0x6f, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x5f, 0x42, 0x42, 0x5f, 0x30, 0x5f, 0x31, |
| 45 |
0x00, 0x41, 0x73, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x00, 0x4e, 0x6f, 0x42, 0x61, |
| 46 |
0x72, 0x72, 0x69, 0x65, 0x72, 0x00, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x00, |
| 47 |
0x64, 0x3a, 0x5c, 0x64, 0x6f, 0x6e, 0x6f, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x5f, |
| 48 |
0x67, 0x65, 0x6e, 0x78, 0x2e, 0x63, 0x70, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 49 |
0x02, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x21, 0x01, 0x00, 0x00, 0x00, |
| 50 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x27, 0x01, 0x00, |
| 51 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, |
| 52 |
0x00, 0x1c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, |
| 53 |
0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x00, 0x21, 0x00, |
| 54 |
0x00, 0x00, 0x24, 0x00, 0x04, 0x00, 0x11, 0x00, 0x00, 0x00, 0x56, 0x01, 0x00, |
| 55 |
0x00, 0x03, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x14, 0x64, 0x6f, 0x6e, 0x6f, 0x74, |
| 56 |
0x68, 0x69, 0x6e, 0x67, 0x5f, 0x67, 0x65, 0x6e, 0x78, 0x5f, 0x30, 0x2e, 0x61, |
| 57 |
0x73, 0x6d, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x01, 0x00, |
| 58 |
0x30, 0x00, 0x00, 0x51, 0x20, 0x00, 0x00, 0x00, 0x52, 0x03, 0x00, 0x00, 0x00, |
| 59 |
0x34, 0x00, 0x00, 0x00, 0x01, 0x4d, 0x00, 0x20, 0x07, 0x7f, 0x00, 0x00, 0x31, |
| 60 |
0x00, 0x00, 0x07, 0x00, 0x3a, 0x00, 0x20, 0xe0, 0x0f, 0x00, 0x06, 0x10, 0x00, |
| 61 |
0x00, 0x82}; |
| 62 |
|
| 63 |
static uint8_t SKYLAKE_DONOTHING_ISA[] |
| 64 |
= {0x43, 0x49, 0x53, 0x41, 0x03, 0x06, 0x01, 0x00, 0x09, 0x44, 0x6f, 0x4e, 0x6f, |
| 65 |
0x74, 0x68, 0x69, 0x6e, 0x67, 0x30, 0x00, 0x00, 0x00, 0x67, 0x01, 0x00, 0x00, |
| 66 |
0x42, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x05, 0x97, 0x01, 0x00, |
| 67 |
0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, |
| 68 |
0x44, 0x6f, 0x4e, 0x6f, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x00, 0x6e, 0x75, 0x6c, |
| 69 |
0x6c, 0x00, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x78, 0x00, 0x74, 0x68, |
| 70 |
0x72, 0x65, 0x61, 0x64, 0x5f, 0x79, 0x00, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, |
| 71 |
0x69, 0x64, 0x5f, 0x78, 0x00, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, |
| 72 |
0x5f, 0x79, 0x00, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x5f, 0x7a, |
| 73 |
0x00, 0x74, 0x73, 0x63, 0x00, 0x72, 0x30, 0x00, 0x61, 0x72, 0x67, 0x00, 0x72, |
| 74 |
0x65, 0x74, 0x76, 0x61, 0x6c, 0x00, 0x73, 0x70, 0x00, 0x66, 0x70, 0x00, 0x68, |
| 75 |
0x77, 0x5f, 0x69, 0x64, 0x00, 0x73, 0x72, 0x30, 0x00, 0x63, 0x72, 0x30, 0x00, |
| 76 |
0x63, 0x65, 0x30, 0x00, 0x64, 0x62, 0x67, 0x30, 0x00, 0x63, 0x6f, 0x6c, 0x6f, |
| 77 |
0x72, 0x00, 0x54, 0x30, 0x00, 0x54, 0x31, 0x00, 0x54, 0x32, 0x00, 0x54, 0x33, |
| 78 |
0x00, 0x54, 0x32, 0x35, 0x32, 0x00, 0x54, 0x32, 0x35, 0x35, 0x00, 0x53, 0x33, |
| 79 |
0x31, 0x00, 0x56, 0x33, 0x32, 0x00, 0x56, 0x33, 0x33, 0x00, 0x44, 0x6f, 0x4e, |
| 80 |
0x6f, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x5f, 0x42, 0x42, 0x5f, 0x30, 0x5f, 0x31, |
| 81 |
0x00, 0x41, 0x73, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x00, 0x4e, 0x6f, 0x42, 0x61, |
| 82 |
0x72, 0x72, 0x69, 0x65, 0x72, 0x00, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x00, |
| 83 |
0x64, 0x3a, 0x5c, 0x64, 0x6f, 0x6e, 0x6f, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x5f, |
| 84 |
0x67, 0x65, 0x6e, 0x78, 0x2e, 0x63, 0x70, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 85 |
0x02, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x21, 0x01, 0x00, 0x00, 0x00, |
| 86 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x27, 0x01, 0x00, |
| 87 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, |
| 88 |
0x00, 0x1c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, |
| 89 |
0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x00, 0x21, 0x00, |
| 90 |
0x00, 0x00, 0x24, 0x00, 0x04, 0x00, 0x11, 0x00, 0x00, 0x00, 0x56, 0x01, 0x00, |
| 91 |
0x00, 0x03, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x14, 0x64, 0x6f, 0x6e, 0x6f, 0x74, |
| 92 |
0x68, 0x69, 0x6e, 0x67, 0x5f, 0x67, 0x65, 0x6e, 0x78, 0x5f, 0x30, 0x2e, 0x61, |
| 93 |
0x73, 0x6d, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x01, 0x00, |
| 94 |
0x30, 0x00, 0x00, 0x51, 0x20, 0x00, 0x00, 0x00, 0x52, 0x03, 0x00, 0x00, 0x00, |
| 95 |
0x34, 0x00, 0x00, 0x00, 0x01, 0x4d, 0x00, 0x20, 0x07, 0x7f, 0x00, 0x00, 0x31, |
| 96 |
0x00, 0x00, 0x07, 0x00, 0x02, 0x00, 0x20, 0xe0, 0x0f, 0x00, 0x06, 0x10, 0x00, |
| 97 |
0x00, 0x82}; |
| 98 |
|
| 99 |
static uint8_t BROXTON_DONOTHING_ISA[] |
| 100 |
= {0x43, 0x49, 0x53, 0x41, 0x03, 0x06, 0x01, 0x00, 0x09, 0x44, 0x6f, 0x4e, 0x6f, |
| 101 |
0x74, 0x68, 0x69, 0x6e, 0x67, 0x30, 0x00, 0x00, 0x00, 0x67, 0x01, 0x00, 0x00, |
| 102 |
0x42, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0x97, 0x01, 0x00, |
| 103 |
0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, |
| 104 |
0x44, 0x6f, 0x4e, 0x6f, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x00, 0x6e, 0x75, 0x6c, |
| 105 |
0x6c, 0x00, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x78, 0x00, 0x74, 0x68, |
| 106 |
0x72, 0x65, 0x61, 0x64, 0x5f, 0x79, 0x00, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, |
| 107 |
0x69, 0x64, 0x5f, 0x78, 0x00, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, |
| 108 |
0x5f, 0x79, 0x00, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x5f, 0x7a, |
| 109 |
0x00, 0x74, 0x73, 0x63, 0x00, 0x72, 0x30, 0x00, 0x61, 0x72, 0x67, 0x00, 0x72, |
| 110 |
0x65, 0x74, 0x76, 0x61, 0x6c, 0x00, 0x73, 0x70, 0x00, 0x66, 0x70, 0x00, 0x68, |
| 111 |
0x77, 0x5f, 0x69, 0x64, 0x00, 0x73, 0x72, 0x30, 0x00, 0x63, 0x72, 0x30, 0x00, |
| 112 |
0x63, 0x65, 0x30, 0x00, 0x64, 0x62, 0x67, 0x30, 0x00, 0x63, 0x6f, 0x6c, 0x6f, |
| 113 |
0x72, 0x00, 0x54, 0x30, 0x00, 0x54, 0x31, 0x00, 0x54, 0x32, 0x00, 0x54, 0x33, |
| 114 |
0x00, 0x54, 0x32, 0x35, 0x32, 0x00, 0x54, 0x32, 0x35, 0x35, 0x00, 0x53, 0x33, |
| 115 |
0x31, 0x00, 0x56, 0x33, 0x32, 0x00, 0x56, 0x33, 0x33, 0x00, 0x44, 0x6f, 0x4e, |
| 116 |
0x6f, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x5f, 0x42, 0x42, 0x5f, 0x30, 0x5f, 0x31, |
| 117 |
0x00, 0x41, 0x73, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x00, 0x4e, 0x6f, 0x42, 0x61, |
| 118 |
0x72, 0x72, 0x69, 0x65, 0x72, 0x00, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x00, |
| 119 |
0x64, 0x3a, 0x5c, 0x64, 0x6f, 0x6e, 0x6f, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x5f, |
| 120 |
0x67, 0x65, 0x6e, 0x78, 0x2e, 0x63, 0x70, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 121 |
0x02, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x21, 0x01, 0x00, 0x00, 0x00, |
| 122 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x27, 0x01, 0x00, |
| 123 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, |
| 124 |
0x00, 0x1c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, |
| 125 |
0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x00, 0x21, 0x00, |
| 126 |
0x00, 0x00, 0x24, 0x00, 0x04, 0x00, 0x11, 0x00, 0x00, 0x00, 0x56, 0x01, 0x00, |
| 127 |
0x00, 0x03, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x14, 0x64, 0x6f, 0x6e, 0x6f, 0x74, |
| 128 |
0x68, 0x69, 0x6e, 0x67, 0x5f, 0x67, 0x65, 0x6e, 0x78, 0x5f, 0x30, 0x2e, 0x61, |
| 129 |
0x73, 0x6d, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x01, 0x00, |
| 130 |
0x30, 0x00, 0x00, 0x51, 0x20, 0x00, 0x00, 0x00, 0x52, 0x03, 0x00, 0x00, 0x00, |
| 131 |
0x34, 0x00, 0x00, 0x00, 0x01, 0x4d, 0x00, 0x20, 0x07, 0x7f, 0x00, 0x00, 0x31, |
| 132 |
0x00, 0x00, 0x07, 0x00, 0x02, 0x00, 0x20, 0xe0, 0x0f, 0x00, 0x06, 0x10, 0x00, |
| 133 |
0x00, 0x82}; |
| 134 |
|
| 135 |
static uint8_t CANNONLAKE_DONOTHING_ISA[] |
| 136 |
= {0x43, 0x49, 0x53, 0x41, 0x03, 0x06, 0x01, 0x00, 0x09, 0x44, 0x6f, 0x4e, 0x6f, |
| 137 |
0x74, 0x68, 0x69, 0x6e, 0x67, 0x30, 0x00, 0x00, 0x00, 0x67, 0x01, 0x00, 0x00, |
| 138 |
0x42, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x07, 0x97, 0x01, 0x00, |
| 139 |
0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, |
| 140 |
0x44, 0x6f, 0x4e, 0x6f, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x00, 0x6e, 0x75, 0x6c, |
| 141 |
0x6c, 0x00, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x78, 0x00, 0x74, 0x68, |
| 142 |
0x72, 0x65, 0x61, 0x64, 0x5f, 0x79, 0x00, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, |
| 143 |
0x69, 0x64, 0x5f, 0x78, 0x00, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, |
| 144 |
0x5f, 0x79, 0x00, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x5f, 0x7a, |
| 145 |
0x00, 0x74, 0x73, 0x63, 0x00, 0x72, 0x30, 0x00, 0x61, 0x72, 0x67, 0x00, 0x72, |
| 146 |
0x65, 0x74, 0x76, 0x61, 0x6c, 0x00, 0x73, 0x70, 0x00, 0x66, 0x70, 0x00, 0x68, |
| 147 |
0x77, 0x5f, 0x69, 0x64, 0x00, 0x73, 0x72, 0x30, 0x00, 0x63, 0x72, 0x30, 0x00, |
| 148 |
0x63, 0x65, 0x30, 0x00, 0x64, 0x62, 0x67, 0x30, 0x00, 0x63, 0x6f, 0x6c, 0x6f, |
| 149 |
0x72, 0x00, 0x54, 0x30, 0x00, 0x54, 0x31, 0x00, 0x54, 0x32, 0x00, 0x54, 0x33, |
| 150 |
0x00, 0x54, 0x32, 0x35, 0x32, 0x00, 0x54, 0x32, 0x35, 0x35, 0x00, 0x53, 0x33, |
| 151 |
0x31, 0x00, 0x56, 0x33, 0x32, 0x00, 0x56, 0x33, 0x33, 0x00, 0x44, 0x6f, 0x4e, |
| 152 |
0x6f, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x5f, 0x42, 0x42, 0x5f, 0x30, 0x5f, 0x31, |
| 153 |
0x00, 0x41, 0x73, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x00, 0x4e, 0x6f, 0x42, 0x61, |
| 154 |
0x72, 0x72, 0x69, 0x65, 0x72, 0x00, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x00, |
| 155 |
0x64, 0x3a, 0x5c, 0x64, 0x6f, 0x6e, 0x6f, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x5f, |
| 156 |
0x67, 0x65, 0x6e, 0x78, 0x2e, 0x63, 0x70, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 157 |
0x02, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x21, 0x01, 0x00, 0x00, 0x00, |
| 158 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x27, 0x01, 0x00, |
| 159 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, |
| 160 |
0x00, 0x1c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, |
| 161 |
0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x00, 0x21, 0x00, |
| 162 |
0x00, 0x00, 0x24, 0x00, 0x04, 0x00, 0x11, 0x00, 0x00, 0x00, 0x56, 0x01, 0x00, |
| 163 |
0x00, 0x03, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x14, 0x64, 0x6f, 0x6e, 0x6f, 0x74, |
| 164 |
0x68, 0x69, 0x6e, 0x67, 0x5f, 0x67, 0x65, 0x6e, 0x78, 0x5f, 0x30, 0x2e, 0x61, |
| 165 |
0x73, 0x6d, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x01, 0x00, |
| 166 |
0x30, 0x00, 0x00, 0x51, 0x20, 0x00, 0x00, 0x00, 0x52, 0x03, 0x00, 0x00, 0x00, |
| 167 |
0x34, 0x00, 0x00, 0x00, 0x01, 0x4d, 0x00, 0x20, 0x07, 0x7f, 0x00, 0x00, 0x31, |
| 168 |
0x00, 0x00, 0x07, 0x00, 0x3a, 0x00, 0x20, 0xe0, 0x0f, 0x00, 0x06, 0x10, 0x00, |
| 169 |
0x00, 0x82}; |
| 170 |
|
| 171 |
struct IsaData |
| 172 |
{ |
| 173 |
IsaData(): binary(nullptr), |
| 174 |
size(0), |
| 175 |
options(nullptr) {} |
| 176 |
|
| 177 |
IsaData(uint8_t *in_binary, |
| 178 |
size_t in_size, |
| 179 |
char *in_options): binary(in_binary), |
| 180 |
size(in_size), |
| 181 |
options(in_options) {} |
| 182 |
|
| 183 |
uint8_t *binary; |
| 184 |
size_t size; |
| 185 |
char *options; |
| 186 |
}; |
| 187 |
typedef std::vector<IsaData> IsaArray; |
| 188 |
|
| 189 |
using CMRT_UMD::CmSampler; |
| 190 |
using CMRT_UMD::CmSampler8x8; |
| 191 |
class KernelTest: public CmTest |
| 192 |
{ |
| 193 |
public: |
| 194 |
KernelTest(): m_program(nullptr), m_kernel(nullptr) {} |
| 195 |
|
| 196 |
~KernelTest() {} |
| 197 |
|
| 198 |
int32_t LoadDestroyProgram(uint8_t *isa_code, |
| 199 |
uint32_t size, |
| 200 |
const char *options) |
| 201 |
{ |
| 202 |
if (nullptr == options) |
| 203 |
{ |
| 204 |
options = "nojitter"; |
| 205 |
} |
| 206 |
int32_t result = m_mockDevice->LoadProgram(isa_code, size, m_program, |
| 207 |
options); |
| 208 |
if (result != CM_SUCCESS) |
| 209 |
{ |
| 210 |
return result; |
| 211 |
} |
| 212 |
return m_mockDevice->DestroyProgram(m_program); |
| 213 |
}//================================================ |
| 214 |
|
| 215 |
//*------------------------------------------------------------------------- |
| 216 |
//| Selects ISA code, size and options from an array and loads them as a |
| 217 |
//| CmProgram. |
| 218 |
//*------------------------------------------------------------------------- |
| 219 |
int32_t SelectLoadDestroyProgram(IsaArray *isa_array) |
| 220 |
{ |
| 221 |
IsaData *isa_data = FindIsaData(isa_array); |
| 222 |
return LoadDestroyProgram(isa_data->binary, |
| 223 |
static_cast<uint32_t>(isa_data->size), |
| 224 |
isa_data->options); |
| 225 |
} |
| 226 |
|
| 227 |
//*------------------------------------------------------------------------- |
| 228 |
//| Creates a kernel from the default ISA code. |
| 229 |
//*------------------------------------------------------------------------- |
| 230 |
int32_t CreateKernel(const char *kernel_name) |
| 231 |
{ |
| 232 |
if (nullptr == kernel_name) // Tests the return value if CmProgram is invalid. |
| 233 |
{ |
| 234 |
return m_mockDevice->CreateKernel(nullptr, "DoNothing", m_kernel, |
| 235 |
nullptr); |
| 236 |
} |
| 237 |
int32_t result = CreateKernelFromDefaultIsa(kernel_name); |
| 238 |
if (CM_SUCCESS == result) |
| 239 |
{ |
| 240 |
uint32_t spill_size = 0; |
| 241 |
int32_t temp_result = m_kernel->QuerySpillSize(spill_size); |
| 242 |
EXPECT_EQ(CM_FAILURE, temp_result); |
| 243 |
} |
| 244 |
DestroyKernel(); |
| 245 |
return result; |
| 246 |
}//=============== |
| 247 |
|
| 248 |
int32_t SetArgument(uint32_t index, |
| 249 |
size_t size, |
| 250 |
const void *value) |
| 251 |
{ |
| 252 |
int32_t result = CreateKernelFromDefaultIsa("DoNothing"); |
| 253 |
EXPECT_EQ(CM_SUCCESS, result); |
| 254 |
|
| 255 |
result = m_kernel->SetKernelArg(index, size, value); |
| 256 |
DestroyKernel(); |
| 257 |
return result; |
| 258 |
}//=============== |
| 259 |
|
| 260 |
//*------------------------------------------------------------------------- |
| 261 |
//| Sets sampler BTI for CmSampler. |
| 262 |
//*------------------------------------------------------------------------- |
| 263 |
template<class SamplerType, class Function > |
| 264 |
int32_t SetSamplerBTI(int sampler_count, |
| 265 |
uint32_t binding_table_index, |
| 266 |
Function Create) |
| 267 |
{ |
| 268 |
int32_t result = CreateKernelFromDefaultIsa("DoNothing"); |
| 269 |
EXPECT_EQ(CM_SUCCESS, result); |
| 270 |
|
| 271 |
SamplerType *samplers[2]; |
| 272 |
samplers[0] = samplers[1] = nullptr; |
| 273 |
|
| 274 |
for (int i = 0; i < sampler_count; ++i) |
| 275 |
{ |
| 276 |
samplers[i] = Create(); |
| 277 |
EXPECT_NE(nullptr, samplers[i]); |
| 278 |
} |
| 279 |
|
| 280 |
if (0 == sampler_count) |
| 281 |
{ |
| 282 |
++sampler_count; // Test for nullptr; |
| 283 |
} |
| 284 |
SamplerIndex *sampler_index = nullptr; |
| 285 |
int32_t return_value = 0; |
| 286 |
for (int i = 0; i < sampler_count; ++i) |
| 287 |
{ |
| 288 |
if (nullptr != samplers[i]) |
| 289 |
{ |
| 290 |
result = samplers[i]->GetIndex(sampler_index); |
| 291 |
EXPECT_EQ(CM_SUCCESS, result); |
| 292 |
} |
| 293 |
result = m_kernel->SetSamplerBTI(sampler_index, |
| 294 |
binding_table_index); |
| 295 |
if (0 == i) |
| 296 |
{ |
| 297 |
return_value = result; |
| 298 |
} |
| 299 |
else |
| 300 |
{ |
| 301 |
EXPECT_EQ(CM_FAILURE, result); |
| 302 |
} |
| 303 |
} |
| 304 |
|
| 305 |
for (int i = 0; i < sampler_count; ++i) |
| 306 |
{ |
| 307 |
if (nullptr != samplers[i]) |
| 308 |
{ |
| 309 |
result = DestroySampler(samplers[i]); |
| 310 |
EXPECT_EQ(CM_SUCCESS, result); |
| 311 |
} |
| 312 |
} |
| 313 |
|
| 314 |
DestroyKernel(); |
| 315 |
return return_value; |
| 316 |
} |
| 317 |
|
| 318 |
protected: |
| 319 |
//*------------------------------------------------------------------------- |
| 320 |
//| Creates CmSampler. |
| 321 |
//*------------------------------------------------------------------------- |
| 322 |
CmSampler* CreateSampler() |
| 323 |
{ |
| 324 |
CM_SAMPLER_STATE sampler_state; |
| 325 |
sampler_state.magFilterType = CM_TEXTURE_FILTER_TYPE_LINEAR; |
| 326 |
sampler_state.minFilterType = CM_TEXTURE_FILTER_TYPE_LINEAR; |
| 327 |
sampler_state.addressU = CM_TEXTURE_ADDRESS_CLAMP; |
| 328 |
sampler_state.addressV = CM_TEXTURE_ADDRESS_CLAMP; |
| 329 |
sampler_state.addressW = CM_TEXTURE_ADDRESS_CLAMP; |
| 330 |
CmSampler *sampler = nullptr; |
| 331 |
m_mockDevice->CreateSampler(sampler_state, sampler); |
| 332 |
return sampler; |
| 333 |
} |
| 334 |
|
| 335 |
//*------------------------------------------------------------------------- |
| 336 |
//| Creates CmSampler8x8. |
| 337 |
//*------------------------------------------------------------------------- |
| 338 |
CmSampler8x8* CreateSampler8x8() |
| 339 |
{ |
| 340 |
CM_AVS_NONPIPLINED_STATE nonpipelined_state; |
| 341 |
nonpipelined_state.BypassXAF = nonpipelined_state.BypassYAF = 1; |
| 342 |
nonpipelined_state.DefaultSharpLvl = 255; |
| 343 |
nonpipelined_state.maxDerivative4Pixels = 7; |
| 344 |
nonpipelined_state.maxDerivative8Pixels = 20; |
| 345 |
nonpipelined_state.transitionArea4Pixels = 4; |
| 346 |
nonpipelined_state.transitionArea8Pixels = 5; |
| 347 |
|
| 348 |
CM_AVS_STATE_MSG state_message; |
| 349 |
state_message.AvsState = &nonpipelined_state; |
| 350 |
state_message.AVSTYPE = 0; |
| 351 |
state_message.BypassIEF = 1; |
| 352 |
state_message.GainFactor = 44; |
| 353 |
state_message.GlobalNoiseEstm = 255; |
| 354 |
state_message.StrongEdgeThr = 8; |
| 355 |
state_message.WeakEdgeThr = 1; |
| 356 |
state_message.StrongEdgeWght = 7; |
| 357 |
state_message.RegularWght = 2; |
| 358 |
state_message.NonEdgeWght = 1; |
| 359 |
state_message.wR3xCoefficient = 6; |
| 360 |
state_message.wR3cCoefficient = 15; |
| 361 |
state_message.wR5xCoefficient = 9; |
| 362 |
state_message.wR5cxCoefficient = 8; |
| 363 |
state_message.wR5cCoefficient = 3; |
| 364 |
|
| 365 |
CM_SAMPLER_8X8_DESCR descriptor; |
| 366 |
descriptor.stateType = CM_SAMPLER8X8_AVS; |
| 367 |
descriptor.avs = &state_message; |
| 368 |
|
| 369 |
CmSampler8x8 *sampler8x8 = nullptr; |
| 370 |
m_mockDevice->CreateSampler8x8(descriptor, sampler8x8); |
| 371 |
return sampler8x8; |
| 372 |
} |
| 373 |
|
| 374 |
//*------------------------------------------------------------------------- |
| 375 |
//| Resets the default ISA array. |
| 376 |
//*------------------------------------------------------------------------- |
| 377 |
bool ResetDefaultIsaArray(); |
| 378 |
|
| 379 |
//*------------------------------------------------------------------------- |
| 380 |
//| Sets pointers to ISA binaries in the default ISA array. |
| 381 |
//*------------------------------------------------------------------------- |
| 382 |
bool SetDefaultIsaArrayBinaries(); |
| 383 |
|
| 384 |
//*------------------------------------------------------------------------- |
| 385 |
//| Sets sizs of ISA binaries in the default ISA array. |
| 386 |
//*------------------------------------------------------------------------- |
| 387 |
bool SetDefaultIsaArraySizes(); |
| 388 |
|
| 389 |
// Array of default ISA data. |
| 390 |
IsaArray m_isaArray; |
| 391 |
|
| 392 |
private: |
| 393 |
//*------------------------------------------------------------------------- |
| 394 |
//| Finds the index of the ISA data corresponding to the platform in test. |
| 395 |
//*------------------------------------------------------------------------- |
| 396 |
IsaData* FindIsaData(IsaArray *isa_array); |
| 397 |
|
| 398 |
int32_t CreateKernelFromDefaultIsa(const char *kernel_name) |
| 399 |
{ |
| 400 |
ResetDefaultIsaArray(); |
| 401 |
SetDefaultIsaArrayBinaries(); |
| 402 |
SetDefaultIsaArraySizes(); |
| 403 |
IsaData *current_isa_data = FindIsaData(&m_isaArray); |
| 404 |
int32_t result |
| 405 |
= m_mockDevice->LoadProgram( |
| 406 |
current_isa_data->binary, |
| 407 |
static_cast<uint32_t>(current_isa_data->size), |
| 408 |
m_program, "nojitter"); |
| 409 |
EXPECT_EQ(CM_SUCCESS, result); |
| 410 |
return m_mockDevice->CreateKernel(m_program, kernel_name, m_kernel, |
| 411 |
nullptr); |
| 412 |
}//============================================ |
| 413 |
|
| 414 |
int32_t DestroyKernel() |
| 415 |
{ |
| 416 |
int32_t result = CM_SUCCESS; |
| 417 |
if (nullptr != m_kernel) |
| 418 |
{ |
| 419 |
result = m_mockDevice->DestroyKernel(m_kernel); |
| 420 |
EXPECT_EQ(CM_SUCCESS, result); |
| 421 |
} |
| 422 |
if (nullptr != m_program) |
| 423 |
{ |
| 424 |
result = m_mockDevice->DestroyProgram(m_program); |
| 425 |
EXPECT_EQ(CM_SUCCESS, result); |
| 426 |
} |
| 427 |
return result; |
| 428 |
}//=============== |
| 429 |
|
| 430 |
int32_t DestroySampler(CmSampler *sampler) |
| 431 |
{ |
| 432 |
return m_mockDevice->DestroySampler(sampler); |
| 433 |
} |
| 434 |
|
| 435 |
int32_t DestroySampler(CmSampler8x8 *sampler) |
| 436 |
{ |
| 437 |
return m_mockDevice->DestroySampler8x8(sampler); |
| 438 |
} |
| 439 |
|
| 440 |
CMRT_UMD::CmProgram *m_program; |
| 441 |
CMRT_UMD::CmKernel *m_kernel; |
| 442 |
}; |
| 443 |
|
| 444 |
TEST_F(KernelTest, LoadDestroyProgram) |
| 445 |
{ |
| 446 |
ResetDefaultIsaArray(); |
| 447 |
RunEach<int32_t>(CM_INVALID_COMMON_ISA, |
| 448 |
[this]() |
| 449 |
{ return SelectLoadDestroyProgram(&m_isaArray); }); |
| 450 |
|
| 451 |
SetDefaultIsaArrayBinaries(); |
| 452 |
RunEach<int32_t>(CM_INVALID_COMMON_ISA, |
| 453 |
[this]() |
| 454 |
{ return SelectLoadDestroyProgram(&m_isaArray); }); |
| 455 |
|
| 456 |
SetDefaultIsaArraySizes(); |
| 457 |
|
| 458 |
char options[CM_MAX_OPTION_SIZE_IN_BYTE + 1]; |
| 459 |
for (int i = 0; i < CM_MAX_OPTION_SIZE_IN_BYTE; ++i) |
| 460 |
{ |
| 461 |
options[i] = '0'; |
| 462 |
} |
| 463 |
options[CM_MAX_OPTION_SIZE_IN_BYTE] = 0; |
| 464 |
char *options_ptr = options; // Uses a pointer instead if an array name. |
| 465 |
for_each(m_isaArray.begin(), m_isaArray.end(), |
| 466 |
[options_ptr](IsaData &isa_data) |
| 467 |
{ isa_data.options = options_ptr; }); |
| 468 |
RunEach<int32_t>(CM_INVALID_ARG_VALUE, |
| 469 |
[this]() |
| 470 |
{ return SelectLoadDestroyProgram(&m_isaArray); }); |
| 471 |
|
| 472 |
return; |
| 473 |
}//======== |
| 474 |
|
| 475 |
TEST_F(KernelTest, LoadWrongIsa) |
| 476 |
{ |
| 477 |
const uint32_t CODE_SIZE = sizeof(SKYLAKE_DONOTHING_ISA); |
| 478 |
uint8_t wrong_isa_code[CODE_SIZE]; |
| 479 |
memcpy_s(wrong_isa_code, CODE_SIZE, SKYLAKE_DONOTHING_ISA, CODE_SIZE); |
| 480 |
wrong_isa_code[0x23] = 0xff; |
| 481 |
uint8_t *wrong_isa_code_ptr = wrong_isa_code; |
| 482 |
|
| 483 |
ResetDefaultIsaArray(); |
| 484 |
auto SetIsaArray = [wrong_isa_code_ptr, CODE_SIZE](IsaData &isa_data) { |
| 485 |
isa_data.binary = wrong_isa_code_ptr; |
| 486 |
isa_data.size = CODE_SIZE; }; |
| 487 |
for_each(m_isaArray.begin(), m_isaArray.end(), SetIsaArray); |
| 488 |
|
| 489 |
RunEach<int32_t>(CM_INVALID_GENX_BINARY, |
| 490 |
[this]() |
| 491 |
{ return SelectLoadDestroyProgram(&m_isaArray); }); |
| 492 |
return; |
| 493 |
}//======== |
| 494 |
|
| 495 |
TEST_F(KernelTest, CreateKernel) |
| 496 |
{ |
| 497 |
RunEach<int32_t>(CM_FAILURE, |
| 498 |
[this]() { return CreateKernel("wrong_name"); }); |
| 499 |
|
| 500 |
RunEach<int32_t>(CM_NULL_POINTER, |
| 501 |
[this]() { return CreateKernel(nullptr); }); |
| 502 |
return; |
| 503 |
}//======== |
| 504 |
|
| 505 |
TEST_F(KernelTest, SetArgument) |
| 506 |
{ |
| 507 |
int arg0_value = 10; |
| 508 |
void *arg0_ptr = &arg0_ptr; |
| 509 |
|
| 510 |
RunEach<int32_t>(CM_SUCCESS, |
| 511 |
[this, arg0_ptr]() { return SetArgument(0, sizeof(int), |
| 512 |
arg0_ptr); }); |
| 513 |
RunEach<int32_t>(CM_INVALID_ARG_INDEX, |
| 514 |
[this, arg0_ptr]() { return SetArgument(2, sizeof(int), |
| 515 |
arg0_ptr); }); |
| 516 |
RunEach<int32_t>(CM_INVALID_ARG_SIZE, |
| 517 |
[this, arg0_ptr]() { return SetArgument(0, sizeof(int) + 1, |
| 518 |
arg0_ptr); }); |
| 519 |
RunEach<int32_t>(CM_INVALID_ARG_SIZE, |
| 520 |
[this, arg0_ptr]() { return SetArgument(0, sizeof(int) - 1, |
| 521 |
arg0_ptr); }); |
| 522 |
RunEach<int32_t>(CM_INVALID_ARG_SIZE, |
| 523 |
[this, arg0_ptr]() |
| 524 |
{ return SetArgument(0, 0, arg0_ptr); }); |
| 525 |
RunEach<int32_t>(CM_INVALID_ARG_VALUE, |
| 526 |
[this, arg0_ptr]() { return SetArgument(0, sizeof(int), |
| 527 |
nullptr); }); |
| 528 |
return; |
| 529 |
}//======== |
| 530 |
|
| 531 |
TEST_F(KernelTest, SetSamplerBTI) |
| 532 |
{ |
| 533 |
auto CreateSampler = [this]() { return this->CreateSampler(); }; |
| 534 |
|
| 535 |
RunEach<int32_t>(CM_NULL_POINTER, |
| 536 |
[this, &CreateSampler]() { |
| 537 |
return SetSamplerBTI<CmSampler>(0, 5, |
| 538 |
CreateSampler); }); |
| 539 |
|
| 540 |
static const uint32_t MAX_INDEX = 15; |
| 541 |
RunEach<int32_t>(CM_KERNELPAYLOAD_SAMPLER_INVALID_BTINDEX, |
| 542 |
[this, &CreateSampler]() { |
| 543 |
return SetSamplerBTI<CmSampler>(1, MAX_INDEX + 1, |
| 544 |
CreateSampler); }); |
| 545 |
|
| 546 |
RunEach<int32_t>(CM_SUCCESS, |
| 547 |
[this, &CreateSampler]() { |
| 548 |
return SetSamplerBTI<CmSampler>(2, 5, |
| 549 |
CreateSampler); }); |
| 550 |
|
| 551 |
auto CreateSampler8x8 = [this]() { return this->CreateSampler8x8(); }; |
| 552 |
|
| 553 |
RunEach<int32_t>(CM_KERNELPAYLOAD_SAMPLER_INVALID_BTINDEX, |
| 554 |
[this, &CreateSampler8x8]() { |
| 555 |
return SetSamplerBTI<CmSampler8x8>( |
| 556 |
1, MAX_INDEX + 1, CreateSampler8x8); }); |
| 557 |
|
| 558 |
RunEach<int32_t>(CM_SUCCESS, |
| 559 |
[this, &CreateSampler8x8]() { |
| 560 |
return SetSamplerBTI<CmSampler8x8>( |
| 561 |
2, 5, CreateSampler8x8); }); |
| 562 |
return; |
| 563 |
} |