2 * Copyright (c) 2006 Chelsio, Inc. All rights reserved.
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33 #include <linux/types.h>
35 #include "cxgb3_ioctl.h"
39 void cxio_dump_tpt(struct cxio_rdev *rdev, u32 stag)
41 struct ch_mem_range *m;
46 m = kmalloc(sizeof(*m) + size, GFP_ATOMIC);
48 PDBG("%s couldn't allocate memory.\n", __FUNCTION__);
52 m->addr = (stag>>8) * 32 + rdev->rnic_info.tpt_base;
54 PDBG("%s TPT addr 0x%x len %d\n", __FUNCTION__, m->addr, m->len);
55 rc = rdev->t3cdev_p->ctl(rdev->t3cdev_p, RDMA_GET_MEM, m);
57 PDBG("%s toectl returned error %d\n", __FUNCTION__, rc);
64 PDBG("TPT %08x: %016llx\n", m->addr, (unsigned long long) *data);
72 void cxio_dump_pbl(struct cxio_rdev *rdev, u32 pbl_addr, uint len, u8 shift)
74 struct ch_mem_range *m;
80 npages = (len + (1ULL << shift) - 1) >> shift;
81 size = npages * sizeof(u64);
83 m = kmalloc(sizeof(*m) + size, GFP_ATOMIC);
85 PDBG("%s couldn't allocate memory.\n", __FUNCTION__);
91 PDBG("%s PBL addr 0x%x len %d depth %d\n",
92 __FUNCTION__, m->addr, m->len, npages);
93 rc = rdev->t3cdev_p->ctl(rdev->t3cdev_p, RDMA_GET_MEM, m);
95 PDBG("%s toectl returned error %d\n", __FUNCTION__, rc);
100 data = (u64 *)m->buf;
102 PDBG("PBL %08x: %016llx\n", m->addr, (unsigned long long) *data);
110 void cxio_dump_wqe(union t3_wr *wqe)
112 __be64 *data = (__be64 *)wqe;
113 uint size = (uint)(be64_to_cpu(*data) & 0xff);
118 PDBG("WQE %p: %016llx\n", data,
119 (unsigned long long) be64_to_cpu(*data));
125 void cxio_dump_wce(struct t3_cqe *wce)
127 __be64 *data = (__be64 *)wce;
128 int size = sizeof(*wce);
131 PDBG("WCE %p: %016llx\n", data,
132 (unsigned long long) be64_to_cpu(*data));
138 void cxio_dump_rqt(struct cxio_rdev *rdev, u32 hwtid, int nents)
140 struct ch_mem_range *m;
141 int size = nents * 64;
145 m = kmalloc(sizeof(*m) + size, GFP_ATOMIC);
147 PDBG("%s couldn't allocate memory.\n", __FUNCTION__);
150 m->mem_id = MEM_PMRX;
151 m->addr = ((hwtid)<<10) + rdev->rnic_info.rqt_base;
153 PDBG("%s RQT addr 0x%x len %d\n", __FUNCTION__, m->addr, m->len);
154 rc = rdev->t3cdev_p->ctl(rdev->t3cdev_p, RDMA_GET_MEM, m);
156 PDBG("%s toectl returned error %d\n", __FUNCTION__, rc);
161 data = (u64 *)m->buf;
163 PDBG("RQT %08x: %016llx\n", m->addr, (unsigned long long) *data);
171 void cxio_dump_tcb(struct cxio_rdev *rdev, u32 hwtid)
173 struct ch_mem_range *m;
178 m = kmalloc(sizeof(*m) + size, GFP_ATOMIC);
180 PDBG("%s couldn't allocate memory.\n", __FUNCTION__);
184 m->addr = hwtid * size;
186 PDBG("%s TCB %d len %d\n", __FUNCTION__, m->addr, m->len);
187 rc = rdev->t3cdev_p->ctl(rdev->t3cdev_p, RDMA_GET_MEM, m);
189 PDBG("%s toectl returned error %d\n", __FUNCTION__, rc);
194 data = (u32 *)m->buf;
196 printk("%2u: %08x %08x %08x %08x %08x %08x %08x %08x\n",
198 *(data+2), *(data+3), *(data),*(data+1),
199 *(data+6), *(data+7), *(data+4), *(data+5));