13526Sxy150489 /* 23526Sxy150489 * This file is provided under a CDDLv1 license. When using or 33526Sxy150489 * redistributing this file, you may do so under this license. 43526Sxy150489 * In redistributing this file this license must be included 53526Sxy150489 * and no other modification of this header file is permitted. 63526Sxy150489 * 73526Sxy150489 * CDDL LICENSE SUMMARY 83526Sxy150489 * 93526Sxy150489 * Copyright(c) 1999 - 2007 Intel Corporation. All rights reserved. 103526Sxy150489 * 113526Sxy150489 * The contents of this file are subject to the terms of Version 123526Sxy150489 * 1.0 of the Common Development and Distribution License (the "License"). 133526Sxy150489 * 143526Sxy150489 * You should have received a copy of the License with this software. 153526Sxy150489 * You can obtain a copy of the License at 163526Sxy150489 * http://www.opensolaris.org/os/licensing. 173526Sxy150489 * See the License for the specific language governing permissions 183526Sxy150489 * and limitations under the License. 193526Sxy150489 */ 203526Sxy150489 213526Sxy150489 /* 223526Sxy150489 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 233526Sxy150489 * Use is subject to license terms of the CDDLv1. 243526Sxy150489 */ 253526Sxy150489 263526Sxy150489 #pragma ident "%Z%%M% %I% %E% SMI" 273526Sxy150489 283526Sxy150489 /* 293526Sxy150489 * ********************************************************************** 303526Sxy150489 * * 313526Sxy150489 * Module Name: * 324919Sxy150489 * e1000g_debug.c * 333526Sxy150489 * * 343526Sxy150489 * Abstract: * 354919Sxy150489 * This module includes the debug routines * 363526Sxy150489 * * 373526Sxy150489 * ********************************************************************** 383526Sxy150489 */ 393526Sxy150489 #ifdef GCC 403526Sxy150489 #ifdef __STDC__ 413526Sxy150489 #include <stdarg.h> 423526Sxy150489 #else 433526Sxy150489 #include <varargs.h> 443526Sxy150489 #endif 453526Sxy150489 #define _SYS_VARARGS_H 463526Sxy150489 #endif 473526Sxy150489 484919Sxy150489 #include "e1000g_debug.h" 493526Sxy150489 #include "e1000g_sw.h" 50*5082Syy150190 #ifdef E1000G_DEBUG 51*5082Syy150190 #include <sys/pcie.h> 52*5082Syy150190 #endif 534919Sxy150489 544919Sxy150489 #ifdef E1000G_DEBUG 55*5082Syy150190 #define WPL 8 /* 8 16-bit words per line */ 56*5082Syy150190 #define NUM_REGS 185 /* must match the array initializer */ 57*5082Syy150190 typedef struct { 58*5082Syy150190 char name[10]; 59*5082Syy150190 uint32_t offset; 60*5082Syy150190 } Regi_t; 614919Sxy150489 int e1000g_debug = E1000G_WARN_LEVEL; 624919Sxy150489 #endif 634919Sxy150489 int e1000g_log_mode = E1000G_LOG_PRINT; 643526Sxy150489 653526Sxy150489 void 664919Sxy150489 e1000g_log(void *instance, int level, char *fmt, ...) 673526Sxy150489 { 684919Sxy150489 struct e1000g *Adapter = (struct e1000g *)instance; 693526Sxy150489 auto char name[NAMELEN]; 703526Sxy150489 auto char buf[BUFSZ]; 713526Sxy150489 va_list ap; 723526Sxy150489 734919Sxy150489 switch (level) { 744919Sxy150489 #ifdef E1000G_DEBUG 754919Sxy150489 case E1000G_VERBOSE_LEVEL: /* 16 or 0x010 */ 764919Sxy150489 if (e1000g_debug < E1000G_VERBOSE_LEVEL) 774919Sxy150489 return; 784919Sxy150489 level = CE_CONT; 794919Sxy150489 break; 804919Sxy150489 814919Sxy150489 case E1000G_TRACE_LEVEL: /* 8 or 0x008 */ 824919Sxy150489 if (e1000g_debug < E1000G_TRACE_LEVEL) 834919Sxy150489 return; 844919Sxy150489 level = CE_CONT; 854919Sxy150489 break; 864919Sxy150489 874919Sxy150489 case E1000G_INFO_LEVEL: /* 4 or 0x004 */ 884919Sxy150489 if (e1000g_debug < E1000G_INFO_LEVEL) 894919Sxy150489 return; 904919Sxy150489 level = CE_CONT; 914919Sxy150489 break; 924919Sxy150489 934919Sxy150489 case E1000G_WARN_LEVEL: /* 2 or 0x002 */ 944919Sxy150489 if (e1000g_debug < E1000G_WARN_LEVEL) 954919Sxy150489 return; 964919Sxy150489 level = CE_CONT; 974919Sxy150489 break; 984919Sxy150489 994919Sxy150489 case E1000G_ERRS_LEVEL: /* 1 or 0x001 */ 1004919Sxy150489 level = CE_CONT; 1014919Sxy150489 break; 1024919Sxy150489 #else 1034919Sxy150489 case CE_CONT: 1044919Sxy150489 case CE_NOTE: 1054919Sxy150489 case CE_WARN: 1064919Sxy150489 case CE_PANIC: 1074919Sxy150489 break; 1084919Sxy150489 #endif 1094919Sxy150489 default: 1104919Sxy150489 level = CE_CONT; 1114919Sxy150489 break; 1124919Sxy150489 } 1134919Sxy150489 1143526Sxy150489 if (Adapter != NULL) { 1153526Sxy150489 (void) sprintf(name, "%s - e1000g[%d] ", 1163526Sxy150489 ddi_get_name(Adapter->dip), ddi_get_instance(Adapter->dip)); 1173526Sxy150489 } else { 1183526Sxy150489 (void) sprintf(name, "e1000g"); 1193526Sxy150489 } 1203526Sxy150489 /* 1213526Sxy150489 * va_start uses built in macro __builtin_va_alist from the 1223526Sxy150489 * compiler libs which requires compiler system to have 1233526Sxy150489 * __BUILTIN_VA_ARG_INCR defined. 1243526Sxy150489 */ 1253526Sxy150489 /* 1263526Sxy150489 * Many compilation systems depend upon the use of special functions 1273526Sxy150489 * built into the the compilation system to handle variable argument 1283526Sxy150489 * lists and stack allocations. The method to obtain this in SunOS 1293526Sxy150489 * is to define the feature test macro "__BUILTIN_VA_ARG_INCR" which 1303526Sxy150489 * enables the following special built-in functions: 1313526Sxy150489 * __builtin_alloca 1323526Sxy150489 * __builtin_va_alist 1333526Sxy150489 * __builtin_va_arg_incr 1343526Sxy150489 * It is intended that the compilation system define this feature test 1353526Sxy150489 * macro, not the user of the system. 1363526Sxy150489 * 1373526Sxy150489 * The tests on the processor type are to provide a transitional period 1383526Sxy150489 * for existing compilation systems, and may be removed in a future 1393526Sxy150489 * release. 1403526Sxy150489 */ 1413526Sxy150489 /* 1423526Sxy150489 * Using GNU gcc compiler it doesn't expand to va_start.... 1433526Sxy150489 */ 1443526Sxy150489 va_start(ap, fmt); 1453526Sxy150489 (void) vsprintf(buf, fmt, ap); 1463526Sxy150489 va_end(ap); 1473526Sxy150489 1484919Sxy150489 if ((e1000g_log_mode & E1000G_LOG_ALL) == E1000G_LOG_ALL) 1493526Sxy150489 cmn_err(level, "%s: %s", name, buf); 1504919Sxy150489 else if (e1000g_log_mode & E1000G_LOG_DISPLAY) 1514919Sxy150489 cmn_err(level, "^%s: %s", name, buf); 1524919Sxy150489 else if (e1000g_log_mode & E1000G_LOG_PRINT) 1534919Sxy150489 cmn_err(level, "!%s: %s", name, buf); 1544919Sxy150489 else /* if they are not set properly then do both */ 1554919Sxy150489 cmn_err(level, "%s: %s", name, buf); 1563526Sxy150489 } 157*5082Syy150190 158*5082Syy150190 159*5082Syy150190 160*5082Syy150190 #ifdef E1000G_DEBUG 161*5082Syy150190 void 162*5082Syy150190 eeprom_dump(void *instance) 163*5082Syy150190 { 164*5082Syy150190 struct e1000g *Adapter = (struct e1000g *)instance; 165*5082Syy150190 struct e1000_hw *hw = &Adapter->shared; 166*5082Syy150190 uint16_t eeprom[WPL], size_field; 167*5082Syy150190 int i, ret, sign, size, lines, offset = 0; 168*5082Syy150190 int ee_size[] = 169*5082Syy150190 {128, 256, 512, 1024, 2048, 4096, 16 * 1024, 32 * 1024, 64 * 1024}; 170*5082Syy150190 171*5082Syy150190 if (ret = e1000_read_nvm(hw, 0x12, 1, &size_field)) { 172*5082Syy150190 e1000g_log(Adapter, CE_WARN, 173*5082Syy150190 "e1000_read_nvm failed to read size: %d", ret); 174*5082Syy150190 return; 175*5082Syy150190 } 176*5082Syy150190 177*5082Syy150190 sign = (size_field & 0xc000) >> 14; 178*5082Syy150190 if (sign != 1) { 179*5082Syy150190 e1000g_log(Adapter, CE_WARN, 180*5082Syy150190 "eeprom_dump invalid signature: %d", sign); 181*5082Syy150190 } 182*5082Syy150190 183*5082Syy150190 size = (size_field & 0x3c00) >> 10; 184*5082Syy150190 if (size < 0 || size > 11) { 185*5082Syy150190 e1000g_log(Adapter, CE_WARN, 186*5082Syy150190 "eeprom_dump invalid size: %d", size); 187*5082Syy150190 } 188*5082Syy150190 189*5082Syy150190 e1000g_log(Adapter, CE_CONT, 190*5082Syy150190 "eeprom_dump size field: %d eeprom bytes: %d\n", 191*5082Syy150190 size, ee_size[size]); 192*5082Syy150190 193*5082Syy150190 e1000g_log(Adapter, CE_CONT, 194*5082Syy150190 "e1000_read_nvm hebs: %d\n", ((size_field & 0x000f) >> 10)); 195*5082Syy150190 196*5082Syy150190 lines = ee_size[size] / WPL / 2; 197*5082Syy150190 e1000g_log(Adapter, CE_CONT, 198*5082Syy150190 "dump eeprom %d lines of %d words per line\n", lines, WPL); 199*5082Syy150190 200*5082Syy150190 for (i = 0; i < lines; i++) { 201*5082Syy150190 if (ret = e1000_read_nvm(hw, offset, WPL, eeprom)) { 202*5082Syy150190 e1000g_log(Adapter, CE_WARN, 203*5082Syy150190 "e1000_read_nvm failed: %d", ret); 204*5082Syy150190 return; 205*5082Syy150190 } 206*5082Syy150190 207*5082Syy150190 e1000g_log(Adapter, CE_CONT, 208*5082Syy150190 "0x%04x %04x %04x %04x %04x %04x %04x %04x %04x\n", 209*5082Syy150190 offset, 210*5082Syy150190 eeprom[0], eeprom[1], eeprom[2], eeprom[3], 211*5082Syy150190 eeprom[4], eeprom[5], eeprom[6], eeprom[7]); 212*5082Syy150190 offset += WPL; 213*5082Syy150190 } 214*5082Syy150190 } 215*5082Syy150190 216*5082Syy150190 /* 217*5082Syy150190 * phy_dump - dump important phy registers 218*5082Syy150190 */ 219*5082Syy150190 void 220*5082Syy150190 phy_dump(void *instance) 221*5082Syy150190 { 222*5082Syy150190 struct e1000g *Adapter = (struct e1000g *)instance; 223*5082Syy150190 struct e1000_hw *hw = &Adapter->shared; 224*5082Syy150190 /* offset to each phy register */ 225*5082Syy150190 int32_t offset[] = 226*5082Syy150190 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 227*5082Syy150190 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 228*5082Syy150190 30, 31, 0x1796, 0x187A, 0x1895, 0x1F30, 0x1F35, 0x1F3E, 0x1F54, 229*5082Syy150190 0x1F55, 0x1F56, 0x1F72, 0x1F76, 0x1F77, 0x1F78, 0x1F79, 0x1F98, 230*5082Syy150190 0x2010, 0x2011, 0x20DC, 0x20DD, 0x20DE, 0x28B4, 0x2F52, 0x2F5B, 231*5082Syy150190 0x2F70, 0x2F90, 0x2FB1, 0x2FB2 }; 232*5082Syy150190 uint16_t value; /* register value */ 233*5082Syy150190 uint32_t stat; /* status from e1000_read_phy_reg */ 234*5082Syy150190 int i; 235*5082Syy150190 236*5082Syy150190 e1000g_log(Adapter, CE_CONT, "Begin PHY dump\n"); 237*5082Syy150190 for (i = 0; i < ((sizeof (offset)) / sizeof (offset[0])); i++) { 238*5082Syy150190 239*5082Syy150190 stat = e1000_read_phy_reg(hw, offset[i], &value); 240*5082Syy150190 if (stat == 0) { 241*5082Syy150190 e1000g_log(Adapter, CE_CONT, 242*5082Syy150190 "phyreg offset: %d value: 0x%x\n", 243*5082Syy150190 offset[i], value); 244*5082Syy150190 } else { 245*5082Syy150190 e1000g_log(Adapter, CE_WARN, 246*5082Syy150190 "phyreg offset: %d ERROR: 0x%x\n", 247*5082Syy150190 offset[i], stat); 248*5082Syy150190 } 249*5082Syy150190 } 250*5082Syy150190 } 251*5082Syy150190 252*5082Syy150190 uint32_t 253*5082Syy150190 e1000_read_reg(struct e1000_hw *hw, uint32_t offset) 254*5082Syy150190 { 255*5082Syy150190 return (ddi_get32(((struct e1000g_osdep *)(hw)->back)->reg_handle, 256*5082Syy150190 (uint32_t *)((hw)->hw_addr + offset))); 257*5082Syy150190 } 258*5082Syy150190 259*5082Syy150190 260*5082Syy150190 /* 261*5082Syy150190 * mac_dump - dump important mac registers 262*5082Syy150190 */ 263*5082Syy150190 void 264*5082Syy150190 mac_dump(void *instance) 265*5082Syy150190 { 266*5082Syy150190 struct e1000g *Adapter = (struct e1000g *)instance; 267*5082Syy150190 struct e1000_hw *hw = &Adapter->shared; 268*5082Syy150190 int i; 269*5082Syy150190 270*5082Syy150190 /* {name, offset} for each mac register */ 271*5082Syy150190 Regi_t macreg[NUM_REGS] = { 272*5082Syy150190 {"CTRL", E1000_CTRL}, {"STATUS", E1000_STATUS}, 273*5082Syy150190 {"EECD", E1000_EECD}, {"EERD", E1000_EERD}, 274*5082Syy150190 {"CTRL_EXT", E1000_CTRL_EXT}, {"FLA", E1000_FLA}, 275*5082Syy150190 {"MDIC", E1000_MDIC}, {"SCTL", E1000_SCTL}, 276*5082Syy150190 {"FCAL", E1000_FCAL}, {"FCAH", E1000_FCAH}, 277*5082Syy150190 {"FCT", E1000_FCT}, {"VET", E1000_VET}, 278*5082Syy150190 {"ICR", E1000_ICR}, {"ITR", E1000_ITR}, 279*5082Syy150190 {"ICS", E1000_ICS}, {"IMS", E1000_IMS}, 280*5082Syy150190 {"IMC", E1000_IMC}, {"IAM", E1000_IAM}, 281*5082Syy150190 {"RCTL", E1000_RCTL}, {"FCTTV", E1000_FCTTV}, 282*5082Syy150190 {"TXCW", E1000_TXCW}, {"RXCW", E1000_RXCW}, 283*5082Syy150190 {"TCTL", E1000_TCTL}, {"TIPG", E1000_TIPG}, 284*5082Syy150190 {"AIT", E1000_AIT}, {"LEDCTL", E1000_LEDCTL}, 285*5082Syy150190 {"PBA", E1000_PBA}, {"PBS", E1000_PBS}, 286*5082Syy150190 {"EEMNGCTL", E1000_EEMNGCTL}, {"ERT", E1000_ERT}, 287*5082Syy150190 {"FCRTL", E1000_FCRTL}, {"FCRTH", E1000_FCRTH}, 288*5082Syy150190 {"PSRCTL", E1000_PSRCTL}, {"RDBAL", E1000_RDBAL}, 289*5082Syy150190 {"RDBAH", E1000_RDBAH}, {"RDLEN", E1000_RDLEN}, 290*5082Syy150190 {"RDH", E1000_RDH}, {"RDT", E1000_RDT}, 291*5082Syy150190 {"RDTR", E1000_RDTR}, {"RXDCTL", E1000_RXDCTL}, 292*5082Syy150190 {"RADV", E1000_RADV}, {"RDBAL1", E1000_RDBAL1}, 293*5082Syy150190 {"RDBAH1", E1000_RDBAH1}, {"RDLEN1", E1000_RDLEN1}, 294*5082Syy150190 {"RDH1", E1000_RDH1}, {"RDT1", E1000_RDT1}, 295*5082Syy150190 {"RXDCTL1", E1000_RXDCTL1}, {"RSRPD", E1000_RSRPD}, 296*5082Syy150190 {"RAID", E1000_RAID}, {"CPUVEC", E1000_CPUVEC}, 297*5082Syy150190 {"TDFH", E1000_TDFH}, {"TDFT", E1000_TDFT}, 298*5082Syy150190 {"TDFHS", E1000_TDFHS}, {"TDFTS", E1000_TDFTS}, 299*5082Syy150190 {"TDFPC", E1000_TDFPC}, {"TDBAL", E1000_TDBAL}, 300*5082Syy150190 {"TDBAH", E1000_TDBAH}, {"TDLEN", E1000_TDLEN}, 301*5082Syy150190 {"TDH", E1000_TDH}, {"TDT", E1000_TDT}, 302*5082Syy150190 {"TIDV", E1000_TIDV}, {"TXDCTL", E1000_TXDCTL}, 303*5082Syy150190 {"TADV", E1000_TADV}, {"TARC0", E1000_TARC0}, 304*5082Syy150190 {"TDBAL1", E1000_TDBAL1}, {"TDBAH1", E1000_TDBAH1}, 305*5082Syy150190 {"TDLEN1", E1000_TDLEN1}, {"TDH1", E1000_TDH1}, 306*5082Syy150190 {"TDT1", E1000_TDT1}, {"TXDCTL1", E1000_TXDCTL1}, 307*5082Syy150190 {"TARC1", E1000_TARC1}, {"ALGNERRC", E1000_ALGNERRC}, 308*5082Syy150190 {"RXERRC", E1000_RXERRC}, {"MPC", E1000_MPC}, 309*5082Syy150190 {"SCC", E1000_SCC}, {"ECOL", E1000_ECOL}, 310*5082Syy150190 {"MCC", E1000_MCC}, {"LATECOL", E1000_LATECOL}, 311*5082Syy150190 {"COLC", E1000_COLC}, {"DC", E1000_DC}, 312*5082Syy150190 {"TNCRS", E1000_TNCRS}, {"SEC", E1000_SEC}, 313*5082Syy150190 {"CEXTERR", E1000_CEXTERR}, {"RLEC", E1000_RLEC}, 314*5082Syy150190 {"XONRXC", E1000_XONRXC}, {"XONTXC", E1000_XONTXC}, 315*5082Syy150190 {"XOFFRXC", E1000_XOFFRXC}, {"XOFFTXC", E1000_XOFFTXC}, 316*5082Syy150190 {"FCRUC", E1000_FCRUC}, {"PRC64", E1000_PRC64}, 317*5082Syy150190 {"PRC127", E1000_PRC127}, {"PRC255", E1000_PRC255}, 318*5082Syy150190 {"PRC511", E1000_PRC511}, {"PRC1023", E1000_PRC1023}, 319*5082Syy150190 {"PRC1522", E1000_PRC1522}, {"GPRC", E1000_GPRC}, 320*5082Syy150190 {"BPRC", E1000_BPRC}, {"MPRC", E1000_MPRC}, 321*5082Syy150190 {"GPTC", E1000_GPTC}, {"GORCL", E1000_GORCL}, 322*5082Syy150190 {"GORCH", E1000_GORCH}, {"GOTCL", E1000_GOTCL}, 323*5082Syy150190 {"GOTCH", E1000_GOTCH}, {"RNBC", E1000_RNBC}, 324*5082Syy150190 {"RUC", E1000_RUC}, {"RFC", E1000_RFC}, 325*5082Syy150190 {"ROC", E1000_ROC}, {"RJC", E1000_RJC}, 326*5082Syy150190 {"MGTPRC", E1000_MGTPRC}, {"MGTPDC", E1000_MGTPDC}, 327*5082Syy150190 {"MGTPTC", E1000_MGTPTC}, {"TORL", E1000_TORL}, 328*5082Syy150190 {"TORH", E1000_TORH}, {"TOTL", E1000_TOTL}, 329*5082Syy150190 {"TOTH", E1000_TOTH}, {"TPR", E1000_TPR}, 330*5082Syy150190 {"TPT", E1000_TPT}, {"PTC64", E1000_PTC64}, 331*5082Syy150190 {"PTC127", E1000_PTC127}, {"PTC255", E1000_PTC255}, 332*5082Syy150190 {"PTC511", E1000_PTC511}, {"PTC1023", E1000_PTC1023}, 333*5082Syy150190 {"PTC1522", E1000_PTC1522}, {"MPTC", E1000_MPTC}, 334*5082Syy150190 {"BPTC", E1000_BPTC}, {"TSCTC", E1000_TSCTC}, 335*5082Syy150190 {"TSCTFC", E1000_TSCTFC}, {"IAC", E1000_IAC}, 336*5082Syy150190 {"ICRXPTC", E1000_ICRXPTC}, {"ICRXATC", E1000_ICRXATC}, 337*5082Syy150190 {"ICTXPTC", E1000_ICTXPTC}, {"ICTXATC", E1000_ICTXATC}, 338*5082Syy150190 {"ICTXQEC", E1000_ICTXQEC}, {"ICTXQMTC", E1000_ICTXQMTC}, 339*5082Syy150190 {"ICRXDMTC", E1000_ICRXDMTC}, {"ICRXOC", E1000_ICRXOC}, 340*5082Syy150190 {"RXCSUM", E1000_RXCSUM}, {"RFCTL", E1000_RFCTL}, 341*5082Syy150190 {"WUC", E1000_WUC}, {"WUFC", E1000_WUFC}, 342*5082Syy150190 {"WUS", E1000_WUS}, {"MRQC", E1000_MRQC}, 343*5082Syy150190 {"MANC", E1000_MANC}, {"IPAV", E1000_IPAV}, 344*5082Syy150190 {"MANC2H", E1000_MANC2H}, {"RSSIM", E1000_RSSIM}, 345*5082Syy150190 {"RSSIR", E1000_RSSIR}, {"WUPL", E1000_WUPL}, 346*5082Syy150190 {"GCR", E1000_GCR}, {"GSCL_1", E1000_GSCL_1}, 347*5082Syy150190 {"GSCL_2", E1000_GSCL_2}, {"GSCL_3", E1000_GSCL_3}, 348*5082Syy150190 {"GSCL_4", E1000_GSCL_4}, {"FACTPS", E1000_FACTPS}, 349*5082Syy150190 {"FWSM", E1000_FWSM}, 350*5082Syy150190 351*5082Syy150190 {"CTRL", E1000_CTRL}, {"STATUS", E1000_STATUS}, 352*5082Syy150190 {"RCTL", E1000_RCTL}, {"RDLEN", E1000_RDLEN}, 353*5082Syy150190 {"RDH", E1000_RDH}, {"RDT", E1000_RDT}, 354*5082Syy150190 {"RDTR", E1000_RDTR}, {"TCTL", E1000_TCTL}, 355*5082Syy150190 {"TDBAL", E1000_TDBAL}, {"TDBAH", E1000_TDBAH}, 356*5082Syy150190 {"TDLEN", E1000_TDLEN}, {"TDH", E1000_TDH}, 357*5082Syy150190 {"TDT", E1000_TDT}, {"TIDV", E1000_TIDV}, 358*5082Syy150190 {"TXDCTL", E1000_TXDCTL}, {"TADV", E1000_TADV}, 359*5082Syy150190 {"TARC0", E1000_TARC0}, {"TDBAL1", E1000_TDBAL1}, 360*5082Syy150190 {"TDBAH1", E1000_TDBAH1}, {"TDLEN1", E1000_TDLEN1}, 361*5082Syy150190 {"TDH1", E1000_TDH1}, {"TDT1", E1000_TDT1}, 362*5082Syy150190 {"TXDCTL1", E1000_TXDCTL1}, {"TARC1", E1000_TARC1}, 363*5082Syy150190 {"CTRL_EXT", E1000_CTRL_EXT}, {"ERT", E1000_ERT}, 364*5082Syy150190 {"RDBAL", E1000_RDBAL}, {"RDBAH", E1000_RDBAH}, 365*5082Syy150190 {"RXDCTL", E1000_RXDCTL}, {"TXDMAC", E1000_TXDMAC}, 366*5082Syy150190 }; 367*5082Syy150190 368*5082Syy150190 e1000g_log(Adapter, CE_CONT, "Begin MAC dump\n"); 369*5082Syy150190 370*5082Syy150190 for (i = 0; i < NUM_REGS; i++) { 371*5082Syy150190 e1000g_log(Adapter, CE_CONT, 372*5082Syy150190 "macreg %10s offset: 0x%x value: 0x%x\n", 373*5082Syy150190 macreg[i].name, macreg[i].offset, 374*5082Syy150190 e1000_read_reg(hw, macreg[i].offset)); 375*5082Syy150190 } 376*5082Syy150190 } 377*5082Syy150190 378*5082Syy150190 void 379*5082Syy150190 pciconfig_dump(void *instance) 380*5082Syy150190 { 381*5082Syy150190 struct e1000g *Adapter = (struct e1000g *)instance; 382*5082Syy150190 ddi_acc_handle_t handle; 383*5082Syy150190 uint8_t cap_ptr; 384*5082Syy150190 uint8_t next_ptr; 385*5082Syy150190 off_t offset; 386*5082Syy150190 387*5082Syy150190 handle = Adapter->osdep.cfg_handle; 388*5082Syy150190 389*5082Syy150190 e1000g_log(Adapter, CE_CONT, "Begin dump PCI config space\n"); 390*5082Syy150190 391*5082Syy150190 e1000g_log(Adapter, CE_CONT, 392*5082Syy150190 "PCI_CONF_VENID:\t0x%x\n", 393*5082Syy150190 pci_config_get16(handle, PCI_CONF_VENID)); 394*5082Syy150190 e1000g_log(Adapter, CE_CONT, 395*5082Syy150190 "PCI_CONF_DEVID:\t0x%x\n", 396*5082Syy150190 pci_config_get16(handle, PCI_CONF_DEVID)); 397*5082Syy150190 e1000g_log(Adapter, CE_CONT, 398*5082Syy150190 "PCI_CONF_COMMAND:\t0x%x\n", 399*5082Syy150190 pci_config_get16(handle, PCI_CONF_COMM)); 400*5082Syy150190 e1000g_log(Adapter, CE_CONT, 401*5082Syy150190 "PCI_CONF_STATUS:\t0x%x\n", 402*5082Syy150190 pci_config_get16(handle, PCI_CONF_STAT)); 403*5082Syy150190 e1000g_log(Adapter, CE_CONT, 404*5082Syy150190 "PCI_CONF_REVID:\t0x%x\n", 405*5082Syy150190 pci_config_get8(handle, PCI_CONF_REVID)); 406*5082Syy150190 e1000g_log(Adapter, CE_CONT, 407*5082Syy150190 "PCI_CONF_PROG_CLASS:\t0x%x\n", 408*5082Syy150190 pci_config_get8(handle, PCI_CONF_PROGCLASS)); 409*5082Syy150190 e1000g_log(Adapter, CE_CONT, 410*5082Syy150190 "PCI_CONF_SUB_CLASS:\t0x%x\n", 411*5082Syy150190 pci_config_get8(handle, PCI_CONF_SUBCLASS)); 412*5082Syy150190 e1000g_log(Adapter, CE_CONT, 413*5082Syy150190 "PCI_CONF_BAS_CLASS:\t0x%x\n", 414*5082Syy150190 pci_config_get8(handle, PCI_CONF_BASCLASS)); 415*5082Syy150190 e1000g_log(Adapter, CE_CONT, 416*5082Syy150190 "PCI_CONF_CACHE_LINESZ:\t0x%x\n", 417*5082Syy150190 pci_config_get8(handle, PCI_CONF_CACHE_LINESZ)); 418*5082Syy150190 e1000g_log(Adapter, CE_CONT, 419*5082Syy150190 "PCI_CONF_LATENCY_TIMER:\t0x%x\n", 420*5082Syy150190 pci_config_get8(handle, PCI_CONF_LATENCY_TIMER)); 421*5082Syy150190 e1000g_log(Adapter, CE_CONT, 422*5082Syy150190 "PCI_CONF_HEADER_TYPE:\t0x%x\n", 423*5082Syy150190 pci_config_get8(handle, PCI_CONF_HEADER)); 424*5082Syy150190 e1000g_log(Adapter, CE_CONT, 425*5082Syy150190 "PCI_CONF_BIST:\t0x%x\n", 426*5082Syy150190 pci_config_get8(handle, PCI_CONF_BIST)); 427*5082Syy150190 e1000g_log(Adapter, CE_CONT, 428*5082Syy150190 "PCI_CONF_BASE0:\t0x%x\n", 429*5082Syy150190 pci_config_get32(handle, PCI_CONF_BASE0)); 430*5082Syy150190 e1000g_log(Adapter, CE_CONT, 431*5082Syy150190 "PCI_CONF_BASE1:\t0x%x\n", 432*5082Syy150190 pci_config_get32(handle, PCI_CONF_BASE1)); 433*5082Syy150190 e1000g_log(Adapter, CE_CONT, 434*5082Syy150190 "PCI_CONF_BASE2:\t0x%x\n", 435*5082Syy150190 pci_config_get32(handle, PCI_CONF_BASE2)); 436*5082Syy150190 e1000g_log(Adapter, CE_CONT, 437*5082Syy150190 "PCI_CONF_BASE3:\t0x%x\n", 438*5082Syy150190 pci_config_get32(handle, PCI_CONF_BASE3)); 439*5082Syy150190 e1000g_log(Adapter, CE_CONT, 440*5082Syy150190 "PCI_CONF_BASE4:\t0x%x\n", 441*5082Syy150190 pci_config_get32(handle, PCI_CONF_BASE4)); 442*5082Syy150190 e1000g_log(Adapter, CE_CONT, 443*5082Syy150190 "PCI_CONF_BASE5:\t0x%x\n", 444*5082Syy150190 pci_config_get32(handle, PCI_CONF_BASE5)); 445*5082Syy150190 e1000g_log(Adapter, CE_CONT, 446*5082Syy150190 "PCI_CONF_CIS:\t0x%x\n", 447*5082Syy150190 pci_config_get32(handle, PCI_CONF_CIS)); 448*5082Syy150190 e1000g_log(Adapter, CE_CONT, 449*5082Syy150190 "PCI_CONF_SUBVENID:\t0x%x\n", 450*5082Syy150190 pci_config_get16(handle, PCI_CONF_SUBVENID)); 451*5082Syy150190 e1000g_log(Adapter, CE_CONT, 452*5082Syy150190 "PCI_CONF_SUBSYSID:\t0x%x\n", 453*5082Syy150190 pci_config_get16(handle, PCI_CONF_SUBSYSID)); 454*5082Syy150190 e1000g_log(Adapter, CE_CONT, 455*5082Syy150190 "PCI_CONF_ROM:\t0x%x\n", 456*5082Syy150190 pci_config_get32(handle, PCI_CONF_ROM)); 457*5082Syy150190 458*5082Syy150190 cap_ptr = pci_config_get8(handle, PCI_CONF_CAP_PTR); 459*5082Syy150190 460*5082Syy150190 e1000g_log(Adapter, CE_CONT, 461*5082Syy150190 "PCI_CONF_CAP_PTR:\t0x%x\n", cap_ptr); 462*5082Syy150190 e1000g_log(Adapter, CE_CONT, 463*5082Syy150190 "PCI_CONF_ILINE:\t0x%x\n", 464*5082Syy150190 pci_config_get8(handle, PCI_CONF_ILINE)); 465*5082Syy150190 e1000g_log(Adapter, CE_CONT, 466*5082Syy150190 "PCI_CONF_IPIN:\t0x%x\n", 467*5082Syy150190 pci_config_get8(handle, PCI_CONF_IPIN)); 468*5082Syy150190 e1000g_log(Adapter, CE_CONT, 469*5082Syy150190 "PCI_CONF_MIN_G:\t0x%x\n", 470*5082Syy150190 pci_config_get8(handle, PCI_CONF_MIN_G)); 471*5082Syy150190 e1000g_log(Adapter, CE_CONT, 472*5082Syy150190 "PCI_CONF_MAX_L:\t0x%x\n", 473*5082Syy150190 pci_config_get8(handle, PCI_CONF_MAX_L)); 474*5082Syy150190 475*5082Syy150190 /* Power Management */ 476*5082Syy150190 offset = cap_ptr; 477*5082Syy150190 478*5082Syy150190 e1000g_log(Adapter, CE_CONT, 479*5082Syy150190 "PCI_PM_CAP_ID:\t0x%x\n", 480*5082Syy150190 pci_config_get8(handle, offset)); 481*5082Syy150190 482*5082Syy150190 next_ptr = pci_config_get8(handle, offset + 1); 483*5082Syy150190 484*5082Syy150190 e1000g_log(Adapter, CE_CONT, 485*5082Syy150190 "PCI_PM_NEXT_PTR:\t0x%x\n", next_ptr); 486*5082Syy150190 e1000g_log(Adapter, CE_CONT, 487*5082Syy150190 "PCI_PM_CAP:\t0x%x\n", 488*5082Syy150190 pci_config_get16(handle, offset + PCI_PMCAP)); 489*5082Syy150190 e1000g_log(Adapter, CE_CONT, 490*5082Syy150190 "PCI_PM_CSR:\t0x%x\n", 491*5082Syy150190 pci_config_get16(handle, offset + PCI_PMCSR)); 492*5082Syy150190 e1000g_log(Adapter, CE_CONT, 493*5082Syy150190 "PCI_PM_CSR_BSE:\t0x%x\n", 494*5082Syy150190 pci_config_get8(handle, offset + PCI_PMCSR_BSE)); 495*5082Syy150190 e1000g_log(Adapter, CE_CONT, 496*5082Syy150190 "PCI_PM_DATA:\t0x%x\n", 497*5082Syy150190 pci_config_get8(handle, offset + PCI_PMDATA)); 498*5082Syy150190 499*5082Syy150190 /* MSI Configuration */ 500*5082Syy150190 offset = next_ptr; 501*5082Syy150190 502*5082Syy150190 e1000g_log(Adapter, CE_CONT, 503*5082Syy150190 "PCI_MSI_CAP_ID:\t0x%x\n", 504*5082Syy150190 pci_config_get8(handle, offset)); 505*5082Syy150190 506*5082Syy150190 next_ptr = pci_config_get8(handle, offset + 1); 507*5082Syy150190 508*5082Syy150190 e1000g_log(Adapter, CE_CONT, 509*5082Syy150190 "PCI_MSI_NEXT_PTR:\t0x%x\n", next_ptr); 510*5082Syy150190 e1000g_log(Adapter, CE_CONT, 511*5082Syy150190 "PCI_MSI_CTRL:\t0x%x\n", 512*5082Syy150190 pci_config_get16(handle, offset + PCI_MSI_CTRL)); 513*5082Syy150190 e1000g_log(Adapter, CE_CONT, 514*5082Syy150190 "PCI_MSI_ADDR:\t0x%x\n", 515*5082Syy150190 pci_config_get32(handle, offset + PCI_MSI_ADDR_OFFSET)); 516*5082Syy150190 e1000g_log(Adapter, CE_CONT, 517*5082Syy150190 "PCI_MSI_ADDR_HI:\t0x%x\n", 518*5082Syy150190 pci_config_get32(handle, offset + 0x8)); 519*5082Syy150190 e1000g_log(Adapter, CE_CONT, 520*5082Syy150190 "PCI_MSI_DATA:\t0x%x\n", 521*5082Syy150190 pci_config_get16(handle, offset + 0xC)); 522*5082Syy150190 523*5082Syy150190 /* PCI Express Configuration */ 524*5082Syy150190 offset = next_ptr; 525*5082Syy150190 526*5082Syy150190 e1000g_log(Adapter, CE_CONT, 527*5082Syy150190 "PCIE_CAP_ID:\t0x%x\n", 528*5082Syy150190 pci_config_get8(handle, offset + PCIE_CAP_ID)); 529*5082Syy150190 530*5082Syy150190 next_ptr = pci_config_get8(handle, offset + PCIE_CAP_NEXT_PTR); 531*5082Syy150190 532*5082Syy150190 e1000g_log(Adapter, CE_CONT, 533*5082Syy150190 "PCIE_CAP_NEXT_PTR:\t0x%x\n", next_ptr); 534*5082Syy150190 e1000g_log(Adapter, CE_CONT, 535*5082Syy150190 "PCIE_PCIECAP:\t0x%x\n", 536*5082Syy150190 pci_config_get16(handle, offset + PCIE_PCIECAP)); 537*5082Syy150190 e1000g_log(Adapter, CE_CONT, 538*5082Syy150190 "PCIE_DEVCAP:\t0x%x\n", 539*5082Syy150190 pci_config_get32(handle, offset + PCIE_DEVCAP)); 540*5082Syy150190 e1000g_log(Adapter, CE_CONT, 541*5082Syy150190 "PCIE_DEVCTL:\t0x%x\n", 542*5082Syy150190 pci_config_get16(handle, offset + PCIE_DEVCTL)); 543*5082Syy150190 e1000g_log(Adapter, CE_CONT, 544*5082Syy150190 "PCIE_DEVSTS:\t0x%x\n", 545*5082Syy150190 pci_config_get16(handle, offset + PCIE_DEVSTS)); 546*5082Syy150190 e1000g_log(Adapter, CE_CONT, 547*5082Syy150190 "PCIE_LINKCAP:\t0x%x\n", 548*5082Syy150190 pci_config_get32(handle, offset + PCIE_LINKCAP)); 549*5082Syy150190 e1000g_log(Adapter, CE_CONT, 550*5082Syy150190 "PCIE_LINKCTL:\t0x%x\n", 551*5082Syy150190 pci_config_get16(handle, offset + PCIE_LINKCTL)); 552*5082Syy150190 e1000g_log(Adapter, CE_CONT, 553*5082Syy150190 "PCIE_LINKSTS:\t0x%x\n", 554*5082Syy150190 pci_config_get16(handle, offset + PCIE_LINKSTS)); 555*5082Syy150190 } 556*5082Syy150190 #endif 557