bsp/qoriq: Add MAS7 support for MMU

This enables usage of the full real address space which is 40-bit on the
T2080 for example.
This commit is contained in:
Sebastian Huber
2014-12-19 13:06:39 +01:00
parent 71b611d172
commit 0e05095ab5
7 changed files with 50 additions and 21 deletions

View File

@@ -90,6 +90,9 @@ RTEMS_BSPOPTS_HELP([QORIQ_INITIAL_MSR],[initial MSR value])
RTEMS_BSPOPTS_SET([QORIQ_INITIAL_SPEFSCR],[*],[0x00000000])
RTEMS_BSPOPTS_HELP([QORIQ_INITIAL_SPEFSCR],[initial SPEFSCR value])
RTEMS_BSPOPTS_SET([QORIQ_MMU_DEVICE_MAS7],[*],[0x0])
RTEMS_BSPOPTS_HELP([QORIQ_MMU_DEVICE_MAS7],[MAS7 value for device TLB1 entries])
RTEMS_BSPOPTS_SET([QORIQ_CLOCK_TIMER],[qoriq_core_1],[4])
RTEMS_BSPOPTS_SET([QORIQ_CLOCK_TIMER],[*],[0])
RTEMS_BSPOPTS_HELP([QORIQ_CLOCK_TIMER],[global timer used for system clock, 0..3 maps to A0..A3, and 4..7 maps to B0..B3])

View File

@@ -52,6 +52,7 @@ typedef struct {
uint32_t mas1;
uint32_t mas2;
uint32_t mas3;
uint32_t mas7;
} qoriq_mmu_entry;
typedef struct {
@@ -67,7 +68,8 @@ bool qoriq_mmu_add(
uint32_t last,
uint32_t mas1,
uint32_t mas2,
uint32_t mas3
uint32_t mas3,
uint32_t mas7
);
void qoriq_mmu_partition(qoriq_mmu_context *self, int max_count);
@@ -83,6 +85,7 @@ void qoriq_tlb1_write(
uint32_t mas1,
uint32_t mas2,
uint32_t mas3,
uint32_t mas7,
uint32_t ea,
uint32_t tsize
);

View File

@@ -58,7 +58,8 @@ _start:
li r5, FSL_EIS_MAS2_I
li r6, FSL_EIS_MAS3_SR | FSL_EIS_MAS3_SW | FSL_EIS_MAS3_SX
li r7, 0
li r8, 11
li r8, 0
li r9, 11
bl qoriq_tlb1_write
/* MSR initialization */
@@ -137,8 +138,9 @@ null_area_setup_done:
li r4, 0
li r5, 0
li r6, FSL_EIS_MAS3_SR
mr r7, UBOOT_BOARD_INFO
li r8, 1
li r7, 0
mr r8, UBOOT_BOARD_INFO
li r9, 1
bl qoriq_tlb1_write
mr r3, UBOOT_BOARD_INFO
bl bsp_uboot_copy_board_info
@@ -180,7 +182,8 @@ _start_core_1:
li r5, FSL_EIS_MAS2_I
li r6, FSL_EIS_MAS3_SR | FSL_EIS_MAS3_SW | FSL_EIS_MAS3_SX
li r7, 0
li r8, 11
li r8, 0
li r9, 11
bl qoriq_tlb1_write
/* MSR initialization */

View File

@@ -1,8 +1,8 @@
/*
* Copyright (c) 2013 embedded brains GmbH. All rights reserved.
* Copyright (c) 2013-2014 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Obere Lagerstr. 30
* Dornierstr. 4
* 82178 Puchheim
* Germany
* <rtems@embedded-brains.de>
@@ -93,7 +93,15 @@ static void release_core_1(void)
qoriq_mmu_context mmu_context;
qoriq_mmu_context_init(&mmu_context);
qoriq_mmu_add(&mmu_context, BOOT_BEGIN, BOOT_LAST, 0, 0, FSL_EIS_MAS3_SR | FSL_EIS_MAS3_SW);
qoriq_mmu_add(
&mmu_context,
BOOT_BEGIN,
BOOT_LAST,
0,
0,
FSL_EIS_MAS3_SR | FSL_EIS_MAS3_SW,
0
);
qoriq_mmu_partition(&mmu_context, TLB_COUNT);
qoriq_mmu_write_to_tlb1(&mmu_context, TLB_BEGIN);

View File

@@ -33,6 +33,7 @@ typedef struct {
uint32_t size;
uint32_t mas2;
uint32_t mas3;
uint32_t mas7;
} entry;
#define ENTRY_X(b, s) { \
@@ -66,7 +67,8 @@ typedef struct {
.begin = (uint32_t) b, \
.size = (uint32_t) s, \
.mas2 = FSL_EIS_MAS2_I | FSL_EIS_MAS2_G, \
.mas3 = FSL_EIS_MAS3_SR | FSL_EIS_MAS3_SW \
.mas3 = FSL_EIS_MAS3_SR | FSL_EIS_MAS3_SW, \
.mas7 = QORIQ_MMU_DEVICE_MAS7 \
}
static const entry DATA config [] = {
@@ -118,7 +120,8 @@ void TEXT qoriq_mmu_config(int first_tlb, int scratch_tlb)
cur->begin + cur->size - 1,
0,
cur->mas2,
cur->mas3
cur->mas3,
cur->mas7
);
}
}

View File

@@ -30,19 +30,18 @@
qoriq_tlb1_write:
rlwinm r3, r3, 16, 12, 15
rlwinm r7, r7, 0, 0, 19
rlwinm r8, r8, 0, 0, 19
oris r3, r3, 0x1000
mtspr FSL_EIS_MAS0, r3
oris r4, r4, 0xc000
rlwinm r8, r8, 8, 20, 23
or r8, r4, r8
mtspr FSL_EIS_MAS1, r8
or r5, r7, r5
rlwinm r9, r9, 8, 20, 23
or r9, r4, r9
mtspr FSL_EIS_MAS1, r9
or r5, r8, r5
mtspr FSL_EIS_MAS2, r5
or r6, r7, r6
or r6, r8, r6
mtspr FSL_EIS_MAS3, r6
li r0, 0
mtspr FSL_EIS_MAS7, r0
mtspr FSL_EIS_MAS7, r7
tlbwe
sync
isync

View File

@@ -165,7 +165,8 @@ bool TEXT qoriq_mmu_add(
uint32_t last,
uint32_t mas1,
uint32_t mas2,
uint32_t mas3
uint32_t mas3,
uint32_t mas7
)
{
bool ok = true;
@@ -181,7 +182,8 @@ bool TEXT qoriq_mmu_add(
.last = last,
.mas1 = mas1,
.mas2 = mas2,
.mas3 = mas3
.mas3 = mas3,
.mas7 = mas7
};
append(self, &new_entry);
} else {
@@ -269,7 +271,15 @@ void TEXT qoriq_mmu_write_to_tlb1(qoriq_mmu_context *self, int first_tlb)
uint32_t tsize = (power_of_two(size) - 10) / 2;
int tlb = first_tlb + i;
qoriq_tlb1_write(tlb, cur->mas1, cur->mas2, cur->mas3, ea, tsize);
qoriq_tlb1_write(
tlb,
cur->mas1,
cur->mas2,
cur->mas3,
cur->mas7,
ea,
tsize
);
}
}