Path: blob/master/drivers/message/fusion/mptdebug.h
15109 views
/*1* linux/drivers/message/fusion/mptdebug.h2* For use with LSI PCI chip/adapter(s)3* running LSI Fusion MPT (Message Passing Technology) firmware.4*5* Copyright (c) 1999-2008 LSI Corporation6* (mailto:[email protected])7*8*/9/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/1011#ifndef MPTDEBUG_H_INCLUDED12#define MPTDEBUG_H_INCLUDED1314/*15* debug level can be programmed on the fly via SysFS (hex values)16*17* Example: (programming for MPT_DEBUG_EVENTS on host 5)18*19* echo 8 > /sys/class/scsi_host/host5/debug_level20*21* --------------------------------------------------------22* mpt_debug_level - command line parameter23* this allow enabling debug at driver load time (for all iocs)24*25* Example (programming for MPT_DEBUG_EVENTS)26*27* insmod mptbase.ko mpt_debug_level=828*29* --------------------------------------------------------30* CONFIG_FUSION_LOGGING - enables compiling debug into driver31* this can be enabled in the driver Makefile32*33*34* --------------------------------------------------------35* Please note most debug prints are set to logging priority = debug36* This is the lowest level, and most verbose. Please refer to manual37* pages for syslogd or syslogd-ng on how to configure this.38*/3940#define MPT_DEBUG 0x0000000141#define MPT_DEBUG_MSG_FRAME 0x0000000242#define MPT_DEBUG_SG 0x0000000443#define MPT_DEBUG_EVENTS 0x0000000844#define MPT_DEBUG_VERBOSE_EVENTS 0x0000001045#define MPT_DEBUG_INIT 0x0000002046#define MPT_DEBUG_EXIT 0x0000004047#define MPT_DEBUG_FAIL 0x0000008048#define MPT_DEBUG_TM 0x0000010049#define MPT_DEBUG_DV 0x0000020050#define MPT_DEBUG_REPLY 0x0000040051#define MPT_DEBUG_HANDSHAKE 0x0000080052#define MPT_DEBUG_CONFIG 0x0000100053#define MPT_DEBUG_DL 0x0000200054#define MPT_DEBUG_RESET 0x0000800055#define MPT_DEBUG_SCSI 0x0001000056#define MPT_DEBUG_IOCTL 0x0002000057#define MPT_DEBUG_FC 0x0008000058#define MPT_DEBUG_SAS 0x0010000059#define MPT_DEBUG_SAS_WIDE 0x0020000060#define MPT_DEBUG_36GB_MEM 0x004000006162/*63* CONFIG_FUSION_LOGGING - enabled in Kconfig64*/6566#ifdef CONFIG_FUSION_LOGGING67#define MPT_CHECK_LOGGING(IOC, CMD, BITS) \68{ \69if (IOC->debug_level & BITS) \70CMD; \71}72#else73#define MPT_CHECK_LOGGING(IOC, CMD, BITS)74#endif757677/*78* debug macros79*/8081#define dprintk(IOC, CMD) \82MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG)8384#define dsgprintk(IOC, CMD) \85MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_SG)8687#define devtprintk(IOC, CMD) \88MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_EVENTS)8990#define devtverboseprintk(IOC, CMD) \91MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_VERBOSE_EVENTS)9293#define dinitprintk(IOC, CMD) \94MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_INIT)9596#define dexitprintk(IOC, CMD) \97MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_EXIT)9899#define dfailprintk(IOC, CMD) \100MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_FAIL)101102#define dtmprintk(IOC, CMD) \103MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_TM)104105#define ddvprintk(IOC, CMD) \106MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_DV)107108#define dreplyprintk(IOC, CMD) \109MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_REPLY)110111#define dhsprintk(IOC, CMD) \112MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_HANDSHAKE)113114#define dcprintk(IOC, CMD) \115MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_CONFIG)116117#define ddlprintk(IOC, CMD) \118MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_DL)119120#define drsprintk(IOC, CMD) \121MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_RESET)122123#define dsprintk(IOC, CMD) \124MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_SCSI)125126#define dctlprintk(IOC, CMD) \127MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_IOCTL)128129#define dfcprintk(IOC, CMD) \130MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_FC)131132#define dsasprintk(IOC, CMD) \133MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_SAS)134135#define dsaswideprintk(IOC, CMD) \136MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_SAS_WIDE)137138#define d36memprintk(IOC, CMD) \139MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_36GB_MEM)140141142/*143* Verbose logging144*/145#if defined(MPT_DEBUG_VERBOSE) && defined(CONFIG_FUSION_LOGGING)146static inline void147DBG_DUMP_FW_DOWNLOAD(MPT_ADAPTER *ioc, u32 *mfp, int numfrags)148{149int i;150151if (!(ioc->debug_level & MPT_DEBUG))152return;153printk(KERN_DEBUG "F/W download request:\n");154for (i=0; i < 7+numfrags*2; i++)155printk(" %08x", le32_to_cpu(mfp[i]));156printk("\n");157}158159static inline void160DBG_DUMP_PUT_MSG_FRAME(MPT_ADAPTER *ioc, u32 *mfp)161{162int ii, n;163164if (!(ioc->debug_level & MPT_DEBUG_MSG_FRAME))165return;166printk(KERN_DEBUG "%s: About to Put msg frame @ %p:\n",167ioc->name, mfp);168n = ioc->req_sz/4 - 1;169while (mfp[n] == 0)170n--;171for (ii=0; ii<=n; ii++) {172if (ii && ((ii%8)==0))173printk("\n");174printk(" %08x", le32_to_cpu(mfp[ii]));175}176printk("\n");177}178179static inline void180DBG_DUMP_FW_REQUEST_FRAME(MPT_ADAPTER *ioc, u32 *mfp)181{182int i, n;183184if (!(ioc->debug_level & MPT_DEBUG_MSG_FRAME))185return;186n = 10;187printk(KERN_INFO " ");188for (i = 0; i < n; i++)189printk(" %08x", le32_to_cpu(mfp[i]));190printk("\n");191}192193static inline void194DBG_DUMP_REQUEST_FRAME(MPT_ADAPTER *ioc, u32 *mfp)195{196int i, n;197198if (!(ioc->debug_level & MPT_DEBUG_MSG_FRAME))199return;200n = 24;201for (i=0; i<n; i++) {202if (i && ((i%8)==0))203printk("\n");204printk("%08x ", le32_to_cpu(mfp[i]));205}206printk("\n");207}208209static inline void210DBG_DUMP_REPLY_FRAME(MPT_ADAPTER *ioc, u32 *mfp)211{212int i, n;213214if (!(ioc->debug_level & MPT_DEBUG_MSG_FRAME))215return;216n = (le32_to_cpu(mfp[0]) & 0x00FF0000) >> 16;217printk(KERN_INFO " ");218for (i=0; i<n; i++)219printk(" %08x", le32_to_cpu(mfp[i]));220printk("\n");221}222223static inline void224DBG_DUMP_REQUEST_FRAME_HDR(MPT_ADAPTER *ioc, u32 *mfp)225{226int i, n;227228if (!(ioc->debug_level & MPT_DEBUG_MSG_FRAME))229return;230n = 3;231printk(KERN_INFO " ");232for (i=0; i<n; i++)233printk(" %08x", le32_to_cpu(mfp[i]));234printk("\n");235}236237static inline void238DBG_DUMP_TM_REQUEST_FRAME(MPT_ADAPTER *ioc, u32 *mfp)239{240int i, n;241242if (!(ioc->debug_level & MPT_DEBUG_TM))243return;244n = 13;245printk(KERN_DEBUG "TM_REQUEST:\n");246for (i=0; i<n; i++) {247if (i && ((i%8)==0))248printk("\n");249printk("%08x ", le32_to_cpu(mfp[i]));250}251printk("\n");252}253254static inline void255DBG_DUMP_TM_REPLY_FRAME(MPT_ADAPTER *ioc, u32 *mfp)256{257int i, n;258259if (!(ioc->debug_level & MPT_DEBUG_TM))260return;261n = (le32_to_cpu(mfp[0]) & 0x00FF0000) >> 16;262printk(KERN_DEBUG "TM_REPLY MessageLength=%d:\n", n);263for (i=0; i<n; i++) {264if (i && ((i%8)==0))265printk("\n");266printk(" %08x", le32_to_cpu(mfp[i]));267}268printk("\n");269}270271#define dmfprintk(IOC, CMD) \272MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_MSG_FRAME)273274# else /* ifdef MPT_DEBUG_MF */275276#define DBG_DUMP_FW_DOWNLOAD(IOC, mfp, numfrags)277#define DBG_DUMP_PUT_MSG_FRAME(IOC, mfp)278#define DBG_DUMP_FW_REQUEST_FRAME(IOC, mfp)279#define DBG_DUMP_REQUEST_FRAME(IOC, mfp)280#define DBG_DUMP_REPLY_FRAME(IOC, mfp)281#define DBG_DUMP_REQUEST_FRAME_HDR(IOC, mfp)282#define DBG_DUMP_TM_REQUEST_FRAME(IOC, mfp)283#define DBG_DUMP_TM_REPLY_FRAME(IOC, mfp)284285#define dmfprintk(IOC, CMD) \286MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_MSG_FRAME)287288#endif /* defined(MPT_DEBUG_VERBOSE) && defined(CONFIG_FUSION_LOGGING) */289290#endif /* ifndef MPTDEBUG_H_INCLUDED */291292293