hipz_fns_core.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * IBM eServer eHCA Infiniband device driver for Linux on POWER
  3. *
  4. * HW abstraction register functions
  5. *
  6. * Authors: Christoph Raisch <raisch@de.ibm.com>
  7. * Heiko J Schick <schickhj@de.ibm.com>
  8. * Hoang-Nam Nguyen <hnguyen@de.ibm.com>
  9. * Reinhard Ernst <rernst@de.ibm.com>
  10. *
  11. * Copyright (c) 2005 IBM Corporation
  12. *
  13. * All rights reserved.
  14. *
  15. * This source code is distributed under a dual license of GPL v2.0 and OpenIB
  16. * BSD.
  17. *
  18. * OpenIB BSD License
  19. *
  20. * Redistribution and use in source and binary forms, with or without
  21. * modification, are permitted provided that the following conditions are met:
  22. *
  23. * Redistributions of source code must retain the above copyright notice, this
  24. * list of conditions and the following disclaimer.
  25. *
  26. * Redistributions in binary form must reproduce the above copyright notice,
  27. * this list of conditions and the following disclaimer in the documentation
  28. * and/or other materials
  29. * provided with the distribution.
  30. *
  31. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  32. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  33. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  34. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  35. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  36. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  37. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  38. * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  39. * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  40. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  41. * POSSIBILITY OF SUCH DAMAGE.
  42. */
  43. #ifndef __HIPZ_FNS_CORE_H__
  44. #define __HIPZ_FNS_CORE_H__
  45. #include "hcp_phyp.h"
  46. #include "hipz_hw.h"
  47. #define hipz_galpa_store_cq(gal, offset, value) \
  48. hipz_galpa_store(gal, CQTEMM_OFFSET(offset), value)
  49. #define hipz_galpa_load_cq(gal, offset) \
  50. hipz_galpa_load(gal, CQTEMM_OFFSET(offset))
  51. #define hipz_galpa_store_qp(gal, offset, value) \
  52. hipz_galpa_store(gal, QPTEMM_OFFSET(offset), value)
  53. #define hipz_galpa_load_qp(gal, offset) \
  54. hipz_galpa_load(gal, QPTEMM_OFFSET(offset))
  55. static inline void hipz_update_sqa(struct ehca_qp *qp, u16 nr_wqes)
  56. {
  57. /* ringing doorbell :-) */
  58. hipz_galpa_store_qp(qp->galpas.kernel, qpx_sqa,
  59. EHCA_BMASK_SET(QPX_SQADDER, nr_wqes));
  60. }
  61. static inline void hipz_update_rqa(struct ehca_qp *qp, u16 nr_wqes)
  62. {
  63. /* ringing doorbell :-) */
  64. hipz_galpa_store_qp(qp->galpas.kernel, qpx_rqa,
  65. EHCA_BMASK_SET(QPX_RQADDER, nr_wqes));
  66. }
  67. static inline void hipz_update_feca(struct ehca_cq *cq, u32 nr_cqes)
  68. {
  69. hipz_galpa_store_cq(cq->galpas.kernel, cqx_feca,
  70. EHCA_BMASK_SET(CQX_FECADDER, nr_cqes));
  71. }
  72. static inline void hipz_set_cqx_n0(struct ehca_cq *cq, u32 value)
  73. {
  74. u64 cqx_n0_reg;
  75. hipz_galpa_store_cq(cq->galpas.kernel, cqx_n0,
  76. EHCA_BMASK_SET(CQX_N0_GENERATE_SOLICITED_COMP_EVENT,
  77. value));
  78. cqx_n0_reg = hipz_galpa_load_cq(cq->galpas.kernel, cqx_n0);
  79. }
  80. static inline void hipz_set_cqx_n1(struct ehca_cq *cq, u32 value)
  81. {
  82. u64 cqx_n1_reg;
  83. hipz_galpa_store_cq(cq->galpas.kernel, cqx_n1,
  84. EHCA_BMASK_SET(CQX_N1_GENERATE_COMP_EVENT, value));
  85. cqx_n1_reg = hipz_galpa_load_cq(cq->galpas.kernel, cqx_n1);
  86. }
  87. #endif /* __HIPZ_FNC_CORE_H__ */