[haiku-commits] haiku: hrev44189 - headers/private/kernel/arch/arm src/system/boot/platform/raspberrypi_arm

  • From: kallisti5@xxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 18 May 2012 23:10:01 +0200 (CEST)

hrev44189 adds 1 changeset to branch 'master'
old head: 80cbddc9f7a1baa3160aed68dce0e5946df6e71c
new head: b8733e36c7d449d8707dc805c410b9ce9ab59245

----------------------------------------------------------------------------

b8733e3: rPi MMU: Working towards mapped memory
  
  * BCM2708 defines no longer assume 0x20 address
    We will be throwing away the blob memory mapping
    and using our own.
  * Use existing blob mapping to turn GPIO led on pre mmu_init
  * Remap MMU hardware addresses from 0x7E. We could map each device,
    however the kernel will throw away the mappings again anyway. For
    now we just map the whole range and use offsets.
  * Serial uart no longer works, however at least
    we know why now :). Serial driver now needs to
    use mapped address.

                          [ Alexander von Gluck IV <kallisti5@xxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev44189
Commit:      b8733e36c7d449d8707dc805c410b9ce9ab59245
URL:         http://cgit.haiku-os.org/haiku/commit/?id=b8733e3
Author:      Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date:        Fri May 18 15:16:02 2012 UTC

----------------------------------------------------------------------------

3 files changed, 24 insertions(+), 54 deletions(-)
headers/private/kernel/arch/arm/bcm2708.h        |   33 +++++++++---------
src/system/boot/platform/raspberrypi_arm/mmu.cpp |   32 ++---------------
src/system/boot/platform/raspberrypi_arm/start.c |   13 +++----

----------------------------------------------------------------------------

diff --git a/headers/private/kernel/arch/arm/bcm2708.h 
b/headers/private/kernel/arch/arm/bcm2708.h
index 07f0ba6..010851c 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 cc4c23d..e628255 100644
--- a/src/system/boot/platform/raspberrypi_arm/mmu.cpp
+++ b/src/system/boot/platform/raspberrypi_arm/mmu.cpp
@@ -14,9 +14,7 @@
 #include <boot/stage2.h>
 #include <arch/cpu.h>
 #include <arch_kernel.h>
-#ifdef __ARM__
 #include <arm_mmu.h>
-#endif
 #include <kernel.h>
 
 #include <board_config.h>
@@ -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 7f57ce2..c7ee41e 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;
 


Other related posts:

  • » [haiku-commits] haiku: hrev44189 - headers/private/kernel/arch/arm src/system/boot/platform/raspberrypi_arm - kallisti5