Index: src/sys/arch/sparc64/sparc64/ofw_patch.c =================================================================== RCS file: /cvsroot/src/sys/arch/sparc64/sparc64/ofw_patch.c,v retrieving revision 1.15 diff -u -r1.15 ofw_patch.c --- src/sys/arch/sparc64/sparc64/ofw_patch.c 8 Jul 2026 09:34:32 -0000 1.15 +++ src/sys/arch/sparc64/sparc64/ofw_patch.c 7 Aug 2026 08:58:21 -0000 @@ -41,8 +41,16 @@ #include #include +/* + * GPIO pin configurations + * num: the bit representing the pin + * act: on/off are reversed + * def: default state for LED or ALERT (will be set or checked by the driver) + * to: timeout (secs) before which we need to read the state + */ static void -add_gpio_pin(prop_array_t pins, const char *name, int num, int act, int def) +add_gpio_pin(prop_array_t pins, const char *name, int num, int act, + int def, int to) { prop_dictionary_t pin = prop_dictionary_create(); prop_dictionary_set_string(pin, "name", name); @@ -50,6 +58,8 @@ prop_dictionary_set_bool(pin, "active_high", act); if (def != -1) prop_dictionary_set_int32(pin, "default_state", def); + if (to != -1) + prop_dictionary_set_int32(pin, "timeout", to); prop_array_add(pins, pin); prop_object_release(pin); } @@ -108,27 +118,27 @@ switch (ia->ia_addr) { case 0x38: /* front panel LEDs */ pins = prop_array_create(); - add_gpio_pin(pins, "LED indicator", 7, 0, -1); - add_gpio_pin(pins, "LED fault", 5, 0, 0); - add_gpio_pin(pins, "LED power", 4, 0, 1); + add_gpio_pin(pins, "LED indicator", 7, 0, -1, -1); + add_gpio_pin(pins, "LED fault", 5, 0, 0, -1); + add_gpio_pin(pins, "LED power", 4, 0, 1, -1); prop_dictionary_set(dict, "pins", pins); prop_object_release(pins); break; case 0x23: /* drive bay O/1 LEDs */ pins = prop_array_create(); - add_gpio_pin(pins, "LED bay0_fault", 10, 0, 0); - add_gpio_pin(pins, "LED bay1_fault", 11, 0, 0); - add_gpio_pin(pins, "LED bay0_remove", 12, 0, 0); - add_gpio_pin(pins, "LED bay1_remove", 13, 0, 0); + add_gpio_pin(pins, "LED bay0_fault", 10, 0, 0, -1); + add_gpio_pin(pins, "LED bay1_fault", 11, 0, 0, -1); + add_gpio_pin(pins, "LED bay0_remove", 12, 0, 0, -1); + add_gpio_pin(pins, "LED bay1_remove", 13, 0, 0, -1); prop_dictionary_set(dict, "pins", pins); prop_object_release(pins); break; case 0x25: /* drive bay 2/3 LEDs (v240 only)*/ pins = prop_array_create(); - add_gpio_pin(pins, "LED bay2_fault", 10, 0, 0); - add_gpio_pin(pins, "LED bay3_fault", 11, 0, 0); - add_gpio_pin(pins, "LED bay2_remove", 12, 0, 0); - add_gpio_pin(pins, "LED bay3_remove", 13, 0, 0); + add_gpio_pin(pins, "LED bay2_fault", 10, 0, 0, -1); + add_gpio_pin(pins, "LED bay3_fault", 11, 0, 0, -1); + add_gpio_pin(pins, "LED bay2_remove", 12, 0, 0, -1); + add_gpio_pin(pins, "LED bay3_remove", 13, 0, 0, -1); prop_dictionary_set(dict, "pins", pins); prop_object_release(pins); break; @@ -143,19 +153,55 @@ prop_array_t pins; switch (ia->ia_addr) { - case 0x22: /* Disks present */ + case 0x12: /* V215 disk status / LED's */ + break; + pins = prop_array_create(); + add_gpio_pin(pins, "ALERT HDD 0 present", + 6, 1, -1, -1); + add_gpio_pin(pins, "ALERT HDD 1 present", + 7, 1, -1, -1); + add_gpio_pin(pins, "LED hdd0_fault", 0, 0, 0, -1); + add_gpio_pin(pins, "LED hdd0_remove", 4, 0, 0, -1); + add_gpio_pin(pins, "LED hdd1_fault", 1, 0, 0, -1); + add_gpio_pin(pins, "LED hdd1_remove", 5, 0, 0, -1); + prop_dictionary_set(dict, "pins", pins); + prop_object_release(pins); + break; + case 0x22: /* V245 disk status / LED's */ pins = prop_array_create(); - add_gpio_pin(pins, - "INDICATOR HDD 0 present", 8, 1, -1); - add_gpio_pin(pins, - "INDICATOR HDD 1 present", 9, 1, -1); - add_gpio_pin(pins, - "INDICATOR HDD 2 present", 10, 1, -1); - add_gpio_pin(pins, - "INDICATOR HDD 3 present", 11, 1, -1); + add_gpio_pin(pins, "ALERT HDD 0 present", + 8, 1, -1, -1); + add_gpio_pin(pins, "ALERT HDD 1 present", + 9, 1, -1, -1); + add_gpio_pin(pins, "ALERT HDD 2 present", + 10, 1, -1, -1); + add_gpio_pin(pins, "ALERT HDD 3 present", + 11, 1, -1, -1); + add_gpio_pin(pins, "LED hdd0_fault", 0, 0, 0, -1); + add_gpio_pin(pins, "LED hdd0_remove", 4, 0, 0, -1); + add_gpio_pin(pins, "LED hdd1_fault", 1, 0, 0, -1); + add_gpio_pin(pins, "LED hdd1_remove", 5, 0, 0, -1); + add_gpio_pin(pins, "LED hdd2_fault", 2, 0, 0, -1); + add_gpio_pin(pins, "LED hdd2_remove", 6, 0, 0, -1); + add_gpio_pin(pins, "LED hdd3_fault", 3, 0, 0, -1); + add_gpio_pin(pins, "LED hdd3_remove", 7, 0, 0, -1); prop_dictionary_set(dict, "pins", pins); prop_object_release(pins); break; + case 0x3e: /* PSU 0 */ + pins = prop_array_create(); + prop_dictionary_set(dict, "pins", pins); + add_gpio_pin(pins, "ALERT PSU 0 input power", + 6, 0, 0, -1); + prop_object_release(pins); + break; + case 0x3f: /* PSU 1 */ + pins = prop_array_create(); + prop_dictionary_set(dict, "pins", pins); + add_gpio_pin(pins, "ALERT PSU 1 input power", + 6, 0, 0, -1); + prop_object_release(pins); + break; } } @@ -169,8 +215,8 @@ switch (ia->ia_addr) { case 0x18: /* front panel LEDs */ pins = prop_array_create(); - add_gpio_pin(pins, "LED power", 0, 1, -1); - add_gpio_pin(pins, "LED fault", 1, 0, -1); + add_gpio_pin(pins, "LED power", 0, 1, -1, -1); + add_gpio_pin(pins, "LED fault", 1, 0, -1, -1); prop_dictionary_set(dict, "pins", pins); prop_object_release(pins); break; @@ -187,62 +233,64 @@ switch (ia->ia_addr) { case 0x38: /* interrupt status */ pins = prop_array_create(); - add_gpio_pin(pins, "ALERT high_temp", 1, 0, 30); - add_gpio_pin(pins, "ALERT disk_event", 2, 0, 30); - add_gpio_pin(pins, "ALERT fan_fail", 4, 0, 30); - add_gpio_pin(pins, "ALERT key_event", 5, 0, 30); - add_gpio_pin(pins, "ALERT psu_event", 6, 0, 30); + add_gpio_pin(pins, "ALERT high_temp", 1, 0, -1, 30); + add_gpio_pin(pins, "ALERT disk_event", 2, 0, -1, 30); + add_gpio_pin(pins, "ALERT fan_fail", 4, 0, -1, 30); + add_gpio_pin(pins, "ALERT key_event", 5, 0, -1, 30); + add_gpio_pin(pins, "ALERT psu_event", 6, 0, -1, 30); prop_dictionary_set(dict, "pins", pins); prop_object_release(pins); break; case 0x39: /* PSU status */ pins = prop_array_create(); - add_gpio_pin(pins, "INDICATOR psu0_present", 0, 0, -1); - add_gpio_pin(pins, "INDICATOR psu1_present", 1, 0, -1); - add_gpio_pin(pins, "INDICATOR psu0_fault", 4, 0, -1); - add_gpio_pin(pins, "INDICATOR psu1_fault", 5, 0, -1); + add_gpio_pin(pins, "INDICATOR psu0_present", + 0, 0, -1, -1); + add_gpio_pin(pins, "INDICATOR psu1_present", + 1, 0, -1, -1); + add_gpio_pin(pins, "ALERT psu0_fault", 4, 0, 1, -1); + add_gpio_pin(pins, "ALERT psu1_fault", 5, 0, 1, -1); prop_dictionary_set(dict, "pins", pins); prop_object_release(pins); break; case 0x3d: /* disk status */ pins = prop_array_create(); - add_gpio_pin(pins, "INDICATOR disk0_present", - 0, 0, -1); - add_gpio_pin(pins, "INDICATOR disk1_present", - 1, 0, -1); - add_gpio_pin(pins, "INDICATOR disk2_present", - 2, 0, -1); - add_gpio_pin(pins, "INDICATOR disk3_present", - 3, 0, -1); - add_gpio_pin(pins, "INDICATOR disk4_present", - 4, 0, -1); - add_gpio_pin(pins, "INDICATOR disk5_present", - 5, 0, -1); + add_gpio_pin(pins, "ALERT disk0_present", + 0, 0, -1, -1); + add_gpio_pin(pins, "ALERT disk1_present", + 1, 0, -1, -1); + add_gpio_pin(pins, "ALERT disk2_present", + 2, 0, -1, -1); + add_gpio_pin(pins, "ALERT disk3_present", + 3, 0, -1, -1); + add_gpio_pin(pins, "ALERT disk4_present", + 4, 0, -1, -1); + add_gpio_pin(pins, "ALERT disk5_present", + 5, 0, -1, -1); prop_dictionary_set(dict, "pins", pins); prop_object_release(pins); break; case 0x3e: /* front panel LEDs (E250/E450) */ pins = prop_array_create(); - add_gpio_pin(pins, "LED disk_fault", 0, 0, -1); - add_gpio_pin(pins, "LED psu_fault", 1, 0, -1); - add_gpio_pin(pins, "LED overtemp", 2, 0, -1); - add_gpio_pin(pins, "LED fault", 3, 0, -1); - add_gpio_pin(pins, "LED activity", 4, 0, -1); + add_gpio_pin(pins, "LED disk_fault", 0, 0, -1, -1); + add_gpio_pin(pins, "LED psu_fault", 1, 0, -1, -1); + add_gpio_pin(pins, "LED overtemp", 2, 0, -1, -1); + add_gpio_pin(pins, "LED fault", 3, 0, -1, -1); + add_gpio_pin(pins, "LED activity", 4, 0, -1, -1); /* Pin 5 is power LED, but not controllable */ - add_gpio_pin(pins, "INDICATOR key_normal", 6, 0, -1); - add_gpio_pin(pins, "INDICATOR key_diag", 7, 0, -1); + add_gpio_pin(pins, "INDICATOR key_normal", 6, 0, -1, -1); + add_gpio_pin(pins, "INDICATOR key_diag", 7, 0, -1, -1); /* If not "normal" or "diag", key is "lock" */ prop_dictionary_set(dict, "pins", pins); prop_object_release(pins); break; case 0x3f: /* disk fault LEDs */ pins = prop_array_create(); - add_gpio_pin(pins, "LED disk0_fault", 0, 0, -1); - add_gpio_pin(pins, "LED disk1_fault", 1, 0, -1); - add_gpio_pin(pins, "LED disk2_fault", 2, 0, -1); - add_gpio_pin(pins, "LED disk3_fault", 3, 0, -1); - add_gpio_pin(pins, "LED disk4_fault", 4, 0, -1); - add_gpio_pin(pins, "LED disk5_fault", 5, 0, -1); + add_gpio_pin(pins, "LED disk0_fault", 0, 0, -1, -1); + add_gpio_pin(pins, "LED disk1_fault", 1, 0, -1, -1); + add_gpio_pin(pins, "LED disk2_fault", 2, 0, -1, -1); + add_gpio_pin(pins, "LED disk3_fault", 3, 0, -1, -1); + add_gpio_pin(pins, "LED disk4_fault", 4, 0, -1, -1); + add_gpio_pin(pins, "LED disk5_fault", 5, 0, -1, -1); prop_dictionary_set(dict, "pins", pins); prop_object_release(pins); break; @@ -354,15 +402,20 @@ * Add V245 environmental sensors that are not in the OFW tree. */ static void -add_env_sensors_v245(device_t busdev) +add_env_sensors_v245(device_t busdev, int model) { prop_array_t cfg; DPRINTF(ACDB_PROBE, ("\nAdding sensors for %s ", machine_model)); cfg = create_i2c_dict(busdev); - /* PCA9555 at 0x22 */ - add_i2c_device(cfg, "temperature-sensor", "i2c-pca9555", 0x22, 0); + /* PCA9556 at 0x12 (V215) */ + if (model == 215) + add_i2c_device(cfg, "gpio", "i2c-pca9556", 0x12, 0); + + /* PCA9555 at 0x22 (V245) */ + if (model == 245) + add_i2c_device(cfg, "gpio", "i2c-pca9555", 0x22, 0); /* LM95221 at 0x2b */ add_i2c_device(cfg, "temperature-sensor", "i2c-lm95221", 0x2b, 0); @@ -525,7 +578,9 @@ if (device_is_a(busdev, "firei2c")) { if (!strcmp(machine_model, "SUNW,Sun-Fire-V245") || !strcmp(machine_model, "SUNW,Sun-Fire-V215")) { - add_env_sensors_v245(busdev); + add_env_sensors_v245(busdev, + strcmp(machine_model, "SUNW,Sun-Fire-V245") + ? 215 : 245); fix_properties_v245(busdev); } } @@ -552,10 +607,37 @@ } } - if (!strcmp(machine_model, "SUNW,Sun-Fire-V245")) - if (device_is_a(dev, "pcagpio")) + if (!strcmp(machine_model, "SUNW,Sun-Fire-V245") || + !strcmp(machine_model, "SUNW,Sun-Fire-V215")) { + /* CPU temperatures are offset by 30C */ + if (device_is_a(dev, "adt7462sm")){ + prop_dictionary_t props = device_properties(dev); + prop_dictionary_set_uint32(props, + "temp_off", 0x001e1e00); + } + /* Disk status / LED's */ + if (device_is_a(dev, "pcagpio") || + device_is_a(dev, "pcf8574io")) add_gpio_props_v245(dev, aux); + /* Tach pulse is set incorrectly */ + if (device_is_a(dev, "dbcool")) { + prop_dictionary_t props = device_properties(dev); + prop_dictionary_set_uint16(props, + "fan_div", 0x0022); + } + } + + if (!strcmp(machine_model, "SUNW,Sun-Blade-2500-S") || + !strcmp(machine_model, "SUNW,Sun-Blade-1500-S")) { + /* Tach pulse is set incorrectly on both chips */ + if (device_is_a(dev, "dbcool")) { + prop_dictionary_t props = device_properties(dev); + prop_dictionary_set_uint16(props, + "fan_div", 0x0044); + } + } + /* U45 has 5 measured fans */ if (!strcmp(machine_model, "SUNW,A70")) { if (device_is_a(dev, "adt7462sm")){ @@ -571,6 +653,7 @@ device_is_a(busdev, "firei2c")) add_gpio_props_u45(dev, aux); + /* E250 GPIO's */ if (!strcmp(machine_model, "SUNW,Ultra-250")) if (device_is_a(dev, "pcf8574io")) add_gpio_props_e250(dev, aux); Index: src/sys/dev/i2c/pcf8574.c =================================================================== RCS file: /cvsroot/src/sys/dev/i2c/pcf8574.c,v retrieving revision 1.11 diff -u -r1.11 pcf8574.c --- src/sys/dev/i2c/pcf8574.c 31 Jul 2026 06:48:11 -0000 1.11 +++ src/sys/dev/i2c/pcf8574.c 7 Aug 2026 08:58:21 -0000 @@ -63,6 +63,7 @@ struct pcf8574_pin { int pin_sensor; int pin_active; + int pin_default; char pin_desc[ENVSYS_DESCLEN]; }; @@ -96,7 +97,7 @@ static void pcf8574_attach_led( struct pcf8574_softc *, char *, int, int, int); static int pcf8574_attach_sysmon( - struct pcf8574_softc *, char *, int, int, int); + struct pcf8574_softc *, char *, int, int, int, int); void pcf8574_refresh(struct sysmon_envsys *, envsys_data_t *); int pcf8574_get_led(void *); void pcf8574_set_led(void *, int); @@ -133,7 +134,8 @@ prop_dictionary_t dict = device_properties(self); prop_array_t pins; prop_dictionary_t pin; - int i, num, def, envc = 0; + int i, num, envc = 0; + int32_t def, to; char name[32]; const char *nptr = NULL, *spptr; bool ok = TRUE, act; @@ -178,9 +180,11 @@ ok &= prop_dictionary_get_string(pin, "name", &nptr); ok &= prop_dictionary_get_uint32(pin, "pin", &num); ok &= prop_dictionary_get_bool(pin, "active_high", &act); - /* optional default state */ + /* optional default state and timeout */ def = -1; prop_dictionary_get_int32(pin, "default_state", &def); + to = 0; + prop_dictionary_get_int32(pin, "timeout", &to); if (!ok) continue; /* Extract pin type from the name */ @@ -190,24 +194,40 @@ spptr += 1; strncpy(name, spptr, 31); sc->sc_pins[num].pin_active = act; + + /* LED's with an optional default state to set. */ if (!strncmp(nptr, "LED ", 4)) { sc->sc_mask &= ~(1 << num); pcf8574_attach_led(sc, name, num, act, def); } + + /* Indicator: status is either true, or false. */ if (!strncmp(nptr, "INDICATOR ", 10)) { - if (pcf8574_attach_sysmon(sc, name, envc, num, act)) + if (pcf8574_attach_sysmon(sc, name, envc, + num, act, -1)) return; envc++; } + + /* + * Alert: + * - status is either true, or false + * - if a default is set: + * - set envsys state to critical if a default is set + * and status != default + * - if no default is set: + * - display a message if the status changes + */ if (!strncmp(nptr, "ALERT ", 6)) { u_int64_t alert_time; - if (pcf8574_attach_sysmon(sc, name, envc, num, act)) + if (pcf8574_attach_sysmon(sc, name, envc, + num, act, def)) return; - /* Adjust our timeout if the alert times out. */ - if (def != -1) - alert_time = def / 2; + /* Adjust our timeout if the alert has a time out. */ + if (to > 10) + alert_time = to / 2; else alert_time = PCF8574_DEFAULT_TIMER; @@ -215,7 +235,9 @@ alert_time < sc->sc_callout_time) sc->sc_callout_time = alert_time; - sc->sc_alert_mask |= (1 << num); + /* Check alerts if sysmon doesn't (i.e. no default). */ + if (def == -1) + sc->sc_alert_mask |= (1 << num); envc++; } } @@ -310,7 +332,7 @@ static int pcf8574_attach_sysmon(struct pcf8574_softc *sc, char *name, int envc, int pin, - int act) + int act, int def) { int ret; @@ -325,6 +347,12 @@ sc->sc_pins[envc].pin_sensor = pin; sc->sc_sensor[envc].state = ENVSYS_SINVALID; sc->sc_sensor[envc].units = ENVSYS_INDICATOR; + if (def == -1) + sc->sc_pins[envc].pin_default = def; + else { + sc->sc_pins[envc].pin_default = def << pin; + sc->sc_sensor[envc].flags = ENVSYS_FMONCRITICAL; + } strlcpy(sc->sc_sensor[envc].desc, name, sizeof(sc->sc_sensor[envc].desc)); ret = sysmon_envsys_sensor_attach(sc->sc_sme, &sc->sc_sensor[envc]); @@ -345,7 +373,8 @@ { struct pcf8574_softc *sc = sme->sme_cookie; int pin = sc->sc_pins[edata->sensor].pin_sensor; - int act = sc->sc_pins[pin].pin_active; + int act = sc->sc_pins[edata->sensor].pin_active; + int def = sc->sc_pins[edata->sensor].pin_default; u_int8_t prev_state = sc->sc_state; pcf8574_read(sc, &sc->sc_state); @@ -353,7 +382,12 @@ edata->value_cur = sc->sc_state & 1 << pin ? TRUE : FALSE; else edata->value_cur = sc->sc_state & 1 << pin ? FALSE : TRUE; - edata->state = ENVSYS_SVALID; + + /* Is this an alert pin with a default value? */ + if (def != -1 && (sc->sc_state & (1 << pin)) != def) + edata->state = ENVSYS_SCRITICAL; + else + edata->state = ENVSYS_SVALID; /* We read all the pins, so check for alerts on any pin now */ if (sc->sc_state != prev_state) { @@ -428,12 +462,12 @@ printf("%s: Alert: %s = %s\n", device_xname(sc->sc_dev), sc->sc_pins[i].pin_desc, - sc->sc_state & 1 << i ? "True" : "False"); + sc->sc_state & 1 << i ? "TRUE" : "FALSE"); else printf("%s: Alert: %s = %s\n", device_xname(sc->sc_dev), sc->sc_pins[i].pin_desc, - sc->sc_state & 1 << i ? "False" : "True"); + sc->sc_state & 1 << i ? "FALSE" : "TRUE"); } } } Index: src/sys/dev/i2c/pcagpio.c =================================================================== RCS file: /cvsroot/src/sys/dev/i2c/pcagpio.c,v retrieving revision 1.15 diff -u -r1.15 pcagpio.c --- src/sys/dev/i2c/pcagpio.c 3 Aug 2026 12:51:29 -0000 1.15 +++ src/sys/dev/i2c/pcagpio.c 7 Aug 2026 08:58:21 -0000 @@ -70,6 +70,7 @@ struct pcagpio_pin { int pin_sensor; int pin_active; + int pin_default; char pin_desc[ENVSYS_DESCLEN]; }; @@ -94,7 +95,7 @@ static void pcagpio_attach_led( struct pcagpio_softc *, char *, int, int, int); static int pcagpio_attach_sysmon( - struct pcagpio_softc *, char *, int, int, int); + struct pcagpio_softc *, char *, int, int, int, int); void pcagpio_refresh(struct sysmon_envsys *, envsys_data_t *); static int pcagpio_get(void *); static void pcagpio_set(void *, int); @@ -210,11 +211,30 @@ continue; spptr += 1; strncpy(name, spptr, 31); + + + /* LED's with an optional default state to set. */ if (!strncmp(nptr, "LED ", 4)) pcagpio_attach_led(sc, name, num, act, def); + + /* Indicator: status is either true, or false. */ if (!strncmp(nptr, "INDICATOR ", 10)) { if (pcagpio_attach_sysmon(sc, - name, envc, num, act)) + name, envc, num, act, -1)) + return; + envc++; + } + + /* + * Alert: + * - status is either true, or false + * - set envsys state to critical if a default is set + * and status != default + * - display a message if the status changes + */ + if (!strncmp(nptr, "ALERT ", 6)) { + if (pcagpio_attach_sysmon(sc, + name, envc, num, act, -1)) return; envc++; } @@ -317,7 +337,7 @@ static int pcagpio_attach_sysmon(struct pcagpio_softc *sc, char *name, int envc, int pin, - int act) + int act, int def) { int ret; @@ -332,6 +352,12 @@ sc->sc_pins[envc].pin_sensor = pin; sc->sc_sensor[envc].state = ENVSYS_SINVALID; sc->sc_sensor[envc].units = ENVSYS_INDICATOR; + if (def == -1) + sc->sc_pins[envc].pin_default = def; + else { + sc->sc_pins[envc].pin_default = def << pin; + sc->sc_sensor[envc].flags = ENVSYS_FMONCRITICAL; + } strlcpy(sc->sc_sensor[envc].desc, name, sizeof(sc->sc_sensor[envc].desc)); ret = sysmon_envsys_sensor_attach(sc->sc_sme, &sc->sc_sensor[envc]); @@ -352,7 +378,8 @@ { struct pcagpio_softc *sc = sme->sme_cookie; int pin = sc->sc_pins[edata->sensor].pin_sensor; - int act = sc->sc_pins[pin].pin_active; + int act = sc->sc_pins[edata->sensor].pin_active; + int def = sc->sc_pins[edata->sensor].pin_default; u_int32_t prev_state = sc->sc_in; sc->sc_in = pcagpio_readreg(sc, PCAGPIO_INPUT); @@ -360,7 +387,12 @@ edata->value_cur = sc->sc_in & 1 << pin ? TRUE : FALSE; else edata->value_cur = sc->sc_in & 1 << pin ? FALSE : TRUE; - edata->state = ENVSYS_SVALID; + + /* Is this an alert pin with a default value? */ + if (def != -1 && (sc->sc_in & (1 << pin)) != def) + edata->state = ENVSYS_SCRITICAL; + else + edata->state = ENVSYS_SVALID; if (sc->sc_state != prev_state) { DPRINTF("%s: (refresh) status change: 0x%02x > 0x%02x\n",