PPC: Setup debug UART for kernel when booted from U-Boot
Welcome to kernel debugger output! \o/
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include <KernelExport.h>
|
#include <KernelExport.h>
|
||||||
|
|
||||||
|
#include <arch/generic/debug_uart.h>
|
||||||
#include <boot/kernel_args.h>
|
#include <boot/kernel_args.h>
|
||||||
#include <platform/openfirmware/openfirmware.h>
|
#include <platform/openfirmware/openfirmware.h>
|
||||||
#include <real_time_clock.h>
|
#include <real_time_clock.h>
|
||||||
@@ -17,6 +18,7 @@
|
|||||||
|
|
||||||
// TODO: declare this in some header
|
// TODO: declare this in some header
|
||||||
extern void *gFDT;
|
extern void *gFDT;
|
||||||
|
extern "C" DebugUART *debug_uart_from_fdt(const void *fdt);
|
||||||
|
|
||||||
static PPCPlatform *sPPCPlatform;
|
static PPCPlatform *sPPCPlatform;
|
||||||
|
|
||||||
@@ -256,6 +258,7 @@ private:
|
|||||||
int fInput;
|
int fInput;
|
||||||
int fOutput;
|
int fOutput;
|
||||||
int fRTC;
|
int fRTC;
|
||||||
|
DebugUART *fDebugUART;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace BPrivate
|
} // namespace BPrivate
|
||||||
@@ -268,7 +271,8 @@ PPCUBoot::PPCUBoot()
|
|||||||
: PPCPlatform(PPC_PLATFORM_U_BOOT),
|
: PPCPlatform(PPC_PLATFORM_U_BOOT),
|
||||||
fInput(-1),
|
fInput(-1),
|
||||||
fOutput(-1),
|
fOutput(-1),
|
||||||
fRTC(-1)
|
fRTC(-1),
|
||||||
|
fDebugUART(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,7 +294,10 @@ PPCUBoot::Init(struct kernel_args *kernelArgs)
|
|||||||
status_t
|
status_t
|
||||||
PPCUBoot::InitSerialDebug(struct kernel_args *kernelArgs)
|
PPCUBoot::InitSerialDebug(struct kernel_args *kernelArgs)
|
||||||
{
|
{
|
||||||
return B_ERROR;
|
fDebugUART = debug_uart_from_fdt(gFDT);
|
||||||
|
if (fDebugUART == NULL)
|
||||||
|
return B_ERROR;
|
||||||
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// InitPostVM
|
// InitPostVM
|
||||||
@@ -312,6 +319,8 @@ PPCUBoot::InitRTC(struct kernel_args *kernelArgs,
|
|||||||
char
|
char
|
||||||
PPCUBoot::SerialDebugGetChar()
|
PPCUBoot::SerialDebugGetChar()
|
||||||
{
|
{
|
||||||
|
if (fDebugUART)
|
||||||
|
return fDebugUART->GetChar(false);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,6 +328,8 @@ PPCUBoot::SerialDebugGetChar()
|
|||||||
void
|
void
|
||||||
PPCUBoot::SerialDebugPutChar(char c)
|
PPCUBoot::SerialDebugPutChar(char c)
|
||||||
{
|
{
|
||||||
|
if (fDebugUART)
|
||||||
|
fDebugUART->PutChar(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetHardwareRTC
|
// SetHardwareRTC
|
||||||
|
|||||||
Reference in New Issue
Block a user