inteltool: add NetBSD compatibility

Tested on NetBSD-7.0/i386

Change-Id: I6a693633d3a80ea07ade233b1b4fd1c5a1412032
Signed-off-by: Andrey Korolyov <andrey@xdel.ru>
Reviewed-on: https://review.coreboot.org/12835
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Andrey Korolyov
2016-01-05 19:59:06 +03:00
committed by Patrick Georgi
parent 0ff8f9048b
commit 046d217420
3 changed files with 45 additions and 0 deletions

View File

@@ -24,6 +24,10 @@
#include <unistd.h>
#include "inteltool.h"
#ifdef __NetBSD__
#include <machine/sysarch.h>
#endif
/*
* http://pci-ids.ucw.cz/read/PC/8086
* http://en.wikipedia.org/wiki/Intel_Tick-Tock
@@ -344,6 +348,14 @@ int main(int argc, char *argv[])
#if defined(__FreeBSD__)
if (open("/dev/io", O_RDWR) < 0) {
perror("/dev/io");
#elif defined(__NetBSD__)
# ifdef __i386__
if (i386_iopl(3)) {
perror("iopl");
# else
if (x86_64_iopl(3)) {
perror("iopl");
# endif
#else
if (iopl(3)) {
perror("iopl");