From owner-p4-projects@FreeBSD.ORG Fri Jan 4 22:06:58 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3EFD916A420; Fri, 4 Jan 2008 22:06:58 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0416716A41A for ; Fri, 4 Jan 2008 22:06:58 +0000 (UTC) (envelope-from swise@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id E599313C459 for ; Fri, 4 Jan 2008 22:06:57 +0000 (UTC) (envelope-from swise@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m04M6vMB067106 for ; Fri, 4 Jan 2008 22:06:57 GMT (envelope-from swise@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m04M6vej067103 for perforce@freebsd.org; Fri, 4 Jan 2008 22:06:57 GMT (envelope-from swise@FreeBSD.org) Date: Fri, 4 Jan 2008 22:06:57 GMT Message-Id: <200801042206.m04M6vej067103@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to swise@FreeBSD.org using -f From: Steve Wise To: Perforce Change Reviews Cc: Subject: PERFORCE change 132531 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jan 2008 22:06:58 -0000 http://perforce.freebsd.org/chv.cgi?CH=132531 Change 132531 by swise@swise:vic10:iwarp on 2008/01/04 22:06:24 Add tcb dump to cxgbtool. Affected files ... .. //depot/projects/iwarp/usr.sbin/cxgbtool/cxgbtool.c#3 edit Differences ... ==== //depot/projects/iwarp/usr.sbin/cxgbtool/cxgbtool.c#3 (text+ko) ==== @@ -858,26 +858,25 @@ } #endif -#ifdef notyet static int get_tcb2(unsigned int tcb_idx, const char *iff_name) { uint64_t *d; unsigned int i; - struct toetool_mem_range *op; + struct ch_mem_range op; - op = malloc(sizeof(*op) + TCB_SIZE); - if (!op) + op.buf = malloc(TCB_SIZE); + if (!op.buf) err(1, "get TCB"); + memset(op.buf, 0xaa, TCB_SIZE); - op->cmd = TOETOOL_GET_MEM; - op->mem_id = MEM_CM; - op->addr = tcb_idx * TCB_SIZE; - op->len = TCB_SIZE; + op.mem_id = MEM_CM; + op.addr = tcb_idx * TCB_SIZE; + op.len = TCB_SIZE; - if (doit(iff_name, op) < 0) + if (doit(iff_name, CHELSIO_GET_MEM, &op) < 0) err(1, "get TCB"); - for (d = (uint64_t *)op->buf, i = 0; i < TCB_SIZE / 32; i++) { + for (d = (uint64_t *)op.buf, i = 0; i < TCB_SIZE / 32; i++) { printf("%2u:", i); printf(" %08x %08x %08x %08x", (uint32_t)d[1], (uint32_t)(d[1] >> 32), (uint32_t)d[0], @@ -888,7 +887,7 @@ (uint32_t)(d[0] >> 32)); d += 2; } - free(op); + free(op.buf); return 0; } @@ -900,19 +899,23 @@ if (argc != start_arg + 1) return -1; - op.cmd = TOETOOL_GET_TCB; if (get_int_arg(argv[start_arg], &op.tcb_index)) return -1; +#if 0 + op.cmd = CHELSIO_GET_TCB; /* * If this operation isn't directly supported by the driver we may * still be able to read TCBs using the generic memory dump operation. */ - if (doit(iff_name, &op) < 0) { + if (doit(iff_name, CHELSIO_GET_TCB, &op) < 0) { if (errno != EOPNOTSUPP) err(1, "get TCB"); return get_tcb2(op.tcb_index, iff_name); } +#else + return get_tcb2(op.tcb_index, iff_name); +#endif for (d = op.tcb_data, i = 0; i < TCB_WORDS; i += 8) { int j; @@ -924,7 +927,7 @@ } return 0; } -#endif + #ifdef WRC /* * The following defines, typedefs and structures are defined in the FW and @@ -1862,8 +1865,6 @@ r = conf_pm(argc, argv, 3, iff_name); else if (!strcmp(argv[2], "tcam")) r = conf_tcam(argc, argv, 3, iff_name); - else if (!strcmp(argv[2], "tcb")) - r = get_tcb(argc, argv, 3, iff_name); #endif #ifdef WRC else if (!strcmp(argv[2], "wrc")) @@ -1873,6 +1874,8 @@ else if (!strcmp(argv[2], "regdump")) r = dump_regs(argc, argv, 3, iff_name); #ifdef CHELSIO_INTERNAL + else if (!strcmp(argv[2], "tcb")) + r = get_tcb(argc, argv, 3, iff_name); else if (!strcmp(argv[2], "memdump")) r = dump_mc7(argc, argv, 3, iff_name); else if (!strcmp(argv[2], "meminfo"))