diff --git a/headers/private/kernel/arch/arm/bcm2708.h b/headers/private/kernel/arch/arm/bcm2708.h index 07f0ba6430..010851ccef 100644 --- a/headers/private/kernel/arch/arm/bcm2708.h +++ b/headers/private/kernel/arch/arm/bcm2708.h @@ -37,32 +37,33 @@ */ // 1.2.2 notes that peripherals are remapped from 0x7e to 0x20 -#define BCM2708_SDRAM_BASE 0x00000000 -#define BCM2708_PERI_BASE 0x20000000 +#define BCM2708_SDRAM_BASE 0x00000000 +#define BCM2708_DEVICEHW_BASE 0x7E000000 // Real Hardware Base +#define BCM2708_DEVICEFW_BASE 0x20000000 // Firmware Mapped Base -#define ST_BASE (BCM2708_PERI_BASE + 0x3000) +#define ST_BASE 0x3000 // System Timer, sec 12.0, page 172 -#define DMA_BASE (BCM2708_PERI_BASE + 0x7000) +#define DMA_BASE 0x7000 // DMA Controller, sec 4.2, page 39 -#define ARM_BASE (BCM2708_PERI_BASE + 0xB000) +#define ARM_BASE 0xB000 // BCM2708 ARM Control Block, sec 7.5, page 112 -#define PM_BASE (BCM2708_PERI_BASE + 0x100000) +#define PM_BASE 0x100000 // Power Management, Reset controller and Watchdog registers -#define GPIO_BASE (BCM2708_PERI_BASE + 0x200000) +#define GPIO_BASE 0x200000 // GPIO, sec 6.1, page 90 -#define UART0_BASE (BCM2708_PERI_BASE + 0x201000) +#define UART0_BASE 0x201000 // UART 0, sec 13.4, page 177 -#define MMCI0_BASE (BCM2708_PERI_BASE + 0x202000) +#define MMCI0_BASE 0x202000 // MMC -#define UART1_BASE (BCM2708_PERI_BASE + 0x215000) +#define UART1_BASE 0x215000 // UART 1, sec 2.1, page 65 -#define EMMC_BASE (BCM2708_PERI_BASE + 0x300000) +#define EMMC_BASE 0x300000 // eMMC interface, sec 5, page 66 -#define SMI_BASE (BCM2708_PERI_BASE + 0x600000) +#define SMI_BASE 0x600000 // SMI Base -#define USB_BASE (BCM2708_PERI_BASE + 0x980000) +#define USB_BASE 0x980000 // USB Controller, 15.2, page 202 -#define FB_BASE (BCM2708_PERI_BASE + 0x0000) +#define FB_BASE 0x000000 // Fake frame buffer #define FB_SIZE SIZE_4K @@ -79,8 +80,8 @@ #define VECT_BASE 0xffff0000 #define VECT_SIZE SIZE_4K -#define PERIPHERAL_BASE BCM2708_PERI_BASE -#define PERIPHERAL_SIZE 0x1000000 +#define DEVICE_BASE BCM2708_DEVICEHW_BASE +#define DEVICE_SIZE 0x1000000 #define SDRAM_BASE BCM2708_SDRAM_BASE #define SDRAM_SIZE 0x4000000 diff --git a/src/system/boot/platform/raspberrypi_arm/mmu.cpp b/src/system/boot/platform/raspberrypi_arm/mmu.cpp index cc4c23d4de..e628255c90 100644 --- a/src/system/boot/platform/raspberrypi_arm/mmu.cpp +++ b/src/system/boot/platform/raspberrypi_arm/mmu.cpp @@ -14,9 +14,7 @@ #include #include #include -#ifdef __ARM__ #include -#endif #include #include @@ -28,7 +26,7 @@ #define TRACE_MMU #ifdef TRACE_MMU -# define TRACE(x...) dprintf("mmu: " x) +# define TRACE(x...) dprintf("mmu: " x) # define CALLED() dprintf("%s()\n", __func__) #else # define TRACE(x) ; @@ -46,29 +44,6 @@ extern uint8 __stack_start; extern uint8 __stack_end; -#ifdef __ARM__ - - -/* -TODO: - -recycle bit! -*/ - -/*! The (physical) memory layout of the boot loader is currently as follows: - 0x00000000 u-boot (run from NOR flash) - 0xa0000000 u-boot stuff like kernel arguments afaik - 0xa0100000 - 0xa0ffffff boot.tgz (up to 15MB probably never needed so big...) - 0xa1000000 - 0xa1ffffff pagetables - 0xa2000000 - ? code (up to 1MB) - 0xa2100000 boot loader heap / free physical memory - - The kernel is mapped at KERNEL_BASE, all other stuff mapped by the - loader (kernel args, modules, driver settings, ...) comes after - 0x80020000 which means that there is currently only 2 MB reserved for - the kernel itself (see kMaxKernelSize). -*/ - - /* *defines a block in memory */ @@ -87,8 +62,8 @@ struct memblock { static struct memblock LOADER_MEMORYMAP[] = { { "devices", - PERIPHERAL_BASE, - PERIPHERAL_BASE + PERIPHERAL_SIZE - 1, + DEVICE_BASE, + DEVICE_BASE + DEVICE_SIZE - 1, MMU_L2_FLAG_B, }, { @@ -554,7 +529,6 @@ mmu_free(void *virtualAddress, size_t size) sNextVirtualAddress -= size; } } -#endif /*! Sets up the final and kernel accessible GDT and IDT tables. diff --git a/src/system/boot/platform/raspberrypi_arm/start.c b/src/system/boot/platform/raspberrypi_arm/start.c index 7f57ce2c81..c7ee41ed85 100644 --- a/src/system/boot/platform/raspberrypi_arm/start.c +++ b/src/system/boot/platform/raspberrypi_arm/start.c @@ -111,19 +111,14 @@ pi_start(void) cpu_init(); gpio_init(); - // Flick on "OK" led - gpio_write(GPIO_BASE, 16, 0); + // Flick on "OK" led, use pre-mmu firmware base + gpio_write(BCM2708_DEVICEFW_BASE + GPIO_BASE, 16, 0); + + mmu_init(); serial_init(); console_init(); - /* - * TODO: Move befpre gpio_init - * Once memory mapping is working, uart + gpio should - * use mapped peripheral addresses - */ - mmu_init(); - args.heap_size = HEAP_SIZE; args.arguments = NULL;