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

Commit 55bb5269 authored by Gilad Broner's avatar Gilad Broner
Browse files

media: mpq: sdmx: use 32 bit for physical address



As trustzone only supports 32 bit for physical addressing,
qseecom by its current design can also only pass 32 bit addresses.
This mandates the secure demux wrapper api code to convert addresses
from 64 bit and truncate those to 32 bits.
Truncation in this case is safe as memory is always allocated from
heaps intended to be used by TZ and therefore are actually 32 bit.
This change can be reverted in the future when TZ supports 64bit
physical addresses.
As the API changed, a matching version of secure demux application
is required on TZ side, so major version check was updated.

Change-Id: I7a6bce4b9968e19dffe9d2ac1f5785126400f5bc
Signed-off-by: default avatarGilad Broner <gbroner@codeaurora.org>
parent df5046b7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -19,7 +19,7 @@
#include "mpq_dmx_plugin_common.h"
#include "mpq_sdmx.h"

#define SDMX_MAJOR_VERSION_MATCH	(5)
#define SDMX_MAJOR_VERSION_MATCH	(6)

/* Length of mandatory fields that must exist in header of video PES */
#define PES_MANDATORY_FIELDS_LEN			9
+38 −15
Original line number Diff line number Diff line
/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -46,11 +46,27 @@ enum sdmx_cmd_id {

#pragma pack(push, sdmx, 1)

struct __sdmx_buff_descr {
	/* 32bit Physical address where buffer starts */
	u32 base_addr;

	/* Size of buffer */
	u32 size;
};

struct __sdmx_data_buff_descr {
	/* 32bit Physical chunks of the buffer */
	struct __sdmx_buff_descr buff_chunks[SDMX_MAX_PHYSICAL_CHUNKS];

	/* Length of buffer */
	u32 length;
};

struct sdmx_proc_req {
	enum sdmx_cmd_id cmd_id;
	u32 session_handle;
	u8 flags;
	struct sdmx_buff_descr in_buf_descr;
	struct __sdmx_buff_descr in_buf_descr;
	u32 inp_fill_cnt;
	u32 in_rd_offset;
	u32 num_filters;
@@ -113,12 +129,12 @@ struct sdmx_add_filt_req {
	u32 session_handle;
	u32 pid;
	enum sdmx_filter filter_type;
	struct sdmx_buff_descr meta_data_buf;
	struct __sdmx_buff_descr meta_data_buf;
	enum sdmx_buf_mode buffer_mode;
	enum sdmx_raw_out_format ts_out_format;
	u32 flags;
	u32 num_data_bufs;
	struct sdmx_data_buff_descr data_bufs[];
	struct __sdmx_data_buff_descr data_bufs[];
};

struct sdmx_add_filt_rsp {
@@ -501,7 +517,7 @@ int sdmx_add_filter(int session_handle,
	enum sdmx_raw_out_format ts_out_format,
	u32 flags)
{
	int res, cmd_len, rsp_len;
	int res, cmd_len, rsp_len, i, j;
	struct sdmx_add_filt_req *cmd;
	struct sdmx_add_filt_rsp *rsp;
	enum sdmx_status ret;
@@ -511,7 +527,7 @@ int sdmx_add_filter(int session_handle,
		return SDMX_STATUS_INVALID_INPUT_PARAMS;

	cmd_len = sizeof(struct sdmx_add_filt_req)
		+ num_data_bufs * sizeof(struct sdmx_data_buff_descr);
		+ num_data_bufs * sizeof(struct __sdmx_data_buff_descr);
	rsp_len = sizeof(struct sdmx_add_filt_rsp);

	/* Will be later overridden by SDMX response */
@@ -533,17 +549,24 @@ int sdmx_add_filter(int session_handle,
	cmd->filter_type = filterype;
	cmd->ts_out_format = ts_out_format;
	cmd->flags = flags;
	if (meta_data_buf != NULL)
		memcpy(&(cmd->meta_data_buf), meta_data_buf,
			sizeof(struct sdmx_buff_descr));
	else
		memset(&(cmd->meta_data_buf), 0,
			sizeof(struct sdmx_buff_descr));
	if (meta_data_buf != NULL) {
		cmd->meta_data_buf.base_addr = (u32)meta_data_buf->base_addr;
		cmd->meta_data_buf.size = meta_data_buf->size;
	} else {
		memset(&(cmd->meta_data_buf), 0, sizeof(cmd->meta_data_buf));
	}

	cmd->buffer_mode = d_buf_mode;
	cmd->num_data_bufs = num_data_bufs;
	memcpy(cmd->data_bufs, data_bufs,
		num_data_bufs * sizeof(struct sdmx_data_buff_descr));
	for (i = 0; i < num_data_bufs; i++) {
		for (j = 0; j < SDMX_MAX_PHYSICAL_CHUNKS; j++) {
			cmd->data_bufs[i].buff_chunks[j].base_addr =
				(u32)data_bufs[i].buff_chunks[j].base_addr;
			cmd->data_bufs[i].buff_chunks[j].size =
				data_bufs[i].buff_chunks[j].size;
		}
		cmd->data_bufs[i].length = data_bufs[i].length;
	}

	/* Issue QSEECom command */
	res = qseecom_send_command(sdmx_qseecom_handles[session_handle],
@@ -834,7 +857,7 @@ int sdmx_process(int session_handle, u8 flags,
	cmd->cmd_id = SDMX_PROCESS_CMD;
	cmd->session_handle = session_handle;
	cmd->flags = flags;
	cmd->in_buf_descr.base_addr = input_buf_desc->base_addr;
	cmd->in_buf_descr.base_addr = (u32)input_buf_desc->base_addr;
	cmd->in_buf_descr.size = input_buf_desc->size;
	cmd->inp_fill_cnt = *input_fill_count;
	cmd->in_rd_offset = *input_read_offset;