[coreboot-gerrit] Change in coreboot[master]: nvramtool: Add dummy cmos-hw-unix accessor implementation for non-x86

Paul Kocialkowski (Code Review) gerrit at coreboot.org
Wed Nov 22 14:31:20 CET 2017


Paul Kocialkowski has uploaded this change for review. ( https://review.coreboot.org/22562


Change subject: nvramtool: Add dummy cmos-hw-unix accessor implementation for non-x86
......................................................................

nvramtool: Add dummy cmos-hw-unix accessor implementation for non-x86

The default implementation uses inb/outb, that is not available on ARM
platforms and others. A dummy implementation allows building nvramtool
on these platforms.

Change-Id: I75e4a1a0cbd35ca40f7b108658686839ccf9784a
Signed-off-by: Paul Kocialkowski <contact at paulk.fr>
---
M util/nvramtool/accessors/cmos-hw-unix.c
1 file changed, 29 insertions(+), 1 deletion(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/62/22562/1

diff --git a/util/nvramtool/accessors/cmos-hw-unix.c b/util/nvramtool/accessors/cmos-hw-unix.c
index acefdf7..33d6994 100644
--- a/util/nvramtool/accessors/cmos-hw-unix.c
+++ b/util/nvramtool/accessors/cmos-hw-unix.c
@@ -11,7 +11,7 @@
 #define INW(x) __extension__ ({ u_int tmp = (x); inw(tmp); })
 #define INL(x) __extension__ ({ u_int tmp = (x); inl(tmp); })
 #else
-#if defined(__GLIBC__)
+#if defined(__GLIBC__) && (defined(__i386__) || defined(__x86_64__))
 #include <sys/io.h>
 #endif
 #if (defined(__MACH__) && defined(__APPLE__))
@@ -76,6 +76,8 @@
 static unsigned char cmos_hal_read(unsigned addr);
 static void cmos_hal_write(unsigned addr, unsigned char value);
 static void cmos_set_iopl(int level);
+
+#if defined(__i386__) || defined(__x86_64__)
 
 /* no need to initialize anything */
 static void cmos_hal_init(__attribute__((unused)) void *data)
@@ -160,6 +162,32 @@
 #endif
 }
 
+#else
+
+/* no need to initialize anything */
+static void cmos_hal_init(__attribute__((unused)) void *data)
+{
+	return;
+}
+
+static unsigned char cmos_hal_read(__attribute__((unused)) unsigned index)
+{
+	return;
+}
+
+static void cmos_hal_write(__attribute__((unused)) unsigned index,
+			   __attribute__((unused)) unsigned char value)
+{
+	return;
+}
+
+static void cmos_set_iopl(__attribute__((unused)) int level)
+{
+	return;
+}
+
+#endif
+
 cmos_access_t cmos_hal = {
 	.init = cmos_hal_init,
 	.read = cmos_hal_read,

-- 
To view, visit https://review.coreboot.org/22562
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I75e4a1a0cbd35ca40f7b108658686839ccf9784a
Gerrit-Change-Number: 22562
Gerrit-PatchSet: 1
Gerrit-Owner: Paul Kocialkowski <contact at paulk.fr>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20171122/96f61bfb/attachment.html>


More information about the coreboot-gerrit mailing list