mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-19 02:54:24 +00:00
Initialise UART console in all bootloader stages
This patch reworks the console driver to ensure that each bootloader stage initializes it independently. As a result, both BL3-1 and BL2 platform code now calls console_init() instead of relying on BL1 to perform console setup Fixes ARM-software/tf-issues#120 Change-Id: Ic4d66e0375e40a2fc7434afcabc8bbb4715c14ab
This commit is contained in:
parent
c1df3be7dd
commit
0796fe01f8
4 changed files with 24 additions and 3 deletions
|
@ -156,7 +156,7 @@ BL1 performs minimal architectural initialization as follows.
|
||||||
BL1 enables issuing of snoop and DVM (Distributed Virtual Memory) requests
|
BL1 enables issuing of snoop and DVM (Distributed Virtual Memory) requests
|
||||||
from the CCI-400 slave interface corresponding to the cluster that includes
|
from the CCI-400 slave interface corresponding to the cluster that includes
|
||||||
the primary CPU. BL1 also initializes UART0 (PL011 console), which enables
|
the primary CPU. BL1 also initializes UART0 (PL011 console), which enables
|
||||||
access to the `printf` family of functions. The `CNTFRQ_EL0` register is
|
access to the `printf` family of functions in BL1. The `CNTFRQ_EL0` register is
|
||||||
programmed with the base frequency of the system counter, which is retrieved
|
programmed with the base frequency of the system counter, which is retrieved
|
||||||
from the first entry in the frequency modes table. The system level
|
from the first entry in the frequency modes table. The system level
|
||||||
implementation of the generic timer is enabled through the memory mapped
|
implementation of the generic timer is enabled through the memory mapped
|
||||||
|
@ -218,6 +218,8 @@ platform-specific mechanism. It calculates the limits of DRAM (main memory)
|
||||||
to determine whether there is enough space to load the BL3-3 image. A platform
|
to determine whether there is enough space to load the BL3-3 image. A platform
|
||||||
defined base address is used to specify the load address for the BL3-1 image.
|
defined base address is used to specify the load address for the BL3-1 image.
|
||||||
It also defines the extents of memory available for use by the BL3-2 image.
|
It also defines the extents of memory available for use by the BL3-2 image.
|
||||||
|
BL2 also initializes UART0 (PL011 console), which enables access to the
|
||||||
|
`printf` family of functions in BL2
|
||||||
|
|
||||||
#### BL3-1 (EL3 Runtime Firmware) image load
|
#### BL3-1 (EL3 Runtime Firmware) image load
|
||||||
|
|
||||||
|
@ -293,7 +295,8 @@ SMC handler routine.
|
||||||
BL3-1 performs detailed platform initialization, which enables normal world
|
BL3-1 performs detailed platform initialization, which enables normal world
|
||||||
software to function correctly. It also retrieves entrypoint information for
|
software to function correctly. It also retrieves entrypoint information for
|
||||||
the BL3-3 image loaded by BL2 from the platform defined memory address populated
|
the BL3-3 image loaded by BL2 from the platform defined memory address populated
|
||||||
by BL2.
|
by BL2. BL3-1 also initializes UART0 (PL011 console), which enables
|
||||||
|
access to the `printf` family of functions in BL3-1
|
||||||
|
|
||||||
* GICv2 initialization:
|
* GICv2 initialization:
|
||||||
|
|
||||||
|
|
|
@ -31,11 +31,19 @@
|
||||||
#include <console.h>
|
#include <console.h>
|
||||||
#include <platform.h>
|
#include <platform.h>
|
||||||
#include <pl011.h>
|
#include <pl011.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
static unsigned long uart_base = PL011_BASE;
|
static unsigned long uart_base;
|
||||||
|
|
||||||
void console_init(unsigned long base_addr)
|
void console_init(unsigned long base_addr)
|
||||||
{
|
{
|
||||||
|
/* TODO: assert() internally calls printf() and will result in
|
||||||
|
* an infinite loop. This needs to be fixed with some kind of
|
||||||
|
* exception mechanism or early panic support. This also applies
|
||||||
|
* to the other assert() calls below.
|
||||||
|
*/
|
||||||
|
assert(base_addr);
|
||||||
|
|
||||||
/* Initialise internal base address variable */
|
/* Initialise internal base address variable */
|
||||||
uart_base = base_addr;
|
uart_base = base_addr;
|
||||||
|
|
||||||
|
@ -60,6 +68,8 @@ void console_init(unsigned long base_addr)
|
||||||
|
|
||||||
int console_putc(int c)
|
int console_putc(int c)
|
||||||
{
|
{
|
||||||
|
assert(uart_base);
|
||||||
|
|
||||||
if (c == '\n')
|
if (c == '\n')
|
||||||
console_putc('\r');
|
console_putc('\r');
|
||||||
|
|
||||||
|
@ -71,6 +81,8 @@ int console_putc(int c)
|
||||||
|
|
||||||
int console_getc(void)
|
int console_getc(void)
|
||||||
{
|
{
|
||||||
|
assert(uart_base);
|
||||||
|
|
||||||
while ((pl011_read_fr(uart_base) & PL011_UARTFR_RXFE) != 0)
|
while ((pl011_read_fr(uart_base) & PL011_UARTFR_RXFE) != 0)
|
||||||
;
|
;
|
||||||
return pl011_read_dr(uart_base);
|
return pl011_read_dr(uart_base);
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include <platform.h>
|
#include <platform.h>
|
||||||
#include <bl2.h>
|
#include <bl2.h>
|
||||||
#include <bl_common.h>
|
#include <bl_common.h>
|
||||||
|
#include <console.h>
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Declarations of linker defined symbols which will help us find the layout
|
* Declarations of linker defined symbols which will help us find the layout
|
||||||
|
@ -110,6 +111,8 @@ void bl2_early_platform_setup(meminfo *mem_layout,
|
||||||
/* Initialize the platform config for future decision making */
|
/* Initialize the platform config for future decision making */
|
||||||
platform_config_setup();
|
platform_config_setup();
|
||||||
|
|
||||||
|
console_init(PL011_UART0_BASE);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include <fvp_pwrc.h>
|
#include <fvp_pwrc.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <arch_helpers.h>
|
#include <arch_helpers.h>
|
||||||
|
#include <console.h>
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Declarations of linker defined symbols which will help us find the layout
|
* Declarations of linker defined symbols which will help us find the layout
|
||||||
|
@ -117,6 +118,8 @@ void bl31_early_platform_setup(bl31_args *from_bl2,
|
||||||
|
|
||||||
/* Initialize the platform config for future decision making */
|
/* Initialize the platform config for future decision making */
|
||||||
platform_config_setup();
|
platform_config_setup();
|
||||||
|
|
||||||
|
console_init(PL011_UART0_BASE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
|
Loading…
Add table
Reference in a new issue