ipmi_sensor.h 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. *
  8. * Redistribution of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. *
  11. * Redistribution in binary form must reproduce the above copyright
  12. * notice, this list of conditions and the following disclaimer in the
  13. * documentation and/or other materials provided with the distribution.
  14. *
  15. * Neither the name of Sun Microsystems, Inc. or the names of
  16. * contributors may be used to endorse or promote products derived
  17. * from this software without specific prior written permission.
  18. *
  19. * This software is provided "AS IS," without a warranty of any kind.
  20. * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
  21. * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
  22. * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
  23. * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
  24. * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
  25. * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
  26. * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
  27. * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
  28. * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
  29. * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
  30. * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  31. */
  32. #ifndef IPMI_SENSOR_H
  33. #define IPMI_SENSOR_H
  34. #include <math.h>
  35. #include <ipmitool/bswap.h>
  36. #include <ipmitool/ipmi.h>
  37. #include <ipmitool/ipmi_sdr.h>
  38. /* threshold specification bits for analog sensors for get sensor threshold command
  39. * and set sensor threshold command
  40. */
  41. #define UPPER_NON_RECOV_SPECIFIED 0x20
  42. #define UPPER_CRIT_SPECIFIED 0x10
  43. #define UPPER_NON_CRIT_SPECIFIED 0x08
  44. #define LOWER_NON_RECOV_SPECIFIED 0x04
  45. #define LOWER_CRIT_SPECIFIED 0x02
  46. #define LOWER_NON_CRIT_SPECIFIED 0x01
  47. /* state assertion bits for discrete sensors for get sensor reading command */
  48. #define STATE_0_ASSERTED 0x01
  49. #define STATE_1_ASSERTED 0x02
  50. #define STATE_2_ASSERTED 0x04
  51. #define STATE_3_ASSERTED 0x08
  52. #define STATE_4_ASSERTED 0x10
  53. #define STATE_5_ASSERTED 0x20
  54. #define STATE_6_ASSERTED 0x40
  55. #define STATE_7_ASSERTED 0x80
  56. #define STATE_8_ASSERTED 0x01
  57. #define STATE_9_ASSERTED 0x02
  58. #define STATE_10_ASSERTED 0x04
  59. #define STATE_11_ASSERTED 0x08
  60. #define STATE_12_ASSERTED 0x10
  61. #define STATE_13_ASSERTED 0x20
  62. #define STATE_14_ASSERTED 0x40
  63. #ifdef HAVE_PRAGMA_PACK
  64. #pragma pack(1)
  65. #endif
  66. struct sensor_set_thresh_rq {
  67. uint8_t sensor_num; /* sensor # */
  68. uint8_t set_mask; /* threshold setting mask */
  69. uint8_t lower_non_crit; /* new lower non critical threshold*/
  70. uint8_t lower_crit; /* new lower critical threshold*/
  71. uint8_t lower_non_recov; /* new lower non recoverable threshold*/
  72. uint8_t upper_non_crit; /* new upper non critical threshold*/
  73. uint8_t upper_crit; /* new upper critical threshold*/
  74. uint8_t upper_non_recov; /* new upper non recoverable threshold*/
  75. } ATTRIBUTE_PACKING;
  76. #ifdef HAVE_PRAGMA_PACK
  77. #pragma pack(0)
  78. #endif
  79. int ipmi_sensor_main(struct ipmi_intf *, int, char **);
  80. int ipmi_sensor_print_fc(struct ipmi_intf *, struct sdr_record_common_sensor *, uint8_t);
  81. int ipmi_sensor_get_sensor_reading_factors( struct ipmi_intf * intf, struct sdr_record_full_sensor * sensor, uint8_t reading);
  82. #endif /* IPMI_SENSOR_H */