This commit is contained in:
Andy Ritger
2022-11-10 08:39:33 -08:00
parent 7c345b838b
commit 758b4ee818
1323 changed files with 262135 additions and 60754 deletions

View File

@@ -22,19 +22,8 @@
*/
#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
@@ -46,7 +35,15 @@ nvswitch_inforom_bbx_add_sxid
NvU32 data2
)
{
return -NVL_ERR_NOT_SUPPORTED;
NvlStatus status;
status = device->hal.nvswitch_bbx_add_sxid(device, exceptionType, data0, data1, data2);
if (status != NVL_SUCCESS)
{
NVSWITCH_PRINT(device, ERROR, "nvswitch_inforom_bbx_add_sxid failed, status=%d\n", status);
}
return status;
}
void
@@ -55,6 +52,14 @@ nvswitch_inforom_bbx_unload
nvswitch_device *device
)
{
NvlStatus status;
status = device->hal.nvswitch_bbx_unload(device);
if (status != NVL_SUCCESS)
{
NVSWITCH_PRINT(device, ERROR, "nvswitch_inforom_bbx_unload failed, status=%d\n", status);
}
return;
}
@@ -64,7 +69,47 @@ nvswitch_inforom_bbx_load
nvswitch_device *device
)
{
return -NVL_ERR_NOT_SUPPORTED;
NvlStatus status;
NvU64 time_ns = 0;
NvU32 majorVer;
NvU32 minorVer;
NvU32 buildNum;
NvU8 osType;
NvU32 osVersion;
osType = INFOROM_BBX_OBJ_V1_00_SYSTEM_OS_TYPE_UNIX;
status = nvswitch_os_get_os_version(&majorVer, &minorVer, &buildNum);
if (status != NVL_SUCCESS)
{
NVSWITCH_PRINT(device, ERROR,
"%s: Failed to get OS version, status=%d\n",
__FUNCTION__, status);
return status;
}
if ((majorVer > 0xff) || (minorVer > 0xff) || (buildNum > 0xffff))
{
NVSWITCH_PRINT(device, ERROR,
"Unexpected OS versions found. majorVer: 0x%x minorVer: 0x%x buildNum: 0x%x\n",
majorVer, minorVer, buildNum);
return -NVL_ERR_NOT_SUPPORTED;;
}
osVersion =
REF_NUM(INFOROM_BBX_OBJ_V1_00_SYSTEM_OS_MAJOR, majorVer) |
REF_NUM(INFOROM_BBX_OBJ_V1_00_SYSTEM_OS_MINOR, minorVer) |
REF_NUM(INFOROM_BBX_OBJ_V1_00_SYSTEM_OS_BUILD, buildNum);
time_ns = nvswitch_os_get_platform_time_epoch();
status = device->hal.nvswitch_bbx_load(device, time_ns, osType, osVersion);
if (status != NVL_SUCCESS)
{
NVSWITCH_PRINT(device, ERROR, "nvswitch_inforom_bbx_load failed, status=%d\n", status);
}
return status;
}
NvlStatus
@@ -74,5 +119,14 @@ nvswitch_inforom_bbx_get_sxid
NVSWITCH_GET_SXIDS_PARAMS *params
)
{
return -NVL_ERR_NOT_SUPPORTED;
NvlStatus status;
status = device->hal.nvswitch_bbx_get_sxid(device, params);
if (status != NVL_SUCCESS)
{
NVSWITCH_PRINT(device, ERROR, "nvswitch_inforom_bbx_load failed, status=%d\n", status);
}
return status;
}

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2019-2020 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-FileCopyrightText: Copyright (c) 2019-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: MIT
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -36,7 +36,6 @@
// Interface functions
static NvlStatus _nvswitch_inforom_unpack_object(const char *, NvU8 *, NvU32 *);
static NvlStatus _nvswitch_inforom_pack_object(const char *, NvU32 *, NvU8 *);
static void _nvswitch_inforom_string_copy(inforom_U008 *pSrc, NvU8 *pDst, NvU32 size);
static NvlStatus _nvswitch_inforom_read_file(nvswitch_device *device,
const char objectName[INFOROM_FS_FILE_NAME_SIZE],
NvU32 packedObjectSize, NvU8 *pPackedObject);
@@ -45,31 +44,6 @@ static NvlStatus _nvswitch_inforom_write_file(nvswitch_device *device,
NvU32 packedObjectSize,
NvU8 *pPackedObject);
/*!
* Interface to copy string of inforom object.
* inforom_U008 is NvU32, and we use 0xff bits to store the character.
* Therefore we need a special copy API.
*
* @param[in] pSrc Source pointer
* @param[out] pDst Destination pointer
* @param[in] length Length of the string
*/
static void
_nvswitch_inforom_string_copy
(
inforom_U008 *pSrc,
NvU8 *pDst,
NvU32 length
)
{
NvU32 i;
for (i = 0; i < length; ++i)
{
pDst[i] = (NvU8)(pSrc[i] & 0xff);
}
}
static NvlStatus
_nvswitch_inforom_calc_packed_object_size
(
@@ -337,6 +311,31 @@ _nvswitch_inforom_pack_object
return NVL_SUCCESS;
}
/*!
* Interface to copy string of inforom object.
* inforom_U008 is NvU32, and we use 0xff bits to store the character.
* Therefore we need a special copy API.
*
* @param[in] pSrc Source pointer
* @param[out] pDst Destination pointer
* @param[in] length Length of the string
*/
void
nvswitch_inforom_string_copy
(
inforom_U008 *pSrc,
NvU8 *pDst,
NvU32 length
)
{
NvU32 i;
for (i = 0; i < length; ++i)
{
pDst[i] = (NvU8)(pSrc[i] & 0xff);
}
}
/*!
* Read and unpack an object from the InfoROM filesystem.
*
@@ -494,7 +493,7 @@ _nvswitch_inforom_read_file
nvswitch_os_memset(pDmaBuf, 0, transferSize);
cmdSeqDesc = 0;
nvswitch_timeout_create(NVSWITCH_INTERVAL_5MSEC_IN_NS * 100, &timeout);
nvswitch_timeout_create(NVSWITCH_INTERVAL_750MSEC_IN_NS, &timeout);
status = flcnQueueCmdPostBlocking(device, pFlcn, (PRM_FLCN_CMD)&soeCmd, NULL, NULL,
SOE_RM_CMDQ_LOG_ID, &cmdSeqDesc, &timeout);
if (status != NV_OK)
@@ -592,7 +591,7 @@ _nvswitch_inforom_write_file
}
cmdSeqDesc = 0;
nvswitch_timeout_create(NVSWITCH_INTERVAL_5MSEC_IN_NS * 100, &timeout);
nvswitch_timeout_create(NVSWITCH_INTERVAL_750MSEC_IN_NS, &timeout);
status = flcnQueueCmdPostBlocking(device, pFlcn, (PRM_FLCN_CMD)&soeCmd, NULL, NULL,
SOE_RM_CMDQ_LOG_ID, &cmdSeqDesc, &timeout);
if (status != NV_OK)
@@ -938,11 +937,11 @@ nvswitch_inforom_read_static_data
{
pData->OBD.bValid = NV_TRUE;
pData->OBD.buildDate = (NvU32)pInforom->OBD.object.buildDate;
_nvswitch_inforom_string_copy(pInforom->OBD.object.marketingName,
nvswitch_inforom_string_copy(pInforom->OBD.object.marketingName,
pData->OBD.marketingName,
NV_ARRAY_ELEMENTS(pData->OBD.marketingName));
_nvswitch_inforom_string_copy(pInforom->OBD.object.serialNumber,
nvswitch_inforom_string_copy(pInforom->OBD.object.serialNumber,
pData->OBD.serialNum,
NV_ARRAY_ELEMENTS(pData->OBD.serialNum));
@@ -956,7 +955,7 @@ nvswitch_inforom_read_static_data
if (pInforom->OEM.bValid)
{
pData->OEM.bValid = NV_TRUE;
_nvswitch_inforom_string_copy(pInforom->OEM.object.oemInfo,
nvswitch_inforom_string_copy(pInforom->OEM.object.oemInfo,
pData->OEM.oemInfo,
NV_ARRAY_ELEMENTS(pData->OEM.oemInfo));
}
@@ -964,7 +963,7 @@ nvswitch_inforom_read_static_data
if (pInforom->IMG.bValid)
{
pData->IMG.bValid = NV_TRUE;
_nvswitch_inforom_string_copy(pInforom->IMG.object.version,
nvswitch_inforom_string_copy(pInforom->IMG.object.version,
pData->IMG.inforomVer,
NV_ARRAY_ELEMENTS(pData->IMG.inforomVer));
}
@@ -1144,7 +1143,7 @@ nvswitch_initialize_inforom_objects
status);
}
status = nvswitch_inforom_dem_load(device);
status = device->hal.nvswitch_smbpbi_dem_load(device);
if (status != NVL_SUCCESS)
{
NVSWITCH_PRINT(device, INFO, "Failed to load DEM object, rc: %d\n",