kernel/arch/arm: initialize debug console based on FDT
Change-Id: I759d38185c2f7e75d8ba7120c8d06740720171ec Reviewed-on: https://review.haiku-os.org/c/haiku/+/4735 Tested-by: Commit checker robot <[email protected]> Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
326b5263de
commit
15951db938
@@ -10,7 +10,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
//#include <arch_platform.h>
|
|
||||||
#include <arch/debug_console.h>
|
#include <arch/debug_console.h>
|
||||||
#include <arch/generic/debug_uart.h>
|
#include <arch/generic/debug_uart.h>
|
||||||
#include <arch/arm/arch_uart_pl011.h>
|
#include <arch/arm/arch_uart_pl011.h>
|
||||||
@@ -20,9 +19,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
// TODO: Declare this in some header
|
static DebugUART *sArchDebugUART = NULL;
|
||||||
DebugUART *gArchDebugUART;
|
|
||||||
extern DebugUART *debug_uart_from_fdt(const void *fdt);
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -63,20 +60,20 @@ arch_debug_serial_try_getchar(void)
|
|||||||
char
|
char
|
||||||
arch_debug_serial_getchar(void)
|
arch_debug_serial_getchar(void)
|
||||||
{
|
{
|
||||||
if (gArchDebugUART == NULL)
|
if (sArchDebugUART == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return gArchDebugUART->GetChar(false);
|
return sArchDebugUART->GetChar(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
arch_debug_serial_putchar(const char c)
|
arch_debug_serial_putchar(const char c)
|
||||||
{
|
{
|
||||||
if (gArchDebugUART == NULL)
|
if (sArchDebugUART == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gArchDebugUART->PutChar(c);
|
sArchDebugUART->PutChar(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -101,19 +98,22 @@ arch_debug_serial_early_boot_message(const char *string)
|
|||||||
status_t
|
status_t
|
||||||
arch_debug_console_init(kernel_args *args)
|
arch_debug_console_init(kernel_args *args)
|
||||||
{
|
{
|
||||||
// first try with hints from the FDT
|
//TODO: add initialiation for other UART types e.g. 8250
|
||||||
// TODO: Use UEFI somehow to get fdt
|
if (strncmp(args->arch_args.uart.kind, UART_KIND_PL011,
|
||||||
//gArchDebugUART = debug_uart_from_fdt(args->platform_args.fdt);
|
sizeof(args->arch_args.uart.kind)) == 0) {
|
||||||
|
sArchDebugUART = arch_get_uart_pl011(args->arch_args.uart.regs.start,
|
||||||
|
args->arch_args.uart.clock);
|
||||||
|
}
|
||||||
|
|
||||||
// As a last try, lets assume qemu's pl011 at a sane address
|
// As a last try, lets assume qemu's pl011 at a sane address
|
||||||
if (gArchDebugUART == NULL)
|
if (sArchDebugUART == NULL)
|
||||||
gArchDebugUART = arch_get_uart_pl011(0x9000000, 0x16e3600);
|
sArchDebugUART = arch_get_uart_pl011(0x9000000, 0x16e3600);
|
||||||
|
|
||||||
// Oh well.
|
// Oh well.
|
||||||
if (gArchDebugUART == NULL)
|
if (sArchDebugUART == NULL)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
gArchDebugUART->InitEarly();
|
sArchDebugUART->InitEarly();
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user