Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Arm Trusted Firmware
Commits
469744e6
Unverified
Commit
469744e6
authored
Mar 29, 2018
by
Dimitris Papastamos
Committed by
GitHub
Mar 29, 2018
Browse files
Merge pull request #1329 from antonio-nino-diaz-arm/an/rpi3-multi-console
rpi3: Migrate to the multi console API
parents
e74af2af
e0f21f62
Changes
9
Hide whitespace changes
Inline
Side-by-side
docs/plat/rpi3.rst
View file @
469744e6
...
@@ -247,6 +247,11 @@ The following is not currently supported:
...
@@ -247,6 +247,11 @@ The following is not currently supported:
- ``LOAD_IMAGE_V2=0``: Only version 2 is supported.
- ``LOAD_IMAGE_V2=0``: Only version 2 is supported.
- ``MULTI_CONSOLE_API=0``: The multi console API must be enabled. Note that the
crash console uses the internal 16550 driver functions directly in order to be
able to print error messages during early crashes before setting up the
multi console API.
AArch64 kernel build instructions
AArch64 kernel build instructions
---------------------------------
---------------------------------
...
@@ -300,7 +305,7 @@ Setup SD card
...
@@ -300,7 +305,7 @@ Setup SD card
The instructions assume that you have an SD card with a fresh install of
The instructions assume that you have an SD card with a fresh install of
`Raspbian`_ (or that, at least, the ``boot`` partition is untouched, or nearly
`Raspbian`_ (or that, at least, the ``boot`` partition is untouched, or nearly
untouched). They have been tested with the image available in 201
7
-0
9-07
.
untouched). They have been tested with the image available in 201
8
-0
3-13
.
1. Insert the SD card and open the ``boot`` partition.
1. Insert the SD card and open the ``boot`` partition.
...
...
drivers/ti/uart/aarch64/16550_console.S
View file @
469744e6
/*
/*
*
Copyright
(
c
)
2015
-
201
7
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
Copyright
(
c
)
2015
-
201
8
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
*
*
SPDX
-
License
-
Identifier
:
BSD
-
3
-
Clause
*
SPDX
-
License
-
Identifier
:
BSD
-
3
-
Clause
*/
*/
...
@@ -17,10 +17,11 @@
...
@@ -17,10 +17,11 @@
.
globl
console_16550_core_init
.
globl
console_16550_core_init
.
globl
console_16550_core_putc
.
globl
console_16550_core_putc
.
globl
console_16550_core_getc
.
globl
console_16550_core_getc
.
globl
console_16550_core_flush
.
globl
console_16550_putc
.
globl
console_16550_putc
.
globl
console_16550_getc
.
globl
console_16550_getc
.
globl
console_16550_flush
/
*
-----------------------------------------------
/
*
-----------------------------------------------
*
int
console_16550_core_init
(
uintptr_t
base_addr
,
*
int
console_16550_core_init
(
uintptr_t
base_addr
,
...
@@ -119,6 +120,7 @@ endfunc console_16550_register
...
@@ -119,6 +120,7 @@ endfunc console_16550_register
.
equ
console_core_init
,
console_16550_core_init
.
equ
console_core_init
,
console_16550_core_init
.
equ
console_core_putc
,
console_16550_core_putc
.
equ
console_core_putc
,
console_16550_core_putc
.
equ
console_core_getc
,
console_16550_core_getc
.
equ
console_core_getc
,
console_16550_core_getc
.
equ
console_core_flush
,
console_16550_core_flush
#endif
#endif
/
*
--------------------------------------------------------
/
*
--------------------------------------------------------
...
@@ -222,8 +224,7 @@ func console_16550_getc
...
@@ -222,8 +224,7 @@ func console_16550_getc
endfunc
console_16550_getc
endfunc
console_16550_getc
/
*
---------------------------------------------
/
*
---------------------------------------------
*
int
console_core_flush
(
uintptr_t
base_addr
)
*
int
console_16550_core_flush
(
uintptr_t
base_addr
)
*
DEPRECATED
:
Not
used
with
MULTI_CONSOLE_API
!
*
Function
to
force
a
write
of
all
buffered
*
Function
to
force
a
write
of
all
buffered
*
data
that
hasn
't been output.
*
data
that
hasn
't been output.
*
In
:
x0
-
console
base
address
*
In
:
x0
-
console
base
address
...
@@ -231,8 +232,36 @@ endfunc console_16550_getc
...
@@ -231,8 +232,36 @@ endfunc console_16550_getc
*
Clobber
list
:
x0
,
x1
*
Clobber
list
:
x0
,
x1
*
---------------------------------------------
*
---------------------------------------------
*/
*/
func
console_core_flush
func
console_16550_core_flush
/
*
Placeholder
*/
#if ENABLE_ASSERTIONS
cmp
x0
,
#
0
ASM_ASSERT
(
ne
)
#endif /* ENABLE_ASSERTIONS */
/
*
Loop
until
the
transmit
FIFO
is
empty
*/
1
:
ldr
w1
,
[
x0
,
#
UARTLSR
]
and
w1
,
w1
,
#(
UARTLSR_TEMT
|
UARTLSR_THRE
)
cmp
w1
,
#(
UARTLSR_TEMT
|
UARTLSR_THRE
)
b.ne
1
b
mov
w0
,
#
0
mov
w0
,
#
0
ret
ret
endfunc
console_core_flush
endfunc
console_16550_core_flush
/
*
---------------------------------------------
*
int
console_16550_flush
(
console_pl011_t
*
console
)
*
Function
to
force
a
write
of
all
buffered
*
data
that
hasn
't been output.
*
In
:
x0
-
pointer
to
console_t
structure
*
Out
:
return
-
1
on
error
else
return
0
.
*
Clobber
list
:
x0
,
x1
*
---------------------------------------------
*/
func
console_16550_flush
#if ENABLE_ASSERTIONS
cmp
x0
,
#
0
ASM_ASSERT
(
ne
)
#endif /* ENABLE_ASSERTIONS */
ldr
x0
,
[
x0
,
#
CONSOLE_T_16550_BASE
]
b
console_16550_core_flush
endfunc
console_16550_flush
plat/rpi3/aarch64/plat_helpers.S
View file @
469744e6
/*
/*
*
Copyright
(
c
)
2015
-
201
7
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
Copyright
(
c
)
2015
-
201
8
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
*
*
SPDX
-
License
-
Identifier
:
BSD
-
3
-
Clause
*
SPDX
-
License
-
Identifier
:
BSD
-
3
-
Clause
*/
*/
...
@@ -137,7 +137,7 @@ func plat_crash_console_init
...
@@ -137,7 +137,7 @@ func plat_crash_console_init
mov_imm
x0
,
PLAT_RPI3_UART_BASE
mov_imm
x0
,
PLAT_RPI3_UART_BASE
mov_imm
x1
,
PLAT_RPI3_UART_CLK_IN_HZ
mov_imm
x1
,
PLAT_RPI3_UART_CLK_IN_HZ
mov_imm
x2
,
PLAT_RPI3_UART_BAUDRATE
mov_imm
x2
,
PLAT_RPI3_UART_BAUDRATE
b
console_core_init
b
console_
16550_
core_init
endfunc
plat_crash_console_init
endfunc
plat_crash_console_init
/
*
---------------------------------------------
/
*
---------------------------------------------
...
@@ -149,7 +149,7 @@ endfunc plat_crash_console_init
...
@@ -149,7 +149,7 @@ endfunc plat_crash_console_init
*/
*/
func
plat_crash_console_putc
func
plat_crash_console_putc
mov_imm
x1
,
PLAT_RPI3_UART_BASE
mov_imm
x1
,
PLAT_RPI3_UART_BASE
b
console_core_putc
b
console_
16550_
core_putc
endfunc
plat_crash_console_putc
endfunc
plat_crash_console_putc
/
*
---------------------------------------------
/
*
---------------------------------------------
...
@@ -161,8 +161,8 @@ endfunc plat_crash_console_putc
...
@@ -161,8 +161,8 @@ endfunc plat_crash_console_putc
*
---------------------------------------------
*
---------------------------------------------
*/
*/
func
plat_crash_console_flush
func
plat_crash_console_flush
mov_imm
x
1
,
PLAT_RPI3_UART_BASE
mov_imm
x
0
,
PLAT_RPI3_UART_BASE
b
console_core_flush
b
console_
16550_
core_flush
endfunc
plat_crash_console_flush
endfunc
plat_crash_console_flush
/
*
---------------------------------------------
/
*
---------------------------------------------
...
...
plat/rpi3/platform.mk
View file @
469744e6
#
#
# Copyright (c) 2013-201
7
, ARM Limited and Contributors. All rights reserved.
# Copyright (c) 2013-201
8
, ARM Limited and Contributors. All rights reserved.
#
#
# SPDX-License-Identifier: BSD-3-Clause
# SPDX-License-Identifier: BSD-3-Clause
#
#
...
@@ -81,6 +81,9 @@ USE_COHERENT_MEM := 1
...
@@ -81,6 +81,9 @@ USE_COHERENT_MEM := 1
# Enable new version of image loading
# Enable new version of image loading
LOAD_IMAGE_V2
:=
1
LOAD_IMAGE_V2
:=
1
# Use multi console API
MULTI_CONSOLE_API
:=
1
# Platform build flags
# Platform build flags
# --------------------
# --------------------
...
@@ -110,6 +113,10 @@ ifneq (${LOAD_IMAGE_V2}, 1)
...
@@ -110,6 +113,10 @@ ifneq (${LOAD_IMAGE_V2}, 1)
$(error Error
:
rpi3 needs LOAD_IMAGE_V2=1)
$(error Error
:
rpi3 needs LOAD_IMAGE_V2=1)
endif
endif
ifneq
(${MULTI_CONSOLE_API}, 1)
$(error Error
:
rpi3 needs MULTI_CONSOLE_API=1)
endif
ifeq
(${ARCH},aarch32)
ifeq
(${ARCH},aarch32)
$(error Error
:
AArch32 not supported on rpi3)
$(error Error
:
AArch32 not supported on rpi3)
endif
endif
plat/rpi3/rpi3_bl1_setup.c
View file @
469744e6
/*
/*
* Copyright (c) 2015-201
7
, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2015-201
8
, ARM Limited and Contributors. All rights reserved.
*
*
* SPDX-License-Identifier: BSD-3-Clause
* SPDX-License-Identifier: BSD-3-Clause
*/
*/
...
@@ -7,7 +7,6 @@
...
@@ -7,7 +7,6 @@
#include <arch.h>
#include <arch.h>
#include <arch_helpers.h>
#include <arch_helpers.h>
#include <bl_common.h>
#include <bl_common.h>
#include <console.h>
#include <platform_def.h>
#include <platform_def.h>
#include <xlat_mmu_helpers.h>
#include <xlat_mmu_helpers.h>
#include <xlat_tables_defs.h>
#include <xlat_tables_defs.h>
...
@@ -29,8 +28,7 @@ meminfo_t *bl1_plat_sec_mem_layout(void)
...
@@ -29,8 +28,7 @@ meminfo_t *bl1_plat_sec_mem_layout(void)
void
bl1_early_platform_setup
(
void
)
void
bl1_early_platform_setup
(
void
)
{
{
/* Initialize the console to provide early debug support */
/* Initialize the console to provide early debug support */
console_init
(
PLAT_RPI3_UART_BASE
,
PLAT_RPI3_UART_CLK_IN_HZ
,
rpi3_console_init
();
PLAT_RPI3_UART_BAUDRATE
);
/* Allow BL1 to see the whole Trusted RAM */
/* Allow BL1 to see the whole Trusted RAM */
bl1_tzram_layout
.
total_base
=
BL_RAM_BASE
;
bl1_tzram_layout
.
total_base
=
BL_RAM_BASE
;
...
...
plat/rpi3/rpi3_bl2_setup.c
View file @
469744e6
/*
/*
* Copyright (c) 2015-201
7
, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2015-201
8
, ARM Limited and Contributors. All rights reserved.
*
*
* SPDX-License-Identifier: BSD-3-Clause
* SPDX-License-Identifier: BSD-3-Clause
*/
*/
...
@@ -7,7 +7,6 @@
...
@@ -7,7 +7,6 @@
#include <arch_helpers.h>
#include <arch_helpers.h>
#include <assert.h>
#include <assert.h>
#include <bl_common.h>
#include <bl_common.h>
#include <console.h>
#include <debug.h>
#include <debug.h>
#include <desc_image_load.h>
#include <desc_image_load.h>
#include <platform_def.h>
#include <platform_def.h>
...
@@ -27,8 +26,7 @@ static meminfo_t bl2_tzram_layout __aligned(CACHE_WRITEBACK_GRANULE);
...
@@ -27,8 +26,7 @@ static meminfo_t bl2_tzram_layout __aligned(CACHE_WRITEBACK_GRANULE);
void
bl2_early_platform_setup
(
meminfo_t
*
mem_layout
)
void
bl2_early_platform_setup
(
meminfo_t
*
mem_layout
)
{
{
/* Initialize the console to provide early debug support */
/* Initialize the console to provide early debug support */
console_init
(
PLAT_RPI3_UART_BASE
,
PLAT_RPI3_UART_CLK_IN_HZ
,
rpi3_console_init
();
PLAT_RPI3_UART_BAUDRATE
);
/* Setup the BL2 memory layout */
/* Setup the BL2 memory layout */
bl2_tzram_layout
=
*
mem_layout
;
bl2_tzram_layout
=
*
mem_layout
;
...
@@ -40,7 +38,7 @@ void bl2_platform_setup(void)
...
@@ -40,7 +38,7 @@ void bl2_platform_setup(void)
{
{
/*
/*
* This is where a TrustZone address space controller and other
* This is where a TrustZone address space controller and other
* security related peripherals
,
would be configured.
* security related peripherals would be configured.
*/
*/
}
}
...
...
plat/rpi3/rpi3_bl31_setup.c
View file @
469744e6
/*
/*
* Copyright (c) 2015-201
7
, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2015-201
8
, ARM Limited and Contributors. All rights reserved.
*
*
* SPDX-License-Identifier: BSD-3-Clause
* SPDX-License-Identifier: BSD-3-Clause
*/
*/
#include <assert.h>
#include <assert.h>
#include <bl_common.h>
#include <bl_common.h>
#include <console.h>
#include <platform.h>
#include <platform.h>
#include <platform_def.h>
#include <platform_def.h>
#include <xlat_mmu_helpers.h>
#include <xlat_mmu_helpers.h>
...
@@ -58,8 +57,7 @@ void bl31_early_platform_setup(void *from_bl2,
...
@@ -58,8 +57,7 @@ void bl31_early_platform_setup(void *from_bl2,
void
*
plat_params_from_bl2
)
void
*
plat_params_from_bl2
)
{
{
/* Initialize the console to provide early debug support */
/* Initialize the console to provide early debug support */
console_init
(
PLAT_RPI3_UART_BASE
,
PLAT_RPI3_UART_CLK_IN_HZ
,
rpi3_console_init
();
PLAT_RPI3_UART_BAUDRATE
);
#if RESET_TO_BL31
#if RESET_TO_BL31
...
@@ -159,10 +157,3 @@ void bl31_platform_setup(void)
...
@@ -159,10 +157,3 @@ void bl31_platform_setup(void)
return
;
return
;
}
}
void
bl31_plat_runtime_setup
(
void
)
{
/* Initialize the runtime console */
console_init
(
PLAT_RPI3_UART_BASE
,
PLAT_RPI3_UART_CLK_IN_HZ
,
PLAT_RPI3_UART_BAUDRATE
);
}
plat/rpi3/rpi3_common.c
View file @
469744e6
/*
/*
* Copyright (c) 2015-201
7
, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2015-201
8
, ARM Limited and Contributors. All rights reserved.
*
*
* SPDX-License-Identifier: BSD-3-Clause
* SPDX-License-Identifier: BSD-3-Clause
*/
*/
#include <arch_helpers.h>
#include <arch_helpers.h>
#include <bl_common.h>
#include <bl_common.h>
#include <console.h>
#include <debug.h>
#include <debug.h>
#include <interrupt_mgmt.h>
#include <interrupt_mgmt.h>
#include <platform_def.h>
#include <platform_def.h>
#include <uart_16550.h>
#include <xlat_tables_v2.h>
#include <xlat_tables_v2.h>
#include "rpi3_hw.h"
#include "rpi3_hw.h"
...
@@ -68,6 +70,30 @@ static const mmap_region_t plat_rpi3_mmap[] = {
...
@@ -68,6 +70,30 @@ static const mmap_region_t plat_rpi3_mmap[] = {
};
};
#endif
#endif
/*******************************************************************************
* Function that sets up the console
******************************************************************************/
static
console_16550_t
rpi3_console
;
void
rpi3_console_init
(
void
)
{
int
rc
=
console_16550_register
(
PLAT_RPI3_UART_BASE
,
PLAT_RPI3_UART_CLK_IN_HZ
,
PLAT_RPI3_UART_BAUDRATE
,
&
rpi3_console
);
if
(
rc
==
0
)
{
/*
* The crash console doesn't use the multi console API, it uses
* the core console functions directly. It is safe to call panic
* and let it print debug information.
*/
panic
();
}
console_set_scope
(
&
rpi3_console
.
console
,
CONSOLE_FLAG_BOOT
|
CONSOLE_FLAG_RUNTIME
);
}
/*******************************************************************************
/*******************************************************************************
* Function that sets up the translation tables.
* Function that sets up the translation tables.
******************************************************************************/
******************************************************************************/
...
...
plat/rpi3/rpi3_private.h
View file @
469744e6
/*
/*
* Copyright (c) 2015-201
7
, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2015-201
8
, ARM Limited and Contributors. All rights reserved.
*
*
* SPDX-License-Identifier: BSD-3-Clause
* SPDX-License-Identifier: BSD-3-Clause
*/
*/
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
******************************************************************************/
******************************************************************************/
/* Utility functions */
/* Utility functions */
void
rpi3_console_init
(
void
);
void
rpi3_setup_page_tables
(
uintptr_t
total_base
,
size_t
total_size
,
void
rpi3_setup_page_tables
(
uintptr_t
total_base
,
size_t
total_size
,
uintptr_t
code_start
,
uintptr_t
code_limit
,
uintptr_t
code_start
,
uintptr_t
code_limit
,
uintptr_t
rodata_start
,
uintptr_t
rodata_limit
uintptr_t
rodata_start
,
uintptr_t
rodata_limit
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment