/*
* This file is provided under a CDDLv1 license. When using or
* redistributing this file, you may do so under this license.
* In redistributing this file this license must be included
* and no other modification of this header file is permitted.
*
* CDDL LICENSE SUMMARY
*
* Copyright(c) 1999 - 2009 Intel Corporation. All rights reserved.
*
* The contents of this file are subject to the terms of Version
* 1.0 of the Common Development and Distribution License (the "License").
*
* You should have received a copy of the License with this software.
* You can obtain a copy of the License at
* See the License for the specific language governing permissions
* and limitations under the License.
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms of the CDDLv1.
*/
/*
* **********************************************************************
* *
* Module Name: *
* e1000g_debug.c *
* *
* Abstract: *
* This module includes the debug routines *
* *
* **********************************************************************
*/
#ifdef GCC
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#define _SYS_VARARGS_H
#endif
#include "e1000g_debug.h"
#include "e1000g_sw.h"
#ifdef E1000G_DEBUG
#endif
#ifdef E1000G_DEBUG
typedef struct {
} Regi_t;
#endif /* E1000G_DEBUG */
void
{
switch (level) {
#ifdef E1000G_DEBUG
case E1000G_VERBOSE_LEVEL: /* 16 or 0x010 */
if (e1000g_debug < E1000G_VERBOSE_LEVEL)
return;
break;
case E1000G_TRACE_LEVEL: /* 8 or 0x008 */
if (e1000g_debug < E1000G_TRACE_LEVEL)
return;
break;
case E1000G_INFO_LEVEL: /* 4 or 0x004 */
if (e1000g_debug < E1000G_INFO_LEVEL)
return;
break;
case E1000G_WARN_LEVEL: /* 2 or 0x002 */
if (e1000g_debug < E1000G_WARN_LEVEL)
return;
break;
case E1000G_ERRS_LEVEL: /* 1 or 0x001 */
break;
#else
case CE_CONT:
case CE_NOTE:
case CE_WARN:
case CE_PANIC:
break;
#endif
default:
break;
}
} else {
}
/*
* va_start uses built in macro __builtin_va_alist from the
* compiler libs which requires compiler system to have
* __BUILTIN_VA_ARG_INCR defined.
*/
/*
* Many compilation systems depend upon the use of special functions
* built into the the compilation system to handle variable argument
* lists and stack allocations. The method to obtain this in SunOS
* is to define the feature test macro "__BUILTIN_VA_ARG_INCR" which
* enables the following special built-in functions:
* __builtin_alloca
* __builtin_va_alist
* __builtin_va_arg_incr
* It is intended that the compilation system define this feature test
* macro, not the user of the system.
*
* The tests on the processor type are to provide a transitional period
* for existing compilation systems, and may be removed in a future
* release.
*/
/*
* Using GNU gcc compiler it doesn't expand to va_start....
*/
else if (e1000g_log_mode & E1000G_LOG_DISPLAY)
else if (e1000g_log_mode & E1000G_LOG_PRINT)
else /* if they are not set properly then do both */
}
#ifdef E1000G_DEBUG
extern kmutex_t e1000g_nvm_lock;
void
{
int ee_size[] =
{128, 256, 512, 1024, 2048, 4096, 16 * 1024, 32 * 1024, 64 * 1024};
"e1000_read_nvm failed to read size: %d", ret);
goto eeprom_dump_end;
}
if (sign != 1) {
"eeprom_dump invalid signature: %d", sign);
}
"eeprom_dump invalid size: %d", size);
}
"eeprom_dump size field: %d eeprom bytes: %d\n",
for (i = 0; i < lines; i++) {
"e1000_read_nvm failed: %d", ret);
goto eeprom_dump_end;
}
"0x%04x %04x %04x %04x %04x %04x %04x %04x %04x\n",
}
}
/*
* phy_dump - dump important phy registers
*/
void
{
/* offset to each phy register */
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
30, 31, 0x1796, 0x187A, 0x1895, 0x1F30, 0x1F35, 0x1F3E, 0x1F54,
0x1F55, 0x1F56, 0x1F72, 0x1F76, 0x1F77, 0x1F78, 0x1F79, 0x1F98,
0x2010, 0x2011, 0x20DC, 0x20DD, 0x20DE, 0x28B4, 0x2F52, 0x2F5B,
0x2F70, 0x2F90, 0x2FB1, 0x2FB2 };
int i;
if (stat == 0) {
"phyreg offset: %d value: 0x%x\n",
} else {
"phyreg offset: %d ERROR: 0x%x\n",
}
}
}
{
}
/*
* mac_dump - dump important mac registers
*/
void
{
int i;
/* {name, offset} for each mac register */
{"FWSM", E1000_FWSM},
};
for (i = 0; i < NUM_REGS; i++) {
"macreg %10s offset: 0x%x value: 0x%x\n",
}
}
void
{
"PCI_CONF_VENID:\t0x%x\n",
"PCI_CONF_DEVID:\t0x%x\n",
"PCI_CONF_COMMAND:\t0x%x\n",
"PCI_CONF_STATUS:\t0x%x\n",
"PCI_CONF_REVID:\t0x%x\n",
"PCI_CONF_PROG_CLASS:\t0x%x\n",
"PCI_CONF_SUB_CLASS:\t0x%x\n",
"PCI_CONF_BAS_CLASS:\t0x%x\n",
"PCI_CONF_CACHE_LINESZ:\t0x%x\n",
"PCI_CONF_LATENCY_TIMER:\t0x%x\n",
"PCI_CONF_HEADER_TYPE:\t0x%x\n",
"PCI_CONF_BIST:\t0x%x\n",
"PCI_CONF_CIS:\t0x%x\n",
"PCI_CONF_SUBVENID:\t0x%x\n",
"PCI_CONF_SUBSYSID:\t0x%x\n",
"PCI_CONF_ROM:\t0x%x\n",
"PCI_CONF_CAP_PTR:\t0x%x\n", cap_ptr);
"PCI_CONF_ILINE:\t0x%x\n",
"PCI_CONF_IPIN:\t0x%x\n",
"PCI_CONF_MIN_G:\t0x%x\n",
"PCI_CONF_MAX_L:\t0x%x\n",
/* Power Management */
"PCI_PM_CAP_ID:\t0x%x\n",
"PCI_PM_NEXT_PTR:\t0x%x\n", next_ptr);
"PCI_PM_CAP:\t0x%x\n",
"PCI_PM_CSR:\t0x%x\n",
"PCI_PM_CSR_BSE:\t0x%x\n",
"PCI_PM_DATA:\t0x%x\n",
/* MSI Configuration */
"PCI_MSI_CAP_ID:\t0x%x\n",
"PCI_MSI_NEXT_PTR:\t0x%x\n", next_ptr);
"PCI_MSI_CTRL:\t0x%x\n",
"PCI_MSI_ADDR:\t0x%x\n",
"PCI_MSI_ADDR_HI:\t0x%x\n",
"PCI_MSI_DATA:\t0x%x\n",
/* PCI Express Configuration */
"PCIE_CAP_ID:\t0x%x\n",
"PCIE_CAP_NEXT_PTR:\t0x%x\n", next_ptr);
"PCIE_PCIECAP:\t0x%x\n",
"PCIE_DEVCAP:\t0x%x\n",
"PCIE_DEVCTL:\t0x%x\n",
"PCIE_DEVSTS:\t0x%x\n",
"PCIE_LINKCAP:\t0x%x\n",
"PCIE_LINKCTL:\t0x%x\n",
"PCIE_LINKSTS:\t0x%x\n",
}
void
{
/* base address zero, simple print */
if (base == 0) {
/* base address non-zero, get size */
} else {
/* i/o factors that decode from the base address */
if (base & PCI_BASE_SPACE_IO) {
/* memory factors that decode from the base address */
} else {
if (base & PCI_BASE_TYPE_ALL)
else
if (base & PCI_BASE_PREF_M)
else
}
/* disable memory decode */
/* write to base register */
/* read back & compute size */
/* restore base register */
/* re-enable memory decode */
/* print results */
}
}
#endif /* E1000G_DEBUG */