[OpenBIOS] [commit] r1307 - in trunk/openbios-devel: drivers include/arch/common
repository service
svn at openbios.org
Sun Jul 13 18:19:50 CEST 2014
Author: agraf
Date: Sun Jul 13 18:19:50 2014
New Revision: 1307
URL: http://tracker.coreboot.org/trac/openbios/changeset/1307
Log:
Mac99: Support flat NVRAM
The mac99 machine is switching to use a flat NVRAM layout. Support
that hint and treat NVRAM as flat when we find it.
We keep the old (broken) shifted-by-1 way of accessing NVRAM around
to be able to use new OpenBIOS binaries on older QEMU versions.
Signed-off-by: Alexander Graf <agraf at suse.de>
Modified:
trunk/openbios-devel/drivers/macio.c
trunk/openbios-devel/include/arch/common/fw_cfg.h
Modified: trunk/openbios-devel/drivers/macio.c
==============================================================================
--- trunk/openbios-devel/drivers/macio.c Fri May 30 14:11:44 2014 (r1306)
+++ trunk/openbios-devel/drivers/macio.c Sun Jul 13 18:19:50 2014 (r1307)
@@ -27,20 +27,31 @@
#define NW_IO_NVRAM_SIZE 0x00004000
#define NW_IO_NVRAM_OFFSET 0xfff04000
-#define NW_IO_NVRAM_SHIFT 1
#define IO_OPENPIC_SIZE 0x00040000
#define IO_OPENPIC_OFFSET 0x00040000
static char *nvram;
+static int macio_nvram_shift(void)
+{
+ int nvram_flat;
+
+ if (is_oldworld())
+ return OW_IO_NVRAM_SHIFT;
+
+ nvram_flat = fw_cfg_read_i32(FW_CFG_PPC_NVRAM_FLAT);
+ return nvram_flat ? 0 : 1;
+}
+
int
macio_get_nvram_size(void)
{
+ int shift = macio_nvram_shift();
if (is_oldworld())
- return OW_IO_NVRAM_SIZE >> OW_IO_NVRAM_SHIFT;
+ return OW_IO_NVRAM_SIZE >> shift;
else
- return NW_IO_NVRAM_SIZE >> NW_IO_NVRAM_SHIFT;
+ return NW_IO_NVRAM_SIZE >> shift;
}
static unsigned long macio_nvram_offset(void)
@@ -123,12 +134,7 @@
macio_nvram_put(char *buf)
{
int i;
- unsigned int it_shift;
-
- if (is_oldworld())
- it_shift = OW_IO_NVRAM_SHIFT;
- else
- it_shift = NW_IO_NVRAM_SHIFT;
+ unsigned int it_shift = macio_nvram_shift();
for (i=0; i< arch_nvram_size() ; i++)
nvram[i << it_shift] = buf[i];
@@ -142,12 +148,7 @@
macio_nvram_get(char *buf)
{
int i;
- unsigned int it_shift;
-
- if (is_oldworld())
- it_shift = OW_IO_NVRAM_SHIFT;
- else
- it_shift = NW_IO_NVRAM_SHIFT;
+ unsigned int it_shift = macio_nvram_shift();
for (i=0; i< arch_nvram_size(); i++)
buf[i] = nvram[i << it_shift];
Modified: trunk/openbios-devel/include/arch/common/fw_cfg.h
==============================================================================
--- trunk/openbios-devel/include/arch/common/fw_cfg.h Fri May 30 14:11:44 2014 (r1306)
+++ trunk/openbios-devel/include/arch/common/fw_cfg.h Sun Jul 13 18:19:50 2014 (r1307)
@@ -46,6 +46,7 @@
#define FW_CFG_PPC_KVM_PID (FW_CFG_ARCH_LOCAL + 0x07)
#define FW_CFG_PPC_NVRAM_ADDR (FW_CFG_ARCH_LOCAL + 0x08)
#define FW_CFG_PPC_BUSFREQ (FW_CFG_ARCH_LOCAL + 0x09)
+#define FW_CFG_PPC_NVRAM_FLAT (FW_CFG_ARCH_LOCAL + 0x0a)
#define FW_CFG_INVALID 0xffff
More information about the OpenBIOS
mailing list