viatool: add NetBSD support

Change-Id: I033044e4b781475d6d60a49a61313a720103ce38
Signed-off-by: Andrey Korolyov <andrey@xdel.ru>
Reviewed-on: https://review.coreboot.org/12836
Tested-by: build bot (Jenkins)
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
This commit is contained in:
Andrey Korolyov
2016-01-05 20:09:02 +03:00
committed by Patrick Georgi
parent 4ba946c1e1
commit 0ff8f9048b
3 changed files with 45 additions and 0 deletions

View File

@@ -25,6 +25,10 @@
#include <unistd.h>
#include "viatool.h"
#ifdef __NetBSD__
#include <machine/sysarch.h>
#endif
/*
* http://pci-ids.ucw.cz/read/PC/8086
* http://en.wikipedia.org/wiki/Intel_Tick-Tock
@@ -146,6 +150,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");