mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-10-28 12:40:42 +00:00
(Phil) Wrapped Serverworks OSB4 support into i2c-piix4.c (briefly tested
on both platforms). LM87 support is very far along, and should work for a majority of users, but some minor tweaks are still on the to-do list. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@963 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
09091b0a6f
commit
f592b02b21
6 files changed
+589
-395
No files matched your search
+32
-17
@@ -34,6 +34,18 @@
|
||||
|
||||
#include <linux/init.h>
|
||||
|
||||
/* Note: Since the ServerWorks OSB4 SMBus host interface is identical
|
||||
to the Intel PIIX4's, we only mention it during detection. */
|
||||
|
||||
#ifndef PCI_DEVICE_ID_SERVERWORKS_OSB4
|
||||
#define PCI_DEVICE_ID_SERVERWORKS_OSB4 0x0200
|
||||
#endif
|
||||
|
||||
#ifndef PCI_VENDOR_ID_SERVERWORKS
|
||||
#define PCI_VENDOR_ID_SERVERWORKS 0x01166
|
||||
#endif
|
||||
|
||||
|
||||
/* PIIX4 SMBus address offsets */
|
||||
#define SMBHSTSTS (0 + piix4_smba)
|
||||
#define SMBHSLVSTS (1 + piix4_smba)
|
||||
@@ -129,7 +141,7 @@ static struct i2c_adapter piix4_adapter = {
|
||||
|
||||
static int __initdata piix4_initialized;
|
||||
static unsigned short piix4_smba = 0;
|
||||
|
||||
static kind = 0;
|
||||
|
||||
/* Detect whether a PIIX4 can be found, and initialize it, where necessary.
|
||||
Note the differences between kernels with the old PCI BIOS interface and
|
||||
@@ -149,20 +161,26 @@ int piix4_setup(void)
|
||||
goto END;
|
||||
}
|
||||
|
||||
/* Look for the PIIX4, function 3 */
|
||||
/* Note: we keep on searching until we have found 'function 3' */
|
||||
/* Look for the PIIX4, function 3 or Serverworks PSB4 func 0 */
|
||||
/* Note: we keep on searching until we have found the proper function */
|
||||
PIIX4_dev = NULL;
|
||||
do
|
||||
PIIX4_dev = pci_find_device(PCI_VENDOR_ID_SERVERWORKS,
|
||||
PCI_DEVICE_ID_SERVERWORKS_OSB4,
|
||||
PIIX4_dev);
|
||||
while (PIIX4_dev && (PCI_FUNC(PIIX4_dev->devfn) != 0));
|
||||
if (PIIX4_dev == NULL) {
|
||||
PIIX4_dev = pci_find_device(PCI_VENDOR_ID_INTEL,
|
||||
PCI_DEVICE_ID_INTEL_82371AB_3,
|
||||
PIIX4_dev);
|
||||
while (PIIX4_dev && (PCI_FUNC(PIIX4_dev->devfn) != 3));
|
||||
if (PIIX4_dev == NULL) {
|
||||
printk
|
||||
("i2c-piix4.o: Error: Can't detect PIIX4, function 3!\n");
|
||||
error_return = -ENODEV;
|
||||
goto END;
|
||||
}
|
||||
while (PIIX4_dev && (PCI_FUNC(PIIX4_dev->devfn) != 3));
|
||||
if (PIIX4_dev == NULL) {
|
||||
printk
|
||||
("i2c-piix4.o: Error: Can't detect PIIX4 function 3 nor OSB4 function 0!\n");
|
||||
error_return = -ENODEV;
|
||||
goto END;
|
||||
} else { kind=1; /* Intel PIIX4 found */ }
|
||||
} else { kind=2; /* Serverworks OSB4 found */ }
|
||||
|
||||
|
||||
/* Determine the address of the SMBus areas */
|
||||
if (force_addr) {
|
||||
@@ -214,7 +232,7 @@ int piix4_setup(void)
|
||||
}
|
||||
|
||||
/* Everything is happy, let's grab the memory and set things up. */
|
||||
request_region(piix4_smba, 8, "piix4-smbus");
|
||||
request_region(piix4_smba, 8, kind==1?"piix4-smbus":"osb4-smbus");
|
||||
|
||||
#ifdef DEBUG
|
||||
if ((temp & 0x0E) == 8)
|
||||
@@ -450,15 +468,12 @@ u32 piix4_func(struct i2c_adapter *adapter)
|
||||
int __init i2c_piix4_init(void)
|
||||
{
|
||||
int res;
|
||||
printk("i2c-piix4.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
#ifdef DEBUG
|
||||
/* PE- It might be good to make this a permanent part of the code! */
|
||||
printk("piix4.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
if (piix4_initialized) {
|
||||
printk
|
||||
("i2c-piix4.o: Oops, piix4_init called a second time!\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
#endif
|
||||
piix4_initialized = 0;
|
||||
if ((res = piix4_setup())) {
|
||||
printk
|
||||
@@ -467,7 +482,7 @@ int __init i2c_piix4_init(void)
|
||||
return res;
|
||||
}
|
||||
piix4_initialized++;
|
||||
sprintf(piix4_adapter.name, "SMBus PIIX4 adapter at %04x",
|
||||
sprintf(piix4_adapter.name, kind==1?"SMBus PIIX4 adapter at %04x":"SMBus OSB4 adapter at %04x",
|
||||
piix4_smba);
|
||||
if ((res = i2c_add_adapter(&piix4_adapter))) {
|
||||
printk
|
||||
|
||||
+478
-356
File diff suppressed because it is too large.
Load diff
+24
-17
@@ -756,28 +756,35 @@ struct sensors_chips_data {
|
||||
#define LM87_SYSCTL_IN3 1003
|
||||
#define LM87_SYSCTL_IN4 1004
|
||||
#define LM87_SYSCTL_IN5 1005
|
||||
#define LM87_SYSCTL_FAN1 1101
|
||||
#define LM87_SYSCTL_FAN2 1102
|
||||
#define LM87_SYSCTL_TEMP1 1250 /* Degrees Celcius * 100 */
|
||||
#define LM87_SYSCTL_TEMP2 1251 /* Degrees Celcius * 100 */
|
||||
#define LM87_SYSCTL_TEMP3 1252 /* Degrees Celcius * 100 */
|
||||
#define LM87_SYSCTL_AIN1 1006
|
||||
#define LM87_SYSCTL_AIN2 1007
|
||||
#define LM87_SYSCTL_FAN1 1102
|
||||
#define LM87_SYSCTL_FAN2 1103
|
||||
#define LM87_SYSCTL_TEMP1 1250 /* Degrees Celcius * 100 */
|
||||
#define LM87_SYSCTL_TEMP2 1251 /* Degrees Celcius * 100 */
|
||||
#define LM87_SYSCTL_TEMP3 1252 /* Degrees Celcius * 100 */
|
||||
#define LM87_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */
|
||||
#define LM87_SYSCTL_ALARMS 2001 /* bitvector */
|
||||
#define LM87_SYSCTL_ANALOG_OUT 2002
|
||||
#define LM87_SYSCTL_VID 2003
|
||||
|
||||
#define LM87_ALARM_IN0 0x0001
|
||||
#define LM87_ALARM_IN1 0x0002
|
||||
#define LM87_ALARM_IN2 0x0004
|
||||
#define LM87_ALARM_IN3 0x0008
|
||||
#define LM87_ALARM_IN4 0x0100
|
||||
#define LM87_ALARM_IN5 0x0200
|
||||
#define LM87_ALARM_TEMP1 0x0010
|
||||
#define LM87_ALARM_TEMP2 0x4020 /* include D1 fault */
|
||||
#define LM87_ALARM_TEMP3 0x8001 /* include D2 fault */
|
||||
#define LM87_ALARM_FAN1 0x0040
|
||||
#define LM87_ALARM_FAN2 0x0080
|
||||
#define LM87_ALARM_CHAS 0x1000
|
||||
#define LM87_ALARM_IN0 0x0001
|
||||
#define LM87_ALARM_IN1 0x0002
|
||||
#define LM87_ALARM_IN2 0x0004
|
||||
#define LM87_ALARM_IN3 0x0008
|
||||
#define LM87_ALARM_TEMP1 0x0010
|
||||
#define LM87_ALARM_TEMP2 0x0020
|
||||
#define LM87_ALARM_TEMP3 0x0020 /* same?? */
|
||||
#define LM87_ALARM_FAN1 0x0040
|
||||
#define LM87_ALARM_FAN2 0x0080
|
||||
#define LM87_ALARM_IN4 0x0100
|
||||
#define LM87_ALARM_IN5 0x0200
|
||||
#define LM87_ALARM_RESERVED1 0x0400
|
||||
#define LM87_ALARM_RESERVED2 0x0800
|
||||
#define LM87_ALARM_CHAS 0x1000
|
||||
#define LM87_ALARM_THERM_SIG 0x2000
|
||||
#define LM87_ALARM_TEMP2_FAULT 0x4000
|
||||
#define LM87_ALARM_TEMP3_FAULT 0x08000
|
||||
|
||||
#define PCF8574_SYSCTL_STAT 1000
|
||||
|
||||
|
||||
+19
-2
@@ -1777,7 +1777,7 @@ static sensors_chip_feature eeprom_features[] =
|
||||
static sensors_chip_feature lm87_features[] =
|
||||
{
|
||||
{ SENSORS_LM87_IN0, "2.5V", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING,
|
||||
SENSORS_MODE_R, LM87_SYSCTL_IN0, VALUE(2), 2 },
|
||||
SENSORS_MODE_R, LM87_SYSCTL_IN0, VALUE(3), 2 },
|
||||
{ SENSORS_LM87_IN1, "Vccp1", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING,
|
||||
SENSORS_MODE_R, LM87_SYSCTL_IN1, VALUE(3), 2 },
|
||||
{ SENSORS_LM87_IN2, "3.3V", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING,
|
||||
@@ -1788,6 +1788,10 @@ static sensors_chip_feature lm87_features[] =
|
||||
SENSORS_MODE_R, LM87_SYSCTL_IN4, VALUE(3), 2 },
|
||||
{ SENSORS_LM87_IN5, "Vccp2", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING,
|
||||
SENSORS_MODE_R, LM87_SYSCTL_IN5, VALUE(3), 2 },
|
||||
{ SENSORS_LM87_AIN1, "AIN1", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING,
|
||||
SENSORS_MODE_R, LM87_SYSCTL_AIN1, VALUE(3), 0 },
|
||||
{ SENSORS_LM87_AIN2, "AIN2", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING,
|
||||
SENSORS_MODE_R, LM87_SYSCTL_AIN2, VALUE(3), 0 },
|
||||
{ SENSORS_LM87_IN0_MIN, "AmbTemp_min", SENSORS_LM87_IN0,
|
||||
SENSORS_LM87_IN0, SENSORS_MODE_RW,
|
||||
LM87_SYSCTL_IN0, VALUE(1), 2 },
|
||||
@@ -1806,6 +1810,12 @@ static sensors_chip_feature lm87_features[] =
|
||||
{ SENSORS_LM87_IN5_MIN, "Vccp2_min", SENSORS_LM87_IN5,
|
||||
SENSORS_LM87_IN5, SENSORS_MODE_RW,
|
||||
LM87_SYSCTL_IN5, VALUE(1), 2 },
|
||||
{ SENSORS_LM87_AIN1_MIN, "AIN1_min", SENSORS_LM87_AIN1,
|
||||
SENSORS_LM87_AIN1, SENSORS_MODE_RW,
|
||||
LM87_SYSCTL_AIN1, VALUE(1), 0 },
|
||||
{ SENSORS_LM87_AIN2_MIN, "AIN2_min", SENSORS_LM87_AIN2,
|
||||
SENSORS_LM87_AIN2, SENSORS_MODE_RW,
|
||||
LM87_SYSCTL_AIN2, VALUE(1), 0 },
|
||||
{ SENSORS_LM87_IN0_MAX, "AmbTemp_max", SENSORS_LM87_IN0,
|
||||
SENSORS_LM87_IN0, SENSORS_MODE_RW,
|
||||
LM87_SYSCTL_IN0, VALUE(2), 2 },
|
||||
@@ -1824,6 +1834,12 @@ static sensors_chip_feature lm87_features[] =
|
||||
{ SENSORS_LM87_IN5_MAX, "Vccp2_max", SENSORS_LM87_IN5,
|
||||
SENSORS_LM87_IN5, SENSORS_MODE_RW,
|
||||
LM87_SYSCTL_IN5, VALUE(2), 2 },
|
||||
{ SENSORS_LM87_AIN1_MAX, "AIN1_max", SENSORS_LM87_AIN1,
|
||||
SENSORS_LM87_AIN1, SENSORS_MODE_RW,
|
||||
LM87_SYSCTL_AIN1, VALUE(2), 0 },
|
||||
{ SENSORS_LM87_AIN2_MAX, "AIN2_max", SENSORS_LM87_AIN2,
|
||||
SENSORS_LM87_AIN2, SENSORS_MODE_RW,
|
||||
LM87_SYSCTL_AIN2, VALUE(2), 0 },
|
||||
{ SENSORS_LM87_FAN1, "fan1", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING,
|
||||
SENSORS_MODE_R, LM87_SYSCTL_FAN1, VALUE(2), 0 },
|
||||
{ SENSORS_LM87_FAN2, "fan2", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING,
|
||||
@@ -1834,7 +1850,7 @@ static sensors_chip_feature lm87_features[] =
|
||||
{ SENSORS_LM87_FAN2_MIN, "fan2 min", SENSORS_LM87_FAN2,
|
||||
SENSORS_LM87_FAN2, SENSORS_MODE_RW,
|
||||
LM87_SYSCTL_FAN2, VALUE(1), 0 },
|
||||
{ SENSORS_LM87_TEMP3, "temp3", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING,
|
||||
{ SENSORS_LM87_TEMP3, "CPU2 Temp", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING,
|
||||
SENSORS_MODE_R, LM87_SYSCTL_TEMP3, VALUE(3), 1 },
|
||||
{ SENSORS_LM87_TEMP2, "CPU Temp", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING,
|
||||
SENSORS_MODE_R, LM87_SYSCTL_TEMP2, VALUE(3), 1 },
|
||||
@@ -1860,6 +1876,7 @@ static sensors_chip_feature lm87_features[] =
|
||||
LM87_SYSCTL_TEMP3, VALUE(1), 1 },
|
||||
{ SENSORS_LM87_VID, "vid", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING,
|
||||
SENSORS_MODE_R, LM87_SYSCTL_VID, VALUE(1), 2 },
|
||||
/* Ho hum, this will be wrong if fan1 is disabled, but fan2 isn't.. fix?? */
|
||||
{ SENSORS_LM87_FAN1_DIV, "fan_div", SENSORS_LM87_FAN1,
|
||||
SENSORS_NO_MAPPING, SENSORS_MODE_RW,
|
||||
LM87_SYSCTL_FAN_DIV, VALUE(1), 0 },
|
||||
|
||||
@@ -828,18 +828,24 @@
|
||||
#define SENSORS_LM87_IN3 4 /* R */
|
||||
#define SENSORS_LM87_IN4 5 /* R */
|
||||
#define SENSORS_LM87_IN5 6 /* R */
|
||||
#define SENSORS_LM87_AIN1 7 /* R */
|
||||
#define SENSORS_LM87_AIN2 8 /* R */
|
||||
#define SENSORS_LM87_IN0_MIN 11 /* RW */
|
||||
#define SENSORS_LM87_IN1_MIN 12 /* RW */
|
||||
#define SENSORS_LM87_IN2_MIN 13 /* RW */
|
||||
#define SENSORS_LM87_IN3_MIN 14 /* RW */
|
||||
#define SENSORS_LM87_IN4_MIN 15 /* RW */
|
||||
#define SENSORS_LM87_IN5_MIN 16 /* RW */
|
||||
#define SENSORS_LM87_AIN1_MIN 17 /* RW */
|
||||
#define SENSORS_LM87_AIN2_MIN 18 /* RW */
|
||||
#define SENSORS_LM87_IN0_MAX 21 /* RW */
|
||||
#define SENSORS_LM87_IN1_MAX 22 /* RW */
|
||||
#define SENSORS_LM87_IN2_MAX 23 /* RW */
|
||||
#define SENSORS_LM87_IN3_MAX 24 /* RW */
|
||||
#define SENSORS_LM87_IN4_MAX 25 /* RW */
|
||||
#define SENSORS_LM87_IN5_MAX 26 /* RW */
|
||||
#define SENSORS_LM87_AIN1_MAX 27 /* RW */
|
||||
#define SENSORS_LM87_AIN2_MAX 28 /* RW */
|
||||
#define SENSORS_LM87_FAN1 31 /* R */
|
||||
#define SENSORS_LM87_FAN2 32 /* R */
|
||||
#define SENSORS_LM87_FAN1_MIN 41 /* RW */
|
||||
|
||||
+30
-3
@@ -1362,6 +1362,30 @@ void print_lm87(const sensors_chip_name *name)
|
||||
} else
|
||||
printf("ERROR: Can't get IN5 data!\n");
|
||||
free_the_label(&label);
|
||||
if (!sensors_get_label_and_valid(*name,SENSORS_LM87_AIN1,&label,&valid) &&
|
||||
!sensors_get_feature(*name,SENSORS_LM87_AIN1,&cur) &&
|
||||
!sensors_get_feature(*name,SENSORS_LM87_AIN1_MIN,&min) &&
|
||||
!sensors_get_feature(*name,SENSORS_LM87_AIN1_MAX,&max)) {
|
||||
if (valid) {
|
||||
print_label(label,10);
|
||||
printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n",
|
||||
cur,min,max,alarms&LM87_ALARM_FAN1?"ALARM":"");
|
||||
}
|
||||
} else
|
||||
printf("ERROR: Can't get AIN1 data!\n");
|
||||
free_the_label(&label);
|
||||
if (!sensors_get_label_and_valid(*name,SENSORS_LM87_AIN2,&label,&valid) &&
|
||||
!sensors_get_feature(*name,SENSORS_LM87_AIN2,&cur) &&
|
||||
!sensors_get_feature(*name,SENSORS_LM87_AIN2_MIN,&min) &&
|
||||
!sensors_get_feature(*name,SENSORS_LM87_AIN2_MAX,&max)) {
|
||||
if (valid) {
|
||||
print_label(label,10);
|
||||
printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n",
|
||||
cur,min,max,alarms&LM87_ALARM_FAN2?"ALARM":"");
|
||||
}
|
||||
} else
|
||||
printf("ERROR: Can't get AIN2 data!\n");
|
||||
free_the_label(&label);
|
||||
|
||||
if (!sensors_get_label_and_valid(*name,SENSORS_LM87_FAN1,&label,&valid) &&
|
||||
!sensors_get_feature(*name,SENSORS_LM87_FAN1,&cur) &&
|
||||
@@ -1395,7 +1419,8 @@ void print_lm87(const sensors_chip_name *name)
|
||||
if (valid) {
|
||||
print_label(label,10);
|
||||
print_temp_info( cur, max, min, MINMAX );
|
||||
printf(" %s\n", alarms&LM87_ALARM_TEMP1?"ALARM":"");
|
||||
printf(" %s%s\n", alarms&LM87_ALARM_TEMP1?"ALARM":"",
|
||||
alarms&LM87_ALARM_THERM_SIG?" THERM#":"");
|
||||
}
|
||||
} else
|
||||
printf("ERROR: Can't get TEMP1 data!\n");
|
||||
@@ -1408,7 +1433,8 @@ void print_lm87(const sensors_chip_name *name)
|
||||
if (valid) {
|
||||
print_label(label,10);
|
||||
print_temp_info( cur, max, min, MINMAX );
|
||||
printf(" %s\n", alarms&LM87_ALARM_TEMP2?"ALARM":"");
|
||||
printf(" %s%s\n", alarms&LM87_ALARM_TEMP2?"ALARM":"",
|
||||
alarms&LM87_ALARM_TEMP2_FAULT?" FAULT":"");
|
||||
}
|
||||
} else
|
||||
printf("ERROR: Can't get TEMP2 data!\n");
|
||||
@@ -1421,7 +1447,8 @@ void print_lm87(const sensors_chip_name *name)
|
||||
if (valid) {
|
||||
print_label(label,10);
|
||||
print_temp_info( cur, max, min, MINMAX );
|
||||
printf(" %s\n", alarms&LM87_ALARM_TEMP3?"ALARM":"");
|
||||
printf(" %s%s\n", alarms&LM87_ALARM_TEMP3?"ALARM":"",
|
||||
alarms&LM87_ALARM_TEMP3_FAULT?" FAULT":"");
|
||||
}
|
||||
} else
|
||||
printf("ERROR: Can't get TEMP3 data!\n");
|
||||
|
||||
Reference in new issue
Block a user