mirror of
https://github.com/NVIDIA/open-gpu-kernel-modules.git
synced 2026-02-28 02:43:57 +00:00
515.43.04
This commit is contained in:
78
src/common/nvswitch/kernel/inforom/ifrbbx_nvswitch.c
Normal file
78
src/common/nvswitch/kernel/inforom/ifrbbx_nvswitch.c
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2020 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "common_nvswitch.h"
|
||||
#include "regkey_nvswitch.h"
|
||||
#include "nvVer.h"
|
||||
#include "inforom/inforom_nvswitch.h"
|
||||
|
||||
void
|
||||
nvswitch_bbx_collect_current_time
|
||||
(
|
||||
nvswitch_device *device,
|
||||
void *pBbxState
|
||||
)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
NvlStatus
|
||||
nvswitch_inforom_bbx_add_sxid
|
||||
(
|
||||
nvswitch_device *device,
|
||||
NvU32 exceptionType,
|
||||
NvU32 data0,
|
||||
NvU32 data1,
|
||||
NvU32 data2
|
||||
)
|
||||
{
|
||||
return -NVL_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
void
|
||||
nvswitch_inforom_bbx_unload
|
||||
(
|
||||
nvswitch_device *device
|
||||
)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
NvlStatus
|
||||
nvswitch_inforom_bbx_load
|
||||
(
|
||||
nvswitch_device *device
|
||||
)
|
||||
{
|
||||
return -NVL_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
NvlStatus
|
||||
nvswitch_inforom_bbx_get_sxid
|
||||
(
|
||||
nvswitch_device *device,
|
||||
NVSWITCH_GET_SXIDS_PARAMS *params
|
||||
)
|
||||
{
|
||||
return -NVL_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
267
src/common/nvswitch/kernel/inforom/ifrecc_nvswitch.c
Normal file
267
src/common/nvswitch/kernel/inforom/ifrecc_nvswitch.c
Normal file
@@ -0,0 +1,267 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2020 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "common_nvswitch.h"
|
||||
#include "inforom/inforom_nvswitch.h"
|
||||
|
||||
NvlStatus
|
||||
nvswitch_inforom_ecc_load
|
||||
(
|
||||
nvswitch_device *device
|
||||
)
|
||||
{
|
||||
NvlStatus status;
|
||||
NvU8 version = 0;
|
||||
NvU8 subversion = 0;
|
||||
INFOROM_ECC_STATE *pEccState = NULL;
|
||||
struct inforom *pInforom = device->pInforom;
|
||||
|
||||
if (pInforom == NULL)
|
||||
{
|
||||
return -NVL_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
status = nvswitch_inforom_get_object_version_info(device, "ECC", &version,
|
||||
&subversion);
|
||||
if (status != NVL_SUCCESS)
|
||||
{
|
||||
NVSWITCH_PRINT(device, WARN, "no ECC object found, rc:%d\n", status);
|
||||
return NVL_SUCCESS;
|
||||
}
|
||||
|
||||
if (!INFOROM_OBJECT_SUBVERSION_SUPPORTS_NVSWITCH(subversion))
|
||||
{
|
||||
NVSWITCH_PRINT(device, WARN, "ECC v%u.%u not supported\n",
|
||||
version, subversion);
|
||||
return -NVL_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
NVSWITCH_PRINT(device, INFO, "ECC v%u.%u found\n", version, subversion);
|
||||
|
||||
pEccState = nvswitch_os_malloc(sizeof(INFOROM_ECC_STATE));
|
||||
if (pEccState == NULL)
|
||||
{
|
||||
return -NVL_NO_MEM;
|
||||
}
|
||||
nvswitch_os_memset(pEccState, 0, sizeof(INFOROM_ECC_STATE));
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 6:
|
||||
pEccState->pFmt = INFOROM_ECC_OBJECT_V6_S0_FMT;
|
||||
pEccState->pPackedObject = nvswitch_os_malloc(INFOROM_ECC_OBJECT_V6_S0_PACKED_SIZE);
|
||||
if (pEccState->pPackedObject == NULL)
|
||||
{
|
||||
status = -NVL_NO_MEM;
|
||||
goto nvswitch_inforom_ecc_version_fail;
|
||||
}
|
||||
|
||||
pEccState->pEcc = nvswitch_os_malloc(sizeof(INFOROM_ECC_OBJECT));
|
||||
if (pEccState->pEcc == NULL)
|
||||
{
|
||||
status = -NVL_NO_MEM;
|
||||
nvswitch_os_free(pEccState->pPackedObject);
|
||||
goto nvswitch_inforom_ecc_version_fail;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
NVSWITCH_PRINT(device, WARN, "ECC v%u.%u not supported\n",
|
||||
version, subversion);
|
||||
goto nvswitch_inforom_ecc_version_fail;
|
||||
break;
|
||||
}
|
||||
|
||||
status = nvswitch_inforom_read_object(device, "ECC", pEccState->pFmt,
|
||||
pEccState->pPackedObject,
|
||||
pEccState->pEcc);
|
||||
if (status != NVL_SUCCESS)
|
||||
{
|
||||
NVSWITCH_PRINT(device, ERROR, "Failed to read ECC object, rc:%d\n", status);
|
||||
goto nvswitch_inforom_read_fail;
|
||||
}
|
||||
|
||||
status = nvswitch_inforom_add_object(pInforom, &pEccState->pEcc->header);
|
||||
if (status != NVL_SUCCESS)
|
||||
{
|
||||
NVSWITCH_PRINT(device, ERROR, "Failed to cache ECC object header, rc:%d\n",
|
||||
status);
|
||||
goto nvswitch_inforom_read_fail;
|
||||
}
|
||||
|
||||
pInforom->pEccState = pEccState;
|
||||
|
||||
// Update shared surface counts, non-fatal if we encounter a failure
|
||||
status = nvswitch_smbpbi_refresh_ecc_counts(device);
|
||||
if (status != NVL_SUCCESS)
|
||||
{
|
||||
NVSWITCH_PRINT(device, WARN, "Failed to update ECC counts on SMBPBI "
|
||||
"shared surface rc:%d\n", status);
|
||||
}
|
||||
|
||||
return NVL_SUCCESS;
|
||||
|
||||
nvswitch_inforom_read_fail:
|
||||
nvswitch_os_free(pEccState->pPackedObject);
|
||||
nvswitch_os_free(pEccState->pEcc);
|
||||
nvswitch_inforom_ecc_version_fail:
|
||||
nvswitch_os_free(pEccState);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
void
|
||||
nvswitch_inforom_ecc_unload
|
||||
(
|
||||
nvswitch_device *device
|
||||
)
|
||||
{
|
||||
INFOROM_ECC_STATE *pEccState;
|
||||
struct inforom *pInforom = device->pInforom;
|
||||
|
||||
if (pInforom == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pEccState = pInforom->pEccState;
|
||||
if (pEccState == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Flush the data to InfoROM before unloading the object
|
||||
// Currently the driver doesn't support deferred processing and so the
|
||||
// error logging path in the interrupt handler cannot defer the flush.
|
||||
// This is WAR until the driver adds support for deferred processing
|
||||
//
|
||||
nvswitch_inforom_ecc_flush(device);
|
||||
|
||||
nvswitch_os_free(pEccState->pPackedObject);
|
||||
nvswitch_os_free(pEccState->pEcc);
|
||||
nvswitch_os_free(pEccState);
|
||||
pInforom->pEccState = NULL;
|
||||
}
|
||||
|
||||
NvlStatus
|
||||
nvswitch_inforom_ecc_flush
|
||||
(
|
||||
struct nvswitch_device *device
|
||||
)
|
||||
{
|
||||
NvlStatus status = NVL_SUCCESS;
|
||||
struct inforom *pInforom = device->pInforom;
|
||||
INFOROM_ECC_STATE *pEccState;
|
||||
|
||||
if (pInforom == NULL || pInforom->pEccState == NULL)
|
||||
{
|
||||
return -NVL_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
pEccState = pInforom->pEccState;
|
||||
|
||||
if (pEccState->bDirty)
|
||||
{
|
||||
status = nvswitch_inforom_write_object(device, "ECC",
|
||||
pEccState->pFmt, pEccState->pEcc,
|
||||
pEccState->pPackedObject);
|
||||
if (status != NVL_SUCCESS)
|
||||
{
|
||||
NVSWITCH_PRINT(device, ERROR,
|
||||
"Failed to flush ECC object to InfoROM, rc: %d\n", status);
|
||||
}
|
||||
else
|
||||
{
|
||||
pEccState->bDirty = NV_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
NvlStatus
|
||||
nvswitch_inforom_ecc_log_err_event
|
||||
(
|
||||
struct nvswitch_device *device,
|
||||
INFOROM_NVS_ECC_ERROR_EVENT *err_event
|
||||
)
|
||||
{
|
||||
NvlStatus status;
|
||||
INFOROM_ECC_STATE *pEccState;
|
||||
NvU64 time_ns;
|
||||
struct inforom *pInforom = device->pInforom;
|
||||
|
||||
if (pInforom == NULL || pInforom->pEccState == NULL)
|
||||
{
|
||||
return -NVL_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
if (err_event == NULL)
|
||||
{
|
||||
return -NVL_BAD_ARGS;
|
||||
}
|
||||
|
||||
pEccState = pInforom->pEccState;
|
||||
|
||||
time_ns = nvswitch_os_get_platform_time();
|
||||
err_event->timestamp = (NvU32)(time_ns / NVSWITCH_INTERVAL_1SEC_IN_NS);
|
||||
|
||||
// Scrub the incoming address field if it is invalid
|
||||
if (!(err_event->bAddressValid))
|
||||
{
|
||||
err_event->address = 0;
|
||||
}
|
||||
|
||||
// Invoke the chip dependent inforom logging routine
|
||||
status = device->hal.nvswitch_inforom_ecc_log_error_event(device, pEccState->pEcc,
|
||||
err_event);
|
||||
if (status == NVL_SUCCESS)
|
||||
{
|
||||
//
|
||||
// If the error was logged successfully, mark the object as dirty to be
|
||||
// written on the subsequent flush.
|
||||
//
|
||||
pEccState->bDirty = NV_TRUE;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
NvlStatus
|
||||
nvswitch_inforom_ecc_get_errors
|
||||
(
|
||||
nvswitch_device *device,
|
||||
NVSWITCH_GET_ECC_ERROR_COUNTS_PARAMS *params
|
||||
)
|
||||
{
|
||||
struct inforom *pInforom = device->pInforom;
|
||||
|
||||
if (pInforom == NULL || pInforom->pEccState == NULL)
|
||||
{
|
||||
return -NVL_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
return device->hal.nvswitch_inforom_ecc_get_errors(device, params);
|
||||
}
|
||||
107
src/common/nvswitch/kernel/inforom/ifrnvlink_nvswitch.c
Normal file
107
src/common/nvswitch/kernel/inforom/ifrnvlink_nvswitch.c
Normal file
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2019 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "common_nvswitch.h"
|
||||
#include "error_nvswitch.h"
|
||||
|
||||
#include "inforom/inforom_nvswitch.h"
|
||||
|
||||
NvlStatus
|
||||
nvswitch_inforom_nvlink_flush
|
||||
(
|
||||
struct nvswitch_device *device
|
||||
)
|
||||
{
|
||||
return -NVL_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
NvlStatus
|
||||
nvswitch_inforom_nvlink_load
|
||||
(
|
||||
nvswitch_device *device
|
||||
)
|
||||
{
|
||||
return -NVL_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
void
|
||||
nvswitch_inforom_nvlink_unload
|
||||
(
|
||||
nvswitch_device *device
|
||||
)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
NvlStatus
|
||||
nvswitch_inforom_nvlink_get_minion_data
|
||||
(
|
||||
nvswitch_device *device,
|
||||
NvU8 linkId,
|
||||
NvU32 *seedData
|
||||
)
|
||||
{
|
||||
return -NVL_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
NvlStatus
|
||||
nvswitch_inforom_nvlink_set_minion_data
|
||||
(
|
||||
nvswitch_device *device,
|
||||
NvU8 linkId,
|
||||
NvU32 *seedData,
|
||||
NvU32 size
|
||||
)
|
||||
{
|
||||
return -NVL_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
NvlStatus
|
||||
nvswitch_inforom_nvlink_log_error_event
|
||||
(
|
||||
nvswitch_device *device,
|
||||
void *error_event
|
||||
)
|
||||
{
|
||||
return -NVL_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
NvlStatus
|
||||
nvswitch_inforom_nvlink_get_max_correctable_error_rate
|
||||
(
|
||||
nvswitch_device *device,
|
||||
NVSWITCH_GET_NVLINK_MAX_CORRECTABLE_ERROR_RATES_PARAMS *params
|
||||
)
|
||||
{
|
||||
return -NVL_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
NvlStatus
|
||||
nvswitch_inforom_nvlink_get_errors
|
||||
(
|
||||
nvswitch_device *device,
|
||||
NVSWITCH_GET_NVLINK_ERROR_COUNTS_PARAMS *params
|
||||
)
|
||||
{
|
||||
return -NVL_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
209
src/common/nvswitch/kernel/inforom/ifroms_nvswitch.c
Normal file
209
src/common/nvswitch/kernel/inforom/ifroms_nvswitch.c
Normal file
@@ -0,0 +1,209 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2020 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "common_nvswitch.h"
|
||||
#include "error_nvswitch.h"
|
||||
|
||||
#include "inforom/inforom_nvswitch.h"
|
||||
|
||||
NvlStatus
|
||||
nvswitch_inforom_oms_get_device_disable
|
||||
(
|
||||
nvswitch_device *device,
|
||||
NvBool *pBDisabled
|
||||
)
|
||||
{
|
||||
struct inforom *pInforom = device->pInforom;
|
||||
INFOROM_OMS_STATE *pOmsState;
|
||||
|
||||
if (pInforom == NULL)
|
||||
{
|
||||
return -NVL_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
pOmsState = pInforom->pOmsState;
|
||||
if (pOmsState == NULL)
|
||||
{
|
||||
return -NVL_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
*pBDisabled = device->hal.nvswitch_oms_get_device_disable(pOmsState);
|
||||
|
||||
return NVL_SUCCESS;
|
||||
}
|
||||
|
||||
NvlStatus
|
||||
nvswitch_inforom_oms_set_device_disable
|
||||
(
|
||||
nvswitch_device *device,
|
||||
NvBool bForceDeviceDisable
|
||||
)
|
||||
{
|
||||
struct inforom *pInforom = device->pInforom;
|
||||
INFOROM_OMS_STATE *pOmsState;
|
||||
|
||||
if (pInforom == NULL)
|
||||
{
|
||||
return -NVL_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
pOmsState = pInforom->pOmsState;
|
||||
if (pOmsState == NULL)
|
||||
{
|
||||
return -NVL_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
device->hal.nvswitch_oms_set_device_disable(pOmsState, bForceDeviceDisable);
|
||||
|
||||
return NVL_SUCCESS;
|
||||
}
|
||||
|
||||
NvlStatus
|
||||
nvswitch_inforom_oms_load
|
||||
(
|
||||
nvswitch_device *device
|
||||
)
|
||||
{
|
||||
NvlStatus status;
|
||||
NvU8 version = 0;
|
||||
NvU8 subversion = 0;
|
||||
INFOROM_OMS_STATE *pOmsState = NULL;
|
||||
struct inforom *pInforom = device->pInforom;
|
||||
|
||||
if (pInforom == NULL)
|
||||
{
|
||||
return -NVL_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
status = nvswitch_inforom_get_object_version_info(device, "OMS", &version,
|
||||
&subversion);
|
||||
if (status != NVL_SUCCESS)
|
||||
{
|
||||
NVSWITCH_PRINT(device, INFO, "no OMS object found, rc:%d\n", status);
|
||||
return NVL_SUCCESS;
|
||||
}
|
||||
|
||||
if (!INFOROM_OBJECT_SUBVERSION_SUPPORTS_NVSWITCH(subversion))
|
||||
{
|
||||
NVSWITCH_PRINT(device, WARN, "OMS v%u.%u not supported\n",
|
||||
version, subversion);
|
||||
return -NVL_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
NVSWITCH_PRINT(device, INFO, "OMS v%u.%u found\n", version, subversion);
|
||||
|
||||
pOmsState = nvswitch_os_malloc(sizeof(INFOROM_OMS_STATE));
|
||||
if (pOmsState == NULL)
|
||||
{
|
||||
return -NVL_NO_MEM;
|
||||
}
|
||||
nvswitch_os_memset(pOmsState, 0, sizeof(INFOROM_OMS_STATE));
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
pOmsState->pFmt = INFOROM_OMS_OBJECT_V1S_FMT;
|
||||
pOmsState->pPackedObject = nvswitch_os_malloc(INFOROM_OMS_OBJECT_V1_PACKED_SIZE);
|
||||
if (pOmsState->pPackedObject == NULL)
|
||||
{
|
||||
status = -NVL_NO_MEM;
|
||||
goto nvswitch_inforom_oms_version_fail;
|
||||
}
|
||||
|
||||
pOmsState->pOms = nvswitch_os_malloc(sizeof(INFOROM_OMS_OBJECT));
|
||||
if (pOmsState->pOms == NULL)
|
||||
{
|
||||
status = -NVL_NO_MEM;
|
||||
nvswitch_os_free(pOmsState->pPackedObject);
|
||||
goto nvswitch_inforom_oms_version_fail;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
NVSWITCH_PRINT(device, WARN, "OMS v%u.%u not supported\n",
|
||||
version, subversion);
|
||||
goto nvswitch_inforom_oms_version_fail;
|
||||
break;
|
||||
}
|
||||
|
||||
status = nvswitch_inforom_load_object(device, pInforom, "OMS",
|
||||
pOmsState->pFmt,
|
||||
pOmsState->pPackedObject,
|
||||
pOmsState->pOms);
|
||||
if (status != NVL_SUCCESS)
|
||||
{
|
||||
NVSWITCH_PRINT(device, ERROR, "Failed to load OMS object, rc: %d\n",
|
||||
status);
|
||||
goto nvswitch_inforom_oms_load_fail;
|
||||
}
|
||||
|
||||
pInforom->pOmsState = pOmsState;
|
||||
|
||||
device->hal.nvswitch_initialize_oms_state(device, pOmsState);
|
||||
|
||||
return NVL_SUCCESS;
|
||||
|
||||
nvswitch_inforom_oms_load_fail:
|
||||
nvswitch_os_free(pOmsState->pOms);
|
||||
nvswitch_os_free(pOmsState->pPackedObject);
|
||||
nvswitch_inforom_oms_version_fail:
|
||||
nvswitch_os_free(pOmsState);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
void
|
||||
nvswitch_inforom_oms_unload
|
||||
(
|
||||
nvswitch_device *device
|
||||
)
|
||||
{
|
||||
struct inforom *pInforom = device->pInforom;
|
||||
INFOROM_OMS_STATE *pOmsState;
|
||||
NvlStatus status;
|
||||
|
||||
if (pInforom == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pOmsState = pInforom->pOmsState;
|
||||
if (pOmsState == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
(void)device->hal.nvswitch_read_oob_blacklist_state(device);
|
||||
status = device->hal.nvswitch_oms_inforom_flush(device);
|
||||
if (status != NVL_SUCCESS)
|
||||
{
|
||||
NVSWITCH_PRINT(device, ERROR,
|
||||
"Flushing OMS failed during unload, rc:%d\n", status);
|
||||
}
|
||||
|
||||
nvswitch_os_free(pOmsState->pPackedObject);
|
||||
nvswitch_os_free(pOmsState->pOms);
|
||||
nvswitch_os_free(pOmsState);
|
||||
pInforom->pOmsState = NULL;
|
||||
}
|
||||
84
src/common/nvswitch/kernel/inforom/ifrro_nvswitch.c
Normal file
84
src/common/nvswitch/kernel/inforom/ifrro_nvswitch.c
Normal file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2020 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "common_nvswitch.h"
|
||||
#include "inforom/inforom_nvswitch.h"
|
||||
|
||||
NvlStatus
|
||||
nvswitch_inforom_read_only_objects_load
|
||||
(
|
||||
nvswitch_device *device
|
||||
)
|
||||
{
|
||||
NvlStatus status;
|
||||
struct inforom *pInforom = device->pInforom;
|
||||
|
||||
if (pInforom == NULL)
|
||||
{
|
||||
return -NVL_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
status = nvswitch_inforom_load_object(device, pInforom, "OBD",
|
||||
INFOROM_OBD_OBJECT_V1_XX_FMT,
|
||||
pInforom->OBD.packedObject,
|
||||
&pInforom->OBD.object);
|
||||
if (status != NVL_SUCCESS)
|
||||
{
|
||||
NVSWITCH_PRINT(device, ERROR, "Failed to load OBD object, rc:%d\n",
|
||||
status);
|
||||
}
|
||||
else
|
||||
{
|
||||
pInforom->OBD.bValid = NV_TRUE;
|
||||
}
|
||||
|
||||
status = nvswitch_inforom_load_object(device, pInforom, "OEM",
|
||||
INFOROM_OEM_OBJECT_V1_00_FMT,
|
||||
pInforom->OEM.packedObject,
|
||||
&pInforom->OEM.object);
|
||||
if (status != NVL_SUCCESS)
|
||||
{
|
||||
NVSWITCH_PRINT(device, ERROR, "Failed to load OEM object, rc:%d\n",
|
||||
status);
|
||||
}
|
||||
else
|
||||
{
|
||||
pInforom->OEM.bValid = NV_TRUE;
|
||||
}
|
||||
|
||||
status = nvswitch_inforom_load_object(device, pInforom, "IMG",
|
||||
INFOROM_IMG_OBJECT_V1_00_FMT,
|
||||
pInforom->IMG.packedObject,
|
||||
&pInforom->IMG.object);
|
||||
if (status != NVL_SUCCESS)
|
||||
{
|
||||
NVSWITCH_PRINT(device, ERROR, "Failed to load IMG object, rc:%d\n",
|
||||
status);
|
||||
}
|
||||
else
|
||||
{
|
||||
pInforom->IMG.bValid = NV_TRUE;
|
||||
}
|
||||
|
||||
return NVL_SUCCESS;
|
||||
}
|
||||
1181
src/common/nvswitch/kernel/inforom/inforom_nvswitch.c
Normal file
1181
src/common/nvswitch/kernel/inforom/inforom_nvswitch.c
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user