diff -Nur xmbmon201.orig/Makefile.NetBSD xmbmon201/Makefile.NetBSD --- xmbmon201.orig/Makefile.NetBSD Thu Jan 1 01:00:00 1970 +++ xmbmon201/Makefile.NetBSD Tue Feb 18 06:04:46 2003 @@ -0,0 +1,126 @@ +# Generated automatically from Makefile.in by configure. +# +# Makefile for xmbmon related things +# (for FreeBSD) +# + +# for Linux +#DEFS=-DHAVE_CONFIG_H -Wall -DLINUX +# for using SMBus ioctl +#DEFS=-DHAVE_CONFIG_H -Wall -DSMBUS_IOCTL + +# for making small_mbmon +#DEFS=-DHAVE_CONFIG_H -Wall -DSMALL_MBMON + +DEFS=-DHAVE_CONFIG_H -Wall -DNETBSD + +LIBDIR=/usr/X11R6/lib +INCDIR=. +XINCDIR=/usr/X11R6/include +XLIB=-lXaw -lXmu +EXTENSIONLIB=-lXext +INCLUDES=-I$(INCDIR) +XINCLUDES=-I$(XINCDIR) +LIBS=-L$(LIBDIR) -lXaw $(XLIB) -lXt $(EXTENSIONLIB) -lX11 -lm +NETBSDLIBS=-li386 + +#CC=/compat/linux/usr/bin/gcc +CC=cc +CFLAGS=-O -pipe $(INCLUDES) $(DEFS) +CFLAGSX=-O -pipe $(XINCLUDES) $(DEFS) +LDFLAGS=-s + +LINT=lint +# LINT=$(CC) -c -Wall -Wshadow -Wpointer-arith +# also maybe -Wcast-qual -Wwrite-strings +RM=rm -f +INSTALL=install + +INST_DIR=/usr/local/bin +INST_XDIR=/usr/X11R6/bin +INST_XRDIR=/usr/X11R6/lib/X11/app-defaults + +.c.o: + $(CC) -c $(CFLAGS) $*.c + +PROGRAM = mbmon xmbmon + +TESTPROG = testpci testsmb testhwm testfan + +MB_OBJ = getMB-via.o getMB-smb.o getMB-isa.o +SMB_OBJ = smbus_piix4.o smbus_amd.o smbus_ali.o +HWM_OBJ = sens_winbond.o sens_via686.o sens_it87.o sens_lm80.o sens_lm75.o +OBJS = getMBinfo.o tyan_tiger.o pci_pm.o smbuses.o sensors.o $(MB_OBJ) $(SMB_OBJ) $(HWM_OBJ) + +#all: $(PROGRAM) +all: $(PROGRAM) $(TESTPROG) mbmon_small + +mbmon: mbmon.c mbmon.h methods.h pci_pm.h smbuses.h sensors.h $(OBJS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ mbmon.c $(OBJS) $(NETBSDLIBS) + +mbmon_small: mbmon_small.c mbmon.h methods.h pci_pm.h smbuses.h sensors.h $(OBJS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ mbmon_small.c $(OBJS) $(NETBSDLIBS) + +xmbmon: xmbmon.c mbmon.h methods.h pci_pm.h smbuses.h sensors.h $(OBJS) + $(CC) $(CFLAGSX) $(LDFLAGS) -o $@ xmbmon.c $(OBJS) $(LIBS) $(NETBSDLIBS) + +testprog: $(TESTPROG) + +testpci: testpci.c pci_pm.c pci_pm.h + $(CC) $(CFLAGS) $(LDFLAGS) $(NETBSDLIBS) -o $@ testpci.c + +testsmb: testsmb.c pci_pm.c pci_pm.h smbus_piix4.c smbus_amd.c smbus_ali.c + $(CC) $(CFLAGS) $(LDFLAGS) $(NETBSDLIBS) -o $@ testsmb.c $(SMB_OBJ) + +testhwm: testhwm.c pci_pm.c pci_pm.h smbus_piix4.c smbus_amd.c smbus_ali.c + $(CC) $(CFLAGS) $(LDFLAGS) $(NETBSDLIBS) -o $@ testhwm.c $(SMB_OBJ) + +testfan: testhwm.c pci_pm.c pci_pm.h smbus_piix4.c smbus_amd.c smbus_ali.c + $(CC) -DFAN_DIV_CHK -O $(CFLAGS) $(LDFLAGS) $(NETBSDLIBS) -o $@ testhwm.c $(SMB_OBJ) + + +getMB-isa.o: getMB-isa.c methods.h io_static.c + +getMB-smb.o: getMB-smb.c getMB-smb_ioctl.c methods.h smbuses.h io_static.c + +getMB-via.o: getMB-via.c methods.h io_static.c + +getMBinfo.o: getMBinfo.c methods.h pci_pm.h smbuses.h sensors.h sensors.c + +pci_pm.o: pci_pm.c pci_pm.h io_static.c + +smbuses.o: smbuses.c smbuses.h + +smbus_piix4.o: smbus_piix4.c smbuses.h + +smbus_amd.o: smbus_amd.c smbuses.h + +smbus_ali.o: smbus_ali.c smbuses.h + +sensors.o: sensors.c sensors.h + +sens_it87.o: sens_it87.c sensors.h sensors.c + +sens_lm80.o: sens_lm80.c sensors.h sensors.c + +sens_via686.o: sens_via686.c sensors.h sensors.c + +sens_winbond.o: sens_winbond.c sensors.h sensors.c + +sens_lm75.o: sens_lm75.c sensors.h sensors.c + +tyan_tiger.o: tyan_tiger.c io_static.c + + +clean: + $(RM) *.o *.bak a.out core *.core *~ $(PROGRAM) $(TESTPROG) mbmon_small + +distclean: clean + $(RM) Makefile config.cache config.log config.h config.status + +install: $(PROGRAM) + $(INSTALL) -o root -g wheel -m 4555 -c -p mbmon $(INST_DIR) + $(INSTALL) -o root -g wheel -m 4555 -c -p xmbmon $(INST_XDIR) + +lint: + $(LINT) $(INCLUDES) $(DEFS) $(FONTDEFINES) $(SRCS) -lm diff -Nur xmbmon201.orig/getMB-isa.c xmbmon201/getMB-isa.c --- xmbmon201.orig/getMB-isa.c Sat Aug 31 09:00:17 2002 +++ xmbmon201/getMB-isa.c Tue Feb 18 05:17:12 2003 @@ -12,6 +12,9 @@ #include #include +#ifdef NETBSD +#include +#endif #include "io_static.c" diff -Nur xmbmon201.orig/getMB-via.c xmbmon201/getMB-via.c --- xmbmon201.orig/getMB-via.c Fri Jul 12 09:11:45 2002 +++ xmbmon201/getMB-via.c Tue Feb 18 05:17:29 2003 @@ -13,6 +13,9 @@ #include #include #include +#ifdef NETBSD +#include +#endif #include "io_static.c" diff -Nur xmbmon201.orig/io_cpu.h xmbmon201/io_cpu.h --- xmbmon201.orig/io_cpu.h Wed Jul 31 08:11:05 2002 +++ xmbmon201/io_cpu.h Tue Feb 18 05:27:55 2003 @@ -9,7 +9,7 @@ #define OUTw(x,y) outw((y),(x)) #define OUTl(x,y) outl((y),(x)) #define WAIT outb(0x00,0xEB) -#else /* FreeBSD */ +#else /* FreeBSD, NetBSD */ #include #define OUTb(x,y) outb((x),(y)) #define OUTw(x,y) outw((x),(y)) @@ -19,6 +19,7 @@ #ifdef LINUX /* LINUX */ extern int iopl_counter; +#elif NETBSD #else /* FreeBSD */ extern int iofl; #endif diff -Nur xmbmon201.orig/io_static.c xmbmon201/io_static.c --- xmbmon201.orig/io_static.c Wed Jul 31 08:06:31 2002 +++ xmbmon201/io_static.c Tue Feb 18 05:18:10 2003 @@ -1,6 +1,9 @@ /* static open/close IO routines used some places */ #include "io_cpu.h" +#ifdef NETBSD +#include "machine/sysarch.h" +#endif static int OpenIO() { @@ -10,6 +13,8 @@ return -1; } ++iopl_counter; +#elif NETBSD + return i386_iopl(1); #else /* FreeBSD */ if ((iofl = open("/dev/io",000)) < 0) return -1; @@ -23,6 +28,8 @@ iopl(0); if (iopl_counter > 0) --iopl_counter; +#elif NETBSD + i386_iopl(0); #else /* FreeBSD */ close(iofl); #endif diff -Nur xmbmon201.orig/mbmon.c xmbmon201/mbmon.c --- xmbmon201.orig/mbmon.c Sat Jan 18 21:13:41 2003 +++ xmbmon201/mbmon.c Tue Feb 18 05:34:09 2003 @@ -19,8 +19,14 @@ #include #include #include +#ifndef NETBSD #include +#endif #include +#ifdef NETBSD +#include +#include +#endif #include #include #include @@ -177,7 +183,7 @@ printf("%s\n", print_buf); -#else /* FreeBSD */ +#else /* FreeBSD, NetBSD */ struct timeval boottime; time_t uptime; @@ -252,7 +258,7 @@ struct sockaddr_in server, client; FILE *out = stdout; -#ifdef LINUX +#if defined(LINUX) || defined(NETBSD) /* format "%+" is not supported by glibc2 on linux systems */ char *format = "%a %b %d %T %Z %Y", buf[256]; #else diff -Nur xmbmon201.orig/pci_pm.c xmbmon201/pci_pm.c --- xmbmon201.orig/pci_pm.c Sat Jan 18 22:42:33 2003 +++ xmbmon201/pci_pm.c Tue Feb 18 05:20:11 2003 @@ -10,6 +10,9 @@ */ #include +#ifdef NETBSD +#include +#endif #include "pci_pm.h" #include "io_static.c" @@ -17,6 +20,7 @@ #ifdef LINUX /* LINUX */ /* counter for not calling iopl() multiply */ int iopl_counter = 0; +#elif NETBSD #else /* FreeBSD */ /* file descripter for /dev/io */ int iofl; diff -Nur xmbmon201.orig/smbus_ali.c xmbmon201/smbus_ali.c --- xmbmon201.orig/smbus_ali.c Sun Aug 4 17:58:07 2002 +++ xmbmon201/smbus_ali.c Tue Feb 18 05:21:52 2003 @@ -33,6 +33,9 @@ #include #include #include +#ifdef NETBSD +#include +#endif #include "smbuses.h" #include "io_cpu.h" diff -Nur xmbmon201.orig/smbus_amd.c xmbmon201/smbus_amd.c --- xmbmon201.orig/smbus_amd.c Sun Aug 4 18:01:07 2002 +++ xmbmon201/smbus_amd.c Tue Feb 18 05:22:07 2003 @@ -34,6 +34,9 @@ #include #include #include +#ifdef NETBSD +#include +#endif #include "smbuses.h" #include "io_cpu.h" diff -Nur xmbmon201.orig/smbus_piix4.c xmbmon201/smbus_piix4.c --- xmbmon201.orig/smbus_piix4.c Fri Aug 2 20:01:49 2002 +++ xmbmon201/smbus_piix4.c Tue Feb 18 05:22:23 2003 @@ -34,6 +34,9 @@ #include #include #include +#ifdef NETBSD +#include +#endif #include "smbuses.h" #include "io_cpu.h" diff -Nur xmbmon201.orig/tyan_tiger.c xmbmon201/tyan_tiger.c --- xmbmon201.orig/tyan_tiger.c Sat Aug 31 17:55:04 2002 +++ xmbmon201/tyan_tiger.c Tue Feb 18 05:22:53 2003 @@ -8,6 +8,9 @@ #include #include +#ifdef NETBSD +#include +#endif #include "io_static.c"