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

Commit bc3ac9f3 authored by Sekhar Nori's avatar Sekhar Nori Committed by Kevin Hilman
Browse files

davinci: edma: provide ability to detect insufficient CC info data



This patch modifies the EDMA driver to expect the channel
controller (CC) infomation passed on by the platform as a fixed
size (EDMA_MAX_CC) array of pointers to structures.

Doing so helps catch errors of the sort where the resource
structure has information for more channel controllers than
the number channel controller info structures defined.

Such insufficient platform data would lead to illegal memory
accesses.

Signed-off-by: default avatarSekhar Nori <nsekhar@ti.com>
Signed-off-by: default avatarKevin Hilman <khilman@deeprootsystems.com>
parent f027512d
Loading
Loading
Loading
Loading
+18 −11
Original line number Diff line number Diff line
@@ -111,8 +111,7 @@ static const s8 da850_queue_priority_mapping[][2] = {
	{-1, -1}
};

static struct edma_soc_info da830_edma_info[] = {
	{
static struct edma_soc_info da830_edma_cc0_info = {
	.n_channel		= 32,
	.n_region		= 4,
	.n_slot			= 128,
@@ -120,10 +119,13 @@ static struct edma_soc_info da830_edma_info[] = {
	.n_cc			= 1,
	.queue_tc_mapping	= da8xx_queue_tc_mapping,
	.queue_priority_mapping	= da8xx_queue_priority_mapping,
	},
};

static struct edma_soc_info da850_edma_info[] = {
static struct edma_soc_info *da830_edma_info[EDMA_MAX_CC] = {
	&da830_edma_cc0_info,
};

static struct edma_soc_info da850_edma_cc_info[] = {
	{
		.n_channel		= 32,
		.n_region		= 4,
@@ -144,6 +146,11 @@ static struct edma_soc_info da850_edma_info[] = {
	},
};

static struct edma_soc_info *da850_edma_info[EDMA_MAX_CC] = {
	&da850_edma_cc_info[0],
	&da850_edma_cc_info[1],
};

static struct resource da830_edma_resources[] = {
	{
		.name	= "edma_cc0",
+13 −11
Original line number Diff line number Diff line
@@ -69,8 +69,7 @@ static const s8 edma_priority_mapping[][2] = {
	{	-1,		-1	}
};

static struct edma_soc_info edma_info[] = {
	{
static struct edma_soc_info edma_cc0_info = {
	.n_channel		= EDMA_TNETV107X_NUM_DMACH,
	.n_region		= EDMA_TNETV107X_NUM_REGIONS,
	.n_slot			= EDMA_TNETV107X_NUM_PARAMENTRY,
@@ -78,7 +77,10 @@ static struct edma_soc_info edma_info[] = {
	.n_cc			= 1,
	.queue_tc_mapping	= edma_tc_mapping,
	.queue_priority_mapping	= edma_priority_mapping,
	},
};

static struct edma_soc_info *tnetv107x_edma_info[EDMA_MAX_CC] = {
	&edma_cc0_info,
};

static struct resource edma_resources[] = {
@@ -117,7 +119,7 @@ static struct platform_device edma_device = {
	.id		= -1,
	.num_resources	= ARRAY_SIZE(edma_resources),
	.resource	= edma_resources,
	.dev.platform_data = edma_info,
	.dev.platform_data = tnetv107x_edma_info,
};

static struct plat_serial8250_port serial_data[] = {
+12 −10
Original line number Diff line number Diff line
@@ -591,8 +591,7 @@ queue_priority_mapping[][2] = {
	{-1, -1},
};

static struct edma_soc_info dm355_edma_info[] = {
	{
static struct edma_soc_info edma_cc0_info = {
	.n_channel		= 64,
	.n_region		= 4,
	.n_slot			= 128,
@@ -600,7 +599,10 @@ static struct edma_soc_info dm355_edma_info[] = {
	.n_cc			= 1,
	.queue_tc_mapping	= queue_tc_mapping,
	.queue_priority_mapping	= queue_priority_mapping,
	},
};

static struct edma_soc_info *dm355_edma_info[EDMA_MAX_CC] = {
       &edma_cc0_info,
};

static struct resource edma_resources[] = {
+13 −11
Original line number Diff line number Diff line
@@ -822,8 +822,7 @@ dm365_queue_priority_mapping[][2] = {
	{-1, -1},
};

static struct edma_soc_info dm365_edma_info[] = {
	{
static struct edma_soc_info edma_cc0_info = {
	.n_channel		= 64,
	.n_region		= 4,
	.n_slot			= 256,
@@ -832,7 +831,10 @@ static struct edma_soc_info dm365_edma_info[] = {
	.queue_tc_mapping	= dm365_queue_tc_mapping,
	.queue_priority_mapping	= dm365_queue_priority_mapping,
	.default_queue		= EVENTQ_3,
	},
};

static struct edma_soc_info *dm365_edma_info[EDMA_MAX_CC] = {
	&edma_cc0_info,
};

static struct resource edma_resources[] = {
+12 −10
Original line number Diff line number Diff line
@@ -492,8 +492,7 @@ queue_priority_mapping[][2] = {
	{-1, -1},
};

static struct edma_soc_info dm644x_edma_info[] = {
	{
static struct edma_soc_info edma_cc0_info = {
	.n_channel		= 64,
	.n_region		= 4,
	.n_slot			= 128,
@@ -501,7 +500,10 @@ static struct edma_soc_info dm644x_edma_info[] = {
	.n_cc			= 1,
	.queue_tc_mapping	= queue_tc_mapping,
	.queue_priority_mapping	= queue_priority_mapping,
	},
};

static struct edma_soc_info *dm644x_edma_info[EDMA_MAX_CC] = {
	&edma_cc0_info,
};

static struct resource edma_resources[] = {
Loading