[rtems commit] bsp/qoriq: Adjust MMU config only once

Sebastian Huber sebh at rtems.org
Mon Apr 3 12:09:05 UTC 2017


Module:    rtems
Branch:    master
Commit:    f6e793a2cae956fabbb0e2db2ef9727176d1fc3a
Changeset: http://git.rtems.org/rtems/commit/?id=f6e793a2cae956fabbb0e2db2ef9727176d1fc3a

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Apr  3 10:05:51 2017 +0200

bsp/qoriq: Adjust MMU config only once

---

 c/src/lib/libbsp/powerpc/qoriq/include/mmu.h        | 2 +-
 c/src/lib/libbsp/powerpc/qoriq/start/start.S        | 6 ++++--
 c/src/lib/libbsp/powerpc/qoriq/startup/mmu-config.c | 7 +++++--
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/c/src/lib/libbsp/powerpc/qoriq/include/mmu.h b/c/src/lib/libbsp/powerpc/qoriq/include/mmu.h
index f08cc43..2583bec 100644
--- a/c/src/lib/libbsp/powerpc/qoriq/include/mmu.h
+++ b/c/src/lib/libbsp/powerpc/qoriq/include/mmu.h
@@ -78,7 +78,7 @@ void qoriq_mmu_write_to_tlb1(qoriq_mmu_context *self, int first_tlb);
 
 void qoriq_mmu_change_perm(uint32_t test, uint32_t set, uint32_t clear);
 
-void qoriq_mmu_config(int first_tlb, int scratch_tlb);
+void qoriq_mmu_config(bool boot_processor, int first_tlb, int scratch_tlb);
 
 void qoriq_tlb1_write(
 	int esel,
diff --git a/c/src/lib/libbsp/powerpc/qoriq/start/start.S b/c/src/lib/libbsp/powerpc/qoriq/start/start.S
index 6f6771d..481b664 100644
--- a/c/src/lib/libbsp/powerpc/qoriq/start/start.S
+++ b/c/src/lib/libbsp/powerpc/qoriq/start/start.S
@@ -120,6 +120,7 @@ _start:
 	bdnz	.Lnull_area_setup_loop
 .Lnull_area_setup_done:
 
+	li	r3, 1
 	bl	.Linitmmu
 
 	/* Clear SBSS */
@@ -232,8 +233,8 @@ _start:
 	mflr	SAVED_LINK_REGISTER
 
 	/* Configure MMU */
-	li	r3, FIRST_TLB
-	li	r4, SCRATCH_TLB
+	li	r4, FIRST_TLB
+	li	r5, SCRATCH_TLB
 	bl	qoriq_mmu_config
 	mtmsr	INITIAL_MSR
 	isync
@@ -320,6 +321,7 @@ _start_secondary_processor:
 	mr	START_STACK, r3
 
 	bl	.Linitmore
+	li	r3, 0
 	bl	.Linitmmu
 	b	bsp_start_on_secondary_processor
 #endif /* RTEMS_SMP */
diff --git a/c/src/lib/libbsp/powerpc/qoriq/startup/mmu-config.c b/c/src/lib/libbsp/powerpc/qoriq/startup/mmu-config.c
index 3f385aa..3e57230 100644
--- a/c/src/lib/libbsp/powerpc/qoriq/startup/mmu-config.c
+++ b/c/src/lib/libbsp/powerpc/qoriq/startup/mmu-config.c
@@ -191,12 +191,15 @@ static void TEXT config_fdt_adjust(void)
 	}
 }
 
-void TEXT qoriq_mmu_config(int first_tlb, int scratch_tlb)
+void TEXT qoriq_mmu_config(bool boot_processor, int first_tlb, int scratch_tlb)
 {
 	qoriq_mmu_context context;
 	int i = 0;
 
-	config_fdt_adjust();
+	if (boot_processor) {
+		config_fdt_adjust();
+	}
+
 	qoriq_mmu_context_init(&context);
 
 	for (i = 0; i < QORIQ_TLB1_ENTRY_COUNT; ++i) {




More information about the vc mailing list