Files
linux-nv-oot/drivers/video/tegra/tsec/tsec_boot.h
spatki 9a57665a0f tsec: Add support for t264 fw init
This change adds the support for programming streamids to
allow tsec fw on t264 to access PA at a low privilege level.
It also includes the synchronization logic to communicate
with the fw regarding completion of stream id programming
so that the fw can go ahead and initialize itself.

In addition to this, the mailbox used for communicating init done
from tsec fw to ccplex is changed from NV_PTSEC_FALCON_MAILBOX0 to
NV_PTSEC_MAILBOX1 since CCPLEX does not have access to the former from
t26x onwards. Hence falcon based mailboxes are used for tsec-psc comms
and non-falcon ones for tsec-ccplex comms (stream id comms and init done).

Jira TSEC-14

Change-Id: I2871a52222cd69786a8cc3f53162a80486611bb5
Signed-off-by: Sahil Patki <spatki@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3366343
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
(cherry picked from commit db54fde9c4d786b22b7f8694753de3ec80649b17)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3400219
2025-07-24 10:20:36 +00:00

91 lines
2.2 KiB
C

// SPDX-License-Identifier: GPL-2.0-only
/*
* SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*
* Tegra TSEC Module Support
*/
#ifndef TSEC_BOOT_H
#define TSEC_BOOT_H
#define RISCV_IDLE_TIMEOUT_DEFAULT 100000 /* 100 milliseconds */
#define RISCV_IDLE_TIMEOUT_LONG 2000000 /* 2 seconds */
#define RISCV_IDLE_CHECK_PERIOD 10 /* 10 usec */
#define RISCV_IDLE_CHECK_PERIOD_LONG 1000 /* 1 milliseconds */
/* TSEC RISCV boot status values */
#define TSEC_RISCV_INIT_SUCCESS (0xa5a5a5a5)
#define TSEC_RISCV_SMMU_STREAMID1 BIT_ULL(40)
#define TSEC_RISCV_STREAMID_SET_DONE (0xa6a6a6a6)
/* Image descriptor format */
struct RM_RISCV_UCODE_DESC {
/*
* Version 1
* Version 2
* Vesrion 3 = for Partition boot
* Vesrion 4 = for eb riscv boot
*/
u32 version; /* structure version */
u32 bootloaderOffset;
u32 bootloaderSize;
u32 bootloaderParamOffset;
u32 bootloaderParamSize;
u32 riscvElfOffset;
u32 riscvElfSize;
u32 appVersion; /* Changelist number associated with the image */
/*
* Manifest contains information about Monitor and it is
* input to BR
*/
u32 manifestOffset;
u32 manifestSize;
/*
* Monitor Data offset within RISCV image and size
*/
u32 monitorDataOffset;
u32 monitorDataSize;
/*
* Monitor Code offset withtin RISCV image and size
*/
u32 monitorCodeOffset;
u32 monitorCodeSize;
u32 bIsMonitorEnabled;
/*
* Swbrom Code offset within RISCV image and size
*/
u32 swbromCodeOffset;
u32 swbromCodeSize;
/*
* Swbrom Data offset within RISCV image and size
*/
u32 swbromDataOffset;
u32 swbromDataSize;
};
struct riscv_image_desc {
u32 manifest_offset;
u32 manifest_size;
u32 data_offset;
u32 data_size;
u32 code_offset;
u32 code_size;
};
struct riscv_data {
bool valid;
struct riscv_image_desc desc;
dma_addr_t backdoor_img_iova;
u32 *backdoor_img_va;
size_t backdoor_img_size;
bool ipc_mem_initialised;
void __iomem *ipc_co_va;
dma_addr_t ipc_co_iova;
};
int tsec_kickoff_boot(struct platform_device *pdev);
int tsec_finalize_poweron(struct platform_device *dev);
int tsec_prepare_poweroff(struct platform_device *dev);
#endif /* TSEC_BOOT_H */