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/qlxgb/qla_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  * Copyright (c) 2010-2011 Qlogic Corporation
    3  * All rights reserved.
    4  *
    5  *  Redistribution and use in source and binary forms, with or without
    6  *  modification, are permitted provided that the following conditions
    7  *  are met:
    8  *
    9  *  1. Redistributions of source code must retain the above copyright
   10  *     notice, this list of conditions and the following disclaimer.
   11  *  2. Redistributions in binary form must reproduce the above copyright
   12  *     notice, this list of conditions and the following disclaimer in the
   13  *     documentation and/or other materials provided with the distribution.
   14  *
   15  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   16  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   17  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   18  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
   19  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   20  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   21  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   22  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   23  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   24  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   25  *  POSSIBILITY OF SUCH DAMAGE.
   26  */
   27 /*
   28  * File : qla_dbg.c
   29  * Author : David C Somayajulu, Qlogic Corporation, Aliso Viejo, CA 92656.
   30  */
   31 
   32 #include <sys/cdefs.h>
   33 __FBSDID("$FreeBSD: releng/9.0/sys/dev/qlxgb/qla_dbg.c 227064 2011-11-03 21:20:22Z bz $");
   34 
   35 #include "qla_os.h"
   36 #include "qla_reg.h"
   37 #include "qla_hw.h"
   38 #include "qla_def.h"
   39 #include "qla_inline.h"
   40 #include "qla_ver.h"
   41 #include "qla_glbl.h"
   42 #include "qla_dbg.h"
   43 
   44 
   45 uint32_t dbg_level = 0 ;
   46 /*
   47  * Name: qla_dump_buf32
   48  * Function: dumps a buffer as 32 bit words
   49  */
   50 void qla_dump_buf32(qla_host_t *ha, char *msg, void *dbuf32, uint32_t len32)
   51 {
   52         device_t dev;
   53         uint32_t i = 0;
   54         uint32_t *buf;
   55 
   56         dev = ha->pci_dev;
   57         buf = dbuf32;
   58 
   59         device_printf(dev, "%s: %s dump start\n", __func__, msg);
   60 
   61         while (len32 >= 4) {
   62                 device_printf(dev,"0x%08x: 0x%08x 0x%08x 0x%08x 0x%08x\n",
   63                         i, buf[0], buf[1], buf[2], buf[3]);
   64                 i += 4 * 4;
   65                 len32 -= 4;
   66                 buf += 4;
   67         }
   68         switch (len32) {
   69         case 1:
   70                 device_printf(dev,"0x%08x: 0x%08x\n", i, buf[0]);
   71                 break;
   72         case 2:
   73                 device_printf(dev,"0x%08x: 0x%08x 0x%08x\n", i, buf[0], buf[1]);
   74                 break;
   75         case 3:
   76                 device_printf(dev,"0x%08x: 0x%08x 0x%08x 0x%08x\n",
   77                         i, buf[0], buf[1], buf[2]);
   78                 break;
   79         default:
   80                 break;
   81         }
   82         device_printf(dev, "%s: %s dump end\n", __func__, msg);
   83 }
   84 
   85 /*
   86  * Name: qla_dump_buf16
   87  * Function: dumps a buffer as 16 bit words
   88  */
   89 void qla_dump_buf16(qla_host_t *ha, char *msg, void *dbuf16, uint32_t len16)
   90 {
   91         device_t dev;
   92         uint32_t i = 0;
   93         uint16_t *buf;
   94 
   95         dev = ha->pci_dev;
   96         buf = dbuf16;
   97 
   98         device_printf(dev, "%s: %s dump start\n", __func__, msg);
   99 
  100         while (len16 >= 8) {
  101                 device_printf(dev,"0x%08x: 0x%04x 0x%04x 0x%04x 0x%04x"
  102                         " 0x%04x 0x%04x 0x%04x 0x%04x\n", i, buf[0],
  103                         buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]);
  104                 i += 16;
  105                 len16 -= 8;
  106                 buf += 8;
  107         }
  108         switch (len16) {
  109         case 1:
  110                 device_printf(dev,"0x%08x: 0x%04x\n", i, buf[0]);
  111                 break;
  112         case 2:
  113                 device_printf(dev,"0x%08x: 0x%04x 0x%04x\n", i, buf[0], buf[1]);
  114                 break;
  115         case 3:
  116                 device_printf(dev,"0x%08x: 0x%04x 0x%04x 0x%04x\n",
  117                         i, buf[0], buf[1], buf[2]);
  118                 break;
  119         case 4:
  120                 device_printf(dev,"0x%08x: 0x%04x 0x%04x 0x%04x 0x%04x\n", i,
  121                         buf[0], buf[1], buf[2], buf[3]);
  122                 break;
  123         case 5:
  124                 device_printf(dev,"0x%08x:"
  125                         " 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x\n", i,
  126                         buf[0], buf[1], buf[2], buf[3], buf[4]);
  127                 break;
  128         case 6:
  129                 device_printf(dev,"0x%08x:"
  130                         " 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x\n", i,
  131                         buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
  132                 break;
  133         case 7:
  134                 device_printf(dev,"0x%04x: 0x%04x 0x%04x 0x%04x 0x%04x"
  135                         " 0x%04x 0x%04x 0x%04x\n", i, buf[0], buf[1],
  136                         buf[2], buf[3], buf[4], buf[5], buf[6]);
  137                 break;
  138         default:
  139                 break;
  140         }
  141         device_printf(dev, "%s: %s dump end\n", __func__, msg);
  142 }
  143 
  144 /*
  145  * Name: qla_dump_buf8
  146  * Function: dumps a buffer as bytes
  147  */
  148 void qla_dump_buf8(qla_host_t *ha, char *msg, void *dbuf, uint32_t len)
  149 {
  150         device_t dev;
  151         uint32_t i = 0;
  152         uint8_t *buf;
  153 
  154         dev = ha->pci_dev;
  155         buf = dbuf;
  156 
  157         device_printf(dev, "%s: %s 0x%x dump start\n", __func__, msg, len);
  158         
  159         while (len >= 16) {
  160                 device_printf(dev,"0x%08x:"
  161                         " %02x %02x %02x %02x %02x %02x %02x %02x"
  162                         " %02x %02x %02x %02x %02x %02x %02x %02x\n", i,
  163                         buf[0], buf[1], buf[2], buf[3],
  164                         buf[4], buf[5], buf[6], buf[7],
  165                         buf[8], buf[9], buf[10], buf[11],
  166                         buf[12], buf[13], buf[14], buf[15]);
  167                 i += 16;
  168                 len -= 16;
  169                 buf += 16;
  170         }
  171         switch (len) {
  172         case 1:
  173                 device_printf(dev,"0x%08x: %02x\n", i, buf[0]);
  174                 break;
  175         case 2:
  176                 device_printf(dev,"0x%08x: %02x %02x\n", i, buf[0], buf[1]);
  177                 break;
  178         case 3:
  179                 device_printf(dev,"0x%08x: %02x %02x %02x\n",
  180                         i, buf[0], buf[1], buf[2]);
  181                 break;
  182         case 4:
  183                 device_printf(dev,"0x%08x: %02x %02x %02x %02x\n", i,
  184                         buf[0], buf[1], buf[2], buf[3]);
  185                 break;
  186         case 5:
  187                 device_printf(dev,"0x%08x:"
  188                         " %02x %02x %02x %02x %02x\n", i,
  189                         buf[0], buf[1], buf[2], buf[3], buf[4]);
  190                 break;
  191         case 6:
  192                 device_printf(dev,"0x%08x:"
  193                         " %02x %02x %02x %02x %02x %02x\n", i,
  194                         buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
  195                 break;
  196         case 7:
  197                 device_printf(dev,"0x%08x:"
  198                         " %02x %02x %02x %02x %02x %02x %02x\n", i,
  199                         buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6]);
  200                 break;
  201         case 8:
  202                 device_printf(dev,"0x%08x:"
  203                         " %02x %02x %02x %02x %02x %02x %02x %02x\n", i,
  204                         buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
  205                         buf[7]);
  206                 break;
  207         case 9:
  208                 device_printf(dev,"0x%08x:"
  209                         " %02x %02x %02x %02x %02x %02x %02x %02x"
  210                         " %02x\n", i,
  211                         buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
  212                         buf[7], buf[8]);
  213                 break;
  214         case 10:
  215                 device_printf(dev,"0x%08x:"
  216                         " %02x %02x %02x %02x %02x %02x %02x %02x"
  217                         " %02x %02x\n", i,
  218                         buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
  219                         buf[7], buf[8], buf[9]);
  220                 break;
  221         case 11:
  222                 device_printf(dev,"0x%08x:"
  223                         " %02x %02x %02x %02x %02x %02x %02x %02x"
  224                         " %02x %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], buf[10]);
  227                 break;
  228         case 12:
  229                 device_printf(dev,"0x%08x:"
  230                         " %02x %02x %02x %02x %02x %02x %02x %02x"
  231                         " %02x %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], buf[11]);
  234                 break;
  235         case 13:
  236                 device_printf(dev,"0x%08x:"
  237                         " %02x %02x %02x %02x %02x %02x %02x %02x"
  238                         " %02x %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], buf[12]);
  241                 break;
  242         case 14:
  243                 device_printf(dev,"0x%08x:"
  244                         " %02x %02x %02x %02x %02x %02x %02x %02x"
  245                         " %02x %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                         buf[13]);
  249                 break;
  250         case 15:
  251                 device_printf(dev,"0x%08x:"
  252                         " %02x %02x %02x %02x %02x %02x %02x %02x"
  253                         " %02x %02x %02x %02x %02x %02x %02x\n", i,
  254                         buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
  255                         buf[7], buf[8], buf[9], buf[10], buf[11], buf[12],
  256                         buf[13], buf[14]);
  257                 break;
  258         default:
  259                 break;
  260         }
  261         
  262         device_printf(dev, "%s: %s dump end\n", __func__, msg);
  263 }

Cache object: 27d7b948af10888de35c0fbf15890c92


[ 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.