12908d778ab3e244900c310974e1fc1c69066e450James Bottomley/*
22908d778ab3e244900c310974e1fc1c69066e450James Bottomley * Aic94xx SAS/SATA driver dump interface.
32908d778ab3e244900c310974e1fc1c69066e450James Bottomley *
42908d778ab3e244900c310974e1fc1c69066e450James Bottomley * Copyright (C) 2004 Adaptec, Inc.  All rights reserved.
52908d778ab3e244900c310974e1fc1c69066e450James Bottomley * Copyright (C) 2004 David Chaw <david_chaw@adaptec.com>
62908d778ab3e244900c310974e1fc1c69066e450James Bottomley * Copyright (C) 2005 Luben Tuikov <luben_tuikov@adaptec.com>
72908d778ab3e244900c310974e1fc1c69066e450James Bottomley *
82908d778ab3e244900c310974e1fc1c69066e450James Bottomley * This file is licensed under GPLv2.
92908d778ab3e244900c310974e1fc1c69066e450James Bottomley *
102908d778ab3e244900c310974e1fc1c69066e450James Bottomley * This file is part of the aic94xx driver.
112908d778ab3e244900c310974e1fc1c69066e450James Bottomley *
122908d778ab3e244900c310974e1fc1c69066e450James Bottomley * The aic94xx driver is free software; you can redistribute it and/or
132908d778ab3e244900c310974e1fc1c69066e450James Bottomley * modify it under the terms of the GNU General Public License as
142908d778ab3e244900c310974e1fc1c69066e450James Bottomley * published by the Free Software Foundation; version 2 of the
152908d778ab3e244900c310974e1fc1c69066e450James Bottomley * License.
162908d778ab3e244900c310974e1fc1c69066e450James Bottomley *
172908d778ab3e244900c310974e1fc1c69066e450James Bottomley * The aic94xx driver is distributed in the hope that it will be useful,
182908d778ab3e244900c310974e1fc1c69066e450James Bottomley * but WITHOUT ANY WARRANTY; without even the implied warranty of
192908d778ab3e244900c310974e1fc1c69066e450James Bottomley * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
202908d778ab3e244900c310974e1fc1c69066e450James Bottomley * General Public License for more details.
212908d778ab3e244900c310974e1fc1c69066e450James Bottomley *
222908d778ab3e244900c310974e1fc1c69066e450James Bottomley * You should have received a copy of the GNU General Public License
232908d778ab3e244900c310974e1fc1c69066e450James Bottomley * along with the aic94xx driver; if not, write to the Free Software
242908d778ab3e244900c310974e1fc1c69066e450James Bottomley * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
252908d778ab3e244900c310974e1fc1c69066e450James Bottomley *
262908d778ab3e244900c310974e1fc1c69066e450James Bottomley * 2005/07/14/LT  Complete overhaul of this file.  Update pages, register
272908d778ab3e244900c310974e1fc1c69066e450James Bottomley * locations, names, etc.  Make use of macros.  Print more information.
282908d778ab3e244900c310974e1fc1c69066e450James Bottomley * Print all cseq and lseq mip and mdp.
292908d778ab3e244900c310974e1fc1c69066e450James Bottomley *
302908d778ab3e244900c310974e1fc1c69066e450James Bottomley */
312908d778ab3e244900c310974e1fc1c69066e450James Bottomley
325369fcc127622660b1d259fa732420e4a2aecf07Joe Perches#include <linux/pci.h>
332908d778ab3e244900c310974e1fc1c69066e450James Bottomley#include "aic94xx.h"
342908d778ab3e244900c310974e1fc1c69066e450James Bottomley#include "aic94xx_reg.h"
352908d778ab3e244900c310974e1fc1c69066e450James Bottomley#include "aic94xx_reg_def.h"
362908d778ab3e244900c310974e1fc1c69066e450James Bottomley#include "aic94xx_sas.h"
372908d778ab3e244900c310974e1fc1c69066e450James Bottomley
382908d778ab3e244900c310974e1fc1c69066e450James Bottomley#include "aic94xx_dump.h"
392908d778ab3e244900c310974e1fc1c69066e450James Bottomley
402908d778ab3e244900c310974e1fc1c69066e450James Bottomley#ifdef ASD_DEBUG
412908d778ab3e244900c310974e1fc1c69066e450James Bottomley
422908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define MD(x)	    (1 << (x))
432908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define MODE_COMMON (1 << 31)
442908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define MODE_0_7    (0xFF)
452908d778ab3e244900c310974e1fc1c69066e450James Bottomley
462908d778ab3e244900c310974e1fc1c69066e450James Bottomleystatic const struct lseq_cio_regs {
472908d778ab3e244900c310974e1fc1c69066e450James Bottomley	char	*name;
482908d778ab3e244900c310974e1fc1c69066e450James Bottomley	u32	offs;
492908d778ab3e244900c310974e1fc1c69066e450James Bottomley	u8	width;
502908d778ab3e244900c310974e1fc1c69066e450James Bottomley	u32	mode;
512908d778ab3e244900c310974e1fc1c69066e450James Bottomley} LSEQmCIOREGS[] = {
522908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnSCBPTR",    0x20, 16, MD(0)|MD(1)|MD(2)|MD(3)|MD(4) },
532908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnDDBPTR",    0x22, 16, MD(0)|MD(1)|MD(2)|MD(3)|MD(4) },
542908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmREQMBX",      0x30, 32, MODE_COMMON },
552908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmRSPMBX",      0x34, 32, MODE_COMMON },
562908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnINT",       0x38, 32, MODE_0_7 },
572908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnINTEN",     0x3C, 32, MODE_0_7 },
582908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmXMTPRIMD",    0x40, 32, MODE_COMMON },
592908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmXMTPRIMCS",   0x44,  8, MODE_COMMON },
602908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmCONSTAT",     0x45,  8, MODE_COMMON },
612908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnDMAERRS",   0x46,  8, MD(0)|MD(1) },
622908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnSGDMAERRS", 0x47,  8, MD(0)|MD(1) },
632908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnEXPHDRP",   0x48,  8, MD(0) },
642908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnSASAALIGN", 0x48,  8, MD(1) },
652908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnMSKHDRP",   0x49,  8, MD(0) },
662908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnSTPALIGN",  0x49,  8, MD(1) },
672908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnRCVHDRP",   0x4A,  8, MD(0) },
682908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnXMTHDRP",   0x4A,  8, MD(1) },
692908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmALIGNMODE",   0x4B,  8, MD(1) },
702908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnEXPRCVCNT", 0x4C, 32, MD(0) },
712908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnXMTCNT",    0x4C, 32, MD(1) },
722908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnCURRTAG",   0x54, 16, MD(0) },
732908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnPREVTAG",   0x56, 16, MD(0) },
742908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnACKOFS",    0x58,  8, MD(1) },
752908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnXFRLVL",    0x59,  8, MD(0)|MD(1) },
762908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnSGDMACTL",  0x5A,  8, MD(0)|MD(1) },
772908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnSGDMASTAT", 0x5B,  8, MD(0)|MD(1) },
782908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnDDMACTL",   0x5C,  8, MD(0)|MD(1) },
792908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnDDMASTAT",  0x5D,  8, MD(0)|MD(1) },
802908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnDDMAMODE",  0x5E, 16, MD(0)|MD(1) },
812908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnPIPECTL",   0x61,  8, MD(0)|MD(1) },
822908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnACTSCB",    0x62, 16, MD(0)|MD(1) },
832908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnSGBHADR",   0x64,  8, MD(0)|MD(1) },
842908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnSGBADR",    0x65,  8, MD(0)|MD(1) },
852908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnSGDCNT",    0x66,  8, MD(0)|MD(1) },
862908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnSGDMADR",   0x68, 32, MD(0)|MD(1) },
872908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnSGDMADR",   0x6C, 32, MD(0)|MD(1) },
882908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnXFRCNT",    0x70, 32, MD(0)|MD(1) },
892908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnXMTCRC",    0x74, 32, MD(1) },
902908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmCURRTAG",     0x74, 16, MD(0) },
912908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmPREVTAG",     0x76, 16, MD(0) },
922908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnDPSEL",     0x7B,  8, MD(0)|MD(1) },
932908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmDPTHSTAT",    0x7C,  8, MODE_COMMON },
942908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnHOLDLVL",   0x7D,  8, MD(0) },
952908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnSATAFS",    0x7E,  8, MD(1) },
962908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnCMPLTSTAT", 0x7F,  8, MD(0)|MD(1) },
972908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmPRMSTAT0",    0x80, 32, MODE_COMMON },
982908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmPRMSTAT1",    0x84, 32, MODE_COMMON },
992908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmGPRMINT",     0x88,  8, MODE_COMMON },
1002908d778ab3e244900c310974e1fc1c69066e450James Bottomley        {"LmMnCURRSCB",   0x8A, 16, MD(0) },
1012908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmPRMICODE",    0x8C, 32, MODE_COMMON },
1022908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnRCVCNT",    0x90, 16, MD(0) },
1032908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnBUFSTAT",   0x92, 16, MD(0) },
1042908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnXMTHDRSIZE",0x92,  8, MD(1) },
1052908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnXMTSIZE",   0x93,  8, MD(1) },
1062908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnTGTXFRCNT", 0x94, 32, MD(0) },
1072908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnEXPROFS",   0x98, 32, MD(0) },
1082908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnXMTROFS",   0x98, 32, MD(1) },
1092908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnRCVROFS",   0x9C, 32, MD(0) },
1102908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmCONCTL",      0xA0, 16, MODE_COMMON },
1112908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmBITLTIMER",   0xA2, 16, MODE_COMMON },
1122908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmWWNLOW",      0xA8, 32, MODE_COMMON },
1132908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmWWNHIGH",     0xAC, 32, MODE_COMMON },
1142908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnFRMERR",    0xB0, 32, MD(0) },
1152908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnFRMERREN",  0xB4, 32, MD(0) },
1162908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmAWTIMER",     0xB8, 16, MODE_COMMON },
1172908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmAWTCTL",      0xBA,  8, MODE_COMMON },
1182908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnHDRCMPS",   0xC0, 32, MD(0) },
1192908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnXMTSTAT",   0xC4,  8, MD(1) },
1202908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmHWTSTATEN",   0xC5,  8, MODE_COMMON },
1212908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnRRDYRC",    0xC6,  8, MD(0) },
1222908d778ab3e244900c310974e1fc1c69066e450James Bottomley        {"LmMnRRDYTC",    0xC6,  8, MD(1) },
1232908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmHWTSTAT",     0xC7,  8, MODE_COMMON },
1242908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnDATABUFADR",0xC8, 16, MD(0)|MD(1) },
1252908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmDWSSTATUS",   0xCB,  8, MODE_COMMON },
1262908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnACTSTAT",   0xCE, 16, MD(0)|MD(1) },
1272908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmMnREQSCB",    0xD2, 16, MD(0)|MD(1) },
1282908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmXXXPRIM",     0xD4, 32, MODE_COMMON },
1292908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmRCVASTAT",    0xD9,  8, MODE_COMMON },
1302908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmINTDIS1",     0xDA,  8, MODE_COMMON },
1312908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmPSTORESEL",   0xDB,  8, MODE_COMMON },
1322908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmPSTORE",      0xDC, 32, MODE_COMMON },
1332908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmPRIMSTAT0EN", 0xE0, 32, MODE_COMMON },
1342908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmPRIMSTAT1EN", 0xE4, 32, MODE_COMMON },
1352908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{"LmDONETCTL",    0xF2, 16, MODE_COMMON },
1362908d778ab3e244900c310974e1fc1c69066e450James Bottomley	{NULL, 0, 0, 0 }
1372908d778ab3e244900c310974e1fc1c69066e450James Bottomley};
1382908d778ab3e244900c310974e1fc1c69066e450James Bottomley/*
1392908d778ab3e244900c310974e1fc1c69066e450James Bottomleystatic struct lseq_cio_regs LSEQmOOBREGS[] = {
1402908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_BFLTR"        ,0x100, 8, MD(5)},
1412908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_INIT_MIN"     ,0x102,16, MD(5)},
1422908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_INIT_MAX"     ,0x104,16, MD(5)},
1432908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_INIT_NEG"     ,0x106,16, MD(5)},
1442908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_SAS_MIN"      ,0x108,16, MD(5)},
1452908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_SAS_MAX"      ,0x10A,16, MD(5)},
1462908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_SAS_NEG"      ,0x10C,16, MD(5)},
1472908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_WAKE_MIN"     ,0x10E,16, MD(5)},
1482908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_WAKE_MAX"     ,0x110,16, MD(5)},
1492908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_WAKE_NEG"     ,0x112,16, MD(5)},
1502908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_IDLE_MAX"     ,0x114,16, MD(5)},
1512908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_BURST_MAX"    ,0x116,16, MD(5)},
1522908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_XMIT_BURST"   ,0x118, 8, MD(5)},
1532908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_SEND_PAIRS"   ,0x119, 8, MD(5)},
1542908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_INIT_IDLE"    ,0x11A, 8, MD(5)},
1552908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_INIT_NEGO"    ,0x11C, 8, MD(5)},
1562908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_SAS_IDLE"     ,0x11E, 8, MD(5)},
1572908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_SAS_NEGO"     ,0x120, 8, MD(5)},
1582908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_WAKE_IDLE"    ,0x122, 8, MD(5)},
1592908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_WAKE_NEGO"    ,0x124, 8, MD(5)},
1602908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_DATA_KBITS"   ,0x126, 8, MD(5)},
1612908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_BURST_DATA"   ,0x128,32, MD(5)},
1622908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_ALIGN_0_DATA" ,0x12C,32, MD(5)},
1632908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_ALIGN_1_DATA" ,0x130,32, MD(5)},
1642908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_SYNC_DATA"    ,0x134,32, MD(5)},
1652908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_D10_2_DATA"   ,0x138,32, MD(5)},
1662908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_PHY_RST_CNT"  ,0x13C,32, MD(5)},
1672908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_SIG_GEN"      ,0x140, 8, MD(5)},
1682908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_XMIT"         ,0x141, 8, MD(5)},
1692908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"FUNCTION_MAKS"    ,0x142, 8, MD(5)},
1702908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_MODE"         ,0x143, 8, MD(5)},
1712908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"CURRENT_STATUS"   ,0x144, 8, MD(5)},
1722908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"SPEED_MASK"       ,0x145, 8, MD(5)},
1732908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"PRIM_COUNT"       ,0x146, 8, MD(5)},
1742908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_SIGNALS"      ,0x148, 8, MD(5)},
1752908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_DATA_DET"     ,0x149, 8, MD(5)},
1762908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_TIME_OUT"     ,0x14C, 8, MD(5)},
1772908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_TIMER_ENABLE" ,0x14D, 8, MD(5)},
1782908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_STATUS"       ,0x14E, 8, MD(5)},
1792908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"HOT_PLUG_DELAY"   ,0x150, 8, MD(5)},
1802908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"RCD_DELAY"        ,0x151, 8, MD(5)},
1812908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"COMSAS_TIMER"     ,0x152, 8, MD(5)},
1822908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"SNTT_DELAY"       ,0x153, 8, MD(5)},
1832908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"SPD_CHNG_DELAY"   ,0x154, 8, MD(5)},
1842908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"SNLT_DELAY"       ,0x155, 8, MD(5)},
1852908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"SNWT_DELAY"       ,0x156, 8, MD(5)},
1862908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"ALIGN_DELAY"      ,0x157, 8, MD(5)},
1872908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"INT_ENABLE_0"     ,0x158, 8, MD(5)},
1882908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"INT_ENABLE_1"     ,0x159, 8, MD(5)},
1892908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"INT_ENABLE_2"     ,0x15A, 8, MD(5)},
1902908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"INT_ENABLE_3"     ,0x15B, 8, MD(5)},
1912908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_TEST_REG"     ,0x15C, 8, MD(5)},
1922908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"PHY_CONTROL_0"    ,0x160, 8, MD(5)},
1932908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"PHY_CONTROL_1"    ,0x161, 8, MD(5)},
1942908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"PHY_CONTROL_2"    ,0x162, 8, MD(5)},
1952908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"PHY_CONTROL_3"    ,0x163, 8, MD(5)},
1962908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"PHY_OOB_CAL_TX"   ,0x164, 8, MD(5)},
1972908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"PHY_OOB_CAL_RX"   ,0x165, 8, MD(5)},
1982908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_PHY_CAL_TX"   ,0x166, 8, MD(5)},
1992908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_PHY_CAL_RX"   ,0x167, 8, MD(5)},
2002908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"PHY_CONTROL_4"    ,0x168, 8, MD(5)},
2012908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"PHY_TEST"         ,0x169, 8, MD(5)},
2022908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"PHY_PWR_CTL"      ,0x16A, 8, MD(5)},
2032908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"PHY_PWR_DELAY"    ,0x16B, 8, MD(5)},
2042908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_SM_CON"       ,0x16C, 8, MD(5)},
2052908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"ADDR_TRAP_1"      ,0x16D, 8, MD(5)},
2062908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"ADDR_NEXT_1"      ,0x16E, 8, MD(5)},
2072908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"NEXT_ST_1"        ,0x16F, 8, MD(5)},
2082908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"OOB_SM_STATE"     ,0x170, 8, MD(5)},
2092908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"ADDR_TRAP_2"      ,0x171, 8, MD(5)},
2102908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"ADDR_NEXT_2"      ,0x172, 8, MD(5)},
2112908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {"NEXT_ST_2"        ,0x173, 8, MD(5)},
2122908d778ab3e244900c310974e1fc1c69066e450James Bottomley   {NULL, 0, 0, 0 }
2132908d778ab3e244900c310974e1fc1c69066e450James Bottomley};
2142908d778ab3e244900c310974e1fc1c69066e450James Bottomley*/
2152908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define STR_8BIT   "   %30s[0x%04x]:0x%02x\n"
2162908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define STR_16BIT  "   %30s[0x%04x]:0x%04x\n"
2172908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define STR_32BIT  "   %30s[0x%04x]:0x%08x\n"
2182908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define STR_64BIT  "   %30s[0x%04x]:0x%llx\n"
2192908d778ab3e244900c310974e1fc1c69066e450James Bottomley
2202908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define PRINT_REG_8bit(_ha, _n, _r) asd_printk(STR_8BIT, #_n, _n,      \
2212908d778ab3e244900c310974e1fc1c69066e450James Bottomley					     asd_read_reg_byte(_ha, _r))
2222908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define PRINT_REG_16bit(_ha, _n, _r) asd_printk(STR_16BIT, #_n, _n,     \
2232908d778ab3e244900c310974e1fc1c69066e450James Bottomley					      asd_read_reg_word(_ha, _r))
2242908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define PRINT_REG_32bit(_ha, _n, _r) asd_printk(STR_32BIT, #_n, _n,      \
2252908d778ab3e244900c310974e1fc1c69066e450James Bottomley					      asd_read_reg_dword(_ha, _r))
2262908d778ab3e244900c310974e1fc1c69066e450James Bottomley
2272908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define PRINT_CREG_8bit(_ha, _n) asd_printk(STR_8BIT, #_n, _n,      \
2282908d778ab3e244900c310974e1fc1c69066e450James Bottomley					     asd_read_reg_byte(_ha, C##_n))
2292908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define PRINT_CREG_16bit(_ha, _n) asd_printk(STR_16BIT, #_n, _n,     \
2302908d778ab3e244900c310974e1fc1c69066e450James Bottomley					      asd_read_reg_word(_ha, C##_n))
2312908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define PRINT_CREG_32bit(_ha, _n) asd_printk(STR_32BIT, #_n, _n,      \
2322908d778ab3e244900c310974e1fc1c69066e450James Bottomley					      asd_read_reg_dword(_ha, C##_n))
2332908d778ab3e244900c310974e1fc1c69066e450James Bottomley
2342908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define MSTR_8BIT   "   Mode:%02d %30s[0x%04x]:0x%02x\n"
2352908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define MSTR_16BIT  "   Mode:%02d %30s[0x%04x]:0x%04x\n"
2362908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define MSTR_32BIT  "   Mode:%02d %30s[0x%04x]:0x%08x\n"
2372908d778ab3e244900c310974e1fc1c69066e450James Bottomley
2382908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define PRINT_MREG_8bit(_ha, _m, _n, _r) asd_printk(MSTR_8BIT, _m, #_n, _n,   \
2392908d778ab3e244900c310974e1fc1c69066e450James Bottomley					     asd_read_reg_byte(_ha, _r))
2402908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define PRINT_MREG_16bit(_ha, _m, _n, _r) asd_printk(MSTR_16BIT, _m, #_n, _n, \
2412908d778ab3e244900c310974e1fc1c69066e450James Bottomley					      asd_read_reg_word(_ha, _r))
2422908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define PRINT_MREG_32bit(_ha, _m, _n, _r) asd_printk(MSTR_32BIT, _m, #_n, _n, \
2432908d778ab3e244900c310974e1fc1c69066e450James Bottomley					      asd_read_reg_dword(_ha, _r))
2442908d778ab3e244900c310974e1fc1c69066e450James Bottomley
2452908d778ab3e244900c310974e1fc1c69066e450James Bottomley/* can also be used for MD when the register is mode aware already */
2462908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define PRINT_MIS_byte(_ha, _n) asd_printk(STR_8BIT, #_n,CSEQ_##_n-CMAPPEDSCR,\
2472908d778ab3e244900c310974e1fc1c69066e450James Bottomley                                           asd_read_reg_byte(_ha, CSEQ_##_n))
2482908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define PRINT_MIS_word(_ha, _n) asd_printk(STR_16BIT,#_n,CSEQ_##_n-CMAPPEDSCR,\
2492908d778ab3e244900c310974e1fc1c69066e450James Bottomley                                           asd_read_reg_word(_ha, CSEQ_##_n))
2502908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define PRINT_MIS_dword(_ha, _n)                      \
2512908d778ab3e244900c310974e1fc1c69066e450James Bottomley        asd_printk(STR_32BIT,#_n,CSEQ_##_n-CMAPPEDSCR,\
2522908d778ab3e244900c310974e1fc1c69066e450James Bottomley                   asd_read_reg_dword(_ha, CSEQ_##_n))
2532908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define PRINT_MIS_qword(_ha, _n)                                       \
2542908d778ab3e244900c310974e1fc1c69066e450James Bottomley        asd_printk(STR_64BIT, #_n,CSEQ_##_n-CMAPPEDSCR,                \
2552908d778ab3e244900c310974e1fc1c69066e450James Bottomley                   (unsigned long long)(((u64)asd_read_reg_dword(_ha, CSEQ_##_n))     \
2562908d778ab3e244900c310974e1fc1c69066e450James Bottomley                 | (((u64)asd_read_reg_dword(_ha, (CSEQ_##_n)+4))<<32)))
2572908d778ab3e244900c310974e1fc1c69066e450James Bottomley
2582908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define CMDP_REG(_n, _m) (_m*(CSEQ_PAGE_SIZE*2)+CSEQ_##_n)
2592908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define PRINT_CMDP_word(_ha, _n) \
2602908d778ab3e244900c310974e1fc1c69066e450James Bottomleyasd_printk("%20s 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x\n", \
2612908d778ab3e244900c310974e1fc1c69066e450James Bottomley	#_n, \
2622908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_read_reg_word(_ha, CMDP_REG(_n, 0)), \
2632908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_read_reg_word(_ha, CMDP_REG(_n, 1)), \
2642908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_read_reg_word(_ha, CMDP_REG(_n, 2)), \
2652908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_read_reg_word(_ha, CMDP_REG(_n, 3)), \
2662908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_read_reg_word(_ha, CMDP_REG(_n, 4)), \
2672908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_read_reg_word(_ha, CMDP_REG(_n, 5)), \
2682908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_read_reg_word(_ha, CMDP_REG(_n, 6)), \
2692908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_read_reg_word(_ha, CMDP_REG(_n, 7)))
2702908d778ab3e244900c310974e1fc1c69066e450James Bottomley
2712908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define PRINT_CMDP_byte(_ha, _n) \
2722908d778ab3e244900c310974e1fc1c69066e450James Bottomleyasd_printk("%20s 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x\n", \
2732908d778ab3e244900c310974e1fc1c69066e450James Bottomley	#_n, \
2742908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_read_reg_byte(_ha, CMDP_REG(_n, 0)), \
2752908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_read_reg_byte(_ha, CMDP_REG(_n, 1)), \
2762908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_read_reg_byte(_ha, CMDP_REG(_n, 2)), \
2772908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_read_reg_byte(_ha, CMDP_REG(_n, 3)), \
2782908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_read_reg_byte(_ha, CMDP_REG(_n, 4)), \
2792908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_read_reg_byte(_ha, CMDP_REG(_n, 5)), \
2802908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_read_reg_byte(_ha, CMDP_REG(_n, 6)), \
2812908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_read_reg_byte(_ha, CMDP_REG(_n, 7)))
2822908d778ab3e244900c310974e1fc1c69066e450James Bottomley
2832908d778ab3e244900c310974e1fc1c69066e450James Bottomleystatic void asd_dump_cseq_state(struct asd_ha_struct *asd_ha)
2842908d778ab3e244900c310974e1fc1c69066e450James Bottomley{
2852908d778ab3e244900c310974e1fc1c69066e450James Bottomley	int mode;
2862908d778ab3e244900c310974e1fc1c69066e450James Bottomley
2872908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("CSEQ STATE\n");
2882908d778ab3e244900c310974e1fc1c69066e450James Bottomley
2892908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("ARP2 REGISTERS\n");
2902908d778ab3e244900c310974e1fc1c69066e450James Bottomley
2912908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_CREG_32bit(asd_ha, ARP2CTL);
2922908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_CREG_32bit(asd_ha, ARP2INT);
2932908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_CREG_32bit(asd_ha, ARP2INTEN);
2942908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_CREG_8bit(asd_ha, MODEPTR);
2952908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_CREG_8bit(asd_ha, ALTMODE);
2962908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_CREG_8bit(asd_ha, FLAG);
2972908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_CREG_8bit(asd_ha, ARP2INTCTL);
2982908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_CREG_16bit(asd_ha, STACK);
2992908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_CREG_16bit(asd_ha, PRGMCNT);
3002908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_CREG_16bit(asd_ha, ACCUM);
3012908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_CREG_16bit(asd_ha, SINDEX);
3022908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_CREG_16bit(asd_ha, DINDEX);
3032908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_CREG_8bit(asd_ha, SINDIR);
3042908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_CREG_8bit(asd_ha, DINDIR);
3052908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_CREG_8bit(asd_ha, JUMLDIR);
3062908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_CREG_8bit(asd_ha, ARP2HALTCODE);
3072908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_CREG_16bit(asd_ha, CURRADDR);
3082908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_CREG_16bit(asd_ha, LASTADDR);
3092908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_CREG_16bit(asd_ha, NXTLADDR);
3102908d778ab3e244900c310974e1fc1c69066e450James Bottomley
3112908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("IOP REGISTERS\n");
3122908d778ab3e244900c310974e1fc1c69066e450James Bottomley
3132908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_REG_32bit(asd_ha, BISTCTL1, CBISTCTL);
3142908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_CREG_32bit(asd_ha, MAPPEDSCR);
3152908d778ab3e244900c310974e1fc1c69066e450James Bottomley
3162908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("CIO REGISTERS\n");
3172908d778ab3e244900c310974e1fc1c69066e450James Bottomley
3182908d778ab3e244900c310974e1fc1c69066e450James Bottomley	for (mode = 0; mode < 9; mode++)
3192908d778ab3e244900c310974e1fc1c69066e450James Bottomley		PRINT_MREG_16bit(asd_ha, mode, MnSCBPTR, CMnSCBPTR(mode));
3202908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MREG_16bit(asd_ha, 15, MnSCBPTR, CMnSCBPTR(15));
3212908d778ab3e244900c310974e1fc1c69066e450James Bottomley
3222908d778ab3e244900c310974e1fc1c69066e450James Bottomley	for (mode = 0; mode < 9; mode++)
3232908d778ab3e244900c310974e1fc1c69066e450James Bottomley		PRINT_MREG_16bit(asd_ha, mode, MnDDBPTR, CMnDDBPTR(mode));
3242908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MREG_16bit(asd_ha, 15, MnDDBPTR, CMnDDBPTR(15));
3252908d778ab3e244900c310974e1fc1c69066e450James Bottomley
3262908d778ab3e244900c310974e1fc1c69066e450James Bottomley	for (mode = 0; mode < 8; mode++)
3272908d778ab3e244900c310974e1fc1c69066e450James Bottomley		PRINT_MREG_32bit(asd_ha, mode, MnREQMBX, CMnREQMBX(mode));
3282908d778ab3e244900c310974e1fc1c69066e450James Bottomley	for (mode = 0; mode < 8; mode++)
3292908d778ab3e244900c310974e1fc1c69066e450James Bottomley		PRINT_MREG_32bit(asd_ha, mode, MnRSPMBX, CMnRSPMBX(mode));
3302908d778ab3e244900c310974e1fc1c69066e450James Bottomley	for (mode = 0; mode < 8; mode++)
3312908d778ab3e244900c310974e1fc1c69066e450James Bottomley		PRINT_MREG_32bit(asd_ha, mode, MnINT, CMnINT(mode));
3322908d778ab3e244900c310974e1fc1c69066e450James Bottomley	for (mode = 0; mode < 8; mode++)
3332908d778ab3e244900c310974e1fc1c69066e450James Bottomley		PRINT_MREG_32bit(asd_ha, mode, MnINTEN, CMnINTEN(mode));
3342908d778ab3e244900c310974e1fc1c69066e450James Bottomley
3352908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_CREG_8bit(asd_ha, SCRATCHPAGE);
3362908d778ab3e244900c310974e1fc1c69066e450James Bottomley	for (mode = 0; mode < 8; mode++)
3372908d778ab3e244900c310974e1fc1c69066e450James Bottomley		PRINT_MREG_8bit(asd_ha, mode, MnSCRATCHPAGE,
3382908d778ab3e244900c310974e1fc1c69066e450James Bottomley				CMnSCRATCHPAGE(mode));
3392908d778ab3e244900c310974e1fc1c69066e450James Bottomley
3402908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_REG_32bit(asd_ha, CLINKCON, CLINKCON);
3412908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_REG_8bit(asd_ha, CCONMSK, CCONMSK);
3422908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_REG_8bit(asd_ha, CCONEXIST, CCONEXIST);
3432908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_REG_16bit(asd_ha, CCONMODE, CCONMODE);
3442908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_REG_32bit(asd_ha, CTIMERCALC, CTIMERCALC);
3452908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_REG_8bit(asd_ha, CINTDIS, CINTDIS);
3462908d778ab3e244900c310974e1fc1c69066e450James Bottomley
3472908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("SCRATCH MEMORY\n");
3482908d778ab3e244900c310974e1fc1c69066e450James Bottomley
3492908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("MIP 4 >>>>>\n");
3502908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, Q_EXE_HEAD);
3512908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, Q_EXE_TAIL);
3522908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, Q_DONE_HEAD);
3532908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, Q_DONE_TAIL);
3542908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, Q_SEND_HEAD);
3552908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, Q_SEND_TAIL);
3562908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, Q_DMA2CHIM_HEAD);
3572908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, Q_DMA2CHIM_TAIL);
3582908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, Q_COPY_HEAD);
3592908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, Q_COPY_TAIL);
3602908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, REG0);
3612908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, REG1);
3622908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_dword(asd_ha, REG2);
3632908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_byte(asd_ha, LINK_CTL_Q_MAP);
3642908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_byte(asd_ha, MAX_CSEQ_MODE);
3652908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_byte(asd_ha, FREE_LIST_HACK_COUNT);
3662908d778ab3e244900c310974e1fc1c69066e450James Bottomley
3672908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("MIP 5 >>>>\n");
3682908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_qword(asd_ha, EST_NEXUS_REQ_QUEUE);
3692908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_qword(asd_ha, EST_NEXUS_REQ_COUNT);
3702908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, Q_EST_NEXUS_HEAD);
3712908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, Q_EST_NEXUS_TAIL);
3722908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, NEED_EST_NEXUS_SCB);
3732908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_byte(asd_ha, EST_NEXUS_REQ_HEAD);
3742908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_byte(asd_ha, EST_NEXUS_REQ_TAIL);
3752908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_byte(asd_ha, EST_NEXUS_SCB_OFFSET);
3762908d778ab3e244900c310974e1fc1c69066e450James Bottomley
3772908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("MIP 6 >>>>\n");
3782908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, INT_ROUT_RET_ADDR0);
3792908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, INT_ROUT_RET_ADDR1);
3802908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, INT_ROUT_SCBPTR);
3812908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_byte(asd_ha, INT_ROUT_MODE);
3822908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_byte(asd_ha, ISR_SCRATCH_FLAGS);
3832908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, ISR_SAVE_SINDEX);
3842908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, ISR_SAVE_DINDEX);
3852908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, Q_MONIRTT_HEAD);
3862908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, Q_MONIRTT_TAIL);
3872908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_byte(asd_ha, FREE_SCB_MASK);
3882908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, BUILTIN_FREE_SCB_HEAD);
3892908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, BUILTIN_FREE_SCB_TAIL);
3902908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, EXTENDED_FREE_SCB_HEAD);
3912908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, EXTENDED_FREE_SCB_TAIL);
3922908d778ab3e244900c310974e1fc1c69066e450James Bottomley
3932908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("MIP 7 >>>>\n");
3942908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_qword(asd_ha, EMPTY_REQ_QUEUE);
3952908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_qword(asd_ha, EMPTY_REQ_COUNT);
3962908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, Q_EMPTY_HEAD);
3972908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, Q_EMPTY_TAIL);
3982908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, NEED_EMPTY_SCB);
3992908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_byte(asd_ha, EMPTY_REQ_HEAD);
4002908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_byte(asd_ha, EMPTY_REQ_TAIL);
4012908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_byte(asd_ha, EMPTY_SCB_OFFSET);
4022908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, PRIMITIVE_DATA);
4032908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_dword(asd_ha, TIMEOUT_CONST);
4042908d778ab3e244900c310974e1fc1c69066e450James Bottomley
4052908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("MDP 0 >>>>\n");
4062908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("%-20s %6s %6s %6s %6s %6s %6s %6s %6s\n",
4072908d778ab3e244900c310974e1fc1c69066e450James Bottomley		   "Mode: ", "0", "1", "2", "3", "4", "5", "6", "7");
4082908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_CMDP_word(asd_ha, LRM_SAVE_SINDEX);
4092908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_CMDP_word(asd_ha, LRM_SAVE_SCBPTR);
4102908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_CMDP_word(asd_ha, Q_LINK_HEAD);
4112908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_CMDP_word(asd_ha, Q_LINK_TAIL);
4122908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_CMDP_byte(asd_ha, LRM_SAVE_SCRPAGE);
4132908d778ab3e244900c310974e1fc1c69066e450James Bottomley
4142908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("MDP 0 Mode 8 >>>>\n");
4152908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, RET_ADDR);
4162908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, RET_SCBPTR);
4172908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, SAVE_SCBPTR);
4182908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, EMPTY_TRANS_CTX);
4192908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, RESP_LEN);
4202908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, TMF_SCBPTR);
4212908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, GLOBAL_PREV_SCB);
4222908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, GLOBAL_HEAD);
4232908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, CLEAR_LU_HEAD);
4242908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_byte(asd_ha, TMF_OPCODE);
4252908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_byte(asd_ha, SCRATCH_FLAGS);
4262908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, HSB_SITE);
4272908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, FIRST_INV_SCB_SITE);
4282908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_word(asd_ha, FIRST_INV_DDB_SITE);
4292908d778ab3e244900c310974e1fc1c69066e450James Bottomley
4302908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("MDP 1 Mode 8 >>>>\n");
4312908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_qword(asd_ha, LUN_TO_CLEAR);
4322908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_qword(asd_ha, LUN_TO_CHECK);
4332908d778ab3e244900c310974e1fc1c69066e450James Bottomley
4342908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("MDP 2 Mode 8 >>>>\n");
4352908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_qword(asd_ha, HQ_NEW_POINTER);
4362908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_qword(asd_ha, HQ_DONE_BASE);
4372908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_dword(asd_ha, HQ_DONE_POINTER);
4382908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_MIS_byte(asd_ha, HQ_DONE_PASS);
4392908d778ab3e244900c310974e1fc1c69066e450James Bottomley}
4402908d778ab3e244900c310974e1fc1c69066e450James Bottomley
4412908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define PRINT_LREG_8bit(_h, _lseq, _n) \
4422908d778ab3e244900c310974e1fc1c69066e450James Bottomley        asd_printk(STR_8BIT, #_n, _n, asd_read_reg_byte(_h, Lm##_n(_lseq)))
4432908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define PRINT_LREG_16bit(_h, _lseq, _n) \
4442908d778ab3e244900c310974e1fc1c69066e450James Bottomley        asd_printk(STR_16BIT, #_n, _n, asd_read_reg_word(_h, Lm##_n(_lseq)))
4452908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define PRINT_LREG_32bit(_h, _lseq, _n) \
4462908d778ab3e244900c310974e1fc1c69066e450James Bottomley        asd_printk(STR_32BIT, #_n, _n, asd_read_reg_dword(_h, Lm##_n(_lseq)))
4472908d778ab3e244900c310974e1fc1c69066e450James Bottomley
4482908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define PRINT_LMIP_byte(_h, _lseq, _n)                              \
4492908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk(STR_8BIT, #_n, LmSEQ_##_n(_lseq)-LmSCRATCH(_lseq), \
4502908d778ab3e244900c310974e1fc1c69066e450James Bottomley		   asd_read_reg_byte(_h, LmSEQ_##_n(_lseq)))
4512908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define PRINT_LMIP_word(_h, _lseq, _n)                              \
4522908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk(STR_16BIT, #_n, LmSEQ_##_n(_lseq)-LmSCRATCH(_lseq), \
4532908d778ab3e244900c310974e1fc1c69066e450James Bottomley		   asd_read_reg_word(_h, LmSEQ_##_n(_lseq)))
4542908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define PRINT_LMIP_dword(_h, _lseq, _n)                             \
4552908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk(STR_32BIT, #_n, LmSEQ_##_n(_lseq)-LmSCRATCH(_lseq), \
4562908d778ab3e244900c310974e1fc1c69066e450James Bottomley		   asd_read_reg_dword(_h, LmSEQ_##_n(_lseq)))
4572908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define PRINT_LMIP_qword(_h, _lseq, _n)                                \
4582908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk(STR_64BIT, #_n, LmSEQ_##_n(_lseq)-LmSCRATCH(_lseq), \
4592908d778ab3e244900c310974e1fc1c69066e450James Bottomley		 (unsigned long long)(((unsigned long long) \
4602908d778ab3e244900c310974e1fc1c69066e450James Bottomley		 asd_read_reg_dword(_h, LmSEQ_##_n(_lseq))) \
4612908d778ab3e244900c310974e1fc1c69066e450James Bottomley	          | (((unsigned long long) \
4622908d778ab3e244900c310974e1fc1c69066e450James Bottomley		 asd_read_reg_dword(_h, LmSEQ_##_n(_lseq)+4))<<32)))
4632908d778ab3e244900c310974e1fc1c69066e450James Bottomley
4642908d778ab3e244900c310974e1fc1c69066e450James Bottomleystatic void asd_print_lseq_cio_reg(struct asd_ha_struct *asd_ha,
4652908d778ab3e244900c310974e1fc1c69066e450James Bottomley				   u32 lseq_cio_addr, int i)
4662908d778ab3e244900c310974e1fc1c69066e450James Bottomley{
4672908d778ab3e244900c310974e1fc1c69066e450James Bottomley	switch (LSEQmCIOREGS[i].width) {
4682908d778ab3e244900c310974e1fc1c69066e450James Bottomley	case 8:
4692908d778ab3e244900c310974e1fc1c69066e450James Bottomley		asd_printk("%20s[0x%x]: 0x%02x\n", LSEQmCIOREGS[i].name,
4702908d778ab3e244900c310974e1fc1c69066e450James Bottomley			   LSEQmCIOREGS[i].offs,
4712908d778ab3e244900c310974e1fc1c69066e450James Bottomley			   asd_read_reg_byte(asd_ha, lseq_cio_addr +
4722908d778ab3e244900c310974e1fc1c69066e450James Bottomley					     LSEQmCIOREGS[i].offs));
4732908d778ab3e244900c310974e1fc1c69066e450James Bottomley
4742908d778ab3e244900c310974e1fc1c69066e450James Bottomley		break;
4752908d778ab3e244900c310974e1fc1c69066e450James Bottomley	case 16:
4762908d778ab3e244900c310974e1fc1c69066e450James Bottomley		asd_printk("%20s[0x%x]: 0x%04x\n", LSEQmCIOREGS[i].name,
4772908d778ab3e244900c310974e1fc1c69066e450James Bottomley			   LSEQmCIOREGS[i].offs,
4782908d778ab3e244900c310974e1fc1c69066e450James Bottomley			   asd_read_reg_word(asd_ha, lseq_cio_addr +
4792908d778ab3e244900c310974e1fc1c69066e450James Bottomley					     LSEQmCIOREGS[i].offs));
4802908d778ab3e244900c310974e1fc1c69066e450James Bottomley
4812908d778ab3e244900c310974e1fc1c69066e450James Bottomley		break;
4822908d778ab3e244900c310974e1fc1c69066e450James Bottomley	case 32:
4832908d778ab3e244900c310974e1fc1c69066e450James Bottomley		asd_printk("%20s[0x%x]: 0x%08x\n", LSEQmCIOREGS[i].name,
4842908d778ab3e244900c310974e1fc1c69066e450James Bottomley			   LSEQmCIOREGS[i].offs,
4852908d778ab3e244900c310974e1fc1c69066e450James Bottomley			   asd_read_reg_dword(asd_ha, lseq_cio_addr +
4862908d778ab3e244900c310974e1fc1c69066e450James Bottomley					      LSEQmCIOREGS[i].offs));
4872908d778ab3e244900c310974e1fc1c69066e450James Bottomley		break;
4882908d778ab3e244900c310974e1fc1c69066e450James Bottomley	}
4892908d778ab3e244900c310974e1fc1c69066e450James Bottomley}
4902908d778ab3e244900c310974e1fc1c69066e450James Bottomley
4912908d778ab3e244900c310974e1fc1c69066e450James Bottomleystatic void asd_dump_lseq_state(struct asd_ha_struct *asd_ha, int lseq)
4922908d778ab3e244900c310974e1fc1c69066e450James Bottomley{
4932908d778ab3e244900c310974e1fc1c69066e450James Bottomley	u32 moffs;
4942908d778ab3e244900c310974e1fc1c69066e450James Bottomley	int mode;
4952908d778ab3e244900c310974e1fc1c69066e450James Bottomley
4962908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("LSEQ %d STATE\n", lseq);
4972908d778ab3e244900c310974e1fc1c69066e450James Bottomley
4982908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("LSEQ%d: ARP2 REGISTERS\n", lseq);
4992908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LREG_32bit(asd_ha, lseq, ARP2CTL);
5002908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LREG_32bit(asd_ha, lseq, ARP2INT);
5012908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LREG_32bit(asd_ha, lseq, ARP2INTEN);
5022908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LREG_8bit(asd_ha, lseq, MODEPTR);
5032908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LREG_8bit(asd_ha, lseq, ALTMODE);
5042908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LREG_8bit(asd_ha, lseq, FLAG);
5052908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LREG_8bit(asd_ha, lseq, ARP2INTCTL);
5062908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LREG_16bit(asd_ha, lseq, STACK);
5072908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LREG_16bit(asd_ha, lseq, PRGMCNT);
5082908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LREG_16bit(asd_ha, lseq, ACCUM);
5092908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LREG_16bit(asd_ha, lseq, SINDEX);
5102908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LREG_16bit(asd_ha, lseq, DINDEX);
5112908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LREG_8bit(asd_ha, lseq, SINDIR);
5122908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LREG_8bit(asd_ha, lseq, DINDIR);
5132908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LREG_8bit(asd_ha, lseq, JUMLDIR);
5142908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LREG_8bit(asd_ha, lseq, ARP2HALTCODE);
5152908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LREG_16bit(asd_ha, lseq, CURRADDR);
5162908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LREG_16bit(asd_ha, lseq, LASTADDR);
5172908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LREG_16bit(asd_ha, lseq, NXTLADDR);
5182908d778ab3e244900c310974e1fc1c69066e450James Bottomley
5192908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("LSEQ%d: IOP REGISTERS\n", lseq);
5202908d778ab3e244900c310974e1fc1c69066e450James Bottomley
5212908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LREG_32bit(asd_ha, lseq, MODECTL);
5222908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LREG_32bit(asd_ha, lseq, DBGMODE);
5232908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LREG_32bit(asd_ha, lseq, CONTROL);
5242908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_REG_32bit(asd_ha, BISTCTL0, LmBISTCTL0(lseq));
5252908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_REG_32bit(asd_ha, BISTCTL1, LmBISTCTL1(lseq));
5262908d778ab3e244900c310974e1fc1c69066e450James Bottomley
5272908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("LSEQ%d: CIO REGISTERS\n", lseq);
5282908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("Mode common:\n");
5292908d778ab3e244900c310974e1fc1c69066e450James Bottomley
5302908d778ab3e244900c310974e1fc1c69066e450James Bottomley	for (mode = 0; mode < 8; mode++) {
5312908d778ab3e244900c310974e1fc1c69066e450James Bottomley		u32 lseq_cio_addr = LmSEQ_PHY_BASE(mode, lseq);
5322908d778ab3e244900c310974e1fc1c69066e450James Bottomley		int i;
5332908d778ab3e244900c310974e1fc1c69066e450James Bottomley
5342908d778ab3e244900c310974e1fc1c69066e450James Bottomley		for (i = 0; LSEQmCIOREGS[i].name; i++)
5352908d778ab3e244900c310974e1fc1c69066e450James Bottomley			if (LSEQmCIOREGS[i].mode == MODE_COMMON)
5362908d778ab3e244900c310974e1fc1c69066e450James Bottomley				asd_print_lseq_cio_reg(asd_ha,lseq_cio_addr,i);
5372908d778ab3e244900c310974e1fc1c69066e450James Bottomley	}
5382908d778ab3e244900c310974e1fc1c69066e450James Bottomley
5392908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("Mode unique:\n");
5402908d778ab3e244900c310974e1fc1c69066e450James Bottomley	for (mode = 0; mode < 8; mode++) {
5412908d778ab3e244900c310974e1fc1c69066e450James Bottomley		u32 lseq_cio_addr = LmSEQ_PHY_BASE(mode, lseq);
5422908d778ab3e244900c310974e1fc1c69066e450James Bottomley		int i;
5432908d778ab3e244900c310974e1fc1c69066e450James Bottomley
5442908d778ab3e244900c310974e1fc1c69066e450James Bottomley		asd_printk("Mode %d\n", mode);
5452908d778ab3e244900c310974e1fc1c69066e450James Bottomley		for  (i = 0; LSEQmCIOREGS[i].name; i++) {
5462908d778ab3e244900c310974e1fc1c69066e450James Bottomley			if (!(LSEQmCIOREGS[i].mode & (1 << mode)))
5472908d778ab3e244900c310974e1fc1c69066e450James Bottomley				continue;
5482908d778ab3e244900c310974e1fc1c69066e450James Bottomley			asd_print_lseq_cio_reg(asd_ha, lseq_cio_addr, i);
5492908d778ab3e244900c310974e1fc1c69066e450James Bottomley		}
5502908d778ab3e244900c310974e1fc1c69066e450James Bottomley	}
5512908d778ab3e244900c310974e1fc1c69066e450James Bottomley
5522908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("SCRATCH MEMORY\n");
5532908d778ab3e244900c310974e1fc1c69066e450James Bottomley
5542908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("LSEQ%d MIP 0 >>>>\n", lseq);
5552908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, Q_TGTXFR_HEAD);
5562908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, Q_TGTXFR_TAIL);
5572908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, LINK_NUMBER);
5582908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, SCRATCH_FLAGS);
559083d1631be7c36309359792ecf61aaf88559043fWu, Gilbert	PRINT_LMIP_dword(asd_ha, lseq, CONNECTION_STATE);
5602908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, CONCTL);
5612908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, CONSTAT);
5622908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, CONNECTION_MODES);
5632908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, REG1_ISR);
5642908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, REG2_ISR);
5652908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, REG3_ISR);
5662908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_qword(asd_ha, lseq,REG0_ISR);
5672908d778ab3e244900c310974e1fc1c69066e450James Bottomley
5682908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("LSEQ%d MIP 1 >>>>\n", lseq);
5692908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, EST_NEXUS_SCBPTR0);
5702908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, EST_NEXUS_SCBPTR1);
5712908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, EST_NEXUS_SCBPTR2);
5722908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, EST_NEXUS_SCBPTR3);
5732908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, EST_NEXUS_SCB_OPCODE0);
5742908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, EST_NEXUS_SCB_OPCODE1);
5752908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, EST_NEXUS_SCB_OPCODE2);
5762908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, EST_NEXUS_SCB_OPCODE3);
5772908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, EST_NEXUS_SCB_HEAD);
5782908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, EST_NEXUS_SCB_TAIL);
5792908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, EST_NEXUS_BUF_AVAIL);
5802908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_dword(asd_ha, lseq, TIMEOUT_CONST);
5812908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, ISR_SAVE_SINDEX);
5822908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, ISR_SAVE_DINDEX);
5832908d778ab3e244900c310974e1fc1c69066e450James Bottomley
5842908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("LSEQ%d MIP 2 >>>>\n", lseq);
5852908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, EMPTY_SCB_PTR0);
5862908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, EMPTY_SCB_PTR1);
5872908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, EMPTY_SCB_PTR2);
5882908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, EMPTY_SCB_PTR3);
5892908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, EMPTY_SCB_OPCD0);
5902908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, EMPTY_SCB_OPCD1);
5912908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, EMPTY_SCB_OPCD2);
5922908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, EMPTY_SCB_OPCD3);
5932908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, EMPTY_SCB_HEAD);
5942908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, EMPTY_SCB_TAIL);
5952908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, EMPTY_BUFS_AVAIL);
5962908d778ab3e244900c310974e1fc1c69066e450James Bottomley
5972908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("LSEQ%d MIP 3 >>>>\n", lseq);
5982908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_dword(asd_ha, lseq, DEV_PRES_TMR_TOUT_CONST);
5992908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_dword(asd_ha, lseq, SATA_INTERLOCK_TIMEOUT);
6002908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_dword(asd_ha, lseq, SRST_ASSERT_TIMEOUT);
6012908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_dword(asd_ha, lseq, RCV_FIS_TIMEOUT);
6022908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_dword(asd_ha, lseq, ONE_MILLISEC_TIMEOUT);
6032908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_dword(asd_ha, lseq, TEN_MS_COMINIT_TIMEOUT);
6042908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_dword(asd_ha, lseq, SMP_RCV_TIMEOUT);
6052908d778ab3e244900c310974e1fc1c69066e450James Bottomley
6062908d778ab3e244900c310974e1fc1c69066e450James Bottomley	for (mode = 0; mode < 3; mode++) {
6072908d778ab3e244900c310974e1fc1c69066e450James Bottomley		asd_printk("LSEQ%d MDP 0 MODE %d >>>>\n", lseq, mode);
6082908d778ab3e244900c310974e1fc1c69066e450James Bottomley		moffs = mode * LSEQ_MODE_SCRATCH_SIZE;
6092908d778ab3e244900c310974e1fc1c69066e450James Bottomley
6102908d778ab3e244900c310974e1fc1c69066e450James Bottomley		asd_printk(STR_16BIT, "RET_ADDR", 0,
6112908d778ab3e244900c310974e1fc1c69066e450James Bottomley			   asd_read_reg_word(asd_ha, LmSEQ_RET_ADDR(lseq)
6122908d778ab3e244900c310974e1fc1c69066e450James Bottomley					     + moffs));
6132908d778ab3e244900c310974e1fc1c69066e450James Bottomley		asd_printk(STR_16BIT, "REG0_MODE", 2,
6142908d778ab3e244900c310974e1fc1c69066e450James Bottomley			   asd_read_reg_word(asd_ha, LmSEQ_REG0_MODE(lseq)
6152908d778ab3e244900c310974e1fc1c69066e450James Bottomley					     + moffs));
6162908d778ab3e244900c310974e1fc1c69066e450James Bottomley		asd_printk(STR_16BIT, "MODE_FLAGS", 4,
6172908d778ab3e244900c310974e1fc1c69066e450James Bottomley			   asd_read_reg_word(asd_ha, LmSEQ_MODE_FLAGS(lseq)
6182908d778ab3e244900c310974e1fc1c69066e450James Bottomley					     + moffs));
6192908d778ab3e244900c310974e1fc1c69066e450James Bottomley		asd_printk(STR_16BIT, "RET_ADDR2", 0x6,
6202908d778ab3e244900c310974e1fc1c69066e450James Bottomley			   asd_read_reg_word(asd_ha, LmSEQ_RET_ADDR2(lseq)
6212908d778ab3e244900c310974e1fc1c69066e450James Bottomley					     + moffs));
6222908d778ab3e244900c310974e1fc1c69066e450James Bottomley		asd_printk(STR_16BIT, "RET_ADDR1", 0x8,
6232908d778ab3e244900c310974e1fc1c69066e450James Bottomley			   asd_read_reg_word(asd_ha, LmSEQ_RET_ADDR1(lseq)
6242908d778ab3e244900c310974e1fc1c69066e450James Bottomley					     + moffs));
6252908d778ab3e244900c310974e1fc1c69066e450James Bottomley		asd_printk(STR_8BIT, "OPCODE_TO_CSEQ", 0xB,
6262908d778ab3e244900c310974e1fc1c69066e450James Bottomley			   asd_read_reg_byte(asd_ha, LmSEQ_OPCODE_TO_CSEQ(lseq)
6272908d778ab3e244900c310974e1fc1c69066e450James Bottomley					     + moffs));
6282908d778ab3e244900c310974e1fc1c69066e450James Bottomley		asd_printk(STR_16BIT, "DATA_TO_CSEQ", 0xC,
6292908d778ab3e244900c310974e1fc1c69066e450James Bottomley			   asd_read_reg_word(asd_ha, LmSEQ_DATA_TO_CSEQ(lseq)
6302908d778ab3e244900c310974e1fc1c69066e450James Bottomley					     + moffs));
6312908d778ab3e244900c310974e1fc1c69066e450James Bottomley	}
6322908d778ab3e244900c310974e1fc1c69066e450James Bottomley
6332908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("LSEQ%d MDP 0 MODE 5 >>>>\n", lseq);
6342908d778ab3e244900c310974e1fc1c69066e450James Bottomley	moffs = LSEQ_MODE5_PAGE0_OFFSET;
6352908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk(STR_16BIT, "RET_ADDR", 0,
6362908d778ab3e244900c310974e1fc1c69066e450James Bottomley		   asd_read_reg_word(asd_ha, LmSEQ_RET_ADDR(lseq) + moffs));
6372908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk(STR_16BIT, "REG0_MODE", 2,
6382908d778ab3e244900c310974e1fc1c69066e450James Bottomley		   asd_read_reg_word(asd_ha, LmSEQ_REG0_MODE(lseq) + moffs));
6392908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk(STR_16BIT, "MODE_FLAGS", 4,
6402908d778ab3e244900c310974e1fc1c69066e450James Bottomley		   asd_read_reg_word(asd_ha, LmSEQ_MODE_FLAGS(lseq) + moffs));
6412908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk(STR_16BIT, "RET_ADDR2", 0x6,
6422908d778ab3e244900c310974e1fc1c69066e450James Bottomley		   asd_read_reg_word(asd_ha, LmSEQ_RET_ADDR2(lseq) + moffs));
6432908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk(STR_16BIT, "RET_ADDR1", 0x8,
6442908d778ab3e244900c310974e1fc1c69066e450James Bottomley		   asd_read_reg_word(asd_ha, LmSEQ_RET_ADDR1(lseq) + moffs));
6452908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk(STR_8BIT, "OPCODE_TO_CSEQ", 0xB,
6462908d778ab3e244900c310974e1fc1c69066e450James Bottomley	   asd_read_reg_byte(asd_ha, LmSEQ_OPCODE_TO_CSEQ(lseq) + moffs));
6472908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk(STR_16BIT, "DATA_TO_CSEQ", 0xC,
6482908d778ab3e244900c310974e1fc1c69066e450James Bottomley	   asd_read_reg_word(asd_ha, LmSEQ_DATA_TO_CSEQ(lseq) + moffs));
6492908d778ab3e244900c310974e1fc1c69066e450James Bottomley
6502908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("LSEQ%d MDP 0 MODE 0 >>>>\n", lseq);
6512908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, FIRST_INV_DDB_SITE);
6522908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, EMPTY_TRANS_CTX);
6532908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, RESP_LEN);
6542908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, FIRST_INV_SCB_SITE);
6552908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_dword(asd_ha, lseq, INTEN_SAVE);
6562908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, LINK_RST_FRM_LEN);
6572908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, LINK_RST_PROTOCOL);
6582908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, RESP_STATUS);
6592908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, LAST_LOADED_SGE);
6602908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, SAVE_SCBPTR);
6612908d778ab3e244900c310974e1fc1c69066e450James Bottomley
6622908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("LSEQ%d MDP 0 MODE 1 >>>>\n", lseq);
6632908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, Q_XMIT_HEAD);
6642908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, M1_EMPTY_TRANS_CTX);
6652908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, INI_CONN_TAG);
6662908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, FAILED_OPEN_STATUS);
6672908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, XMIT_REQUEST_TYPE);
6682908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, M1_RESP_STATUS);
6692908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, M1_LAST_LOADED_SGE);
6702908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, M1_SAVE_SCBPTR);
6712908d778ab3e244900c310974e1fc1c69066e450James Bottomley
6722908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("LSEQ%d MDP 0 MODE 2 >>>>\n", lseq);
6732908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, PORT_COUNTER);
6742908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, PM_TABLE_PTR);
6752908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, SATA_INTERLOCK_TMR_SAVE);
6762908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, IP_BITL);
6772908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, COPY_SMP_CONN_TAG);
6782908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, P0M2_OFFS1AH);
6792908d778ab3e244900c310974e1fc1c69066e450James Bottomley
6802908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("LSEQ%d MDP 0 MODE 4/5 >>>>\n", lseq);
6812908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, SAVED_OOB_STATUS);
6822908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, SAVED_OOB_MODE);
6832908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, Q_LINK_HEAD);
6842908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, LINK_RST_ERR);
6852908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, SAVED_OOB_SIGNALS);
6862908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, SAS_RESET_MODE);
6872908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, LINK_RESET_RETRY_COUNT);
6882908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, NUM_LINK_RESET_RETRIES);
6892908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, OOB_INT_ENABLES);
6902908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, NOTIFY_TIMER_TIMEOUT);
6912908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, NOTIFY_TIMER_DOWN_COUNT);
6922908d778ab3e244900c310974e1fc1c69066e450James Bottomley
6932908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("LSEQ%d MDP 1 MODE 0 >>>>\n", lseq);
6942908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_qword(asd_ha, lseq, SG_LIST_PTR_ADDR0);
6952908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_qword(asd_ha, lseq, SG_LIST_PTR_ADDR1);
6962908d778ab3e244900c310974e1fc1c69066e450James Bottomley
6972908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("LSEQ%d MDP 1 MODE 1 >>>>\n", lseq);
6982908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_qword(asd_ha, lseq, M1_SG_LIST_PTR_ADDR0);
6992908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_qword(asd_ha, lseq, M1_SG_LIST_PTR_ADDR1);
7002908d778ab3e244900c310974e1fc1c69066e450James Bottomley
7012908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("LSEQ%d MDP 1 MODE 2 >>>>\n", lseq);
7022908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_dword(asd_ha, lseq, INVALID_DWORD_COUNT);
7032908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_dword(asd_ha, lseq, DISPARITY_ERROR_COUNT);
7042908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_dword(asd_ha, lseq, LOSS_OF_SYNC_COUNT);
7052908d778ab3e244900c310974e1fc1c69066e450James Bottomley
7062908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("LSEQ%d MDP 1 MODE 4/5 >>>>\n", lseq);
7072908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_dword(asd_ha, lseq, FRAME_TYPE_MASK);
7082908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_dword(asd_ha, lseq, HASHED_SRC_ADDR_MASK_PRINT);
7092908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, NUM_FILL_BYTES_MASK);
7102908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, TAG_MASK);
7112908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, TARGET_PORT_XFER_TAG);
7122908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_dword(asd_ha, lseq, DATA_OFFSET);
7132908d778ab3e244900c310974e1fc1c69066e450James Bottomley
7142908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("LSEQ%d MDP 2 MODE 0 >>>>\n", lseq);
7152908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_dword(asd_ha, lseq, SMP_RCV_TIMER_TERM_TS);
7162908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_byte(asd_ha, lseq, DEVICE_BITS);
7172908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, SDB_DDB);
7182908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, SDB_NUM_TAGS);
7192908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_word(asd_ha, lseq, SDB_CURR_TAG);
7202908d778ab3e244900c310974e1fc1c69066e450James Bottomley
7212908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("LSEQ%d MDP 2 MODE 1 >>>>\n", lseq);
7222908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_qword(asd_ha, lseq, TX_ID_ADDR_FRAME);
7232908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_dword(asd_ha, lseq, OPEN_TIMER_TERM_TS);
7242908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_dword(asd_ha, lseq, SRST_AS_TIMER_TERM_TS);
7252908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_dword(asd_ha, lseq, LAST_LOADED_SG_EL);
7262908d778ab3e244900c310974e1fc1c69066e450James Bottomley
7272908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("LSEQ%d MDP 2 MODE 2 >>>>\n", lseq);
7282908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_dword(asd_ha, lseq, CLOSE_TIMER_TERM_TS);
7292908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_dword(asd_ha, lseq, BREAK_TIMER_TERM_TS);
7302908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_dword(asd_ha, lseq, DWS_RESET_TIMER_TERM_TS);
7312908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_dword(asd_ha, lseq, SATA_INTERLOCK_TIMER_TERM_TS);
7322908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_dword(asd_ha, lseq, MCTL_TIMER_TERM_TS);
7332908d778ab3e244900c310974e1fc1c69066e450James Bottomley
7342908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("LSEQ%d MDP 2 MODE 4/5 >>>>\n", lseq);
7352908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_dword(asd_ha, lseq, COMINIT_TIMER_TERM_TS);
7362908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_dword(asd_ha, lseq, RCV_ID_TIMER_TERM_TS);
7372908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_dword(asd_ha, lseq, RCV_FIS_TIMER_TERM_TS);
7382908d778ab3e244900c310974e1fc1c69066e450James Bottomley	PRINT_LMIP_dword(asd_ha, lseq, DEV_PRES_TIMER_TERM_TS);
7392908d778ab3e244900c310974e1fc1c69066e450James Bottomley}
7402908d778ab3e244900c310974e1fc1c69066e450James Bottomley
74181e56ded878aeb8730f18c1d0a70d5face788be3Adrian Bunk#if 0
74281e56ded878aeb8730f18c1d0a70d5face788be3Adrian Bunk
7432908d778ab3e244900c310974e1fc1c69066e450James Bottomley/**
7442908d778ab3e244900c310974e1fc1c69066e450James Bottomley * asd_dump_ddb_site -- dump a CSEQ DDB site
7452908d778ab3e244900c310974e1fc1c69066e450James Bottomley * @asd_ha: pointer to host adapter structure
7462908d778ab3e244900c310974e1fc1c69066e450James Bottomley * @site_no: site number of interest
7472908d778ab3e244900c310974e1fc1c69066e450James Bottomley */
7482908d778ab3e244900c310974e1fc1c69066e450James Bottomleyvoid asd_dump_target_ddb(struct asd_ha_struct *asd_ha, u16 site_no)
7492908d778ab3e244900c310974e1fc1c69066e450James Bottomley{
7502908d778ab3e244900c310974e1fc1c69066e450James Bottomley	if (site_no >= asd_ha->hw_prof.max_ddbs)
7512908d778ab3e244900c310974e1fc1c69066e450James Bottomley		return;
7522908d778ab3e244900c310974e1fc1c69066e450James Bottomley
7532908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define DDB_FIELDB(__name)                                        \
7542908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_ddbsite_read_byte(asd_ha, site_no,                    \
7552908d778ab3e244900c310974e1fc1c69066e450James Bottomley			      offsetof(struct asd_ddb_ssp_smp_target_port, __name))
7562908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define DDB2_FIELDB(__name)                                       \
7572908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_ddbsite_read_byte(asd_ha, site_no,                    \
7582908d778ab3e244900c310974e1fc1c69066e450James Bottomley			      offsetof(struct asd_ddb_stp_sata_target_port, __name))
7592908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define DDB_FIELDW(__name)                                        \
7602908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_ddbsite_read_word(asd_ha, site_no,                    \
7612908d778ab3e244900c310974e1fc1c69066e450James Bottomley			      offsetof(struct asd_ddb_ssp_smp_target_port, __name))
7622908d778ab3e244900c310974e1fc1c69066e450James Bottomley
7632908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define DDB_FIELDD(__name)                                         \
7642908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_ddbsite_read_dword(asd_ha, site_no,                    \
7652908d778ab3e244900c310974e1fc1c69066e450James Bottomley			       offsetof(struct asd_ddb_ssp_smp_target_port, __name))
7662908d778ab3e244900c310974e1fc1c69066e450James Bottomley
7672908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("DDB: 0x%02x\n", site_no);
7682908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("conn_type: 0x%02x\n", DDB_FIELDB(conn_type));
7692908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("conn_rate: 0x%02x\n", DDB_FIELDB(conn_rate));
7702908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("init_conn_tag: 0x%04x\n", be16_to_cpu(DDB_FIELDW(init_conn_tag)));
7712908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("send_queue_head: 0x%04x\n", be16_to_cpu(DDB_FIELDW(send_queue_head)));
7722908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("sq_suspended: 0x%02x\n", DDB_FIELDB(sq_suspended));
7732908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("DDB Type: 0x%02x\n", DDB_FIELDB(ddb_type));
7742908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("AWT Default: 0x%04x\n", DDB_FIELDW(awt_def));
7752908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("compat_features: 0x%02x\n", DDB_FIELDB(compat_features));
7762908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("Pathway Blocked Count: 0x%02x\n",
7772908d778ab3e244900c310974e1fc1c69066e450James Bottomley		   DDB_FIELDB(pathway_blocked_count));
7782908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("arb_wait_time: 0x%04x\n", DDB_FIELDW(arb_wait_time));
7792908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("more_compat_features: 0x%08x\n",
7802908d778ab3e244900c310974e1fc1c69066e450James Bottomley		   DDB_FIELDD(more_compat_features));
7812908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("Conn Mask: 0x%02x\n", DDB_FIELDB(conn_mask));
7822908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("flags: 0x%02x\n", DDB_FIELDB(flags));
7832908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("flags2: 0x%02x\n", DDB2_FIELDB(flags2));
7842908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("ExecQ Tail: 0x%04x\n",DDB_FIELDW(exec_queue_tail));
7852908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("SendQ Tail: 0x%04x\n",DDB_FIELDW(send_queue_tail));
7862908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("Active Task Count: 0x%04x\n",
7872908d778ab3e244900c310974e1fc1c69066e450James Bottomley		   DDB_FIELDW(active_task_count));
7882908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("ITNL Reason: 0x%02x\n", DDB_FIELDB(itnl_reason));
7892908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("ITNL Timeout Const: 0x%04x\n", DDB_FIELDW(itnl_timeout));
7902908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("ITNL timestamp: 0x%08x\n", DDB_FIELDD(itnl_timestamp));
7912908d778ab3e244900c310974e1fc1c69066e450James Bottomley}
7922908d778ab3e244900c310974e1fc1c69066e450James Bottomley
7932908d778ab3e244900c310974e1fc1c69066e450James Bottomleyvoid asd_dump_ddb_0(struct asd_ha_struct *asd_ha)
7942908d778ab3e244900c310974e1fc1c69066e450James Bottomley{
7952908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define DDB0_FIELDB(__name)                                  \
7962908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_ddbsite_read_byte(asd_ha, 0,                     \
7972908d778ab3e244900c310974e1fc1c69066e450James Bottomley			      offsetof(struct asd_ddb_seq_shared, __name))
7982908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define DDB0_FIELDW(__name)                                  \
7992908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_ddbsite_read_word(asd_ha, 0,                     \
8002908d778ab3e244900c310974e1fc1c69066e450James Bottomley			      offsetof(struct asd_ddb_seq_shared, __name))
8012908d778ab3e244900c310974e1fc1c69066e450James Bottomley
8022908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define DDB0_FIELDD(__name)                                  \
8032908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_ddbsite_read_dword(asd_ha,0 ,                    \
8042908d778ab3e244900c310974e1fc1c69066e450James Bottomley			       offsetof(struct asd_ddb_seq_shared, __name))
8052908d778ab3e244900c310974e1fc1c69066e450James Bottomley
8062908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define DDB0_FIELDA(__name, _o)                              \
8072908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_ddbsite_read_byte(asd_ha, 0,                     \
8082908d778ab3e244900c310974e1fc1c69066e450James Bottomley			      offsetof(struct asd_ddb_seq_shared, __name)+_o)
8092908d778ab3e244900c310974e1fc1c69066e450James Bottomley
8102908d778ab3e244900c310974e1fc1c69066e450James Bottomley
8112908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("DDB: 0\n");
8122908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("q_free_ddb_head:%04x\n", DDB0_FIELDW(q_free_ddb_head));
8132908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("q_free_ddb_tail:%04x\n", DDB0_FIELDW(q_free_ddb_tail));
8142908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("q_free_ddb_cnt:%04x\n",  DDB0_FIELDW(q_free_ddb_cnt));
8152908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("q_used_ddb_head:%04x\n", DDB0_FIELDW(q_used_ddb_head));
8162908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("q_used_ddb_tail:%04x\n", DDB0_FIELDW(q_used_ddb_tail));
8172908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("shared_mem_lock:%04x\n", DDB0_FIELDW(shared_mem_lock));
8182908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("smp_conn_tag:%04x\n",    DDB0_FIELDW(smp_conn_tag));
8192908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("est_nexus_buf_cnt:%04x\n", DDB0_FIELDW(est_nexus_buf_cnt));
8202908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("est_nexus_buf_thresh:%04x\n",
8212908d778ab3e244900c310974e1fc1c69066e450James Bottomley		   DDB0_FIELDW(est_nexus_buf_thresh));
8222908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("conn_not_active:%02x\n", DDB0_FIELDB(conn_not_active));
8232908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("phy_is_up:%02x\n",       DDB0_FIELDB(phy_is_up));
8242908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("port_map_by_links:%02x %02x %02x %02x "
8252908d778ab3e244900c310974e1fc1c69066e450James Bottomley		   "%02x %02x %02x %02x\n",
8262908d778ab3e244900c310974e1fc1c69066e450James Bottomley		   DDB0_FIELDA(port_map_by_links, 0),
8272908d778ab3e244900c310974e1fc1c69066e450James Bottomley		   DDB0_FIELDA(port_map_by_links, 1),
8282908d778ab3e244900c310974e1fc1c69066e450James Bottomley		   DDB0_FIELDA(port_map_by_links, 2),
8292908d778ab3e244900c310974e1fc1c69066e450James Bottomley		   DDB0_FIELDA(port_map_by_links, 3),
8302908d778ab3e244900c310974e1fc1c69066e450James Bottomley		   DDB0_FIELDA(port_map_by_links, 4),
8312908d778ab3e244900c310974e1fc1c69066e450James Bottomley		   DDB0_FIELDA(port_map_by_links, 5),
8322908d778ab3e244900c310974e1fc1c69066e450James Bottomley		   DDB0_FIELDA(port_map_by_links, 6),
8332908d778ab3e244900c310974e1fc1c69066e450James Bottomley		   DDB0_FIELDA(port_map_by_links, 7));
8342908d778ab3e244900c310974e1fc1c69066e450James Bottomley}
8352908d778ab3e244900c310974e1fc1c69066e450James Bottomley
8362908d778ab3e244900c310974e1fc1c69066e450James Bottomleystatic void asd_dump_scb_site(struct asd_ha_struct *asd_ha, u16 site_no)
8372908d778ab3e244900c310974e1fc1c69066e450James Bottomley{
8382908d778ab3e244900c310974e1fc1c69066e450James Bottomley
8392908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define SCB_FIELDB(__name)                                                 \
8402908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_scbsite_read_byte(asd_ha, site_no, sizeof(struct scb_header)   \
8412908d778ab3e244900c310974e1fc1c69066e450James Bottomley			      + offsetof(struct initiate_ssp_task, __name))
8422908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define SCB_FIELDW(__name)                                                 \
8432908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_scbsite_read_word(asd_ha, site_no, sizeof(struct scb_header)   \
8442908d778ab3e244900c310974e1fc1c69066e450James Bottomley			      + offsetof(struct initiate_ssp_task, __name))
8452908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define SCB_FIELDD(__name)                                                 \
8462908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_scbsite_read_dword(asd_ha, site_no, sizeof(struct scb_header)  \
8472908d778ab3e244900c310974e1fc1c69066e450James Bottomley			       + offsetof(struct initiate_ssp_task, __name))
8482908d778ab3e244900c310974e1fc1c69066e450James Bottomley
8492908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("Total Xfer Len: 0x%08x.\n", SCB_FIELDD(total_xfer_len));
8502908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("Frame Type: 0x%02x.\n", SCB_FIELDB(ssp_frame.frame_type));
8512908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("Tag: 0x%04x.\n", SCB_FIELDW(ssp_frame.tag));
8522908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("Target Port Xfer Tag: 0x%04x.\n",
8532908d778ab3e244900c310974e1fc1c69066e450James Bottomley		   SCB_FIELDW(ssp_frame.tptt));
8542908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("Data Offset: 0x%08x.\n", SCB_FIELDW(ssp_frame.data_offs));
8552908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("Retry Count: 0x%02x.\n", SCB_FIELDB(retry_count));
8562908d778ab3e244900c310974e1fc1c69066e450James Bottomley}
8572908d778ab3e244900c310974e1fc1c69066e450James Bottomley
8582908d778ab3e244900c310974e1fc1c69066e450James Bottomley/**
8592908d778ab3e244900c310974e1fc1c69066e450James Bottomley * asd_dump_scb_sites -- dump currently used CSEQ SCB sites
8602908d778ab3e244900c310974e1fc1c69066e450James Bottomley * @asd_ha: pointer to host adapter struct
8612908d778ab3e244900c310974e1fc1c69066e450James Bottomley */
8622908d778ab3e244900c310974e1fc1c69066e450James Bottomleyvoid asd_dump_scb_sites(struct asd_ha_struct *asd_ha)
8632908d778ab3e244900c310974e1fc1c69066e450James Bottomley{
8642908d778ab3e244900c310974e1fc1c69066e450James Bottomley	u16	site_no;
8652908d778ab3e244900c310974e1fc1c69066e450James Bottomley
8662908d778ab3e244900c310974e1fc1c69066e450James Bottomley	for (site_no = 0; site_no < asd_ha->hw_prof.max_scbs; site_no++) {
8672908d778ab3e244900c310974e1fc1c69066e450James Bottomley		u8 opcode;
8682908d778ab3e244900c310974e1fc1c69066e450James Bottomley
8692908d778ab3e244900c310974e1fc1c69066e450James Bottomley		if (!SCB_SITE_VALID(site_no))
8702908d778ab3e244900c310974e1fc1c69066e450James Bottomley			continue;
8712908d778ab3e244900c310974e1fc1c69066e450James Bottomley
8722908d778ab3e244900c310974e1fc1c69066e450James Bottomley		/* We are only interested in SCB sites currently used.
8732908d778ab3e244900c310974e1fc1c69066e450James Bottomley		 */
8742908d778ab3e244900c310974e1fc1c69066e450James Bottomley		opcode = asd_scbsite_read_byte(asd_ha, site_no,
8752908d778ab3e244900c310974e1fc1c69066e450James Bottomley					       offsetof(struct scb_header,
8762908d778ab3e244900c310974e1fc1c69066e450James Bottomley							opcode));
8772908d778ab3e244900c310974e1fc1c69066e450James Bottomley		if (opcode == 0xFF)
8782908d778ab3e244900c310974e1fc1c69066e450James Bottomley			continue;
8792908d778ab3e244900c310974e1fc1c69066e450James Bottomley
8802908d778ab3e244900c310974e1fc1c69066e450James Bottomley		asd_printk("\nSCB: 0x%x\n", site_no);
8812908d778ab3e244900c310974e1fc1c69066e450James Bottomley		asd_dump_scb_site(asd_ha, site_no);
8822908d778ab3e244900c310974e1fc1c69066e450James Bottomley	}
8832908d778ab3e244900c310974e1fc1c69066e450James Bottomley}
8842908d778ab3e244900c310974e1fc1c69066e450James Bottomley
88581e56ded878aeb8730f18c1d0a70d5face788be3Adrian Bunk#endif  /*  0  */
88681e56ded878aeb8730f18c1d0a70d5face788be3Adrian Bunk
8872908d778ab3e244900c310974e1fc1c69066e450James Bottomley/**
8882908d778ab3e244900c310974e1fc1c69066e450James Bottomley * ads_dump_seq_state -- dump CSEQ and LSEQ states
8892908d778ab3e244900c310974e1fc1c69066e450James Bottomley * @asd_ha: pointer to host adapter structure
8902908d778ab3e244900c310974e1fc1c69066e450James Bottomley * @lseq_mask: mask of LSEQs of interest
8912908d778ab3e244900c310974e1fc1c69066e450James Bottomley */
8922908d778ab3e244900c310974e1fc1c69066e450James Bottomleyvoid asd_dump_seq_state(struct asd_ha_struct *asd_ha, u8 lseq_mask)
8932908d778ab3e244900c310974e1fc1c69066e450James Bottomley{
8942908d778ab3e244900c310974e1fc1c69066e450James Bottomley	int lseq;
8952908d778ab3e244900c310974e1fc1c69066e450James Bottomley
8962908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_dump_cseq_state(asd_ha);
8972908d778ab3e244900c310974e1fc1c69066e450James Bottomley
8982908d778ab3e244900c310974e1fc1c69066e450James Bottomley	if (lseq_mask != 0)
8992908d778ab3e244900c310974e1fc1c69066e450James Bottomley		for_each_sequencer(lseq_mask, lseq_mask, lseq)
9002908d778ab3e244900c310974e1fc1c69066e450James Bottomley			asd_dump_lseq_state(asd_ha, lseq);
9012908d778ab3e244900c310974e1fc1c69066e450James Bottomley}
9022908d778ab3e244900c310974e1fc1c69066e450James Bottomley
9032908d778ab3e244900c310974e1fc1c69066e450James Bottomleyvoid asd_dump_frame_rcvd(struct asd_phy *phy,
9042908d778ab3e244900c310974e1fc1c69066e450James Bottomley			 struct done_list_struct *dl)
9052908d778ab3e244900c310974e1fc1c69066e450James Bottomley{
9062908d778ab3e244900c310974e1fc1c69066e450James Bottomley	unsigned long flags;
9072908d778ab3e244900c310974e1fc1c69066e450James Bottomley	int i;
9082908d778ab3e244900c310974e1fc1c69066e450James Bottomley
9092908d778ab3e244900c310974e1fc1c69066e450James Bottomley	switch ((dl->status_block[1] & 0x70) >> 3) {
9105929faf3334f4c69f3bb02be59d7c127e0cefa1fDarrick J. Wong	case SAS_PROTOCOL_STP:
9112908d778ab3e244900c310974e1fc1c69066e450James Bottomley		ASD_DPRINTK("STP proto device-to-host FIS:\n");
9122908d778ab3e244900c310974e1fc1c69066e450James Bottomley		break;
9132908d778ab3e244900c310974e1fc1c69066e450James Bottomley	default:
9145929faf3334f4c69f3bb02be59d7c127e0cefa1fDarrick J. Wong	case SAS_PROTOCOL_SSP:
9152908d778ab3e244900c310974e1fc1c69066e450James Bottomley		ASD_DPRINTK("SAS proto IDENTIFY:\n");
9162908d778ab3e244900c310974e1fc1c69066e450James Bottomley		break;
9172908d778ab3e244900c310974e1fc1c69066e450James Bottomley	}
9182908d778ab3e244900c310974e1fc1c69066e450James Bottomley	spin_lock_irqsave(&phy->sas_phy.frame_rcvd_lock, flags);
9192908d778ab3e244900c310974e1fc1c69066e450James Bottomley	for (i = 0; i < phy->sas_phy.frame_rcvd_size; i+=4)
9202908d778ab3e244900c310974e1fc1c69066e450James Bottomley		ASD_DPRINTK("%02x: %02x %02x %02x %02x\n",
9212908d778ab3e244900c310974e1fc1c69066e450James Bottomley			    i,
9222908d778ab3e244900c310974e1fc1c69066e450James Bottomley			    phy->frame_rcvd[i],
9232908d778ab3e244900c310974e1fc1c69066e450James Bottomley			    phy->frame_rcvd[i+1],
9242908d778ab3e244900c310974e1fc1c69066e450James Bottomley			    phy->frame_rcvd[i+2],
9252908d778ab3e244900c310974e1fc1c69066e450James Bottomley			    phy->frame_rcvd[i+3]);
9262908d778ab3e244900c310974e1fc1c69066e450James Bottomley	spin_unlock_irqrestore(&phy->sas_phy.frame_rcvd_lock, flags);
9272908d778ab3e244900c310974e1fc1c69066e450James Bottomley}
9282908d778ab3e244900c310974e1fc1c69066e450James Bottomley
92981e56ded878aeb8730f18c1d0a70d5face788be3Adrian Bunk#if 0
93081e56ded878aeb8730f18c1d0a70d5face788be3Adrian Bunk
93181e56ded878aeb8730f18c1d0a70d5face788be3Adrian Bunkstatic void asd_dump_scb(struct asd_ascb *ascb, int ind)
9322908d778ab3e244900c310974e1fc1c69066e450James Bottomley{
9332908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("scb%d: vaddr: 0x%p, dma_handle: 0x%llx, next: 0x%llx, "
9342908d778ab3e244900c310974e1fc1c69066e450James Bottomley		   "index:%d, opcode:0x%02x\n",
9352908d778ab3e244900c310974e1fc1c69066e450James Bottomley		   ind, ascb->dma_scb.vaddr,
9362908d778ab3e244900c310974e1fc1c69066e450James Bottomley		   (unsigned long long)ascb->dma_scb.dma_handle,
9372908d778ab3e244900c310974e1fc1c69066e450James Bottomley		   (unsigned long long)
9382908d778ab3e244900c310974e1fc1c69066e450James Bottomley		   le64_to_cpu(ascb->scb->header.next_scb),
9392908d778ab3e244900c310974e1fc1c69066e450James Bottomley		   le16_to_cpu(ascb->scb->header.index),
9402908d778ab3e244900c310974e1fc1c69066e450James Bottomley		   ascb->scb->header.opcode);
9412908d778ab3e244900c310974e1fc1c69066e450James Bottomley}
9422908d778ab3e244900c310974e1fc1c69066e450James Bottomley
9432908d778ab3e244900c310974e1fc1c69066e450James Bottomleyvoid asd_dump_scb_list(struct asd_ascb *ascb, int num)
9442908d778ab3e244900c310974e1fc1c69066e450James Bottomley{
9452908d778ab3e244900c310974e1fc1c69066e450James Bottomley	int i = 0;
9462908d778ab3e244900c310974e1fc1c69066e450James Bottomley
9472908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_printk("dumping %d scbs:\n", num);
9482908d778ab3e244900c310974e1fc1c69066e450James Bottomley
9492908d778ab3e244900c310974e1fc1c69066e450James Bottomley	asd_dump_scb(ascb, i++);
9502908d778ab3e244900c310974e1fc1c69066e450James Bottomley	--num;
9512908d778ab3e244900c310974e1fc1c69066e450James Bottomley
9522908d778ab3e244900c310974e1fc1c69066e450James Bottomley	if (num > 0 && !list_empty(&ascb->list)) {
9532908d778ab3e244900c310974e1fc1c69066e450James Bottomley		struct list_head *el;
9542908d778ab3e244900c310974e1fc1c69066e450James Bottomley
9552908d778ab3e244900c310974e1fc1c69066e450James Bottomley		list_for_each(el, &ascb->list) {
9562908d778ab3e244900c310974e1fc1c69066e450James Bottomley			struct asd_ascb *s = list_entry(el, struct asd_ascb,
9572908d778ab3e244900c310974e1fc1c69066e450James Bottomley							list);
9582908d778ab3e244900c310974e1fc1c69066e450James Bottomley			asd_dump_scb(s, i++);
9592908d778ab3e244900c310974e1fc1c69066e450James Bottomley			if (--num <= 0)
9602908d778ab3e244900c310974e1fc1c69066e450James Bottomley				break;
9612908d778ab3e244900c310974e1fc1c69066e450James Bottomley		}
9622908d778ab3e244900c310974e1fc1c69066e450James Bottomley	}
9632908d778ab3e244900c310974e1fc1c69066e450James Bottomley}
9642908d778ab3e244900c310974e1fc1c69066e450James Bottomley
96581e56ded878aeb8730f18c1d0a70d5face788be3Adrian Bunk#endif  /*  0  */
96681e56ded878aeb8730f18c1d0a70d5face788be3Adrian Bunk
9672908d778ab3e244900c310974e1fc1c69066e450James Bottomley#endif /* ASD_DEBUG */
968