Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
hipz_fns_core.h
Go to the documentation of this file.
1 /*
2  * IBM eServer eHCA Infiniband device driver for Linux on POWER
3  *
4  * HW abstraction register functions
5  *
6  * Authors: Christoph Raisch <[email protected]>
7  * Heiko J Schick <[email protected]>
8  * Hoang-Nam Nguyen <[email protected]>
9  * Reinhard Ernst <[email protected]>
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 
44 #ifndef __HIPZ_FNS_CORE_H__
45 #define __HIPZ_FNS_CORE_H__
46 
47 #include "hcp_phyp.h"
48 #include "hipz_hw.h"
49 
50 #define hipz_galpa_store_cq(gal, offset, value) \
51  hipz_galpa_store(gal, CQTEMM_OFFSET(offset), value)
52 
53 #define hipz_galpa_load_cq(gal, offset) \
54  hipz_galpa_load(gal, CQTEMM_OFFSET(offset))
55 
56 #define hipz_galpa_store_qp(gal, offset, value) \
57  hipz_galpa_store(gal, QPTEMM_OFFSET(offset), value)
58 #define hipz_galpa_load_qp(gal, offset) \
59  hipz_galpa_load(gal, QPTEMM_OFFSET(offset))
60 
61 static inline void hipz_update_sqa(struct ehca_qp *qp, u16 nr_wqes)
62 {
63  /* ringing doorbell :-) */
64  hipz_galpa_store_qp(qp->galpas.kernel, qpx_sqa,
65  EHCA_BMASK_SET(QPX_SQADDER, nr_wqes));
66 }
67 
68 static inline void hipz_update_rqa(struct ehca_qp *qp, u16 nr_wqes)
69 {
70  /* ringing doorbell :-) */
71  hipz_galpa_store_qp(qp->galpas.kernel, qpx_rqa,
72  EHCA_BMASK_SET(QPX_RQADDER, nr_wqes));
73 }
74 
75 static inline void hipz_update_feca(struct ehca_cq *cq, u32 nr_cqes)
76 {
77  hipz_galpa_store_cq(cq->galpas.kernel, cqx_feca,
78  EHCA_BMASK_SET(CQX_FECADDER, nr_cqes));
79 }
80 
81 static inline void hipz_set_cqx_n0(struct ehca_cq *cq, u32 value)
82 {
83  u64 cqx_n0_reg;
84 
85  hipz_galpa_store_cq(cq->galpas.kernel, cqx_n0,
87  value));
88  cqx_n0_reg = hipz_galpa_load_cq(cq->galpas.kernel, cqx_n0);
89 }
90 
91 static inline void hipz_set_cqx_n1(struct ehca_cq *cq, u32 value)
92 {
93  u64 cqx_n1_reg;
94 
95  hipz_galpa_store_cq(cq->galpas.kernel, cqx_n1,
97  cqx_n1_reg = hipz_galpa_load_cq(cq->galpas.kernel, cqx_n1);
98 }
99 
100 #endif /* __HIPZ_FNC_CORE_H__ */