[OpenBIOS] [commit] r1329 - trunk/openbios-devel/arch/sparc64

repository service svn at openbios.org
Mon Mar 9 10:37:49 CET 2015


Author: mcayland
Date: Mon Mar  9 10:37:48 2015
New Revision: 1329
URL: http://tracker.coreboot.org/trac/openbios/changeset/1329

Log:
SPARC64: use MMIO for NVRAM access

Use MMIO for accessing the m48t59 NVRAM chip. This patch is a counterpart
of a QEMU change.

Signed-off-by: Artyom Tarasenko <atar4qemu at gmail.com>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>

Modified:
   trunk/openbios-devel/arch/sparc64/openbios.c

Modified: trunk/openbios-devel/arch/sparc64/openbios.c
==============================================================================
--- trunk/openbios-devel/arch/sparc64/openbios.c	Mon Dec  1 21:52:15 2014	(r1328)
+++ trunk/openbios-devel/arch/sparc64/openbios.c	Mon Mar  9 10:37:48 2015	(r1329)
@@ -27,21 +27,18 @@
 
 #define UUID_FMT "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x"
 
-#define NVRAM_ADDR_LO 0x74
-#define NVRAM_ADDR_HI 0x75
-#define NVRAM_DATA    0x77
-
 #define APB_SPECIAL_BASE     0x1fe00000000ULL
 #define APB_MEM_BASE         0x1ff00000000ULL
 
 #define MEMORY_SIZE     (512*1024)      /* 512K ram for hosted system */
 
 // XXX
+#define NVRAM_BASE       0x2000
 #define NVRAM_SIZE       0x2000
 #define NVRAM_IDPROM     0x1fd8
 #define NVRAM_IDPROM_SIZE 32
 #define NVRAM_OB_START   (0)
-#define NVRAM_OB_SIZE    ((0x1fd0 - NVRAM_OB_START) & ~15)
+#define NVRAM_OB_SIZE    ((NVRAM_IDPROM - NVRAM_OB_START) & ~15)
 
 static uint8_t idprom[NVRAM_IDPROM_SIZE];
 
@@ -352,34 +349,22 @@
     for (;;);
 }
 
-static uint8_t nvram_read_byte(uint16_t offset)
-{
-    outb(offset & 0xff, NVRAM_ADDR_LO);
-    outb(offset >> 8, NVRAM_ADDR_HI);
-    return inb(NVRAM_DATA);
-}
-
 static void nvram_read(uint16_t offset, char *buf, unsigned int nbytes)
 {
     unsigned int i;
 
-    for (i = 0; i < nbytes; i++)
-        buf[i] = nvram_read_byte(offset + i);
-}
-
-static void nvram_write_byte(uint16_t offset, uint8_t val)
-{
-    outb(offset & 0xff, NVRAM_ADDR_LO);
-    outb(offset >> 8, NVRAM_ADDR_HI);
-    outb(val, NVRAM_DATA);
+    for (i = 0; i < nbytes; i++) {
+        buf[i] = inb(NVRAM_BASE + offset + i);
+    }
 }
 
 static void nvram_write(uint16_t offset, const char *buf, unsigned int nbytes)
 {
     unsigned int i;
 
-    for (i = 0; i < nbytes; i++)
-        nvram_write_byte(offset + i, buf[i]);
+    for (i = 0; i < nbytes; i++) {
+        outb(buf[i], NVRAM_BASE + offset + i);
+    }
 }
 
 static uint8_t qemu_uuid[16];



More information about the OpenBIOS mailing list