auto-detect RAM size

This commit is contained in:
jmcneill 2015-03-01 15:37:26 +00:00
parent 6ad5a230fa
commit df81c70737
3 changed files with 15 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: amlogic_reg.h,v 1.4 2015/03/01 15:07:49 jmcneill Exp $ */
/* $NetBSD: amlogic_reg.h,v 1.5 2015/03/01 15:37:26 jmcneill Exp $ */
/*-
* Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca>
@ -58,6 +58,8 @@
#define AMLOGIC_USB1_OFFSET 0x090c0000
#define AMLOGIC_USB_SIZE 0x40000
#define AMLOGIC_SRAM_OFFSET 0x19000000
#define AMLOGIC_CPUCONF_OFFSET 0x1901ff80
#define AMLOGIC_CBUS_CPU_CLK_CNTL_REG 0x419c

View File

@ -1,4 +1,4 @@
/* $NetBSD: amlogic_machdep.c,v 1.9 2015/03/01 15:07:49 jmcneill Exp $ */
/* $NetBSD: amlogic_machdep.c,v 1.10 2015/03/01 15:37:26 jmcneill Exp $ */
/*
* Machine dependent functions for kernel setup for TI OSK5912 board.
@ -125,7 +125,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: amlogic_machdep.c,v 1.9 2015/03/01 15:07:49 jmcneill Exp $");
__KERNEL_RCSID(0, "$NetBSD: amlogic_machdep.c,v 1.10 2015/03/01 15:37:26 jmcneill Exp $");
#include "opt_machdep.h"
#include "opt_ddb.h"
@ -301,6 +301,14 @@ amlogic_putchar(char c)
}
}
static psize_t
amlogic_get_ram_size(void)
{
const bus_space_handle_t ao_bsh =
AMLOGIC_CORE_VBASE + AMLOGIC_SRAM_OFFSET;
return bus_space_read_4(&amlogic_bs_tag, ao_bsh, 0) << 20;
}
/*
* u_int initarm(...)
*
@ -386,9 +394,7 @@ initarm(void *arg)
KERNEL_BASE, KERNEL_VM_BASE, KERNEL_VM_BASE - KERNEL_BASE, KERNEL_BASE_VOFFSET);
#endif
#if notyet
ram_size = amlogic_get_ram_size();
#endif
#ifdef __HAVE_MM_MD_DIRECT_MAPPED_PHYS
if (ram_size > KERNEL_VM_BASE - KERNEL_BASE) {

View File

@ -1,5 +1,5 @@
#
# $NetBSD: ODROID-C1,v 1.4 2015/03/01 15:07:49 jmcneill Exp $
# $NetBSD: ODROID-C1,v 1.5 2015/03/01 15:37:26 jmcneill Exp $
#
# Odroid-C1 (Amlogic S805) based SBC (Single Board Computer)
#
@ -166,7 +166,7 @@ a9tmr0 at armperiph? # Global Timer
a9wdt0 at armperiph? # Watchdog
# Specify the memory size in megabytes.
options MEMSIZE=1024
#options MEMSIZE=1024
# On-board I/O
amlogicio0 at mainbus?