ap.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Adjunct processor (AP) interfaces
  3. *
  4. * Copyright IBM Corp. 2017
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License (version 2 only)
  8. * as published by the Free Software Foundation.
  9. *
  10. * Author(s): Tony Krowiak <akrowia@linux.vnet.ibm.com>
  11. * Martin Schwidefsky <schwidefsky@de.ibm.com>
  12. * Harald Freudenberger <freude@de.ibm.com>
  13. */
  14. #ifndef _ASM_S390_AP_H_
  15. #define _ASM_S390_AP_H_
  16. /**
  17. * The ap_qid_t identifier of an ap queue.
  18. * If the AP facilities test (APFT) facility is available,
  19. * card and queue index are 8 bit values, otherwise
  20. * card index is 6 bit and queue index a 4 bit value.
  21. */
  22. typedef unsigned int ap_qid_t;
  23. #define AP_MKQID(_card, _queue) (((_card) & 63) << 8 | ((_queue) & 255))
  24. #define AP_QID_CARD(_qid) (((_qid) >> 8) & 63)
  25. #define AP_QID_QUEUE(_qid) ((_qid) & 255)
  26. /**
  27. * struct ap_queue_status - Holds the AP queue status.
  28. * @queue_empty: Shows if queue is empty
  29. * @replies_waiting: Waiting replies
  30. * @queue_full: Is 1 if the queue is full
  31. * @irq_enabled: Shows if interrupts are enabled for the AP
  32. * @response_code: Holds the 8 bit response code
  33. *
  34. * The ap queue status word is returned by all three AP functions
  35. * (PQAP, NQAP and DQAP). There's a set of flags in the first
  36. * byte, followed by a 1 byte response code.
  37. */
  38. struct ap_queue_status {
  39. unsigned int queue_empty : 1;
  40. unsigned int replies_waiting : 1;
  41. unsigned int queue_full : 1;
  42. unsigned int _pad1 : 4;
  43. unsigned int irq_enabled : 1;
  44. unsigned int response_code : 8;
  45. unsigned int _pad2 : 16;
  46. };
  47. /**
  48. * ap_test_queue(): Test adjunct processor queue.
  49. * @qid: The AP queue number
  50. * @tbit: Test facilities bit
  51. * @info: Pointer to queue descriptor
  52. *
  53. * Returns AP queue status structure.
  54. */
  55. struct ap_queue_status ap_test_queue(ap_qid_t qid,
  56. int tbit,
  57. unsigned long *info);
  58. #endif /* _ASM_S390_AP_H_ */