aboutsummaryrefslogtreecommitdiff
path: root/lib/libnvram
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2010-12-03 15:02:36 +1100
committerThomas Huth <thuth@linux.vnet.ibm.com>2011-03-22 15:22:00 +0100
commit39426bad550f340dcf2b544ae23f465fbbbc42f5 (patch)
tree1974f16adec8b1322b4adeaa65783780a5ebeb25 /lib/libnvram
parentcf69a59a3edefc3bea57cceea2cbedd25c7b680d (diff)
downloadSLOF-39426bad550f340dcf2b544ae23f465fbbbc42f5.zip
SLOF-39426bad550f340dcf2b544ae23f465fbbbc42f5.tar.gz
SLOF-39426bad550f340dcf2b544ae23f465fbbbc42f5.tar.bz2
Initial qemu/KVM board support
Added a new board for SLOF running on KVM/qemu. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Diffstat (limited to 'lib/libnvram')
-rw-r--r--lib/libnvram/Makefile3
-rw-r--r--lib/libnvram/nvram.c21
2 files changed, 17 insertions, 7 deletions
diff --git a/lib/libnvram/Makefile b/lib/libnvram/Makefile
index 6c9ec84..afd536f 100644
--- a/lib/libnvram/Makefile
+++ b/lib/libnvram/Makefile
@@ -15,7 +15,8 @@ SRCS = nvram.c envvar.c
TOPCMNDIR ?= ../..
ASFLAGS = $(FLAG) $(RELEASE) $(CPUARCHDEF) -Wa,-mregnames
-CPPFLAGS = -I../libc/include $(CPUARCHDEF) -I$(INCLBRDDIR) -I$(INCLCMNDIR)/$(CPUARCH) -I. -I../../include
+CPPFLAGS = -I../libc/include $(CPUARCHDEF) $(FLAG) \
+ -I$(INCLBRDDIR) -I$(INCLCMNDIR)/$(CPUARCH) -I. -I../../include
LDFLAGS = -nostdlib
TARGET = ../libnvram.a
diff --git a/lib/libnvram/nvram.c b/lib/libnvram/nvram.c
index a31bb53..e9500ec 100644
--- a/lib/libnvram/nvram.c
+++ b/lib/libnvram/nvram.c
@@ -23,9 +23,17 @@
#include <southbridge.h>
#include <nvramlog.h>
+#ifndef NVRAM_LENGTH
+#define NVRAM_LENGTH 0x10000
+#endif
+
void asm_cout(long Character,long UART,long NVRAM);
-static volatile uint8_t *nvram=(volatile uint8_t *)SB_NVRAM_adr;
+#if defined(DISABLE_NVRAM)
+static volatile uint8_t nvram[NVRAM_LENGTH]; /* FAKE */
+#else
+static volatile uint8_t *nvram = (volatile uint8_t *)SB_NVRAM_adr;
+#endif
/* This is extremely ugly, but still better than implementing
* another sbrk() around it.
@@ -490,13 +498,13 @@ void reset_nvram(void)
erase_nvram(0, NVRAM_LENGTH);
DEBUG("Creating CPU log partitions\n");
- *(uint32_t *)&(header[0]) = be32_to_cpu(LLFW_LOG_BE0_NAME_PREFIX);
- *(uint64_t *)&(header[4]) = be64_to_cpu(LLFW_LOG_BE0_NAME);
+ *(uint32_t *)(char *)&(header[0]) = be32_to_cpu(LLFW_LOG_BE0_NAME_PREFIX);
+ *(uint64_t *)(char *)&(header[4]) = be64_to_cpu(LLFW_LOG_BE0_NAME);
cpulog0=create_nvram_partition(LLFW_LOG_BE0_SIGNATURE, header,
(LLFW_LOG_BE0_LENGTH*16)-PARTITION_HEADER_SIZE);
- *(uint32_t *)&(header[0]) = be32_to_cpu(LLFW_LOG_BE1_NAME_PREFIX);
- *(uint64_t *)&(header[4]) = be64_to_cpu(LLFW_LOG_BE1_NAME);
+ *(uint32_t *)(char *)&(header[0]) = be32_to_cpu(LLFW_LOG_BE1_NAME_PREFIX);
+ *(uint64_t *)(char *)&(header[4]) = be64_to_cpu(LLFW_LOG_BE1_NAME);
cpulog1=create_nvram_partition(LLFW_LOG_BE1_SIGNATURE, header,
(LLFW_LOG_BE1_LENGTH*16)-PARTITION_HEADER_SIZE);
@@ -512,7 +520,8 @@ void reset_nvram(void)
void nvram_debug(void)
{
+#if !defined(DISABLE_NVRAM)
printf("\nNVRAM_BASE: %lx\n", (unsigned long)SB_NVRAM_adr);
printf("NVRAM_LEN: %x\n", NVRAM_LENGTH);
+#endif
}
-