snsc.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * SN Platform system controller communication support
  3. *
  4. * This file is subject to the terms and conditions of the GNU General Public
  5. * License. See the file "COPYING" in the main directory of this archive
  6. * for more details.
  7. *
  8. * Copyright (C) 2004-2006 Silicon Graphics, Inc. All rights reserved.
  9. */
  10. /*
  11. * This file contains macros and data types for communication with the
  12. * system controllers in SGI SN systems.
  13. */
  14. #ifndef _SN_SYSCTL_H_
  15. #define _SN_SYSCTL_H_
  16. #include <linux/types.h>
  17. #include <linux/spinlock.h>
  18. #include <linux/wait.h>
  19. #include <linux/fs.h>
  20. #include <linux/cdev.h>
  21. #include <linux/semaphore.h>
  22. #include <asm/sn/types.h>
  23. #define CHUNKSIZE 127
  24. /* This structure is used to track an open subchannel. */
  25. struct subch_data_s {
  26. nasid_t sd_nasid; /* node on which the subchannel was opened */
  27. int sd_subch; /* subchannel number */
  28. spinlock_t sd_rlock; /* monitor lock for rsv */
  29. spinlock_t sd_wlock; /* monitor lock for wsv */
  30. wait_queue_head_t sd_rq; /* wait queue for readers */
  31. wait_queue_head_t sd_wq; /* wait queue for writers */
  32. struct semaphore sd_rbs; /* semaphore for read buffer */
  33. struct semaphore sd_wbs; /* semaphore for write buffer */
  34. char sd_rb[CHUNKSIZE]; /* read buffer */
  35. char sd_wb[CHUNKSIZE]; /* write buffer */
  36. };
  37. struct sysctl_data_s {
  38. struct cdev scd_cdev; /* Character device info */
  39. nasid_t scd_nasid; /* Node on which subchannels are opened. */
  40. };
  41. /* argument types */
  42. #define IR_ARG_INT 0x00 /* 4-byte integer (big-endian) */
  43. #define IR_ARG_ASCII 0x01 /* null-terminated ASCII string */
  44. #define IR_ARG_UNKNOWN 0x80 /* unknown data type. The low
  45. * 7 bits will contain the data
  46. * length. */
  47. #define IR_ARG_UNKNOWN_LENGTH_MASK 0x7f
  48. /* system controller event codes */
  49. #define EV_CLASS_MASK 0xf000ul
  50. #define EV_SEVERITY_MASK 0x0f00ul
  51. #define EV_COMPONENT_MASK 0x00fful
  52. #define EV_CLASS_POWER 0x1000ul
  53. #define EV_CLASS_FAN 0x2000ul
  54. #define EV_CLASS_TEMP 0x3000ul
  55. #define EV_CLASS_ENV 0x4000ul
  56. #define EV_CLASS_TEST_FAULT 0x5000ul
  57. #define EV_CLASS_TEST_WARNING 0x6000ul
  58. #define EV_CLASS_PWRD_NOTIFY 0x8000ul
  59. /* ENV class codes */
  60. #define ENV_PWRDN_PEND 0x4101ul
  61. #define EV_SEVERITY_POWER_STABLE 0x0000ul
  62. #define EV_SEVERITY_POWER_LOW_WARNING 0x0100ul
  63. #define EV_SEVERITY_POWER_HIGH_WARNING 0x0200ul
  64. #define EV_SEVERITY_POWER_HIGH_FAULT 0x0300ul
  65. #define EV_SEVERITY_POWER_LOW_FAULT 0x0400ul
  66. #define EV_SEVERITY_FAN_STABLE 0x0000ul
  67. #define EV_SEVERITY_FAN_WARNING 0x0100ul
  68. #define EV_SEVERITY_FAN_FAULT 0x0200ul
  69. #define EV_SEVERITY_TEMP_STABLE 0x0000ul
  70. #define EV_SEVERITY_TEMP_ADVISORY 0x0100ul
  71. #define EV_SEVERITY_TEMP_CRITICAL 0x0200ul
  72. #define EV_SEVERITY_TEMP_FAULT 0x0300ul
  73. void scdrv_event_init(struct sysctl_data_s *);
  74. #endif /* _SN_SYSCTL_H_ */