pl011 uart: Work around Rpi constructors not getting called
* Serial UART output on Raspberry Pi now functioning This is kind of a hack, however having serial output will enable easier debugging of loader. Not a perimant fix. * With UART output, we can now turn to why the constructors are so messed up. * Thanks to pfoetchen for his help and (lots!) of testing.
This commit is contained in:
@@ -21,8 +21,6 @@ UartPL011 gLoaderUART(uart_base_debug());
|
||||
|
||||
|
||||
static int32 sSerialEnabled = 0;
|
||||
static char sBuffer[16384];
|
||||
static uint32 sBufferPosition;
|
||||
|
||||
|
||||
static void
|
||||
@@ -38,12 +36,7 @@ serial_puts(const char* string, size_t size)
|
||||
if (sSerialEnabled <= 0)
|
||||
return;
|
||||
|
||||
if (sBufferPosition + size < sizeof(sBuffer)) {
|
||||
memcpy(sBuffer + sBufferPosition, string, size);
|
||||
sBufferPosition += size;
|
||||
}
|
||||
|
||||
while (size-- != 0) {
|
||||
while (size-- > 0) {
|
||||
char c = string[0];
|
||||
|
||||
if (c == '\n') {
|
||||
@@ -86,7 +79,5 @@ serial_init(void)
|
||||
|
||||
serial_enable();
|
||||
|
||||
serial_putc('!');
|
||||
serial_puts("SER INIT", 8);
|
||||
serial_puts("Serial startup\n", 15);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ clear_bss(void)
|
||||
static void
|
||||
call_ctors(void)
|
||||
{
|
||||
#warning BUG: constructors don't get called!
|
||||
void (**f)(void);
|
||||
|
||||
for (f = &__ctor_list; f < &__ctor_end; f++) {
|
||||
@@ -65,7 +66,7 @@ abort(void)
|
||||
uint32
|
||||
platform_boot_options(void)
|
||||
{
|
||||
#warning IMPLEMENT platform_boot_options
|
||||
#warning IMPLEMENT platform_boot_options
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -73,7 +74,7 @@ platform_boot_options(void)
|
||||
void
|
||||
platform_start_kernel(void)
|
||||
{
|
||||
#warning IMPLEMENT platform_start_kernel
|
||||
#warning IMPLEMENT platform_start_kernel
|
||||
panic("kernel returned!\n");
|
||||
}
|
||||
|
||||
@@ -81,7 +82,7 @@ platform_start_kernel(void)
|
||||
void
|
||||
platform_exit(void)
|
||||
{
|
||||
#warning IMPLEMENT platform_exit
|
||||
#warning IMPLEMENT platform_exit
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -104,7 +104,9 @@ void
|
||||
UartPL011::InitEarly()
|
||||
{
|
||||
// Perform special hardware UART configuration
|
||||
// Raspberry Pi: Early gpio handled by gpio_init in platform code
|
||||
|
||||
#warning Raspberry Pi Hack: Fix constructors not getting called in loader.
|
||||
fUARTBase = uart_base_debug();
|
||||
}
|
||||
|
||||
|
||||
@@ -135,7 +137,7 @@ int
|
||||
UartPL011::PutChar(char c)
|
||||
{
|
||||
if (fUARTEnabled == true) {
|
||||
WriteUart(PL01x_DR, (unsigned int)c);
|
||||
WriteUart(PL01x_DR, c);
|
||||
// Empty the transmit buffer
|
||||
FlushTx();
|
||||
return 0;
|
||||
@@ -145,7 +147,6 @@ UartPL011::PutChar(char c)
|
||||
}
|
||||
|
||||
|
||||
/* returns -1 if no data available */
|
||||
int
|
||||
UartPL011::GetChar(bool wait)
|
||||
{
|
||||
@@ -158,7 +159,6 @@ void
|
||||
UartPL011::FlushTx()
|
||||
{
|
||||
while (ReadUart(PL01x_FR) & PL01x_FR_TXFF);
|
||||
// wait for the last char to get out
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user