summaryrefslogtreecommitdiff
path: root/util/ectool/ec.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/ectool/ec.c')
-rw-r--r--util/ectool/ec.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/util/ectool/ec.c b/util/ectool/ec.c
index 406cc41ae7..098e8126d9 100644
--- a/util/ectool/ec.c
+++ b/util/ectool/ec.c
@@ -17,9 +17,25 @@
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
+#ifndef __NetBSD__
#include <sys/io.h>
+#endif
#include "ec.h"
+#ifdef __NetBSD__
+#include <machine/sysarch.h>
+static uint8_t inb(unsigned port)
+{
+ uint8_t data;
+ __asm volatile("inb %w1,%0" : "=a" (data) : "d" (port));
+ return data;
+}
+static __inline void outb(uint8_t data, unsigned port)
+{
+ __asm volatile("outb %0,%w1" : : "a" (data), "d" (port));
+}
+#endif
+
extern int verbose;
#define debug(x...) if (verbose) printf(x)