diff --git a/headers/private/kernel/boot/platform/raspberrypi_arm/platform_arch.h b/headers/private/kernel/boot/platform/raspberrypi_arm/platform_arch.h deleted file mode 100644 index 313559bedd..0000000000 --- a/headers/private/kernel/boot/platform/raspberrypi_arm/platform_arch.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. - * Distributed under the terms of the MIT License. - * Copyright 2011-2012, Haiku Inc. All rights reserved. - * Distributed under the terms of the MIT License. -*/ -#ifndef KERNEL_BOOT_PLATFORM_PI_ARCH_H -#define KERNEL_BOOT_PLATFORM_PI_ARCH_H - - -#include - - -struct kernel_args; - - -#ifdef __cplusplus -extern "C" { -#endif -/* memory management */ -extern status_t arch_set_callback(void); -extern void *arch_mmu_allocate(void *address, size_t size, uint8 protection, - bool exactAddress); -extern status_t arch_mmu_free(void *address, size_t size); -extern status_t arch_mmu_init(void); - -/* CPU */ -extern status_t boot_arch_cpu_init(void); - -/* kernel start */ -status_t arch_start_kernel(struct kernel_args *kernelArgs, addr_t kernelEntry, - addr_t kernelStackTop); - -#ifdef __cplusplus -} -#endif - - -#endif /* KERNEL_BOOT_PLATFORM_PI_ARCH_H */ diff --git a/headers/private/kernel/boot/platform/raspberrypi_arm/platform_debug.h b/headers/private/kernel/boot/platform/raspberrypi_arm/platform_debug.h deleted file mode 100644 index f665bebf7c..0000000000 --- a/headers/private/kernel/boot/platform/raspberrypi_arm/platform_debug.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2012, Haiku Inc. All rights reserved. - * Distributed under the terms of the MIT License. - */ -#ifndef _PLATFORM_DEBUG_H_ -#define _PLATFORM_DEBUG_H_ - -#define DEBUG_DELAY_SHORT 200 -#define DEBUG_DELAY_MEDIUM 500 -#define DEBUG_DELAY_LONG 1000 - -void debug_delay(int time); -void debug_set_led(bool on); - -void debug_toggle_led(int count, int delay = DEBUG_DELAY_MEDIUM); - // Toggles the led count times with the delay for both on and off time. - -void debug_blink_number(int number); - // Implements a blink pattern to output arbitrary numbers: - // - // 1. Led turns off and stays off for a long delay. - // 2. Led blinks x times with a short delay, where x is the current - // decimal place + 1 (so 0 values are easier to see). - // 3. Led stays off for a long delay to indicate the move to the next - // decimal place and step 2. is repeated until all the rest of the - // number is 0. - // 4. The led turns on and stays on with a long delay to indicate finish. - // 5. Led state is reset to the original value. - // - // The lowest decimal is output first, so the number will be reversed. As an - // example the number 205 would be blinked as follows: - // long off (start indicator), 6 blinks (indicating 5), - // long off (moving to next decimal), 1 blink (indicating 0) - // long off (moving to next decimal), 3 blinks (indicating 2) - // long on (finish indicator) - -void debug_halt(); - // Stalls execution in an endless loop. - -void debug_assert(bool condition); - // Flashes the led 20 times rapidly and stalls execution if the condition - // isn't met. - -#endif // _PLATFORM_DEBUG_H_ - diff --git a/headers/private/kernel/boot/platform/raspberrypi_arm/platform_kernel_args.h b/headers/private/kernel/boot/platform/raspberrypi_arm/platform_kernel_args.h deleted file mode 100644 index 3248974967..0000000000 --- a/headers/private/kernel/boot/platform/raspberrypi_arm/platform_kernel_args.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2009-2011, Haiku Inc. All rights reserved. - * Distributed under the terms of the MIT License. - */ -#ifndef KERNEL_BOOT_PLATFORM_PI_KERNEL_ARGS_H -#define KERNEL_BOOT_PLATFORM_PI_KERNEL_ARGS_H - - -#ifndef KERNEL_BOOT_KERNEL_ARGS_H -# error This file is included from only -#endif - -#define SMP_MAX_CPUS 1 - -#define MAX_PHYSICAL_MEMORY_RANGE 4 -#define MAX_PHYSICAL_ALLOCATED_RANGE 8 -#define MAX_VIRTUAL_ALLOCATED_RANGE 32 - - -typedef struct { - char dummy; -} platform_kernel_args; - -#endif /* KERNEL_BOOT_PLATFORM_PI_KERNEL_ARGS_H */ diff --git a/headers/private/kernel/boot/platform/raspberrypi_arm/platform_stage2_args.h b/headers/private/kernel/boot/platform/raspberrypi_arm/platform_stage2_args.h deleted file mode 100644 index 81169cf35a..0000000000 --- a/headers/private/kernel/boot/platform/raspberrypi_arm/platform_stage2_args.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2009-2012, Haiku Inc. All rights reserved. - * Distributed under the terms of the MIT License. - */ -#ifndef KERNEL_BOOT_PLATFORM_PI_STAGE2_H -#define KERNEL_BOOT_PLATFORM_PI_STAGE2_H - -#ifndef KERNEL_BOOT_STAGE2_ARGS_H -# error This file is included from only -#endif - -struct platform_stage2_args { - void *boot_tgz_data; - uint32 boot_tgz_size; -}; - -#endif /* KERNEL_BOOT_PLATFORM_PI_STAGE2_H */ diff --git a/src/system/boot/platform/raspberrypi_arm/Jamfile b/src/system/boot/platform/raspberrypi_arm/Jamfile deleted file mode 100644 index d9a102d80d..0000000000 --- a/src/system/boot/platform/raspberrypi_arm/Jamfile +++ /dev/null @@ -1,57 +0,0 @@ -SubDir HAIKU_TOP src system boot platform raspberrypi_arm ; - -SubDirHdrs $(HAIKU_TOP) headers private kernel boot platform $(TARGET_BOOT_PLATFORM) ; -SubDirHdrs $(HAIKU_TOP) src system boot arch $(TARGET_ARCH) ; -SubDirHdrs $(HAIKU_TOP) src system kernel debug ; - -UsePrivateHeaders [ FDirName kernel disk_device_manager ] ; -UsePrivateHeaders [ FDirName graphics common ] ; -UsePrivateHeaders [ FDirName graphics vesa ] ; -UsePrivateHeaders [ FDirName storage ] ; - -UsePrivateHeaders [ FDirName kernel arch $(TARGET_KERNEL_ARCH) board $(TARGET_BOOT_BOARD) ] ; - -{ - local defines = _BOOT_MODE - BOOT_ARCHIVE_BASE=$(HAIKU_BOARD_BOOT_ARCHIVE_BASE) - BOOT_ARCHIVE_SIZE=$(HAIKU_BOARD_BOOT_ARCHIVE_SIZE) ; - - defines = [ FDefines $(defines) ] ; - SubDirCcFlags $(defines) ; - SubDirC++Flags $(defines) -fno-rtti ; -} - -SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons accelerants common ] ; - -BootMergeObject boot_platform_raspberrypi_arm.o : - entry.S - start.cpp - console.cpp - cpu.cpp - debug.cpp - devices.cpp - gpio.cpp - keyboard.cpp - mailbox.cpp - menu.cpp - serial.cpp - video.cpp - - arch_framebuffer_bcm2835.cpp - - $(genericPlatformSources) - : - : boot_platform_generic.a -; - - -SEARCH on [ FGristFiles $(genericPlatformSources) ] - = [ FDirName $(HAIKU_TOP) src system boot platform generic ] ; - -SEARCH on [ FGristFiles devices.cpp ] - = [ FDirName $(HAIKU_TOP) src system boot platform u-boot ] ; - - -# Tell the build system to where stage1.bin can be found, so it can be used -# elsewhere. -SEARCH on stage1.bin = $(SUBDIR) ; diff --git a/src/system/boot/platform/raspberrypi_arm/README b/src/system/boot/platform/raspberrypi_arm/README deleted file mode 100644 index a41f09450c..0000000000 --- a/src/system/boot/platform/raspberrypi_arm/README +++ /dev/null @@ -1,3 +0,0 @@ -THIS PLATFORM CODE SHOULD DIE SOON IN FAVOR OF U-BOOT -Any early ARM drivers should move over to src/system/boot/arch/arm - -- Alex v. 2015 diff --git a/src/system/boot/platform/raspberrypi_arm/arch_start_kernel.S b/src/system/boot/platform/raspberrypi_arm/arch_start_kernel.S deleted file mode 100644 index ebd7db5571..0000000000 --- a/src/system/boot/platform/raspberrypi_arm/arch_start_kernel.S +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2011, Fran??ois Revol . - * All rights reserved. Distributed under the terms of the MIT License. - */ - -#include - -#include - - .text - -/* - * status_t arch_start_kernel(struct kernel_args *kernelArgs, - * addr_t kernelEntry, addr_t kernelStackTop); - - r0 - kernelArgs - r1 - kernelEntry - r2 - kernelStackTop -*/ -FUNCTION(arch_start_kernel): - - // set the kernel stack - mov sp,r2 - - // set up kernel _start args - //mov r0,r0 // kernelArgs - mov r4,r1 - mov r1,#0 // currentCPU=0 - - // call the kernel - mov pc,r4 - - // return - mov r0,#-1 // B_ERROR - mov pc,lr - -FUNCTION_END(arch_start_kernel) diff --git a/src/system/boot/platform/raspberrypi_arm/console.cpp b/src/system/boot/platform/raspberrypi_arm/console.cpp deleted file mode 100644 index 9477ed7b00..0000000000 --- a/src/system/boot/platform/raspberrypi_arm/console.cpp +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright 2004-2005, Axel D?rfler, axeld@pinc-software.de. - * All rights reserved. Distributed under the terms of the MIT License. - * - * Copyright 2009 Jonas Sundström, jonas@kirilla.com - * All rights reserved. Distributed under the terms of the MIT License. - */ - - -#include "console.h" -#include "keyboard.h" -#include "serial.h" - -#include -#include -#include - -#include - - -class Console : public ConsoleNode { -public: - Console(); - - virtual ssize_t ReadAt(void* cookie, off_t pos, void* buffer, - size_t bufferSize); - virtual ssize_t WriteAt(void* cookie, off_t pos, - const void* buffer, size_t bufferSize); -}; - - -class VTConsole : public ConsoleNode { -public: - VTConsole(); - void ClearScreen(); - void SetCursor(int32 x, int32 y); - void SetColor(int32 foreground, int32 background); -}; - - -class SerialConsole : public VTConsole { -public: - SerialConsole(); - - virtual ssize_t ReadAt(void *cookie, off_t pos, void *buffer, - size_t bufferSize); - virtual ssize_t WriteAt(void *cookie, off_t pos, const void *buffer, - size_t bufferSize); -}; - - -static Console sInput; -static Console sOutput; -static SerialConsole sSerial; - -FILE* stdin; -FILE* stdout; -FILE* stderr; - - -// #pragma mark - - - -Console::Console() - : - ConsoleNode() -{ -} - - -ssize_t -Console::ReadAt(void* cookie, off_t pos, void* buffer, size_t bufferSize) -{ - // don't seek in character devices - // not implemented (and not yet? needed) - return B_ERROR; -} - - -ssize_t -Console::WriteAt(void* cookie, off_t /*pos*/, const void* buffer, - size_t bufferSize) -{ - return 0; -} - - -// #pragma mark - - - -VTConsole::VTConsole() - : - ConsoleNode() -{ -} - - -void -VTConsole::ClearScreen() -{ - WriteAt(NULL, 0LL, "\033[2J", 4); -} - - -void -VTConsole::SetCursor(int32 x, int32 y) -{ - char buffer[9]; - x = MIN(80, MAX(1, x)); - y = MIN(25, MAX(1, y)); - int len = snprintf(buffer, sizeof(buffer), - "\033[%" B_PRId32 ";%" B_PRId32 "H", y, x); - WriteAt(NULL, 0LL, buffer, len); -} - - -void -VTConsole::SetColor(int32 foreground, int32 background) -{ - static const char cmap[] = { - 0, 4, 2, 6, 1, 5, 3, 7 }; - char buffer[12]; - - if (foreground < 0 || foreground >= 8) - return; - if (background < 0 || background >= 8) - return; - - // We assume normal display attributes here - int len = snprintf(buffer, sizeof(buffer), - "\033[%" B_PRId32 ";%" B_PRId32 "m", - cmap[foreground] + 30, cmap[background] + 40); - - WriteAt(NULL, 0LL, buffer, len); -} - - -// #pragma mark - - - -SerialConsole::SerialConsole() - : VTConsole() -{ -} - - -ssize_t -SerialConsole::ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize) -{ - // don't seek in character devices - // not implemented (and not yet? needed) - return B_ERROR; -} - - -ssize_t -SerialConsole::WriteAt(void *cookie, off_t /*pos*/, const void *buffer, - size_t bufferSize) -{ - serial_puts((const char *)buffer, bufferSize); - return bufferSize; -} - - -// #pragma mark - - - -void -console_clear_screen(void) -{ - sSerial.ClearScreen(); -} - - -int32 -console_width(void) -{ - return 80; -} - - -int32 -console_height(void) -{ - return 25; -} - - -void -console_set_cursor(int32 x, int32 y) -{ - sSerial.SetCursor(x, y); -} - - -void -console_show_cursor(void) -{ -} - - -void -console_hide_cursor(void) -{ -} - - -int -console_wait_for_key(void) -{ - union key key; - key.ax = serial_getc(true); - return key.code.ascii; -} - - -void -console_set_color(int32 foreground, int32 background) -{ - sSerial.SetColor(foreground, background); -} - - -status_t -console_init(void) -{ - stdin = (FILE *)&sSerial; - stdout = (FILE *)&sSerial; - stderr = (FILE *)&sSerial; - return B_OK; -} - diff --git a/src/system/boot/platform/raspberrypi_arm/console.h b/src/system/boot/platform/raspberrypi_arm/console.h deleted file mode 100644 index 55f21e27a6..0000000000 --- a/src/system/boot/platform/raspberrypi_arm/console.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2009 Jonas Sundström, jonas@kirilla.com - * All rights reserved. Distributed under the terms of the MIT License. - */ -#ifndef _SYSTEM_BOOT_PLATFORM_STUB_CONSOLE_H -#define _SYSTEM_BOOT_PLATFORM_STUB_CONSOLE_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -extern status_t console_init(void); - -#ifdef __cplusplus -} -#endif - -#endif /* _SYSTEM_BOOT_PLATFORM_STUB_CONSOLE_H */ diff --git a/src/system/boot/platform/raspberrypi_arm/cpu.cpp b/src/system/boot/platform/raspberrypi_arm/cpu.cpp deleted file mode 100644 index 0f6f60406c..0000000000 --- a/src/system/boot/platform/raspberrypi_arm/cpu.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2009 Jonas Sundström, jonas@kirilla.com - * All rights reserved. Distributed under the terms of the MIT License. - */ - - -#include "arch_cpu.h" - -extern "C" void -spin(bigtime_t microseconds) -{ - // fallback to arch-specific code - arch_spin(microseconds); -} - - -extern "C" void -cpu_init() -{ - boot_arch_cpu_init(); -} diff --git a/src/system/boot/platform/raspberrypi_arm/cpu.h b/src/system/boot/platform/raspberrypi_arm/cpu.h deleted file mode 100644 index 466b4bfe9b..0000000000 --- a/src/system/boot/platform/raspberrypi_arm/cpu.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2009 Jonas Sundström, jonas@kirilla.com - * All rights reserved. Distributed under the terms of the MIT License. - */ -#ifndef _SYSTEM_BOOT_PLATFORM_PI_CPU_H -#define _SYSTEM_BOOT_PLATFORM_PI_CPU_H - - -#include - - -#ifdef __cplusplus -extern "C" { -#endif - -extern void cpu_init(void); - -#ifdef __cplusplus -} -#endif - -#endif /* _SYSTEM_BOOT_PLATFORM_ROUTERBOARD_MIPSEL_CPU_H */ - diff --git a/src/system/boot/platform/raspberrypi_arm/debug.cpp b/src/system/boot/platform/raspberrypi_arm/debug.cpp deleted file mode 100644 index 2b589ccb91..0000000000 --- a/src/system/boot/platform/raspberrypi_arm/debug.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright 2004-2005, Axel Dörfler, axeld@pinc-software.de. - * All rights reserved. Distributed under the terms of the MIT License. - * - * Copyright 2009 Jonas Sundström, jonas@kirilla.com - * All rights reserved. Distributed under the terms of the MIT License. - */ - -#include "platform_debug.h" - -#include "gpio.h" -#include "serial.h" - -#include -#include -#include - - -extern "C" void platform_video_puts(const char* string); - -extern addr_t gPeripheralBase; -static bool sLedState = true; - - -void -debug_delay(int time) -{ - for (; time >= 0; time--) - for (int i = 0; i < 10000; i++) - asm volatile ("nop"); -} - - -void -debug_set_led(bool on) -{ - gpio_write(gPeripheralBase + GPIO_BASE, 16, on ? 0 : 1); - sLedState = on; -} - - -void -debug_toggle_led(int count, int delay) -{ - for (count *= 2; count > 0; count--) { - debug_set_led(!sLedState); - debug_delay(delay); - } -} - - -void -debug_blink_number(int number) -{ - bool previousState = sLedState; - - debug_set_led(false); - debug_delay(DEBUG_DELAY_LONG); - - while (number > 0) { - debug_toggle_led(number % 10 + 1, DEBUG_DELAY_SHORT); - debug_delay(DEBUG_DELAY_LONG); - number /= 10; - } - - debug_set_led(true); - debug_delay(DEBUG_DELAY_LONG); - - debug_set_led(previousState); -} - - -void -debug_halt() -{ - while (true) - debug_delay(DEBUG_DELAY_LONG); -} - - -void -debug_assert(bool condition) -{ - if (condition) - return; - - debug_toggle_led(20, 20); - debug_halt(); -} - - -extern "C" void -debug_puts(const char* string, int32 length) -{ - platform_video_puts(string); - serial_puts(string, length); -} - - -extern "C" void -panic(const char* format, ...) -{ - const char hint[] = "\n*** PANIC ***\n"; - char buffer[512]; - va_list list; - int length; - - debug_puts(hint, sizeof(hint)); - va_start(list, format); - length = vsnprintf(buffer, sizeof(buffer), format, list); - va_end(list); - - if (length >= (int)sizeof(buffer)) - length = sizeof(buffer) - 1; - - debug_puts(buffer, length); - //fprintf(stderr, "%s", buffer); - - debug_puts("\nPress key to reboot.", 21); - - platform_exit(); -} - - -extern "C" void -dprintf(const char* format, ...) -{ - char buffer[512]; - va_list list; - int length; - - va_start(list, format); - length = vsnprintf(buffer, sizeof(buffer), format, list); - va_end(list); - - if (length >= (int)sizeof(buffer)) - length = sizeof(buffer) - 1; - - debug_puts(buffer, length); - - if (platform_boot_options() & BOOT_OPTION_DEBUG_OUTPUT) - fprintf(stderr, "%s", buffer); -} - - -char* -platform_debug_get_log_buffer(size_t* _size) -{ - return NULL; -} diff --git a/src/system/boot/platform/raspberrypi_arm/entry.S b/src/system/boot/platform/raspberrypi_arm/entry.S deleted file mode 100644 index 6a0bedbcd1..0000000000 --- a/src/system/boot/platform/raspberrypi_arm/entry.S +++ /dev/null @@ -1,34 +0,0 @@ -.section .init -.globl _entry -_entry: - b jmp_loader - -.section .text - /* Start "safe" code area. - * 0x4000 minimum safe area - * defined in boot_loader_raspberrypi_arm.ld - */ - -jmp_loader: - /* Start Haiku loader */ - - /* For Thumb code? */ - /* - ldr r12, =_start - mov lr, pc - bx r12 - */ - - /* Turn on unaligned memory access */ - mrc p15, #0, r4, c1, c0, #0 - orr r4, #0x400000 - mcr p15, #0, r4, c1, c0, #0 - - /* Setup initial stack right below our .text section (growing downwards - into the space reserved for .init) */ - mov sp, #0x8000 - - b _start - - /* Cause exception if loader returns */ - swi 0xFFFFFF diff --git a/src/system/boot/platform/raspberrypi_arm/gpio.cpp b/src/system/boot/platform/raspberrypi_arm/gpio.cpp deleted file mode 100644 index e3bcadccab..0000000000 --- a/src/system/boot/platform/raspberrypi_arm/gpio.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright 2011-2012 Haiku, Inc. All rights reserved. - * Distributed under the terms of the MIT License. - * - * Authors: - * Alexander von Gluck, kallisti5@unixzen.com - * Gordon Henderson, gordon@drogon.net - */ - - -#include "gpio.h" - - -// Define the shift up for the 3 bits per pin in each GPFSEL port -static uint8_t -kGPIOToShift[] = -{ - 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, - 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, - 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, - 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, - 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, -}; - - -// Map a BCM_GPIO pin to it's control port. (GPFSEL 0-5) -static uint8_t -kGPIOToGPFSEL[] = -{ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, -}; - - -// (Word) offset to the GPIO Set registers for each GPIO pin -static uint8_t -kGPIOToGPSET[] = -{ - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, -}; - -// (Word) offset to the GPIO Clear registers for each GPIO pin -static uint8_t -kGPIOToGPCLR[] = -{ - 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, -}; - - -/*! - * At GPIO (base) (pin) state set (value) - */ -void -gpio_write(addr_t base, int pin, bool value) -{ - volatile addr_t *gpio = (addr_t*)base; - - if (value == 1) - *(gpio + kGPIOToGPSET[pin]) = 1 << pin; - else - *(gpio + kGPIOToGPCLR[pin]) = 1 << pin; -} - - -/*! - * At GPIO (base) (pin) set mode (mode) - */ -void -gpio_mode(addr_t base, int pin, int mode) -{ - int sel = kGPIOToGPFSEL[pin]; - int shift = kGPIOToShift[pin]; - - volatile addr_t *gpio = (addr_t*)base + sel; - - if (mode == GPIO_IN) - *gpio = (*gpio & ~(7 << shift)); - else if (mode == GPIO_OUT) - *gpio = (*gpio & ~(7 << shift)) | (1 << shift); - else - *gpio = (*gpio & ~(7 << shift)) | (mode << shift); -} - - -void -gpio_init() -{ - // ** Take control of ok led, and general use pins - int pin = 0; - for (pin = 16; pin <= 25; pin++) - gpio_mode(GPIO_BASE, pin, GPIO_OUT); -} diff --git a/src/system/boot/platform/raspberrypi_arm/gpio.h b/src/system/boot/platform/raspberrypi_arm/gpio.h deleted file mode 100644 index b64ce0b30f..0000000000 --- a/src/system/boot/platform/raspberrypi_arm/gpio.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2011-2012 Haiku, Inc. All rights reserved. - * Distributed under the terms of the MIT License. - * - * Authors: - * Alexander von Gluck, kallisti5@unixzen.com - */ -#ifndef _SYSTEM_BOOT_PLATFORM_PI_GPIO_H -#define _SYSTEM_BOOT_PLATFORM_PI_GPIO_H - - -#include - -#include - - -#define GPIO_IN 0 -#define GPIO_OUT 1 -#define GPIO_ALT0 4 -#define GPIO_ALT1 5 -#define GPIO_ALT2 6 -#define GPIO_ALT3 7 -#define GPIO_ALT4 3 -#define GPIO_ALT5 2 - - - -#ifdef __cplusplus -extern "C" { -#endif - - -void gpio_write(addr_t base, int pin, bool value); -void gpio_mode(addr_t base, int pin, int mode); - -void gpio_init(); - - -#ifdef __cplusplus -} -#endif - - -#endif /* _SYSTEM_BOOT_PLATFORM_PI_GPIO_H */ diff --git a/src/system/boot/platform/raspberrypi_arm/keyboard.cpp b/src/system/boot/platform/raspberrypi_arm/keyboard.cpp deleted file mode 100644 index 68eea93932..0000000000 --- a/src/system/boot/platform/raspberrypi_arm/keyboard.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2009 Jonas Sundström, jonas@kirilla.com - * All rights reserved. Distributed under the terms of the MIT License. - */ - - -#include "keyboard.h" - -#include - - -static uint16 -check_for_key(void) -{ -#warning IMPLEMENT check_for_key - return 0; -} - - -extern "C" void -clear_key_buffer(void) -{ -#warning IMPLEMENT clear_key_buffer - while (check_for_key() != 0) - ; -} - - -extern "C" union key -wait_for_key(void) -{ -#warning IMPLEMENT wait_for_key - union key key; - return key; -} - - -extern "C" uint32 -check_for_boot_keys(void) -{ -#warning IMPLEMENT check_for_boot_keys - return 0; -} diff --git a/src/system/boot/platform/raspberrypi_arm/keyboard.h b/src/system/boot/platform/raspberrypi_arm/keyboard.h deleted file mode 100644 index 4cd0cee3a6..0000000000 --- a/src/system/boot/platform/raspberrypi_arm/keyboard.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2009 Jonas Sundström, jonas@kirilla.com - * All rights reserved. Distributed under the terms of the MIT License. - */ -#ifndef _SYSTEM_BOOT_PLATFORM_PI_KEYBOARD_H -#define _SYSTEM_BOOT_PLATFORM_PI_KEYBOARD_H - - -#include - - -union key { - uint16 ax; - struct { - uint8 ascii; - uint8 bios; - } code; -}; - - -#ifdef __cplusplus -extern "C" { -#endif - -extern void clear_key_buffer(void); -extern union key wait_for_key(void); -extern uint32 check_for_boot_keys(void); - -#ifdef __cplusplus -} -#endif - -#endif /* _SYSTEM_BOOT_PLATFORM_PI_KEYBOARD_H */ diff --git a/src/system/boot/platform/raspberrypi_arm/menu.cpp b/src/system/boot/platform/raspberrypi_arm/menu.cpp deleted file mode 100644 index 76ddf221d7..0000000000 --- a/src/system/boot/platform/raspberrypi_arm/menu.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2009 Jonas Sundström, jonas@kirilla.com - * All rights reserved. Distributed under the terms of the MIT License. - */ - - -#include -#include - - -void -platform_add_menus(Menu* menu) -{ - MenuItem* item; - - switch (menu->Type()) { - case MAIN_MENU: - case SAFE_MODE_MENU: - menu->AddItem(item = new(nothrow) MenuItem("A menu item")); - item->SetType(MENU_ITEM_MARKABLE); - item->SetData(0); - item->SetHelpText("A helpful text."); - - menu->AddItem(item = new(nothrow) MenuItem("Another menu item")); - item->SetHelpText("Some more helpful text."); - item->SetType(MENU_ITEM_MARKABLE); - break; - default: - break; - } -} - - -void -platform_update_menu_item(Menu* menu, MenuItem* item) -{ - platform_generic_update_text_menu_item(menu, item); -} - - -void -platform_run_menu(Menu* menu) -{ - platform_generic_run_text_menu(menu); -} - - -void -platform_get_user_input_text(Menu *menu, MenuItem *item, char *buffer, - size_t bufferSize) -{ - platform_generic_get_user_input_text(menu, item, buffer, bufferSize); -} diff --git a/src/system/boot/platform/raspberrypi_arm/serial.cpp b/src/system/boot/platform/raspberrypi_arm/serial.cpp deleted file mode 100644 index bfe35b1b23..0000000000 --- a/src/system/boot/platform/raspberrypi_arm/serial.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2004-2008, Axel Dörfler, axeld@pinc-software.de. - * Distributed under the terms of the MIT License. - * - * Copyright 2009 Jonas Sundström, jonas@kirilla.com - * All rights reserved. Distributed under the terms of the MIT License. - */ - - -#include "serial.h" -#include "arch_uart_pl011.h" - -#include "board_config.h" -#include -#include -#include - -#include - - -DebugUART *gUART; - - -static bool sSerialEnabled = false; -extern addr_t gPeripheralBase; - - -static void -serial_putc(char c) -{ - gUART->PutChar(c); -} - - -extern "C" int -serial_getc(bool wait) -{ - return gUART->GetChar(wait); -} - - -extern "C" void -serial_puts(const char* string, size_t size) -{ - if (!sSerialEnabled) - return; - - while (size-- > 0) { - char c = string[0]; - - if (c == '\n') { - serial_putc('\r'); - serial_putc('\n'); - } else if (c != '\r') - serial_putc(c); - - string++; - } -} - - -extern "C" void -serial_disable(void) -{ - if (sSerialEnabled) - serial_cleanup(); - - gUART->Disable(); -} - - -extern "C" void -serial_enable(void) -{ - gUART->Enable(); - sSerialEnabled = true; -} - - -extern "C" void -serial_cleanup(void) -{ - sSerialEnabled = false; - gUART->FlushTx(); -} - - -extern "C" void -serial_init(void) -{ - gUART = arch_get_uart_pl011(BOARD_UART_DEBUG, BOARD_UART_CLOCK); - gUART->InitEarly(); - gUART->InitPort(9600); - - serial_enable(); - - serial_puts("\n\n********************\n", 23); - serial_puts("Haiku serial startup\n", 21); -} diff --git a/src/system/boot/platform/raspberrypi_arm/serial.h b/src/system/boot/platform/raspberrypi_arm/serial.h deleted file mode 100644 index d9c13e287e..0000000000 --- a/src/system/boot/platform/raspberrypi_arm/serial.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2009 Jonas Sundström, jonas@kirilla.com - * All rights reserved. Distributed under the terms of the MIT License. - */ -#ifndef _SYSTEM_BOOT_PLATFORM_PI_SERIAL_H -#define _SYSTEM_BOOT_PLATFORM_PI_SERIAL_H - - -#include - - -#ifdef __cplusplus -extern "C" { -#endif - -extern void serial_init(void); -extern void serial_cleanup(void); -extern void serial_disable(void); -extern void serial_enable(void); - -extern void serial_puts(const char *string, size_t size); -extern int serial_getc(bool wait); - - -#ifdef __cplusplus -} -#endif - - -#endif /* _SYSTEM_BOOT_PLATFORM_PI_SERIAL_H */ diff --git a/src/system/boot/platform/raspberrypi_arm/start.cpp b/src/system/boot/platform/raspberrypi_arm/start.cpp deleted file mode 100644 index 4513b72768..0000000000 --- a/src/system/boot/platform/raspberrypi_arm/start.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright 2009 Jonas Sundström, jonas@kirilla.com - * Copyright 2003-2008 Axel Dörfler, axeld@pinc-software.de - * All rights reserved. Distributed under the terms of the MIT License. - */ - - -#include "console.h" -#include "arch_cpu.h" -#include "gpio.h" -#include "keyboard.h" -#include "arch_mmu.h" -#include "serial.h" - -#include - -#include - -#include -#include -#include - -#include - -#include - - -#define HEAP_SIZE 65536 - - -// GCC defined globals -extern void (*__ctor_list)(void); -extern void (*__ctor_end)(void); -extern void (*__dtor_list)(void); -extern void (*__dtor_end)(void); -extern uint8 __bss_start; -extern uint8 __bss_end; -extern uint8 __stack_start; -extern uint8 __stack_end; - -extern int main(stage2_args *args); - -// Adjusted during mmu_init -addr_t gPeripheralBase = DEVICE_BASE; - - -static void -clear_bss(void) -{ - memset(&__bss_start, 0, &__bss_end - &__bss_start); -} - - -static void -fill_stack(void) -{ - memset(&__stack_start, 0xBEBEBEBE, &__stack_end - &__stack_start); -} - - -static void -call_ctors(void) -{ - void (**f)(void); - - for (f = &__ctor_list; f < &__ctor_end; f++) { - (**f)(); - } -} - - -// #pragma mark - - - -void -abort(void) -{ - panic("abort"); -} - - -uint32 -platform_boot_options(void) -{ - #warning IMPLEMENT platform_boot_options - return 0; -} - - -void -platform_start_kernel(void) -{ - preloaded_elf32_image *image = static_cast( - gKernelArgs.kernel_image.Pointer()); - - addr_t kernelEntry = image->elf_header.e_entry; - addr_t stackTop - = gKernelArgs.cpu_kstack[0].start + gKernelArgs.cpu_kstack[0].size; - - serial_cleanup(); - mmu_init_for_kernel(); - - dprintf("kernel entry at %lx\n", kernelEntry); - - status_t error = arch_start_kernel(&gKernelArgs, kernelEntry, - stackTop); - - panic("kernel returned!\n"); -} - - -void -platform_exit(void) -{ - serial_cleanup(); - // Wait for keypress on serial - serial_getc(true); - serial_disable(); -} - - -extern "C" void -_start(void) -{ - stage2_args args; - - clear_bss(); - fill_stack(); - call_ctors(); - - cpu_init(); - gpio_init(); - - // Flick on "OK" led, use pre-mmu firmware base - gpio_write(gPeripheralBase + GPIO_BASE, 16, 0); - - // specify available physical memory, using 128MB for now - // TODO: support CPU/GPU memory split options - insert_physical_memory_range(SDRAM_BASE, 128 * 1024 * 1024); - - // Reserve memory for boot archive before switching on MMU - insert_physical_allocated_range(BOOT_ARCHIVE_BASE, BOOT_ARCHIVE_SIZE); - - // To debug mmu, enable serial_init above me! - mmu_init(); - - // Map in the boot archive loaded into memory by the firmware. - args.platform.boot_tgz_size = BOOT_ARCHIVE_SIZE; - args.platform.boot_tgz_data = (void*)mmu_map_physical_memory( - BOOT_ARCHIVE_BASE, args.platform.boot_tgz_size, kDefaultPageFlags); - - serial_init(); - console_init(); - - args.heap_size = HEAP_SIZE; - args.arguments = NULL; - - main(&args); -} diff --git a/src/system/boot/platform/raspberrypi_arm/video.cpp b/src/system/boot/platform/raspberrypi_arm/video.cpp deleted file mode 100644 index 3d253bed91..0000000000 --- a/src/system/boot/platform/raspberrypi_arm/video.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2009 Jonas Sundström, jonas@kirilla.com - * All rights reserved. Distributed under the terms of the MIT License. - */ - - -#include - -#include -#include - -#include "arch_framebuffer.h" - -#include "blue_screen.h" -#include "frame_buffer_console.h" - -ArchFramebuffer *gFramebuffer = NULL; -static bool sOnScreenDebugOutputAvailable = false; - - -extern "C" void -platform_video_puts(const char* string) -{ - if (sOnScreenDebugOutputAvailable) - blue_screen_puts(string); -} - - -extern "C" void -platform_set_palette(const uint8* palette) -{ -#warning IMPLEMENT platform_set_palette -} - - -extern "C" void -platform_switch_to_logo(void) -{ -#warning IMPLEMENT platform_switch_to_logo -} - - -extern "C" void -platform_switch_to_text_mode(void) -{ -#warning IMPLEMENT platform_switch_to_text_mode -} - - -extern "C" status_t -platform_init_video(void) -{ - extern ArchFramebuffer* arch_get_framebuffer_arm_bcm2835(); - gFramebuffer = arch_get_framebuffer_arm_bcm2825(); - - if (gFramebuffer == NULL) - return B_ERROR; - - status_t result = gFramebuffer->Probe(); - if (result != B_OK) - return result; - - result = gFramebuffer->Init(); - if (result != B_OK) - return result; - - result = gFramebuffer->SetDefaultMode(); - if (result != B_OK) - return result; - - result = frame_buffer_update(gFramebuffer->Base(), gFramebuffer->Width(), - gFramebuffer->Height(), gFramebuffer->Depth(), - gFramebuffer->BytesPerRow()); - if (result != B_OK) - return result; - - result = blue_screen_init(); - if (result != B_OK) - return result; - - result = blue_screen_enter(false); - if (result != B_OK) - return result; - - blue_screen_puts("Welcome to early on-screen debug output on rPi!\n"); - sOnScreenDebugOutputAvailable = true; - - gKernelArgs.frame_buffer.physical_buffer.start - = gFramebuffer->PhysicalBase(); - gKernelArgs.frame_buffer.physical_buffer.size = gFramebuffer->Size(); - gKernelArgs.frame_buffer.bytes_per_row = gFramebuffer->BytesPerRow(); - gKernelArgs.frame_buffer.width = gFramebuffer->Width(); - gKernelArgs.frame_buffer.height = gFramebuffer->Height(); - gKernelArgs.frame_buffer.depth = gFramebuffer->Depth(); - gKernelArgs.frame_buffer.enabled = true; - return B_OK; -} - diff --git a/src/system/kernel/platform/raspberrypi_arm/Jamfile b/src/system/kernel/platform/raspberrypi_arm/Jamfile deleted file mode 100644 index 9bb2b986b4..0000000000 --- a/src/system/kernel/platform/raspberrypi_arm/Jamfile +++ /dev/null @@ -1,8 +0,0 @@ -SubDir HAIKU_TOP src system kernel platform raspberrypi_arm ; - -SubDirCcFlags $(TARGET_KERNEL_PIC_CCFLAGS) ; -SubDirC++Flags $(TARGET_KERNEL_PIC_CCFLAGS) ; - -KernelMergeObject kernel_platform_raspberrypi_arm.o : - platform.cpp -; diff --git a/src/system/kernel/platform/raspberrypi_arm/platform.cpp b/src/system/kernel/platform/raspberrypi_arm/platform.cpp deleted file mode 100644 index d5b2a6957d..0000000000 --- a/src/system/kernel/platform/raspberrypi_arm/platform.cpp +++ /dev/null @@ -1,3 +0,0 @@ -/* - Just a dummy. No BIOS services are required in the kernel. -*/