2 * linux/drivers/net/ehea/ehea_hw.h
4 * eHEA ethernet device driver for IBM eServer System p
6 * (C) Copyright IBM Corp. 2006
9 * Christoph Raisch <raisch@de.ibm.com>
10 * Jan-Bernd Themann <themann@de.ibm.com>
11 * Thomas Klein <tklein@de.ibm.com>
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2, or (at your option)
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
32 #define QPX_SQA_VALUE EHEA_BMASK_IBM(48, 63)
33 #define QPX_RQ1A_VALUE EHEA_BMASK_IBM(48, 63)
34 #define QPX_RQ2A_VALUE EHEA_BMASK_IBM(48, 63)
35 #define QPX_RQ3A_VALUE EHEA_BMASK_IBM(48, 63)
37 #define QPTEMM_OFFSET(x) offsetof(struct ehea_qptemm, x)
51 u64 qpx_reserved1[(0x098 - 0x058) / 8];
53 u64 qpx_reserved2[(0x100 - 0x0A0) / 8];
57 u64 qpx_reserved3[(0x140 - 0x118) / 8];
59 u64 qpx_reserved4[(0x170 - 0x148) / 8];
61 u64 qpx_reserved5[(0x1B0 - 0x178) / 8];
67 u64 qpx_reserved6[(0x220 - 0x1D8) / 8];
69 u64 qpx_reserved7[(0x240 - 0x228) / 8];
76 u64 qpx_reserved8[(0x300 - 0x270) / 8];
92 u64 qpx_reserved9[(0x400 - 0x378) / 8];
93 u64 reserved_ext[(0x500 - 0x400) / 8];
94 u64 reserved2[(0x1000 - 0x500) / 8];
97 #define MRx_HCR_LPARID_VALID EHEA_BMASK_IBM(0, 0)
99 #define MRMWMM_OFFSET(x) offsetof(struct ehea_mrmwmm, x)
110 u64 reserved4[(0x200 - 0x40) / 8];
114 #define QPEDMM_OFFSET(x) offsetof(struct ehea_qpedmm, x)
118 u64 reserved0[(0x400) / 8];
150 #define CQX_FECADDER EHEA_BMASK_IBM(32, 63)
151 #define CQX_FEC_CQE_CNT EHEA_BMASK_IBM(32, 63)
152 #define CQX_N1_GENERATE_COMP_EVENT EHEA_BMASK_IBM(0, 0)
153 #define CQX_EP_EVENT_PENDING EHEA_BMASK_IBM(0, 0)
155 #define CQTEMM_OFFSET(x) offsetof(struct ehea_cqtemm, x)
171 u64 reserved2[(0x1000 - 0x60) / 8];
174 #define EQTEMM_OFFSET(x) offsetof(struct ehea_eqtemm, x)
193 * These access functions will be changed when the dissuccsion about
194 * the new access methods for POWER has settled.
197 static inline u64 epa_load(struct h_epa epa, u32 offset)
199 return __raw_readq((void __iomem *)(epa.addr + offset));
202 static inline void epa_store(struct h_epa epa, u32 offset, u64 value)
204 __raw_writeq(value, (void __iomem *)(epa.addr + offset));
205 epa_load(epa, offset); /* synchronize explicitly to eHEA */
208 static inline void epa_store_acc(struct h_epa epa, u32 offset, u64 value)
210 __raw_writeq(value, (void __iomem *)(epa.addr + offset));
213 #define epa_store_eq(epa, offset, value)\
214 epa_store(epa, EQTEMM_OFFSET(offset), value)
215 #define epa_load_eq(epa, offset)\
216 epa_load(epa, EQTEMM_OFFSET(offset))
218 #define epa_store_cq(epa, offset, value)\
219 epa_store(epa, CQTEMM_OFFSET(offset), value)
220 #define epa_load_cq(epa, offset)\
221 epa_load(epa, CQTEMM_OFFSET(offset))
223 #define epa_store_qp(epa, offset, value)\
224 epa_store(epa, QPTEMM_OFFSET(offset), value)
225 #define epa_load_qp(epa, offset)\
226 epa_load(epa, QPTEMM_OFFSET(offset))
228 #define epa_store_qped(epa, offset, value)\
229 epa_store(epa, QPEDMM_OFFSET(offset), value)
230 #define epa_load_qped(epa, offset)\
231 epa_load(epa, QPEDMM_OFFSET(offset))
233 #define epa_store_mrmw(epa, offset, value)\
234 epa_store(epa, MRMWMM_OFFSET(offset), value)
235 #define epa_load_mrmw(epa, offset)\
236 epa_load(epa, MRMWMM_OFFSET(offset))
238 #define epa_store_base(epa, offset, value)\
239 epa_store(epa, HCAGR_OFFSET(offset), value)
240 #define epa_load_base(epa, offset)\
241 epa_load(epa, HCAGR_OFFSET(offset))
243 static inline void ehea_update_sqa(struct ehea_qp *qp, u16 nr_wqes)
245 struct h_epa epa = qp->epas.kernel;
246 epa_store_acc(epa, QPTEMM_OFFSET(qpx_sqa),
247 EHEA_BMASK_SET(QPX_SQA_VALUE, nr_wqes));
250 static inline void ehea_update_rq3a(struct ehea_qp *qp, u16 nr_wqes)
252 struct h_epa epa = qp->epas.kernel;
253 epa_store_acc(epa, QPTEMM_OFFSET(qpx_rq3a),
254 EHEA_BMASK_SET(QPX_RQ1A_VALUE, nr_wqes));
257 static inline void ehea_update_rq2a(struct ehea_qp *qp, u16 nr_wqes)
259 struct h_epa epa = qp->epas.kernel;
260 epa_store_acc(epa, QPTEMM_OFFSET(qpx_rq2a),
261 EHEA_BMASK_SET(QPX_RQ2A_VALUE, nr_wqes));
264 static inline void ehea_update_rq1a(struct ehea_qp *qp, u16 nr_wqes)
266 struct h_epa epa = qp->epas.kernel;
267 epa_store_acc(epa, QPTEMM_OFFSET(qpx_rq1a),
268 EHEA_BMASK_SET(QPX_RQ3A_VALUE, nr_wqes));
271 static inline void ehea_update_feca(struct ehea_cq *cq, u32 nr_cqes)
273 struct h_epa epa = cq->epas.kernel;
274 epa_store_acc(epa, CQTEMM_OFFSET(cqx_feca),
275 EHEA_BMASK_SET(CQX_FECADDER, nr_cqes));
278 static inline void ehea_reset_cq_n1(struct ehea_cq *cq)
280 struct h_epa epa = cq->epas.kernel;
281 epa_store_cq(epa, cqx_n1,
282 EHEA_BMASK_SET(CQX_N1_GENERATE_COMP_EVENT, 1));
285 static inline void ehea_reset_cq_ep(struct ehea_cq *my_cq)
287 struct h_epa epa = my_cq->epas.kernel;
288 epa_store_acc(epa, CQTEMM_OFFSET(cqx_ep),
289 EHEA_BMASK_SET(CQX_EP_EVENT_PENDING, 0));
292 #endif /* __EHEA_HW_H__ */