diff options
| author | Søren Schmidt <sos@FreeBSD.org> | 2003-03-12 10:59:35 +0000 |
|---|---|---|
| committer | Søren Schmidt <sos@FreeBSD.org> | 2003-03-12 10:59:35 +0000 |
| commit | 9eb8572ea2aeba149c1519a362171eaa4ada22db (patch) | |
| tree | 9b5e3e72ffc9d16e32da87e603fbf840a3eeb83a /sys | |
| parent | d067ce208daaa90e7fc23e45928d30ed19d6e91e (diff) | |
Notes
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/dev/ata/ata-all.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c index 657a7c7c1589..48f9c2c178aa 100644 --- a/sys/dev/ata/ata-all.c +++ b/sys/dev/ata/ata-all.c @@ -1240,6 +1240,7 @@ ata_enclosure_status(struct ata_device *atadev, int *fan, int *temp, int *v05, int *v12) { u_int8_t id1, id2, cnt, div; + int error = ENXIO; if (atadev->flags & ATA_D_ENC_PRESENT) { atadev->channel->locking(atadev->channel, ATA_LF_LOCK); @@ -1248,25 +1249,25 @@ ata_enclosure_status(struct ata_device *atadev, id1 = ata_enclosure_sensor(atadev, 0, 0x4f, 0); ata_enclosure_sensor(atadev, 1, 0x4e, 0x80); id2 = ata_enclosure_sensor(atadev, 0, 0x4f, 0); - if (id1 != 0xa3 || id2 != 0x5c) - return ENXIO; - div = 1 << (((ata_enclosure_sensor(atadev, 0, 0x5d, 0) & 0x20) >> 3)+ - ((ata_enclosure_sensor(atadev, 0, 0x47, 0) & 0x30) >> 4)+1); - cnt = ata_enclosure_sensor(atadev, 0, 0x28, 0); - if (cnt == 0xff) - *fan = 0; - else - *fan = 1350000 / cnt / div; - ata_enclosure_sensor(atadev, 1, 0x4e, 0x01); - *temp = (ata_enclosure_sensor(atadev, 0, 0x50, 0) * 10) + - (ata_enclosure_sensor(atadev, 0, 0x50, 0) & 0x80 ? 5 : 0); - *v05 = ata_enclosure_sensor(atadev, 0, 0x23, 0) * 27; - *v12 = ata_enclosure_sensor(atadev, 0, 0x24, 0) * 61; + if (id1 == 0xa3 && id2 == 0x5c) { + div = 1 << (((ata_enclosure_sensor(atadev, 0, 0x5d, 0)&0x20)>>3)+ + ((ata_enclosure_sensor(atadev, 0, 0x47, 0)&0x30)>>4)+1); + cnt = ata_enclosure_sensor(atadev, 0, 0x28, 0); + if (cnt == 0xff) + *fan = 0; + else + *fan = 1350000 / cnt / div; + ata_enclosure_sensor(atadev, 1, 0x4e, 0x01); + *temp = (ata_enclosure_sensor(atadev, 0, 0x50, 0) * 10) + + (ata_enclosure_sensor(atadev, 0, 0x50, 0) & 0x80 ? 5 : 0); + *v05 = ata_enclosure_sensor(atadev, 0, 0x23, 0) * 27; + *v12 = ata_enclosure_sensor(atadev, 0, 0x24, 0) * 61; + error = 0; + } ATA_UNLOCK_CH(atadev->channel); atadev->channel->locking(atadev->channel, ATA_LF_UNLOCK); - return 0; } - return ENXIO; + return error; } void |
