[U-Boot] [PATCH 2/5] powerpc/pamu : PAMU configuration for accessing SEC block

Ruchika Gupta ruchika.gupta at freescale.com
Thu Mar 28 11:46:32 CET 2013


Signed-off-by: Kuldip Giroh <kuldip.giroh at freescale.com>
Signed-off-by: Ruchika Gupta <ruchika.gupta at freescale.com>
---
Based upon git://git.denx.de/u-boot.git branch master

 arch/powerpc/cpu/mpc8xxx/Makefile         |    2 +-
 arch/powerpc/cpu/mpc8xxx/fsl_pamu_table.c |   68 +++++++++++++++++++++++++++++
 arch/powerpc/include/asm/fsl_pamu.h       |    1 +
 3 files changed, 70 insertions(+), 1 deletions(-)
 create mode 100644 arch/powerpc/cpu/mpc8xxx/fsl_pamu_table.c

diff --git a/arch/powerpc/cpu/mpc8xxx/Makefile b/arch/powerpc/cpu/mpc8xxx/Makefile
index 097599e..7099136 100644
--- a/arch/powerpc/cpu/mpc8xxx/Makefile
+++ b/arch/powerpc/cpu/mpc8xxx/Makefile
@@ -33,7 +33,7 @@ COBJS-$(CONFIG_FSL_IFC) += fsl_ifc.o
 COBJS-$(CONFIG_FSL_LBC) += fsl_lbc.o
 COBJS-$(CONFIG_SYS_SRIO) += srio.o
 COBJS-$(CONFIG_FSL_LAW) += law.o
-COBJS-$(CONFIG_FSL_CORENET) += fsl_pamu.o
+COBJS-$(CONFIG_FSL_CORENET) += fsl_pamu.o fsl_pamu_table.o
 
 endif
 
diff --git a/arch/powerpc/cpu/mpc8xxx/fsl_pamu_table.c b/arch/powerpc/cpu/mpc8xxx/fsl_pamu_table.c
new file mode 100644
index 0000000..44cceee
--- /dev/null
+++ b/arch/powerpc/cpu/mpc8xxx/fsl_pamu_table.c
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2012 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <asm/fsl_pamu.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+void construct_pamu_addr_table(struct pamu_addr_tbl *tbl, int *num_entries)
+{
+	int i  = 0;
+
+	tbl->start_addr[i] =
+			(uint64_t)virt_to_phys((void *)CONFIG_SYS_SDRAM_BASE);
+	tbl->size[i] = (phys_size_t)(min(gd->ram_size, CONFIG_MAX_MEM_MAPPED));
+	tbl->end_addr[i] = tbl->start_addr[i] +  tbl->size[i] - 1;
+
+	i++;
+	tbl->start_addr[i] =
+		(uint64_t)virt_to_phys((void *)CONFIG_SYS_FLASH_BASE_PHYS);
+	tbl->size[i] = 256 * 1024 * 1024; /* 256MB flash */
+	tbl->end_addr[i] = tbl->start_addr[i] +  tbl->size[i] - 1;
+
+	i++;
+#ifdef DEBUG
+	int j;
+	printf("address\t\t\tsize\n");
+	for (j = 0; j < i ; j++)
+		printf("%llx \t\t\t%llx\n",  tbl->start_addr[j],  tbl->size[j]);
+#endif
+
+	*num_entries = i;
+}
+
+int sec_config_pamu_table(uint32_t liodn_ns, uint32_t liodn_s)
+{
+	struct pamu_addr_tbl tbl;
+	int num_entries = 0;
+	int ret = 0;
+
+	construct_pamu_addr_table(&tbl, &num_entries);
+
+	ret = config_pamu(&tbl, num_entries, liodn_ns);
+	if (ret)
+		return ret;
+
+	ret = config_pamu(&tbl, num_entries, liodn_s);
+	if (ret)
+		return ret;
+
+	return ret;
+}
diff --git a/arch/powerpc/include/asm/fsl_pamu.h b/arch/powerpc/include/asm/fsl_pamu.h
index e2cfe97..85ef9bf 100644
--- a/arch/powerpc/include/asm/fsl_pamu.h
+++ b/arch/powerpc/include/asm/fsl_pamu.h
@@ -189,5 +189,6 @@ int pamu_init(void);
 void pamu_enable(void);
 void pamu_disable(void);
 int config_pamu(struct pamu_addr_tbl *tbl, int num_entries, uint32_t liodn);
+int sec_config_pamu_table(uint32_t liodn_ns, uint32_t liodn_s);
 
 #endif
-- 
1.7.7.6




More information about the U-Boot mailing list