The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/qlxge/qls_dbg.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
    3  *
    4  * Copyright (c) 2013-2014 Qlogic Corporation
    5  * All rights reserved.
    6  *
    7  *  Redistribution and use in source and binary forms, with or without
    8  *  modification, are permitted provided that the following conditions
    9  *  are met:
   10  *
   11  *  1. Redistributions of source code must retain the above copyright
   12  *     notice, this list of conditions and the following disclaimer.
   13  *  2. Redistributions in binary form must reproduce the above copyright
   14  *     notice, this list of conditions and the following disclaimer in the
   15  *     documentation and/or other materials provided with the distribution.
   16  *
   17  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   18  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   19  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   20  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
   21  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   22  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   23  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   24  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   25  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   26  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   27  *  POSSIBILITY OF SUCH DAMAGE.
   28  */
   29 /*
   30  * File : qls_dbg.c
   31  * Author : David C Somayajulu, Qlogic Corporation, Aliso Viejo, CA 92656.
   32  */
   33 #include <sys/cdefs.h>
   34 __FBSDID("$FreeBSD: releng/12.0/sys/dev/qlxge/qls_dbg.c 326255 2017-11-27 14:52:40Z pfg $");
   35 
   36 #include "qls_os.h"
   37 #include "qls_hw.h"
   38 #include "qls_def.h"
   39 #include "qls_inline.h"
   40 #include "qls_ver.h"
   41 #include "qls_glbl.h"
   42 #include "qls_dbg.h"
   43 
   44 
   45 uint32_t qls_dbg_level = 0 ;
   46 /*
   47  * Name: qls_dump_buf32
   48  * Function: dumps a buffer as 32 bit words
   49  */
   50 void
   51 qls_dump_buf32(qla_host_t *ha, const char *msg, void *dbuf32, uint32_t len32)
   52 {
   53         device_t dev;
   54         uint32_t i = 0;
   55         uint32_t *buf;
   56 
   57         dev = ha->pci_dev;
   58         buf = dbuf32;
   59 
   60         device_printf(dev, "%s: %s dump start\n", __func__, msg);
   61 
   62         while (len32 >= 4) {
   63                 device_printf(dev,"0x%08x:\t0x%08x, 0x%08x, 0x%08x, 0x%08x,\n",
   64                         i, buf[0], buf[1], buf[2], buf[3]);
   65                 i += 4 * 4;
   66                 len32 -= 4;
   67                 buf += 4;
   68         }
   69         switch (len32) {
   70         case 1:
   71                 device_printf(dev,"0x%08x: 0x%08x\n", i, buf[0]);
   72                 break;
   73         case 2:
   74                 device_printf(dev,"0x%08x: 0x%08x 0x%08x\n", i, buf[0], buf[1]);
   75                 break;
   76         case 3:
   77                 device_printf(dev,"0x%08x: 0x%08x 0x%08x 0x%08x\n",
   78                         i, buf[0], buf[1], buf[2]);
   79                 break;
   80         default:
   81                 break;
   82         }
   83         device_printf(dev, "%s: %s dump end\n", __func__, msg);
   84 
   85         return;
   86 }
   87 
   88 /*
   89  * Name: qls_dump_buf16
   90  * Function: dumps a buffer as 16 bit words
   91  */
   92 void
   93 qls_dump_buf16(qla_host_t *ha, const char *msg, void *dbuf16, uint32_t len16)
   94 {
   95         device_t dev;
   96         uint32_t i = 0;
   97         uint16_t *buf;
   98 
   99         dev = ha->pci_dev;
  100         buf = dbuf16;
  101 
  102         device_printf(dev, "%s: %s dump start\n", __func__, msg);
  103 
  104         while (len16 >= 8) {
  105                 device_printf(dev,"0x%08x: 0x%04x 0x%04x 0x%04x 0x%04x"
  106                         " 0x%04x 0x%04x 0x%04x 0x%04x\n", i, buf[0],
  107                         buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]);
  108                 i += 16;
  109                 len16 -= 8;
  110                 buf += 8;
  111         }
  112         switch (len16) {
  113         case 1:
  114                 device_printf(dev,"0x%08x: 0x%04x\n", i, buf[0]);
  115                 break;
  116         case 2:
  117                 device_printf(dev,"0x%08x: 0x%04x 0x%04x\n", i, buf[0], buf[1]);
  118                 break;
  119         case 3:
  120                 device_printf(dev,"0x%08x: 0x%04x 0x%04x 0x%04x\n",
  121                         i, buf[0], buf[1], buf[2]);
  122                 break;
  123         case 4:
  124                 device_printf(dev,"0x%08x: 0x%04x 0x%04x 0x%04x 0x%04x\n", i,
  125                         buf[0], buf[1], buf[2], buf[3]);
  126                 break;
  127         case 5:
  128                 device_printf(dev,"0x%08x:"
  129                         " 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x\n", i,
  130                         buf[0], buf[1], buf[2], buf[3], buf[4]);
  131                 break;
  132         case 6:
  133                 device_printf(dev,"0x%08x:"
  134                         " 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x\n", i,
  135                         buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
  136                 break;
  137         case 7:
  138                 device_printf(dev,"0x%04x: 0x%04x 0x%04x 0x%04x 0x%04x"
  139                         " 0x%04x 0x%04x 0x%04x\n", i, buf[0], buf[1],
  140                         buf[2], buf[3], buf[4], buf[5], buf[6]);
  141                 break;
  142         default:
  143                 break;
  144         }
  145         device_printf(dev, "%s: %s dump end\n", __func__, msg);
  146 
  147         return;
  148 }
  149 
  150 /*
  151  * Name: qls_dump_buf8
  152  * Function: dumps a buffer as bytes
  153  */
  154 void
  155 qls_dump_buf8(qla_host_t *ha, const char *msg, void *dbuf, uint32_t len)
  156 {
  157         device_t dev;
  158         uint32_t i = 0;
  159         uint8_t *buf;
  160 
  161         dev = ha->pci_dev;
  162         buf = dbuf;
  163 
  164         device_printf(dev, "%s: %s 0x%x dump start\n", __func__, msg, len);
  165         
  166         while (len >= 16) {
  167                 device_printf(dev,"0x%08x:"
  168                         " %02x %02x %02x %02x %02x %02x %02x %02x"
  169                         " %02x %02x %02x %02x %02x %02x %02x %02x\n", i,
  170                         buf[0], buf[1], buf[2], buf[3],
  171                         buf[4], buf[5], buf[6], buf[7],
  172                         buf[8], buf[9], buf[10], buf[11],
  173                         buf[12], buf[13], buf[14], buf[15]);
  174                 i += 16;
  175                 len -= 16;
  176                 buf += 16;
  177         }
  178         switch (len) {
  179         case 1:
  180                 device_printf(dev,"0x%08x: %02x\n", i, buf[0]);
  181                 break;
  182         case 2:
  183                 device_printf(dev,"0x%08x: %02x %02x\n", i, buf[0], buf[1]);
  184                 break;
  185         case 3:
  186                 device_printf(dev,"0x%08x: %02x %02x %02x\n",
  187                         i, buf[0], buf[1], buf[2]);
  188                 break;
  189         case 4:
  190                 device_printf(dev,"0x%08x: %02x %02x %02x %02x\n", i,
  191                         buf[0], buf[1], buf[2], buf[3]);
  192                 break;
  193         case 5:
  194                 device_printf(dev,"0x%08x:"
  195                         " %02x %02x %02x %02x %02x\n", i,
  196                         buf[0], buf[1], buf[2], buf[3], buf[4]);
  197                 break;
  198         case 6:
  199                 device_printf(dev,"0x%08x:"
  200                         " %02x %02x %02x %02x %02x %02x\n", i,
  201                         buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
  202                 break;
  203         case 7:
  204                 device_printf(dev,"0x%08x:"
  205                         " %02x %02x %02x %02x %02x %02x %02x\n", i,
  206                         buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6]);
  207                 break;
  208         case 8:
  209                 device_printf(dev,"0x%08x:"
  210                         " %02x %02x %02x %02x %02x %02x %02x %02x\n", i,
  211                         buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
  212                         buf[7]);
  213                 break;
  214         case 9:
  215                 device_printf(dev,"0x%08x:"
  216                         " %02x %02x %02x %02x %02x %02x %02x %02x"
  217                         " %02x\n", i,
  218                         buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
  219                         buf[7], buf[8]);
  220                 break;
  221         case 10:
  222                 device_printf(dev,"0x%08x:"
  223                         " %02x %02x %02x %02x %02x %02x %02x %02x"
  224                         " %02x %02x\n", i,
  225                         buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
  226                         buf[7], buf[8], buf[9]);
  227                 break;
  228         case 11:
  229                 device_printf(dev,"0x%08x:"
  230                         " %02x %02x %02x %02x %02x %02x %02x %02x"
  231                         " %02x %02x %02x\n", i,
  232                         buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
  233                         buf[7], buf[8], buf[9], buf[10]);
  234                 break;
  235         case 12:
  236                 device_printf(dev,"0x%08x:"
  237                         " %02x %02x %02x %02x %02x %02x %02x %02x"
  238                         " %02x %02x %02x %02x\n", i,
  239                         buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
  240                         buf[7], buf[8], buf[9], buf[10], buf[11]);
  241                 break;
  242         case 13:
  243                 device_printf(dev,"0x%08x:"
  244                         " %02x %02x %02x %02x %02x %02x %02x %02x"
  245                         " %02x %02x %02x %02x %02x\n", i,
  246                         buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
  247                         buf[7], buf[8], buf[9], buf[10], buf[11], buf[12]);
  248                 break;
  249         case 14:
  250                 device_printf(dev,"0x%08x:"
  251                         " %02x %02x %02x %02x %02x %02x %02x %02x"
  252                         " %02x %02x %02x %02x %02x %02x\n", i,
  253                         buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
  254                         buf[7], buf[8], buf[9], buf[10], buf[11], buf[12],
  255                         buf[13]);
  256                 break;
  257         case 15:
  258                 device_printf(dev,"0x%08x:"
  259                         " %02x %02x %02x %02x %02x %02x %02x %02x"
  260                         " %02x %02x %02x %02x %02x %02x %02x\n", i,
  261                         buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
  262                         buf[7], buf[8], buf[9], buf[10], buf[11], buf[12],
  263                         buf[13], buf[14]);
  264                 break;
  265         default:
  266                 break;
  267         }
  268         
  269         device_printf(dev, "%s: %s dump end\n", __func__, msg);
  270 
  271         return;
  272 }
  273 
  274 void
  275 qls_dump_cq(qla_host_t *ha)
  276 {
  277         qls_dump_buf32(ha, "cq_icb", ha->rx_ring[0].cq_icb_vaddr,
  278                 (sizeof (q81_cq_icb_t) >> 2));
  279 
  280         device_printf(ha->pci_dev, "%s: lbq_addr_tbl_paddr  %p\n", __func__,
  281                 (void *)ha->rx_ring[0].lbq_addr_tbl_paddr);
  282 
  283         qls_dump_buf32(ha, "lbq_addr_tbl", ha->rx_ring[0].lbq_addr_tbl_vaddr,
  284                 (PAGE_SIZE >> 2));
  285 
  286         device_printf(ha->pci_dev, "%s: lbq_paddr  %p\n", __func__,
  287                 (void *)ha->rx_ring[0].lbq_paddr);
  288 
  289         qls_dump_buf32(ha, "lbq", ha->rx_ring[0].lbq_vaddr,
  290                 (QLA_LBQ_SIZE >> 2));
  291 
  292         device_printf(ha->pci_dev, "%s: sbq_addr_tbl_paddr  %p\n", __func__,
  293                 (void *)ha->rx_ring[0].sbq_addr_tbl_paddr);
  294 
  295         qls_dump_buf32(ha, "sbq_addr_tbl", ha->rx_ring[0].sbq_addr_tbl_vaddr,
  296                 (PAGE_SIZE >> 2));
  297 
  298         device_printf(ha->pci_dev, "%s: sbq_paddr  %p\n", __func__,
  299                 (void *)ha->rx_ring[0].sbq_paddr);
  300 
  301         qls_dump_buf32(ha, "sbq", ha->rx_ring[0].sbq_vaddr,
  302                 (QLA_SBQ_SIZE >> 2) );
  303 
  304         device_printf(ha->pci_dev, "%s: lb_paddr  %p\n", __func__,
  305                 (void *)ha->rx_ring[0].lb_paddr);
  306 
  307         return;
  308 }
  309 

Cache object: 9718e948bf91581db53eae47e1ed0a4a


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.