Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 64c83d82 authored by Zhen Kong's avatar Zhen Kong
Browse files

firmware: qcom: add shared memory bridge support for tz_log driver



add shared memory bridge support for tz_log driver.

Change-Id: I07eebf388000809cdf0cce472215cd9d02e364af
Signed-off-by: default avatarZhen Kong <zkong@codeaurora.org>
parent dc8ae713
Loading
Loading
Loading
Loading
+8 −8
Original line number Original line Diff line number Diff line
@@ -20,6 +20,7 @@


#include <soc/qcom/scm.h>
#include <soc/qcom/scm.h>
#include <soc/qcom/qseecomi.h>
#include <soc/qcom/qseecomi.h>
#include <soc/qcom/qtee_shmbridge.h>


/* QSEE_LOG_BUF_SIZE = 32K */
/* QSEE_LOG_BUF_SIZE = 32K */
#define QSEE_LOG_BUF_SIZE 0x8000
#define QSEE_LOG_BUF_SIZE 0x8000
@@ -319,6 +320,7 @@ static struct tzdbg tzdbg = {
static struct tzdbg_log_t *g_qsee_log;
static struct tzdbg_log_t *g_qsee_log;
static dma_addr_t coh_pmem;
static dma_addr_t coh_pmem;
static uint32_t debug_rw_buf_size;
static uint32_t debug_rw_buf_size;
static struct qtee_shm shm;


/*
/*
 * Debugfs data structure and functions
 * Debugfs data structure and functions
@@ -856,14 +858,13 @@ static void tzdbg_register_qsee_log_buf(struct platform_device *pdev)
	void *buf = NULL;
	void *buf = NULL;


	len = QSEE_LOG_BUF_SIZE;
	len = QSEE_LOG_BUF_SIZE;
	buf = dma_alloc_coherent(&pdev->dev, len, &coh_pmem, GFP_KERNEL);
	ret = qtee_shmbridge_allocate_shm(len, &shm);
	if (buf == NULL) {
	if (ret)
		pr_err("Failed to alloc memory for size %zu\n", len);
		return;
		return;
	}
	buf = shm.vaddr;
	coh_pmem = shm.paddr;


	g_qsee_log = (struct tzdbg_log_t *)buf;
	g_qsee_log = (struct tzdbg_log_t *)buf;

	desc.args[0] = coh_pmem;
	desc.args[0] = coh_pmem;
	desc.args[1] = len;
	desc.args[1] = len;
	desc.arginfo = 0x22;
	desc.arginfo = 0x22;
@@ -886,7 +887,7 @@ static void tzdbg_register_qsee_log_buf(struct platform_device *pdev)
	return;
	return;


err:
err:
	dma_free_coherent(&pdev->dev, len, (void *)g_qsee_log, coh_pmem);
	qtee_shmbridge_free_shm(&shm);
}
}


static int  tzdbgfs_init(struct platform_device *pdev)
static int  tzdbgfs_init(struct platform_device *pdev)
@@ -933,8 +934,7 @@ static void tzdbgfs_exit(struct platform_device *pdev)
	dent_dir = platform_get_drvdata(pdev);
	dent_dir = platform_get_drvdata(pdev);
	debugfs_remove_recursive(dent_dir);
	debugfs_remove_recursive(dent_dir);
	if (g_qsee_log)
	if (g_qsee_log)
		dma_free_coherent(&pdev->dev, QSEE_LOG_BUF_SIZE,
		qtee_shmbridge_free_shm(&shm);
					 (void *)g_qsee_log, coh_pmem);
}
}


static int __update_hypdbg_base(struct platform_device *pdev,
static int __update_hypdbg_base(struct platform_device *pdev,