hrev44165 adds 4 changesets to branch 'master' old head: 6e11d185ae02c18318f4aecf3a080771544b14cc new head: ce077d96cb0569a3c2587a10121d4fa1d0d1ac54 ---------------------------------------------------------------------------- 56b0f60: rpi: Add new beta loader * Sets uart up for us * Enhanced non-linux os loading * Supports device trees * Add config.txt example with sample settings a5453f6: rpi: Clean up debug output 91161d1: pl011 uart: Fix fifo states * Lets wait for space *before* writing to the fifo instead of after. * Flush functions now really flush the fifo waiting for them to enter an empty state. * Simple memory barriers added (may need revised) We don't have access to the kernel barriers here. ce077d9: rpi: Flush serial on cleanup * Wait for transmit fifo to empty on serial cleanup * Serial cleanup on platform exit [ Alexander von Gluck IV <kallisti5@xxxxxxxxxxx> ] ---------------------------------------------------------------------------- 7 files changed, 69 insertions(+), 18 deletions(-) build/jam/board/raspberry_pi/beta_start.elf | Bin 0 -> 3099476 bytes build/jam/board/raspberry_pi/config.txt | 38 ++++++++++++++++ build/jam/board/raspberry_pi/info.txt | 1 + src/system/boot/platform/raspberrypi_arm/debug.cpp | 2 +- .../boot/platform/raspberrypi_arm/serial.cpp | 7 ++- src/system/boot/platform/raspberrypi_arm/start.c | 2 +- src/system/kernel/arch/arm/uart_pl011.cpp | 37 +++++++++------ ############################################################################ Commit: 56b0f60189baa88948707da0f9df2320a1bcae32 URL: http://cgit.haiku-os.org/haiku/commit/?id=56b0f60 Author: Alexander von Gluck IV <kallisti5@xxxxxxxxxxx> Date: Wed May 16 08:55:09 2012 UTC rpi: Add new beta loader * Sets uart up for us * Enhanced non-linux os loading * Supports device trees * Add config.txt example with sample settings ---------------------------------------------------------------------------- diff --git a/build/jam/board/raspberry_pi/beta_start.elf b/build/jam/board/raspberry_pi/beta_start.elf new file mode 100644 index 0000000..1e78b23 Binary files /dev/null and b/build/jam/board/raspberry_pi/beta_start.elf differ diff --git a/build/jam/board/raspberry_pi/config.txt b/build/jam/board/raspberry_pi/config.txt new file mode 100644 index 0000000..47cabbf --- /dev/null +++ b/build/jam/board/raspberry_pi/config.txt @@ -0,0 +1,38 @@ +##### Overclocking +# WARNING: Don't adjust unless you know what you are doing! +#arm_freq=800 +#gpu_freq=350 +#core_freq=250 +#h264_freq=250 +#isp_freq=250 +#v3d_freq=250 +#sdram_freq=250 +#over_voltage=0 +#over_voltage_sdram=0 +#over_voltage_sdram_c=0 +#over_voltage_sdram_i=0 +#over_voltage_sdram_p=0 + + +##### Video +#sdtv_mode=0 +#sdtv_aspect=1 +#hdmi_mode=19 +#hdmi_drive= +#test_mode=0 +#disable_overscan=0 +enable_l2cache=1 + + +##### Low level +# Skip boot tags for non-linux platforms +disable_commandline_tags=1 +#kernel_address= +#device_tree=bcm2835.dtb +#device_tree_address=0x100 + + +##### UART Settings +# Default is 115200 +#init_uart_baud=9600 +#init_uart_clock= diff --git a/build/jam/board/raspberry_pi/info.txt b/build/jam/board/raspberry_pi/info.txt index 9b69e40..38f3715 100644 --- a/build/jam/board/raspberry_pi/info.txt +++ b/build/jam/board/raspberry_pi/info.txt @@ -11,6 +11,7 @@ get them from one of the official images: * bootcode.bin : 2nd stage bootloader, starts with SDRAM disabled * loader.bin : 3rd stage bootloader, starts with SDRAM enabled * start.elf: The GPU binary firmware image, provided by the foundation. + * For now, use beta_start.elf * kernel.img: The OS kernel to load on the ARM processor. Normally this is Linux - see instructions for compiling a kernel. * cmdline.txt: Parameters passed to the kernel on boot. ############################################################################ Commit: a5453f6dd85705ee49b20f23e682b090693366e1 URL: http://cgit.haiku-os.org/haiku/commit/?id=a5453f6 Author: Alexander von Gluck IV <kallisti5@xxxxxxxxxxx> Date: Wed May 16 08:56:52 2012 UTC rpi: Clean up debug output ---------------------------------------------------------------------------- diff --git a/src/system/boot/platform/raspberrypi_arm/debug.cpp b/src/system/boot/platform/raspberrypi_arm/debug.cpp index 4e47bc7..b2a987c 100644 --- a/src/system/boot/platform/raspberrypi_arm/debug.cpp +++ b/src/system/boot/platform/raspberrypi_arm/debug.cpp @@ -17,7 +17,7 @@ extern "C" void panic(const char* format, ...) { - const char hint[] = "*** PANIC ***"; + const char hint[] = "\n*** PANIC ***\n"; char buffer[512]; va_list list; int length; diff --git a/src/system/boot/platform/raspberrypi_arm/serial.cpp b/src/system/boot/platform/raspberrypi_arm/serial.cpp index e0bb0ec..ec6f6c0 100644 --- a/src/system/boot/platform/raspberrypi_arm/serial.cpp +++ b/src/system/boot/platform/raspberrypi_arm/serial.cpp @@ -79,5 +79,6 @@ serial_init(void) serial_enable(); - serial_puts("Serial startup\n", 15); + serial_puts("\n\n********************\n", 23); + serial_puts("Haiku serial startup\n", 21); } ############################################################################ Commit: 91161d1d6f52ac67333224547fe7af146dbd5ef0 URL: http://cgit.haiku-os.org/haiku/commit/?id=91161d1 Author: Alexander von Gluck IV <kallisti5@xxxxxxxxxxx> Date: Wed May 16 09:47:24 2012 UTC pl011 uart: Fix fifo states * Lets wait for space *before* writing to the fifo instead of after. * Flush functions now really flush the fifo waiting for them to enter an empty state. * Simple memory barriers added (may need revised) We don't have access to the kernel barriers here. ---------------------------------------------------------------------------- diff --git a/src/system/kernel/arch/arm/uart_pl011.cpp b/src/system/kernel/arch/arm/uart_pl011.cpp index f279b11..7ba7bd3 100644 --- a/src/system/kernel/arch/arm/uart_pl011.cpp +++ b/src/system/kernel/arch/arm/uart_pl011.cpp @@ -14,13 +14,20 @@ //#include <target/debugconfig.h> +static void +barrier() +{ + asm volatile ("" : : : "memory"); +} + + UartPL011::UartPL011(addr_t base) : fUARTEnabled(true), fUARTBase(base) { - // TODO: Nice, but not required - #if 0 + barrier(); + // ** Loopback test uint32 cr = PL01x_CR_UARTEN; // Enable UART @@ -37,23 +44,19 @@ UartPL011::UartPL011(addr_t base) // Write a 0 to the port and wait for confim.. WriteUart(PL01x_DR, 0); - while (ReadUart(PL01x_FR) & PL01x_FR_BUSY); - // Wait for xmit on loopback + while (ReadUart(PL01x_FR) & PL01x_FR_BUSY) + barrier(); // ** Disable loopback, enable uart cr = PL01x_CR_UARTEN | PL011_CR_RXE | PL011_CR_TXE; WriteUart(PL011_CR, cr); - // Enable DMA to received request outputs - WriteUart(PL011_DMACR, PL011_DMAONERR); - // ** Clear interrupts WriteUart(PL011_ICR, PL011_OEIS | PL011_BEIS | PL011_PEIS | PL011_FEIS); - // Set Rx timeout interrupt mask and Rx interrput mask - WriteUart(PL011_IMSC, PL011_RTIM | PL011_RXIM); - #endif + // ** Disable interrupts + WriteUart(PL011_IMSC, 0); } @@ -134,9 +137,11 @@ int UartPL011::PutChar(char c) { if (fUARTEnabled == true) { + // Wait until there is room in fifo + while ((ReadUart(PL01x_FR) & PL01x_FR_TXFF) != 0) + barrier(); + WriteUart(PL01x_DR, c); - // Empty the transmit buffer - FlushTx(); return 0; } @@ -155,12 +160,16 @@ UartPL011::GetChar(bool wait) void UartPL011::FlushTx() { - while (ReadUart(PL01x_FR) & PL01x_FR_TXFF); + // Wait until transmit fifo empty + while ((ReadUart(PL01x_FR) & PL011_FR_TXFE) == 0) + barrier(); } void UartPL011::FlushRx() { - #warning ARM Amba PL011 UART incomplete + // Wait until receive fifo empty + while ((ReadUart(PL01x_FR) & PL01x_FR_RXFE) == 0) + barrier(); } ############################################################################ Revision: hrev44165 Commit: ce077d96cb0569a3c2587a10121d4fa1d0d1ac54 URL: http://cgit.haiku-os.org/haiku/commit/?id=ce077d9 Author: Alexander von Gluck IV <kallisti5@xxxxxxxxxxx> Date: Wed May 16 09:50:29 2012 UTC rpi: Flush serial on cleanup * Wait for transmit fifo to empty on serial cleanup * Serial cleanup on platform exit ---------------------------------------------------------------------------- diff --git a/src/system/boot/platform/raspberrypi_arm/serial.cpp b/src/system/boot/platform/raspberrypi_arm/serial.cpp index ec6f6c0..926f0b4 100644 --- a/src/system/boot/platform/raspberrypi_arm/serial.cpp +++ b/src/system/boot/platform/raspberrypi_arm/serial.cpp @@ -67,7 +67,9 @@ serial_enable(void) extern "C" void serial_cleanup(void) { -#warning IMPLEMENT serial_cleanup + // Transmit the last of our fifo + gLoaderUART.FlushTx(); + gLoaderUART.Disable(); } diff --git a/src/system/boot/platform/raspberrypi_arm/start.c b/src/system/boot/platform/raspberrypi_arm/start.c index bac1cee..366bb64 100644 --- a/src/system/boot/platform/raspberrypi_arm/start.c +++ b/src/system/boot/platform/raspberrypi_arm/start.c @@ -92,7 +92,7 @@ platform_start_kernel(void) void platform_exit(void) { - #warning IMPLEMENT platform_exit + serial_cleanup(); }