diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..3afe7406 --- /dev/null +++ b/Makefile @@ -0,0 +1,95 @@ +# Uncomment the second line on SMP systems if the magic invocation fails. +#SMP := 0 +#SMP := 1 +SMP := $(shell if grep -q '^SMP[[:space:]]*=' /usr/src/linux/Makefile; then echo 1; else echo 0; fi) + +# Uncomment the second line if you do not want to compile the included +# i2c modules. WARNING! If the i2c module version does not match the +# smbus/sensor module versions, you will get into severe problems. +I2C := 1 +#I2C := 0 + +# Uncomment the second line if you are a developer. This will enable many +# additional warnings at compile-time +WARN := 0 +#WARN := 1 + +# This is the directory into which the modules will be installed, if you +# call 'make install' +MODDIR := /lib/modules/extra/misc + +# This is the directory into which the include files will be installed, +# if you call 'make install'. If you install it in the directory below, +# #include , for example, should work, regardless of the +# current linux kernel. +INCLUDEDIR := /usr/local/include/linux + + +# Below this, nothing should need to be changed. + +# Note that this is a monolithic Makefile; it calls no sub-Makefiles, +# but instead, it compiles everything right from here. Yes, there are +# some distinct advantages to this; see the following paper for more info: +# http://www.tip.net.au/~millerp/rmch/recu-make-cons-harm.html +# Note that is still uses Makefile fragments in sub-directories; these +# are called 'Module.mk'. + +# Within each Module.mk, rules and dependencies can be added to targets +# all, install and clean. Use double colons instead of single ones +# to do this. + +# The subdirectories we need to build things in +MODULES := +ifeq ($(I2C),1) +MODULES += i2c +endif + +# Some often-used commands with default options +MKDIR := mkdir -p +RM := rm -f + +# Determine the default compiler flags +CFLAGS := -D__KERNEL__ -DMODULE -I. -O2 -fomit-frame-pointer + +ifeq ($(SMP),1) +CFLAGS += -D__SMP__ +endif + +ifeq ($(WARN),1) +CFLAGS += -Wall -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual \ + -Wcast-align -Wwrite-strings -Wnested-externs -Winline +endif + +.PHONY: all clean install version package + +# Include all makefiles for sub-modules +include $(patsubst %,%/Module.mk,$(MODULES)) + + +all:: + +install:: + +clean:: + $(RM) lm_sensors-* + +# This is tricky, but it works like a charm. It needs lots of utilities +# though: cut, find, gzip, ln, tail and tar. +package: version clean + lmversion=`tail -1 version.h|cut -f 2 -d \"`; \ + lmpackage=lm_sensors-$$lmversion; \ + ln -s . $$lmpackage; \ + find $$lmpackage/ -type f | grep -v ^$$lmpackage/$$lmpackage$$ | \ + grep -v ^$$lmpackage/$$lmpackage.tar$$ | \ + grep -v ^$$lmpackage/$$ | \ + grep -v CVS | \ + grep -v ^$$lmpackage/.# | \ + tar rvf $$lmpackage.tar -T -; \ + gzip -9 $$lmpackage.tar ;\ + $(RM) $$lmpackage.tar $$lmpackage + +version: + $(RM) version.h + echo '#define LM_DATE "'`date +'%Y%m%d'`\" > version.h + echo -n 'Version: '; \ + echo '#define LM_VERSION "'`read VER; echo $$VER`\" >> version.h diff --git a/doc/useful_addresses.html b/doc/useful_addresses.html index ec85655f..f9011088 100644 --- a/doc/useful_addresses.html +++ b/doc/useful_addresses.html @@ -55,6 +55,12 @@ hardware monitor wmlm78 is a graphical extension of lm_sensors, which can be docked in Window Manager. +
  • Other things + diff --git a/i2c/Module.mk b/i2c/Module.mk new file mode 100644 index 00000000..c67855d7 --- /dev/null +++ b/i2c/Module.mk @@ -0,0 +1,17 @@ +# Note that MODULE_DIR (the directory in which this file resides) is a +# 'simply expanded variable'. That means that its value is substituted +# verbatim in the rules, until it is redefined. +MODULE_DIR := i2c + +TARGETS := $(MODULE_DIR)/i2c-core.o $(MODULE_DIR)/algo-bit.o \ + $(MODULE_DIR)/i2c-dev.o $(MODULE_DIR)/bit-lp.o \ + $(MODULE_DIR)/bit-velle.o $(MODULE_DIR)/bit-mb.o + +all :: $(TARGETS) + +install :: $(TARGETS) + $(MKDIR) $(MODDIR) + install -o root -g root -m 644 $(MODDIR) $(TARGETS) + +clean :: + $(RM) $(TARGETS) diff --git a/i2c/bit-mb.c b/i2c/bit-mb.c index 4f3371b7..661596fb 100644 --- a/i2c/bit-mb.c +++ b/i2c/bit-mb.c @@ -24,6 +24,14 @@ #include #include #include +#include +#include + +/* When exactly was the new pci interface introduced? */ +#if LINUX_VERSION_CODE < 0x020100 +#include +#endif + #include "i2c.h" #include "algo-bit.h" @@ -119,6 +127,9 @@ static void bit_mb_exit(void) release_region(I2C_DIR, IOSPACE); } +/* When exactly was the new pci interface introduced? */ +#if LINUX_VERSION_CODE >= 0x020100 + static u32 find_i2c(void) { struct pci_dev *s_bridge; @@ -138,6 +149,31 @@ static u32 find_i2c(void) return (val & (0xff<<8)); } +#else + +static u32 find_i2c(void) +{ + unsigned char VIA_bus, VIA_devfn; + u32 val; + + if (! pcibios_present()) + return(0); + + if(pcibios_find_device( + PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_3, 0, &VIA_bus, + &VIA_devfn)); + return 0; + + if ( PCIBIOS_SUCCESSFUL != + pcibios_read_config_dword(VIA_bus, VIA_devfn, + PM_IO_BASE_REGISTER, &val)) + return 0; + return (val & (0xff<<8)); +} + +#endif + + #ifdef MODULE MODULE_AUTHOR("Kyosti Malkki "); MODULE_DESCRIPTION("SMBus for VT82C586"); diff --git a/version.h b/version.h new file mode 100644 index 00000000..64a5df4a --- /dev/null +++ b/version.h @@ -0,0 +1,2 @@ +#define LM_DATE "19981103" +#define LM_VERSION "2.0.0pre0"