rPi MMU: Fixes to hrev44189

* I had the wrong addresses, 0x20 was the physical
  address not a mapped one.
* Attempt to map uart in mmu post mmu_init.
This commit is contained in:
Alexander von Gluck IV 2012-05-22 07:03:56 -05:00
parent 87a01ad64e
commit 9c5e60f656
4 changed files with 20 additions and 15 deletions

View File

@ -36,10 +36,9 @@
* - BCM2835-ARM-Peripherals.pdf
*/
// 1.2.2 notes that peripherals are remapped from 0x7e to 0x20
// Section 1.2.2
#define BCM2708_SDRAM_BASE 0x00000000
#define BCM2708_DEVICEHW_BASE 0x7E000000 // Real Hardware Base
#define BCM2708_DEVICEFW_BASE 0x20000000 // Firmware Mapped Base
#define BCM2708_PERIPHERAL_BASE 0x20000000
#define ST_BASE 0x3000
// System Timer, sec 12.0, page 172
@ -77,11 +76,11 @@
#define ARM_CTRL_0_SBM_BASE (ARM_BASE + 0x800)
// ARM Semaphores, Doorbells, and Mailboxes
#define VECT_BASE 0xffff0000
#define VECT_BASE 0xFFFF0000
#define VECT_SIZE SIZE_4K
#define DEVICE_BASE BCM2708_DEVICEHW_BASE
#define DEVICE_SIZE 0x1000000
#define PERIPHERAL_BASE BCM2708_PERIPHERAL_BASE
#define PERIPHERAL_SIZE 0xFFFFFF
#define SDRAM_BASE BCM2708_SDRAM_BASE
#define SDRAM_SIZE 0x4000000

View File

@ -62,12 +62,16 @@ struct memblock {
static struct memblock LOADER_MEMORYMAP[] = {
{
"devices",
DEVICE_BASE,
DEVICE_BASE + DEVICE_SIZE - 1,
PERIPHERAL_BASE,
PERIPHERAL_BASE + PERIPHERAL_SIZE,
MMU_L2_FLAG_B,
},
// Device memory between 0x0 and 0x10000000
// (0x0) Ram / Video ram (0x10000000) (256MB)
// We don't detect the split yet, se we have to be
// careful not to run into video ram.
{
"RAM_loader", // 1MB loader
"RAM_loader", // 1MB for the loader
SDRAM_BASE + 0,
SDRAM_BASE + 0x0fffff,
MMU_L2_FLAG_C,
@ -84,7 +88,6 @@ static struct memblock LOADER_MEMORYMAP[] = {
SDRAM_BASE + 0x11FFFFF,
MMU_L2_FLAG_C,
},
#if 0
{
"RAM_stack", // stack
SDRAM_BASE + 0x1200000,
@ -97,7 +100,7 @@ static struct memblock LOADER_MEMORYMAP[] = {
SDRAM_BASE + 0x2500000,
MMU_L2_FLAG_C,
},
// (0x2500000 ~37MB)
#ifdef FB_BASE
{
"framebuffer", // 2MB framebuffer ram
@ -106,7 +109,6 @@ static struct memblock LOADER_MEMORYMAP[] = {
MMU_L2_FLAG_AP_RW|MMU_L2_FLAG_C,
},
#endif
#endif
};
@ -585,7 +587,7 @@ mmu_init(void)
{
CALLED();
mmu_write_C1(mmu_read_C1() & ~((1<<29)|(1<<28)|(1<<0)));
mmu_write_C1(mmu_read_C1() & ~((1 << 29) | (1 << 28) | (1 << 0)));
// access flag disabled, TEX remap disabled, mmu disabled
uint32 highestRAMAddress = SDRAM_BASE;

View File

@ -14,6 +14,7 @@
#include <boot/platform.h>
#include <arch/cpu.h>
#include <boot/stage2.h>
#include "mmu.h"
#include <string.h>
@ -87,7 +88,10 @@ serial_cleanup(void)
extern "C" void
serial_init(void)
{
gUART = arch_get_uart_pl011(BOARD_UART_DEBUG, BOARD_UART_CLOCK);
addr_t uart0 = mmu_map_physical_memory(PERIPHERAL_BASE + BOARD_UART_DEBUG,
0x00004000, kDefaultPageFlags);
gUART = arch_get_uart_pl011(uart0, BOARD_UART_CLOCK);
gUART->InitEarly();
gUART->InitPort(9600);

View File

@ -112,7 +112,7 @@ pi_start(void)
gpio_init();
// Flick on "OK" led, use pre-mmu firmware base
gpio_write(BCM2708_DEVICEFW_BASE + GPIO_BASE, 16, 0);
gpio_write(PERIPHERAL_BASE + GPIO_BASE, 16, 0);
mmu_init();