#include "priv.h"
#include <core/pci.h>
#include <subdev/timer.h>
#include <subdev/vfn.h>
#include <engine/fifo/chan.h>
#include <engine/sec2.h>
#include <nvfw/fw.h>
#include <nvrm/nvtypes.h>
#include <nvrm/535.113.01/common/sdk/nvidia/inc/class/cl0000.h>
#include <nvrm/535.113.01/common/sdk/nvidia/inc/class/cl0005.h>
#include <nvrm/535.113.01/common/sdk/nvidia/inc/class/cl0080.h>
#include <nvrm/535.113.01/common/sdk/nvidia/inc/class/cl2080.h>
#include <nvrm/535.113.01/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080event.h>
#include <nvrm/535.113.01/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080gpu.h>
#include <nvrm/535.113.01/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080internal.h>
#include <nvrm/535.113.01/common/sdk/nvidia/inc/nvos.h>
#include <nvrm/535.113.01/common/shared/msgq/inc/msgq/msgq_priv.h>
#include <nvrm/535.113.01/common/uproc/os/common/include/libos_init_args.h>
#include <nvrm/535.113.01/nvidia/arch/nvalloc/common/inc/gsp/gsp_fw_sr_meta.h>
#include <nvrm/535.113.01/nvidia/arch/nvalloc/common/inc/gsp/gsp_fw_wpr_meta.h>
#include <nvrm/535.113.01/nvidia/arch/nvalloc/common/inc/rmRiscvUcode.h>
#include <nvrm/535.113.01/nvidia/arch/nvalloc/common/inc/rmgspseq.h>
#include <nvrm/535.113.01/nvidia/generated/g_allclasses.h>
#include <nvrm/535.113.01/nvidia/generated/g_os_nvoc.h>
#include <nvrm/535.113.01/nvidia/generated/g_rpc-structures.h>
#include <nvrm/535.113.01/nvidia/inc/kernel/gpu/gsp/gsp_fw_heap.h>
#include <nvrm/535.113.01/nvidia/inc/kernel/gpu/gsp/gsp_init_args.h>
#include <nvrm/535.113.01/nvidia/inc/kernel/gpu/gsp/gsp_static_config.h>
#include <nvrm/535.113.01/nvidia/inc/kernel/gpu/intr/engine_idx.h>
#include <nvrm/535.113.01/nvidia/kernel/inc/vgpu/rpc_global_enums.h>
#include <linux/acpi.h>
#include <linux/ctype.h>
#include <linux/parser.h>
#define GSP_MSG_MIN_SIZE …
#define GSP_MSG_MAX_SIZE …
struct r535_gsp_msg { … };
#define GSP_MSG_HDR_SIZE …
static int
r535_rpc_status_to_errno(uint32_t rpc_status)
{ … }
static void *
r535_gsp_msgq_wait(struct nvkm_gsp *gsp, u32 repc, u32 *prepc, int *ptime)
{ … }
static void *
r535_gsp_msgq_recv(struct nvkm_gsp *gsp, u32 repc, int *ptime)
{ … }
static int
r535_gsp_cmdq_push(struct nvkm_gsp *gsp, void *argv)
{ … }
static void *
r535_gsp_cmdq_get(struct nvkm_gsp *gsp, u32 argc)
{ … }
struct nvfw_gsp_rpc { … };
static void
r535_gsp_msg_done(struct nvkm_gsp *gsp, struct nvfw_gsp_rpc *msg)
{ … }
static void
r535_gsp_msg_dump(struct nvkm_gsp *gsp, struct nvfw_gsp_rpc *msg, int lvl)
{ … }
static struct nvfw_gsp_rpc *
r535_gsp_msg_recv(struct nvkm_gsp *gsp, int fn, u32 repc)
{ … }
static int
r535_gsp_msg_ntfy_add(struct nvkm_gsp *gsp, u32 fn, nvkm_gsp_msg_ntfy_func func, void *priv)
{ … }
static int
r535_gsp_rpc_poll(struct nvkm_gsp *gsp, u32 fn)
{ … }
static void *
r535_gsp_rpc_send(struct nvkm_gsp *gsp, void *argv, bool wait, u32 repc)
{ … }
static void
r535_gsp_event_dtor(struct nvkm_gsp_event *event)
{ … }
static int
r535_gsp_device_event_get(struct nvkm_gsp_event *event)
{ … }
static int
r535_gsp_device_event_ctor(struct nvkm_gsp_device *device, u32 handle, u32 id,
nvkm_gsp_event_func func, struct nvkm_gsp_event *event)
{ … }
static void
r535_gsp_device_dtor(struct nvkm_gsp_device *device)
{ … }
static int
r535_gsp_subdevice_ctor(struct nvkm_gsp_device *device)
{ … }
static int
r535_gsp_device_ctor(struct nvkm_gsp_client *client, struct nvkm_gsp_device *device)
{ … }
static void
r535_gsp_client_dtor(struct nvkm_gsp_client *client)
{ … }
static int
r535_gsp_client_ctor(struct nvkm_gsp *gsp, struct nvkm_gsp_client *client)
{ … }
static int
r535_gsp_rpc_rm_free(struct nvkm_gsp_object *object)
{ … }
static void
r535_gsp_rpc_rm_alloc_done(struct nvkm_gsp_object *object, void *repv)
{ … }
static void *
r535_gsp_rpc_rm_alloc_push(struct nvkm_gsp_object *object, void *argv, u32 repc)
{ … }
static void *
r535_gsp_rpc_rm_alloc_get(struct nvkm_gsp_object *object, u32 oclass, u32 argc)
{ … }
static void
r535_gsp_rpc_rm_ctrl_done(struct nvkm_gsp_object *object, void *repv)
{ … }
static int
r535_gsp_rpc_rm_ctrl_push(struct nvkm_gsp_object *object, void **argv, u32 repc)
{ … }
static void *
r535_gsp_rpc_rm_ctrl_get(struct nvkm_gsp_object *object, u32 cmd, u32 argc)
{ … }
static void
r535_gsp_rpc_done(struct nvkm_gsp *gsp, void *repv)
{ … }
static void *
r535_gsp_rpc_get(struct nvkm_gsp *gsp, u32 fn, u32 argc)
{ … }
static void *
r535_gsp_rpc_push(struct nvkm_gsp *gsp, void *argv, bool wait, u32 repc)
{ … }
const struct nvkm_gsp_rm
r535_gsp_rm = …;
static void
r535_gsp_msgq_work(struct work_struct *work)
{ … }
static irqreturn_t
r535_gsp_intr(struct nvkm_inth *inth)
{ … }
static int
r535_gsp_intr_get_table(struct nvkm_gsp *gsp)
{ … }
static int
r535_gsp_rpc_get_gsp_static_info(struct nvkm_gsp *gsp)
{ … }
static void
nvkm_gsp_mem_dtor(struct nvkm_gsp *gsp, struct nvkm_gsp_mem *mem)
{ … }
static int
nvkm_gsp_mem_ctor(struct nvkm_gsp *gsp, size_t size, struct nvkm_gsp_mem *mem)
{ … }
static int
r535_gsp_postinit(struct nvkm_gsp *gsp)
{ … }
static int
r535_gsp_rpc_unloading_guest_driver(struct nvkm_gsp *gsp, bool suspend)
{ … }
enum registry_type { … };
#define REGISTRY_MAX_KEY_LENGTH …
struct registry_list_entry { … };
static int add_registry(struct nvkm_gsp *gsp, const char *key,
enum registry_type type, const void *data, size_t length)
{ … }
static int add_registry_num(struct nvkm_gsp *gsp, const char *key, u32 value)
{ … }
static int add_registry_string(struct nvkm_gsp *gsp, const char *key, const char *value)
{ … }
static void build_registry(struct nvkm_gsp *gsp, PACKED_REGISTRY_TABLE *registry)
{ … }
static void clean_registry(struct nvkm_gsp *gsp)
{ … }
MODULE_PARM_DESC(…) …;
static char *NVreg_RegistryDwords;
module_param(NVreg_RegistryDwords, charp, 0400);
struct nv_gsp_registry_entries { … };
static const struct nv_gsp_registry_entries r535_registry_entries[] = …;
#define NV_GSP_REG_NUM_ENTRIES …
static size_t strip(char *s, const char *reject)
{ … }
static int
r535_gsp_rpc_set_registry(struct nvkm_gsp *gsp)
{ … }
#if defined(CONFIG_ACPI) && defined(CONFIG_X86)
static void
r535_gsp_acpi_caps(acpi_handle handle, CAPS_METHOD_DATA *caps)
{ … }
static void
r535_gsp_acpi_jt(acpi_handle handle, JT_METHOD_DATA *jt)
{ … }
static void
r535_gsp_acpi_mux_id(acpi_handle handle, u32 id, MUX_METHOD_DATA_ELEMENT *mode,
MUX_METHOD_DATA_ELEMENT *part)
{ … }
static void
r535_gsp_acpi_mux(acpi_handle handle, DOD_METHOD_DATA *dod, MUX_METHOD_DATA *mux)
{ … }
static void
r535_gsp_acpi_dod(acpi_handle handle, DOD_METHOD_DATA *dod)
{ … }
#endif
static void
r535_gsp_acpi_info(struct nvkm_gsp *gsp, ACPI_METHOD_DATA *acpi)
{ … }
static int
r535_gsp_rpc_set_system_info(struct nvkm_gsp *gsp)
{ … }
static int
r535_gsp_msg_os_error_log(void *priv, u32 fn, void *repv, u32 repc)
{ … }
static int
r535_gsp_msg_rc_triggered(void *priv, u32 fn, void *repv, u32 repc)
{ … }
static int
r535_gsp_msg_mmu_fault_queued(void *priv, u32 fn, void *repv, u32 repc)
{ … }
static int
r535_gsp_msg_post_event(void *priv, u32 fn, void *repv, u32 repc)
{ … }
static int
r535_gsp_msg_run_cpu_sequencer(void *priv, u32 fn, void *repv, u32 repc)
{ … }
static int
r535_gsp_booter_unload(struct nvkm_gsp *gsp, u32 mbox0, u32 mbox1)
{ … }
static int
r535_gsp_booter_load(struct nvkm_gsp *gsp, u32 mbox0, u32 mbox1)
{ … }
static int
r535_gsp_wpr_meta_init(struct nvkm_gsp *gsp)
{ … }
static int
r535_gsp_shared_init(struct nvkm_gsp *gsp)
{ … }
static int
r535_gsp_rmargs_init(struct nvkm_gsp *gsp, bool resume)
{ … }
static inline u64
r535_gsp_libos_id8(const char *name)
{ … }
static void create_pte_array(u64 *ptes, dma_addr_t addr, size_t size)
{ … }
static int
r535_gsp_libos_init(struct nvkm_gsp *gsp)
{ … }
void
nvkm_gsp_sg_free(struct nvkm_device *device, struct sg_table *sgt)
{ … }
int
nvkm_gsp_sg(struct nvkm_device *device, u64 size, struct sg_table *sgt)
{ … }
static void
nvkm_gsp_radix3_dtor(struct nvkm_gsp *gsp, struct nvkm_gsp_radix3 *rx3)
{ … }
static int
nvkm_gsp_radix3_sg(struct nvkm_gsp *gsp, struct sg_table *sgt, u64 size,
struct nvkm_gsp_radix3 *rx3)
{ … }
int
r535_gsp_fini(struct nvkm_gsp *gsp, bool suspend)
{ … }
int
r535_gsp_init(struct nvkm_gsp *gsp)
{ … }
static int
r535_gsp_rm_boot_ctor(struct nvkm_gsp *gsp)
{ … }
static const struct nvkm_firmware_func
r535_gsp_fw = …;
static int
r535_gsp_elf_section(struct nvkm_gsp *gsp, const char *name, const u8 **pdata, u64 *psize)
{ … }
static void
r535_gsp_dtor_fws(struct nvkm_gsp *gsp)
{ … }
void
r535_gsp_dtor(struct nvkm_gsp *gsp)
{ … }
int
r535_gsp_oneinit(struct nvkm_gsp *gsp)
{ … }
static int
r535_gsp_load_fw(struct nvkm_gsp *gsp, const char *name, const char *ver,
const struct firmware **pfw)
{ … }
int
r535_gsp_load(struct nvkm_gsp *gsp, int ver, const struct nvkm_gsp_fwif *fwif)
{ … }
#define NVKM_GSP_FIRMWARE(chip) …
NVKM_GSP_FIRMWARE(…);
NVKM_GSP_FIRMWARE(…);
NVKM_GSP_FIRMWARE(…);
NVKM_GSP_FIRMWARE(…);
NVKM_GSP_FIRMWARE(…);
NVKM_GSP_FIRMWARE(…);
NVKM_GSP_FIRMWARE(…);
NVKM_GSP_FIRMWARE(…);
NVKM_GSP_FIRMWARE(…);
NVKM_GSP_FIRMWARE(…);
NVKM_GSP_FIRMWARE(…);
NVKM_GSP_FIRMWARE(…);
NVKM_GSP_FIRMWARE(…);
NVKM_GSP_FIRMWARE(…);
NVKM_GSP_FIRMWARE(…);
NVKM_GSP_FIRMWARE(…);