chp.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * Copyright IBM Corp. 2007, 2010
  3. * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
  4. */
  5. #ifndef S390_CHP_H
  6. #define S390_CHP_H S390_CHP_H
  7. #include <linux/types.h>
  8. #include <linux/device.h>
  9. #include <linux/mutex.h>
  10. #include <asm/chpid.h>
  11. #include "chsc.h"
  12. #include "css.h"
  13. #define CHP_STATUS_STANDBY 0
  14. #define CHP_STATUS_CONFIGURED 1
  15. #define CHP_STATUS_RESERVED 2
  16. #define CHP_STATUS_NOT_RECOGNIZED 3
  17. #define CHP_ONLINE 0
  18. #define CHP_OFFLINE 1
  19. #define CHP_VARY_ON 2
  20. #define CHP_VARY_OFF 3
  21. struct chp_link {
  22. struct chp_id chpid;
  23. u32 fla_mask;
  24. u16 fla;
  25. };
  26. static inline int chp_test_bit(u8 *bitmap, int num)
  27. {
  28. int byte = num >> 3;
  29. int mask = 128 >> (num & 7);
  30. return (bitmap[byte] & mask) ? 1 : 0;
  31. }
  32. struct channel_path {
  33. struct device dev;
  34. struct chp_id chpid;
  35. struct mutex lock; /* Serialize access to below members. */
  36. int state;
  37. struct channel_path_desc desc;
  38. struct channel_path_desc_fmt1 desc_fmt1;
  39. /* Channel-measurement related stuff: */
  40. int cmg;
  41. int shared;
  42. struct cmg_chars cmg_chars;
  43. };
  44. /* Return channel_path struct for given chpid. */
  45. static inline struct channel_path *chpid_to_chp(struct chp_id chpid)
  46. {
  47. return channel_subsystems[chpid.cssid]->chps[chpid.id];
  48. }
  49. int chp_get_status(struct chp_id chpid);
  50. u8 chp_get_sch_opm(struct subchannel *sch);
  51. int chp_is_registered(struct chp_id chpid);
  52. struct channel_path_desc *chp_get_chp_desc(struct chp_id chpid);
  53. void chp_remove_cmg_attr(struct channel_path *chp);
  54. int chp_add_cmg_attr(struct channel_path *chp);
  55. int chp_update_desc(struct channel_path *chp);
  56. int chp_new(struct chp_id chpid);
  57. void chp_cfg_schedule(struct chp_id chpid, int configure);
  58. void chp_cfg_cancel_deconfigure(struct chp_id chpid);
  59. int chp_info_get_status(struct chp_id chpid);
  60. int chp_ssd_get_mask(struct chsc_ssd_info *, struct chp_link *);
  61. #endif /* S390_CHP_H */