- print vars of interest to help setup mem map

- shuffle memory map
- set up transparent translations: first 32MB of RAM and last 16MB for IO space.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26478 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
François Revol 2008-07-17 23:56:22 +00:00
parent 6eeea348d0
commit 36265c4de7
5 changed files with 90 additions and 38 deletions

View File

@ -5,25 +5,70 @@
#ifndef ATARI_MEMORY_MAP_H
#define ATARI_MEMORY_MAP_H
#define ATARI_CHIPRAM_TOP_TT 0x00a00000
/* -> e00000 is VME for MegaST*/
#define ATARI_CHIPRAM_TOP_FALCON 0x00e00000
/* the DMA-accessible RAM */
#define ATARI_CHIPRAM_BASE 0x00000000
#define ATARI_CHIPRAM_MAX 0x00e00000
#define ATARI_CHIPRAM_LAST \
(ATARI_CHIPRAM_BASE + (ATARI_CHIPRAM_MAX - 1))
#define ATARI_ROM_BASE ATARI_CHIPRAM_TOP_FALCON
#define ATARI_ROM_TOP 0x00f00000
#define ATARI_IO_BASE ATARI_ROM_TOP
#define ATARI_CARTRIDGE_BASE 0x00fa0000
#define ATARI_OLD_ROM_BASE 0x00fc0000
#define ATARI_TOSROM_BASE 0x00e00000
#define ATARI_TOSROM_MAX 0x00100000
#define ATARI_TOSROM_LAST \
(ATARI_TOSROM_BASE + (ATARI_TOSROM_MAX - 1))
#define ATARI_IO_TOP 0x01000000
#define ATARI_FASTRAM_TOP ATARI_IO_TOP
/* some reserved ST I/O there... */
/* cartridge ROM */
#define ATARI_CARTROM_BASE 0x00fa0000
#define ATARI_CARTROM_MAX 0x00020000
#define ATARI_CARTROM_LAST \
(ATARI_CARTROM_BASE + (ATARI_CARTROM_MAX - 1))
#define ATARI_SYSROM_BASE 0x00fc0000
#define ATARI_SYSROM_MAX 0x00030000
#define ATARI_SYSROM_LAST \
(ATARI_SYSROM_BASE + (ATARI_SYSROM_MAX - 1))
/* more ST I/O there... */
/* the fast, non-DMA-accessible RAM */
#define ATARI_FASTRAM_BASE 0x01000000
// max on TT,
// but there is nothing beyond until SHADOW_BASE
//#define ATARI_FASTRAM_MAX 0x00400000
#define ATARI_FASTRAM_MAX 0xfe000000
#define ATARI_FASTRAM_LAST \
(ATARI_FASTRAM_BASE + (ATARI_FASTRAM_MAX - 1))
/* due to ST legacy (24 bit addressing), IO is actually there */
#define ATARI_SHADOW_BASE 0xff000000
/* how we will use it */
#define ATARI_IO_BASE (ATARI_SHADOW_BASE + 0x00f00000)
#define ATARI_IO_MAX 0x00100000
#define ATARI_IO_LAST \
(ATARI_IO_BASE + (ATARI_IO_MAX - 1))
/* physical memory layout as used by the bootloader */
//#define ATARI_ZBEOS_STACK_BASE 0x00040000
#define ATARI_ZBEOS_STACK_BASE 0x00060000
#define ATARI_ZBEOS_STACK_END 0x00080000
#define ATARI_ZBEOS_BASE 0x00080000 /* from .prg shell.S will copy itself there */
/* from .prg shell.S will copy itself there
* must stay in sync with src/system/ldscripts/m68k/boot_prg_atari_m68k.ld
*/
#define ATARI_ZBEOS_BASE 0x00080000
#define ATARI_ZBEOS_MAX 0x00080000
#define ATARI_ZBEOS_LAST \
(ATARI_ZBEOS_BASE + (ATARI_ZBEOS_MAX - 1))
#define ATARI_STRAM_VIRT_BASE
#endif /* ATARI_MEMORY_MAP_H */

View File

@ -6,6 +6,7 @@
*/
#include "atari_memory_map.h"
#include "mmu.h"
#include <boot/platform.h>
@ -46,20 +47,14 @@
/** The (physical) memory layout of the boot loader is currently as follows:
* 0x0800 - 0x10000 supervisor mode stack (1) XXX: more ? x86 starts at 500
* 0x10000 - ? code (up to ~500 kB)
* unused (TT0 instead):
* 0x90000 1st temporary page table (identity maps 0-4 MB)
* 0x91000 2nd (4-8 MB)
*
* 0x92000 - 0x92000 further page tables
* 0x100000 page directory
* 0x100000 or FAST_RAM_BASE if any:
* ... page directory
* ... boot loader heap (32 kB)
* ... free physical memory
* [0xa00000] end of chip RAM for TT (falcon has more till ROM)
* [0xe00000 - 0xf00000 TOS ROM]
* [0xf00000 - 0x1000000 I/O]
XXX: where is the video buffer ?
* 0xdNNNNN video buffer usually there, as per v_bas_ad
* (=Logbase() but Physbase() is better)
*
* The first 16 MB (2) are identity mapped (0x0 - 0x1000000); paging
* The first 32 MB (2) are identity mapped (0x0 - 0x1000000); paging
* is turned on. The kernel is mapped at 0x80000000, all other stuff
* mapped by the loader (kernel args, modules, driver settings, ...)
* comes after 0x81000000 which means that there is currently only
@ -67,9 +62,10 @@
*
* (1) no need for user stack, we are already in supervisor mode in the
* loader.
* (2) maps the whole regular ST space; transparent translation registers
* have larger granularity anyway;
* (2) maps the whole regular ST space; transparent translation registers
* have larger granularity anyway.
*/
#warning M68K: check for Physbase() < ST_RAM_TOP
#define TRACE_MMU
#ifdef TRACE_MMU
@ -444,7 +440,8 @@ mmu_init_for_kernel(void)
// remove identity mapping of ST space
gMMUOps->set_tt(0, NULL, 0, 0);
// actually done by the kernel when it's done using query_early
//gMMUOps->set_tt(0, NULL, 0, 0);
#if 0
// set up a new idt
@ -594,6 +591,11 @@ mmu_init(void)
gKernelArgs.num_physical_allocated_ranges = 1;
// remember the start of the allocated physical pages
// enable transparent translation of the first 32 MB
gMMUOps->set_tt(0, ATARI_CHIPRAM_BASE, 0x02000000, 0);
// enable transparent translation of the 16MB ST shadow range for I/O
gMMUOps->set_tt(0, ATARI_SHADOW_BASE, 0x01000000, 0);
init_page_directory();
#if 0

View File

@ -45,20 +45,20 @@ initialize(void)
static status_t
set_tt(int which, addr_t pa, size_t len, uint32 perms)
{
TRACE(("mmu_030:set_tt(%d, 0x%lx, %ld, 0x%08lx)\n", which, pa, len, perms));
TRACE(("mmu_030:set_tt(%d, 0x%lx, 0x%lx, 0x%08lx)\n", which, pa, len, perms));
uint32 mask;
uint32 ttr = 0;
mask = 1;
mask = 0x0000ffff;
if (len) {
len = (len >> 24) & 0x00ff;
while (len >>= 1)
mask <<= 1;
mask = (mask - 1);
// enable, cachable(?), r/w
// super only
// mc68030 user's manual, page 9-57
ttr = 0x08043;
ttr |= (pa & 0xff000000);
ttr |= ((mask & 0xff000000) >> 8);
ttr |= (mask & 0x00ff0000);
}
TRACE(("mmu_030:set_tt: 0x%08lx\n", ttr));

View File

@ -43,21 +43,21 @@ initialize(void)
static status_t
set_tt(int which, addr_t pa, size_t len, uint32 perms)
set_tt(int which, addr_t pa, size_t len, uint32 perms /* NOTUSED */)
{
TRACE(("mmu_040:set_tt(%d, 0x%lx, %ld, 0x%08lx)\n", which, pa, len, perms));
TRACE(("mmu_040:set_tt(%d, 0x%lx, 0x%lx, 0x%08lx)\n", which, pa, len, perms));
uint32 mask;
uint32 ttr = 0;
mask = 1;
mask = 0x0000ffff;
if (len) {
len = (len >> 24) & 0x00ff;
while (len >>= 1)
mask <<= 1;
mask = (mask - 1);
// enable, super only, upa=0,
// cachable write-through, rw
ttr = 0x0a000;
ttr |= (pa & 0xff000000);
ttr |= ((mask & 0xff000000) >> 8);
ttr |= (mask & 0x00ff0000);
}
TRACE(("mmu_040:set_tt: 0x%08lx\n", ttr));

View File

@ -123,11 +123,16 @@ _start(void)
init_nat_features();
//serial_init();
console_init();
Bconout(DEV_CON, 'K');
cpu_init();
console_init();
Bconout(DEV_CON, 'U');
//mmu_init();
dprintf("membot = %p\n", *TOSVAR_membot);
dprintf("memtop = %p\n", *TOSVAR_memtop);
dprintf("v_bas_ad= %p\n", *TOSVAR_v_bas_ad);
dprintf("phystop = %p\n", *TOSVARphystop);
dprintf("ramtop = %p\n", *TOSVARramtop);
cpu_init();
mmu_init();
// wait a bit to give the user the opportunity to press a key
spin(750000);