| 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 | //! |
| 24 | //! \file kernel_test_os.cpp |
| 25 | //! \brief Implementation of Linux-dependent part of class KernelTest. |
| 26 | //! \details |
| 27 | //! |
| 28 | |
| 29 | #include "kernel_test.h" |
| 30 | |
| 31 | IsaData* KernelTest::FindIsaData(IsaArray *isa_array) |
| 32 | { |
| 33 | uint32_t index = static_cast<uint32_t>(m_currentPlatform); |
| 34 | return &((*isa_array)[index]); |
| 35 | } |
| 36 | |
| 37 | //*----------------------------------------------------------------------------- |
| 38 | //| Reset the default ISA array. |
| 39 | //*----------------------------------------------------------------------------- |
| 40 | bool KernelTest::ResetDefaultIsaArray() |
| 41 | { |
| 42 | m_isaArray.clear(); |
| 43 | m_isaArray.resize(static_cast<size_t>(igfx_MAX)); |
| 44 | return true; |
| 45 | } |
| 46 | |
| 47 | //*----------------------------------------------------------------------------- |
| 48 | //| Sets pointers to ISA binaries in the default ISA array. |
| 49 | //*----------------------------------------------------------------------------- |
| 50 | bool KernelTest::SetDefaultIsaArrayBinaries() |
| 51 | { |
| 52 | m_isaArray[0] = IsaData(SKYLAKE_DONOTHING_ISA, 0, nullptr); |
| 53 | m_isaArray[1] = IsaData(BROXTON_DONOTHING_ISA, 0, nullptr); |
| 54 | m_isaArray[2] = IsaData(BROADWELL_DONOTHING_ISA, 0, nullptr); |
| 55 | m_isaArray[3] = IsaData(CANNONLAKE_DONOTHING_ISA, 0, nullptr); |
| 56 | return true; |
| 57 | } |
| 58 | |
| 59 | //*----------------------------------------------------------------------------- |
| 60 | //| Sets sizs of ISA binaries in the default ISA array. |
| 61 | //*----------------------------------------------------------------------------- |
| 62 | bool KernelTest::SetDefaultIsaArraySizes() |
| 63 | { |
| 64 | size_t code_sizes[] = {sizeof(SKYLAKE_DONOTHING_ISA), |
| 65 | sizeof(BROXTON_DONOTHING_ISA), |
| 66 | sizeof(BROADWELL_DONOTHING_ISA), |
| 67 | sizeof(CANNONLAKE_DONOTHING_ISA)}; |
| 68 | for (size_t i = 0; i < m_isaArray.size(); ++i) |
| 69 | { |
| 70 | m_isaArray[i].size = code_sizes[i]; |
| 71 | } |
| 72 | return true; |
| 73 | } |