From 3c3b8858a15c12b94eee441ff8fdfe230bd9cc90 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Wed, 28 Nov 2012 01:38:38 +0100 Subject: [PATCH] Move framebuffer init past mmu_init and map the framebuffer. Add more fields to arch framebuffer to hold the physical address and size of the framebuffer. Then fill these in when mapping the framebuffer to virtual memory. --- src/system/boot/arch/arm/arch_framebuffer.h | 4 ++++ .../raspberrypi_arm/arch_framebuffer_bcm2708.cpp | 14 ++++++-------- src/system/boot/platform/raspberrypi_arm/start.cpp | 4 +--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/system/boot/arch/arm/arch_framebuffer.h b/src/system/boot/arch/arm/arch_framebuffer.h index df71f0ec67..f8f4892cf6 100644 --- a/src/system/boot/arch/arm/arch_framebuffer.h +++ b/src/system/boot/arch/arm/arch_framebuffer.h @@ -38,6 +38,8 @@ public: { return B_OK; }; virtual addr_t Base() { return fBase; }; + addr_t PhysicalBase() { return fPhysicalBase; }; + size_t Size() { return fSize; }; int Width() { return fCurrentWidth; }; int Height() { return fCurrentHeight; }; @@ -46,6 +48,8 @@ public: protected: addr_t fBase; + addr_t fPhysicalBase; + size_t fSize; int fCurrentWidth; int fCurrentHeight; int fCurrentDepth; diff --git a/src/system/boot/platform/raspberrypi_arm/arch_framebuffer_bcm2708.cpp b/src/system/boot/platform/raspberrypi_arm/arch_framebuffer_bcm2708.cpp index becbf92673..57d6243460 100644 --- a/src/system/boot/platform/raspberrypi_arm/arch_framebuffer_bcm2708.cpp +++ b/src/system/boot/platform/raspberrypi_arm/arch_framebuffer_bcm2708.cpp @@ -154,14 +154,12 @@ ArchFramebufferBCM2708::SetVideoMode(int width, int height, int depth) && sFramebufferConfig.screen_size >= sFramebufferConfig.bytes_per_row * sFramebufferConfig.height); -#if 1 - fBase = BCM2708_BUS_TO_PHYSICAL(sFramebufferConfig.frame_buffer_address); -#else - // TODO: Enable when the MMU works. - fBase = (addr_t)mmu_map_physical_memory( - BCM2708_BUS_TO_PHYSICAL(sFramebufferConfig.frame_buffer_address), - sFramebufferConfig.screen_size, MMU_L2_FLAG_AP_RW | MMU_L2_FLAG_C); -#endif + fPhysicalBase + = BCM2708_BUS_TO_PHYSICAL(sFramebufferConfig.frame_buffer_address); + fSize = sFramebufferConfig.screen_size; + + fBase = (addr_t)mmu_map_physical_memory(fPhysicalBase, fSize, + kDefaultPageFlags); uint8* line = (uint8*)fBase; for (uint32 y = 0; y < sFramebufferConfig.height; y++) { diff --git a/src/system/boot/platform/raspberrypi_arm/start.cpp b/src/system/boot/platform/raspberrypi_arm/start.cpp index 4245e8be10..008ac9229d 100644 --- a/src/system/boot/platform/raspberrypi_arm/start.cpp +++ b/src/system/boot/platform/raspberrypi_arm/start.cpp @@ -116,12 +116,10 @@ _start(void) // Flick on "OK" led, use pre-mmu firmware base gpio_write(gPeripheralBase + GPIO_BASE, 16, 0); - // Set up the framebuffer here to help debug the early boot. - platform_init_video(); - // To debug mmu, enable serial_init above me! mmu_init(); + platform_init_video(); serial_init(); console_init();