diff options
author | venki <none@none> | 2005-10-19 02:08:58 -0700 |
---|---|---|
committer | venki <none@none> | 2005-10-19 02:08:58 -0700 |
commit | b29b9e18acbca49b266e291e6dc75a886c5d3d2b (patch) | |
tree | 1b09799704ce8c569f889820d43b63f2d88206ed | |
parent | 3c04777e760a0ff56ed78e3cd151f923a271e8df (diff) | |
download | illumos-joyent-b29b9e18acbca49b266e291e6dc75a886c5d3d2b.tar.gz |
6333857 picl needs to monitor psu temperature
-rw-r--r-- | usr/src/cmd/picl/plugins/sun4u/chicago/envd/envd.h | 15 | ||||
-rw-r--r-- | usr/src/cmd/picl/plugins/sun4u/chicago/envd/envmodel.info | 6 | ||||
-rw-r--r-- | usr/src/cmd/picl/plugins/sun4u/chicago/envd/piclenvd.c | 89 | ||||
-rw-r--r-- | usr/src/cmd/picl/plugins/sun4u/chicago/envd/piclenvsetup.c | 2 | ||||
-rw-r--r-- | usr/src/cmd/picl/plugins/sun4u/chicago/frutree/system-board.info | 7 | ||||
-rw-r--r-- | usr/src/uts/sun4u/io/pic16f747.c | 13 | ||||
-rw-r--r-- | usr/src/uts/sun4u/sys/pic16f747.h | 32 |
7 files changed, 142 insertions, 22 deletions
diff --git a/usr/src/cmd/picl/plugins/sun4u/chicago/envd/envd.h b/usr/src/cmd/picl/plugins/sun4u/chicago/envd/envd.h index 1a8bd3c05c..1f5a6a5f86 100644 --- a/usr/src/cmd/picl/plugins/sun4u/chicago/envd/envd.h +++ b/usr/src/cmd/picl/plugins/sun4u/chicago/envd/envd.h @@ -39,7 +39,7 @@ extern "C" { /* * Chicago Platform Details */ -#define MAX_SENSORS 8 +#define MAX_SENSORS 9 #define MAX_FANS 6 /* @@ -71,6 +71,7 @@ extern "C" { #define SENSOR_FIRE "FireASIC" #define SENSOR_LSI1064 "LSI1064" #define SENSOR_FRONT_PANEL "Front_panel" +#define SENSOR_PSU "PSU" #define CPU0_SENSOR_ID 0 #define CPU1_SENSOR_ID 1 @@ -80,6 +81,7 @@ extern "C" { #define FIRE_SENSOR_ID 5 #define LSI1064_SENSOR_ID 6 #define FRONT_PANEL_SENSOR_ID 7 +#define PSU_SENSOR_ID 8 /* * Hard disk sensor names and ids @@ -231,6 +233,8 @@ extern "C" { "/devices/ebus@1f,464000/env-monitor@3,0:lsi1064" #define SENSOR_FRONT_PANEL_DEVFS \ "/devices/ebus@1f,464000/env-monitor@3,0:front_panel" +#define SENSOR_PSU_DEVFS \ + "/devices/ebus@1f,464000/env-monitor@3,0:psu" /* * Temperature type @@ -426,6 +430,13 @@ typedef struct { #define FRONT_PANEL_LOW_SHUTDOWN 0 #define FRONT_PANEL_LOW_POWER_OFF 0 +#define PSU_HIGH_POWER_OFF 95 +#define PSU_HIGH_SHUTDOWN 85 +#define PSU_HIGH_WARNING 75 +#define PSU_LOW_WARNING 5 +#define PSU_LOW_SHUTDOWN 0 +#define PSU_LOW_POWER_OFF 0 + /* * Temperature sensor related data structure */ @@ -480,7 +491,7 @@ typedef int fanspeed_t; typedef struct env_fan { char *name; /* fan name */ - char *devfs_path; /* fan device devfs path */ + char *devfs_path; /* fan device devfs path */ uchar_t id; fanspeed_t speed_min; /* minimum speed */ fanspeed_t speed_max; /* maximum speed */ diff --git a/usr/src/cmd/picl/plugins/sun4u/chicago/envd/envmodel.info b/usr/src/cmd/picl/plugins/sun4u/chicago/envd/envmodel.info index 520324f157..752e3a3fa8 100644 --- a/usr/src/cmd/picl/plugins/sun4u/chicago/envd/envmodel.info +++ b/usr/src/cmd/picl/plugins/sun4u/chicago/envd/envmodel.info @@ -61,6 +61,7 @@ VERBOSE 1 #define SENSOR_FIRE FireASIC #define SENSOR_LSI1064 LSI1064 #define SENSOR_FRONT_PANEL Front_panel +#define SENSOR_PSU PSU #define CPU0_SENSOR_ID 0 #define CPU1_SENSOR_ID 1 @@ -70,6 +71,7 @@ VERBOSE 1 #define FIRE_SENSOR_ID 5 #define LSI1064_SENSOR_ID 6 #define FRONT_PANEL_SENSOR_ID 7 +#define PSU_SENSOR_ID 8 /* * Hard disk sensor names and ids @@ -120,6 +122,10 @@ name:/platform/ebus@1f,464000/env-monitor@3,0/SENSOR_FRONT_PANEL PROP Label string r 0 "front_panel-sensor" PROP ID int r 4 FRONT_PANEL_SENSOR_ID +name:/platform/ebus@1f,464000/env-monitor@3,0/SENSOR_PSU + PROP Label string r 0 "psu-sensor" + PROP ID int r 4 PSU_SENSOR_ID + name:/platform/ebus@1f,464000/env-monitor@3,0/ENV_SYSTEM_FAN0 PROP Label string r 0 "cpu0-fan" diff --git a/usr/src/cmd/picl/plugins/sun4u/chicago/envd/piclenvd.c b/usr/src/cmd/picl/plugins/sun4u/chicago/envd/piclenvd.c index ecf6361485..ba8d3bf14a 100644 --- a/usr/src/cmd/picl/plugins/sun4u/chicago/envd/piclenvd.c +++ b/usr/src/cmd/picl/plugins/sun4u/chicago/envd/piclenvd.c @@ -86,6 +86,12 @@ extern int env_picl_setup_tuneables(void); static boolean_t has_fan_failed(env_fan_t *fanp); +/* + * PSU fan fault handling + */ +static boolean_t has_psufan_failed(void); +static int psufan_last_status = FAN_OK; + #pragma init(piclenvd_register) /* @@ -152,6 +158,10 @@ static es_sensor_blk_t sensor_default_ctl[MAX_SENSORS] = { FRONT_PANEL_HIGH_POWER_OFF, FRONT_PANEL_HIGH_SHUTDOWN, FRONT_PANEL_HIGH_WARNING, FRONT_PANEL_LOW_WARNING, FRONT_PANEL_LOW_SHUTDOWN, FRONT_PANEL_LOW_POWER_OFF + }, + { + PSU_HIGH_POWER_OFF, PSU_HIGH_SHUTDOWN, PSU_HIGH_WARNING, + PSU_LOW_WARNING, PSU_LOW_SHUTDOWN, PSU_LOW_POWER_OFF } }; @@ -261,6 +271,9 @@ static env_sensor_t envd_sensor_front_panel = { SENSOR_FRONT_PANEL, SENSOR_FRONT_PANEL_DEVFS, FRONT_PANEL_SENSOR_ID, -1, NULL, }; +static env_sensor_t envd_sensor_psu = { + SENSOR_PSU, SENSOR_PSU_DEVFS, PSU_SENSOR_ID, -1, NULL, +}; /* * The vendor-id and device-id are the properties associated with @@ -306,7 +319,7 @@ static env_disk_t *envd_disks[] = { /* * NULL terminated array of temperature sensors */ -#define N_ENVD_SENSORS 8 +#define N_ENVD_SENSORS 9 static env_sensor_t *envd_sensors[] = { &envd_sensor_cpu0, &envd_sensor_cpu1, @@ -316,6 +329,7 @@ static env_sensor_t *envd_sensors[] = { &envd_sensor_fire, &envd_sensor_lsi1064, &envd_sensor_front_panel, + &envd_sensor_psu, NULL }; @@ -1728,10 +1742,7 @@ fan_thr(void *args) for (i = 0; (fanp = envd_fans[i]) != NULL; i++) { if (fanp->present == B_FALSE) continue; - /* - * We initiate shutdown if fan status indicates - * failure. Also, don't warn repeatedly. - */ + if (has_fan_failed(fanp) == B_TRUE) { if (fanp->last_status == FAN_FAILED) continue; @@ -1749,6 +1760,23 @@ fan_thr(void *args) envd_log(LOG_ALERT, msgbuf); } } + + if (has_psufan_failed() == B_TRUE) { + if (psufan_last_status == FAN_FAILED) + continue; + psufan_last_status = FAN_FAILED; + (void) snprintf(msgbuf, sizeof (msgbuf), + ENV_FAN_FAILURE_WARNING_MSG, SENSOR_PSU, + fan_rpm_string, fan_status_string); + envd_log(LOG_ALERT, msgbuf); + } else { + if (psufan_last_status == FAN_OK) + continue; + psufan_last_status = FAN_OK; + (void) snprintf(msgbuf, sizeof (msgbuf), + ENV_FAN_OK_MSG, SENSOR_PSU); + envd_log(LOG_ALERT, msgbuf); + } } /*NOTREACHED*/ @@ -2077,6 +2105,57 @@ has_fan_failed(env_fan_t *fanp) return (B_FALSE); } +boolean_t +has_psufan_failed(void) +{ + uchar_t status; + int ret, ntries; + + if (envd_sensor_psu.fd == -1) + return (B_FALSE); + + /* + * For psu, only fan fault is visible, no fan speed + */ + (void) strncpy(fan_rpm_string, NOT_AVAILABLE, sizeof (fan_rpm_string)); + + /* + * Read RF_FAN_STATUS bit of the fan fault register, retry if + * the PIC is busy, with a 1 second delay to allow it to update. + */ + for (ntries = 0; ntries < MAX_RETRIES_FOR_FAN_FAULT; ntries++) { + ret = ioctl(envd_sensor_psu.fd, PIC_GET_FAN_STATUS, &status); + if ((ret == 0) && ((status & 0x1) == 0)) + break; + (void) sleep(1); + } + + if (ntries > 0) { + if (env_debug) { + envd_log(LOG_ERR, + "%d retries attempted in reading fan status.\n", + ntries); + } + } + + if (ntries == MAX_RETRIES_FOR_FAN_FAULT) { + (void) strncpy(fan_status_string, NOT_AVAILABLE, + sizeof (fan_status_string)); + return (B_TRUE); + } + + if (env_debug) + envd_log(LOG_ERR, "fan status = 0x%x\n", status); + + if (status & 0x1) { + (void) snprintf(fan_status_string, sizeof (fan_status_string), + "0x%x", status); + return (B_TRUE); + } + + return (B_FALSE); +} + static int scsi_mode_select(env_disk_t *diskp, uchar_t page_code, uchar_t *pagebuf, uint16_t pagelen) diff --git a/usr/src/cmd/picl/plugins/sun4u/chicago/envd/piclenvsetup.c b/usr/src/cmd/picl/plugins/sun4u/chicago/envd/piclenvsetup.c index 1f72c84e6e..0d4578e9eb 100644 --- a/usr/src/cmd/picl/plugins/sun4u/chicago/envd/piclenvsetup.c +++ b/usr/src/cmd/picl/plugins/sun4u/chicago/envd/piclenvsetup.c @@ -97,6 +97,8 @@ static sensor_node_t sensor_nodes[] = { {"/platform/ebus@1f,464000/env-monitor@3,0", SENSOR_LSI1064, NULL, NULL, NULL, NULL}, {"/platform/ebus@1f,464000/env-monitor@3,0", SENSOR_FRONT_PANEL, + NULL, NULL, NULL, NULL}, + {"/platform/ebus@1f,464000/env-monitor@3,0", SENSOR_PSU, NULL, NULL, NULL, NULL} }; #define N_SENSOR_NODES (sizeof (sensor_nodes)/sizeof (sensor_nodes[0])) diff --git a/usr/src/cmd/picl/plugins/sun4u/chicago/frutree/system-board.info b/usr/src/cmd/picl/plugins/sun4u/chicago/frutree/system-board.info index 766cc2894d..6908981887 100644 --- a/usr/src/cmd/picl/plugins/sun4u/chicago/frutree/system-board.info +++ b/usr/src/cmd/picl/plugins/sun4u/chicago/frutree/system-board.info @@ -310,6 +310,9 @@ REFPROP _fru_parent /frutree/chassis/MB/system-board name:/platform/ebus@1f,464000/env-monitor@3,0/Front_panel REFPROP _fru_parent /frutree/chassis/FIOB/system-board +name:/platform/ebus@1f,464000/env-monitor@3,0/PSU +REFPROP _fru_parent /frutree/chassis/MB/system-board + /* * Environmental device associated with motherboard */ @@ -335,6 +338,10 @@ ROW PROP Class string r 0 "temperature-sensor" REFPROP _temperature-sensor_ name:/platform/ebus@1f,464000/env-monitor@3,0/LSI1064 ENDROW +ROW +PROP Class string r 0 "temperature-sensor" +REFPROP _temperature-sensor_ name:/platform/ebus@1f,464000/env-monitor@3,0/PSU +ENDROW ENDTABLE /* diff --git a/usr/src/uts/sun4u/io/pic16f747.c b/usr/src/uts/sun4u/io/pic16f747.c index 83d0a220dc..dbdc42ff95 100644 --- a/usr/src/uts/sun4u/io/pic16f747.c +++ b/usr/src/uts/sun4u/io/pic16f747.c @@ -90,11 +90,11 @@ static struct dev_ops pic_dev_ops = { */ static struct minor_node_info pic_nodes[N_PIC_NODES] = { {NULL, 0, 0}, /* Reserved */ - {"fan_0", RF_FAN0_PERIOD, 0}, /* System Fan 0 */ - {"fan_1", RF_FAN1_PERIOD, 1}, /* System Fan 1 */ - {"fan_2", RF_FAN2_PERIOD, 2}, /* System Fan 2 */ - {"fan_3", RF_FAN3_PERIOD, 3}, /* System Fan 3 */ - {"fan_4", RF_FAN4_PERIOD, 4}, /* System Fan 4 in P0.1 */ + {"fan_0", RF_FAN0_PERIOD, F0_FLT_BIT}, /* System Fan 0 */ + {"fan_1", RF_FAN1_PERIOD, F1_FLT_BIT}, /* System Fan 1 */ + {"fan_2", RF_FAN2_PERIOD, F2_FLT_BIT}, /* System Fan 2 */ + {"fan_3", RF_FAN3_PERIOD, F3_FLT_BIT}, /* System Fan 3 */ + {"fan_4", RF_FAN4_PERIOD, F4_FLT_BIT}, /* System Fan 4 */ {"adt7462", RF_LOCAL_TEMP, 0}, /* ADT7462 Local Temperature */ {"cpu_0", RF_REMOTE1_TEMP, 0}, /* CPU 0 temp */ {"cpu_1", RF_REMOTE2_TEMP, 0}, /* CPU 1 temp */ @@ -102,7 +102,8 @@ static struct minor_node_info pic_nodes[N_PIC_NODES] = { {"lm95221", RF_LM95221_TEMP, 0}, /* LM95221 Local Temperature */ {"fire", RF_FIRE_TEMP, 0}, /* FIRE Temp */ {"lsi1064", RF_LSI1064_TEMP, 0}, /* LSI1064 Temp */ - {"front_panel", RF_FRONT_TEMP, 0} /* Front Panel Temperature */ + {"front_panel", RF_FRONT_TEMP, 0}, /* Front Panel Temperature */ + {"psu", RF_PSU_TEMP, PSUF_FLT_BIT} /* PSU Temp (and ffault) */ }; /* diff --git a/usr/src/uts/sun4u/sys/pic16f747.h b/usr/src/uts/sun4u/sys/pic16f747.h index 833cefec05..3669c96bb7 100644 --- a/usr/src/uts/sun4u/sys/pic16f747.h +++ b/usr/src/uts/sun4u/sys/pic16f747.h @@ -53,6 +53,7 @@ extern "C" { #define RF_FAN2_PERIOD 0x02 #define RF_FAN3_PERIOD 0x03 #define RF_FAN4_PERIOD 0x04 +#define RF_FAN5_PERIOD 0x05 /* unused */ #define RF_LOCAL_TEMP 0x06 #define RF_REMOTE1_TEMP 0x07 #define RF_REMOTE2_TEMP 0x08 @@ -64,26 +65,39 @@ extern "C" { #define RF_FAN_STATUS 0x0E #define RF_VCORE0 0x0F #define RF_VCORE1 0x10 +#define RF_VMEM0 0x11 +#define RF_VMEM1 0x12 +#define RF_PSU_TEMP 0x13 /* - * Bitmasks for RF_STATUS register + * Bitmasks for RF_COMMAND values + */ +#define CMD_TO_ESTAR 0x01 +#define CMD_PIC_RESET 0x80 + +/* + * Bitmasks for RF_STATUS values */ #define ST_FFAULT 0x01 /* fan failure has occurred */ #define ST_ENV_BUSY 0x02 /* environmental bus is busy */ -#define ST_STALE_ADT_DATA 0x04 /* ADT7462 data currently invalid */ -#define ST_STALE_LM_DATA 0x08 /* LM95221 data currently invalid */ +#define ST_ENV_STALE 0x04 /* ADT7462/LM95221 data invalid */ +#define ST_TPM_GOOD 0x08 /* TPM self test passed */ #define ST_FW_VERSION 0xF0 /* firmware version number */ /* - * Bitmasks for RF_COMMAND values + * Fan fault bits in RF_FAN_STATUS */ -#define CMD_TO_ESTAR 0x01 -#define CMD_PIC_RESET 0x80 +#define F0_FLT_BIT 0 +#define F1_FLT_BIT 1 +#define F2_FLT_BIT 2 +#define F3_FLT_BIT 3 +#define F4_FLT_BIT 4 +#define F5_FLT_BIT 5 /* unused */ +#define PSUF_FLT_BIT 6 /* Number of fans/sensors */ -#define MAX_PIC_NODES 16 #define N_FANS 5 -#define N_SENSORS 8 +#define N_SENSORS 9 #define N_PIC_NODES (N_FANS+N_SENSORS+1) /* @@ -97,7 +111,7 @@ typedef struct minor_node_info { } minor_node_info; /* - * PIC device minor numbers are constructed as <inst_9-12>:<unit_0-8> + * PIC device minor numbers are constructed as <inst_8-11>:<unit_0-7> */ #define PIC_INST_TO_MINOR(x) (((x) << 8) & 0x0F00) #define PIC_UNIT_TO_MINOR(x) ((x) & 0xFF) |