[OpenBIOS] [commit] r998 - in trunk/openbios-devel: arch/sparc32 config/examples
repository service
svn at openbios.org
Sun Jan 2 01:05:46 CET 2011
Author: mcayland
Date: Sun Jan 2 01:05:44 2011
New Revision: 998
URL: http://tracker.coreboot.org/trac/openbios/changeset/998
Log:
Change the SPARC32 build system so that OFMEM is now included within SPARC32 builds.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at siriusit.co.uk>
Tested-by: Blue Swirl <blauwirbel at gmail.com>
Reviewed-by: Blue Swirl <blauwirbel at gmail.com>
Added:
trunk/openbios-devel/arch/sparc32/ofmem_sparc32.c
Modified:
trunk/openbios-devel/arch/sparc32/build.xml
trunk/openbios-devel/arch/sparc32/lib.c
trunk/openbios-devel/config/examples/sparc32_config.xml
Modified: trunk/openbios-devel/arch/sparc32/build.xml
==============================================================================
--- trunk/openbios-devel/arch/sparc32/build.xml Thu Dec 30 23:02:09 2010 (r997)
+++ trunk/openbios-devel/arch/sparc32/build.xml Sun Jan 2 01:05:44 2011 (r998)
@@ -15,6 +15,7 @@
<object source="udiv.S"/>
<object source="linux_load.c"/>
<object source="sys_info.c"/>
+ <object source="ofmem_sparc32.c"/>
<object source="romvec.c"/>
<object source="call-romvec.S"/>
<object source="entry.S"/>
Modified: trunk/openbios-devel/arch/sparc32/lib.c
==============================================================================
--- trunk/openbios-devel/arch/sparc32/lib.c Thu Dec 30 23:02:09 2010 (r997)
+++ trunk/openbios-devel/arch/sparc32/lib.c Sun Jan 2 01:05:44 2011 (r998)
@@ -497,6 +497,16 @@
DPRINTF("obp_dumb_munmap: virta 0x%x, sz %d\n", (unsigned int)va, size);
}
+void ofmem_arch_unmap_pages(ucell virt, ucell size)
+{
+ /* Currently do nothing */
+}
+
+void ofmem_arch_early_map_pages(phys_addr_t phys, ucell virt, ucell size, ucell mode)
+{
+ /* Currently do nothing */
+}
+
char *obp_dumb_memalloc(char *va, unsigned int size)
{
size = (size + 7) & ~7;
Added: trunk/openbios-devel/arch/sparc32/ofmem_sparc32.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/openbios-devel/arch/sparc32/ofmem_sparc32.c Sun Jan 2 01:05:44 2011 (r998)
@@ -0,0 +1,135 @@
+/*
+ * <ofmem_sparc32.c>
+ *
+ * OF Memory manager
+ *
+ * Copyright (C) 1999-2004 Samuel Rydh (samuel at ibrium.se)
+ * Copyright (C) 2004 Stefan Reinauer
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation
+ *
+ */
+
+#include "config.h"
+#include "libopenbios/bindings.h"
+#include "libc/string.h"
+#include "libopenbios/ofmem.h"
+#include "asm/asi.h"
+#include "pgtsrmmu.h"
+
+#define OF_MALLOC_BASE ((char*)OFMEM + ALIGN_SIZE(sizeof(ofmem_t), 8))
+
+/* Temporarily very small */
+#define MEMSIZE (1 * 1024)
+static union {
+ char memory[MEMSIZE];
+ ofmem_t ofmem;
+} s_ofmem_data;
+
+#define OFMEM (&s_ofmem_data.ofmem)
+#define TOP_OF_RAM (s_ofmem_data.memory + MEMSIZE)
+
+translation_t **g_ofmem_translations = &s_ofmem_data.ofmem.trans;
+
+extern uint32_t qemu_mem_size;
+
+static inline size_t ALIGN_SIZE(size_t x, size_t a)
+{
+ return (x + a - 1) & ~(a-1);
+}
+
+static ucell get_heap_top( void )
+{
+ return (ucell)TOP_OF_RAM;
+}
+
+ofmem_t* ofmem_arch_get_private(void)
+{
+ return OFMEM;
+}
+
+void* ofmem_arch_get_malloc_base(void)
+{
+ return OF_MALLOC_BASE;
+}
+
+ucell ofmem_arch_get_heap_top(void)
+{
+ return get_heap_top();
+}
+
+ucell ofmem_arch_get_virt_top(void)
+{
+ return (ucell)TOP_OF_RAM;
+}
+
+phys_addr_t ofmem_arch_get_phys_top(void)
+{
+ ofmem_t *ofmem = ofmem_arch_get_private();
+
+ return (uintptr_t)ofmem->ramsize - 0x1000000;
+}
+
+retain_t *ofmem_arch_get_retained(void)
+{
+ /* Not used */
+ return 0;
+}
+
+int ofmem_arch_get_physaddr_cellsize(void)
+{
+ return 2;
+}
+
+int ofmem_arch_encode_physaddr(ucell *p, phys_addr_t value)
+{
+ int n = 0;
+
+ p[n++] = value >> 32;
+ p[n++] = value;
+
+ return n;
+}
+
+int ofmem_arch_get_translation_entry_size(void)
+{
+ /* Return size of a single MMU package translation property entry in cells */
+ return 3;
+}
+
+void ofmem_arch_create_translation_entry(ucell *transentry, translation_t *t)
+{
+ /* Generate translation property entry for SPARC. While there is no
+ formal documentation for this, both Linux kernel and OpenSolaris sources
+ expect a translation property entry to have the following layout:
+
+ virtual address
+ length
+ mode
+ */
+
+ transentry[0] = t->virt;
+ transentry[1] = t->size;
+ transentry[2] = t->mode;
+}
+
+/************************************************************************/
+/* misc */
+/************************************************************************/
+
+ucell ofmem_arch_default_translation_mode( phys_addr_t phys )
+{
+ return SRMMU_REF | SRMMU_CACHE | SRMMU_PRIV;
+}
+
+/************************************************************************/
+/* init / cleanup */
+/************************************************************************/
+
+void ofmem_init( void )
+{
+ memset(&s_ofmem_data, 0, sizeof(s_ofmem_data));
+ s_ofmem_data.ofmem.ramsize = qemu_mem_size;
+}
Modified: trunk/openbios-devel/config/examples/sparc32_config.xml
==============================================================================
--- trunk/openbios-devel/config/examples/sparc32_config.xml Thu Dec 30 23:02:09 2010 (r997)
+++ trunk/openbios-devel/config/examples/sparc32_config.xml Sun Jan 2 01:05:44 2011 (r998)
@@ -26,6 +26,8 @@
<option name="CONFIG_DEBLOCKER" type="boolean" value="true"/>
<option name="CONFIG_FONT_8X8" type="boolean" value="true"/>
<option name="CONFIG_FONT_8X16" type="boolean" value="false"/>
+ <option name="CONFIG_OFMEM" type="boolean" value="true"/>
+ <option name="CONFIG_OFMEM_MALLOC_ALIGN" type="integer" value="8"/>
<option name="CONFIG_LOADER_AOUT" type="boolean" value="true"/>
<option name="CONFIG_LOADER_BOOTINFO" type="boolean" value="false"/>
<option name="CONFIG_LOADER_ELF" type="boolean" value="true"/>
More information about the OpenBIOS
mailing list