| 1 | /* |
| 2 | * Copyright (c) 2020, 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 mos_os_mock_adaptor.cpp |
| 24 | //! \brief Common interface and structure used in mock adaptor. |
| 25 | //! |
| 26 | |
| 27 | #include "mos_os.h" |
| 28 | #include "mos_os_specific.h" |
| 29 | #include "mos_os_mock_adaptor.h" |
| 30 | #include "mos_os_mock_adaptor_specific.h" |
| 31 | |
| 32 | #define TGL_A0_REV_ID 0x00 |
| 33 | #define TGL_B0_REV_ID 0x01 |
| 34 | #define TGL_C0_REV_ID 0x02 |
| 35 | |
| 36 | MOS_STATUS MosMockAdaptor::InitializePlatForm() |
| 37 | { |
| 38 | MOS_STATUS eStatus = MOS_STATUS_SUCCESS; |
| 39 | |
| 40 | MOS_OS_CHK_NULL_RETURN(m_pPlatform); |
| 41 | |
| 42 | switch (m_productFamily) |
| 43 | { |
| 44 | case IGFX_TIGERLAKE_LP: |
| 45 | m_pPlatform->eProductFamily = IGFX_TIGERLAKE_LP; |
| 46 | m_pPlatform->eDisplayCoreFamily = IGFX_GEN12_CORE; |
| 47 | m_pPlatform->eRenderCoreFamily = IGFX_GEN12_CORE; |
| 48 | |
| 49 | if (m_stepping[0] == 'a' || m_stepping[0] == 'A') |
| 50 | { |
| 51 | m_pPlatform->usRevId = TGL_A0_REV_ID; |
| 52 | } |
| 53 | else if (m_stepping[0] == 'b' || m_stepping[0] == 'B') |
| 54 | { |
| 55 | m_pPlatform->usRevId = TGL_B0_REV_ID; |
| 56 | } |
| 57 | else if (m_stepping[0] == 'c' || m_stepping[0] == 'C') |
| 58 | { |
| 59 | m_pPlatform->usRevId = TGL_C0_REV_ID; |
| 60 | } |
| 61 | else |
| 62 | { |
| 63 | MOS_OS_ASSERTMESSAGE("Invalid stepping."); |
| 64 | } |
| 65 | |
| 66 | break; |
| 67 | default: //default setting |
| 68 | m_pPlatform->eProductFamily = IGFX_UNKNOWN; |
| 69 | m_pPlatform->eDisplayCoreFamily = IGFX_UNKNOWN_CORE; |
| 70 | m_pPlatform->eRenderCoreFamily = IGFX_UNKNOWN_CORE; |
| 71 | eStatus = MOS_STATUS_UNKNOWN; |
| 72 | return eStatus; |
| 73 | } |
| 74 | |
| 75 | m_pPlatform->usDeviceID = m_deviceId; |
| 76 | |
| 77 | if (m_stepping[1] == '0') |
| 78 | { |
| 79 | m_pPlatform->usRevId += 0; |
| 80 | } |
| 81 | else if (m_stepping[1] == '1') |
| 82 | { |
| 83 | m_pPlatform->usRevId += 1; |
| 84 | } |
| 85 | else if (m_stepping[1] == '2') |
| 86 | { |
| 87 | m_pPlatform->usRevId += 2; |
| 88 | } |
| 89 | else if (m_stepping[1] == '3') |
| 90 | { |
| 91 | m_pPlatform->usRevId += 3; |
| 92 | } |
| 93 | else |
| 94 | { |
| 95 | MOS_OS_ASSERTMESSAGE("Invalid stepping."); |
| 96 | } |
| 97 | |
| 98 | return eStatus; |
| 99 | } |