xref: /onnv-gate/usr/src/uts/common/io/ixgbe/ixgbe_debug.c (revision 9353:b9caf92a0042)
16621Sbt150084 /*
26621Sbt150084  * CDDL HEADER START
36621Sbt150084  *
4*9353SSamuel.Tu@Sun.COM  * Copyright(c) 2007-2009 Intel Corporation. All rights reserved.
56621Sbt150084  * The contents of this file are subject to the terms of the
66621Sbt150084  * Common Development and Distribution License (the "License").
76621Sbt150084  * You may not use this file except in compliance with the License.
86621Sbt150084  *
96621Sbt150084  * You can obtain a copy of the license at:
106621Sbt150084  *      http://www.opensolaris.org/os/licensing.
116621Sbt150084  * See the License for the specific language governing permissions
126621Sbt150084  * and limitations under the License.
136621Sbt150084  *
146621Sbt150084  * When using or redistributing this file, you may do so under the
156621Sbt150084  * License only. No other modification of this header is permitted.
166621Sbt150084  *
176621Sbt150084  * If applicable, add the following below this CDDL HEADER, with the
186621Sbt150084  * fields enclosed by brackets "[]" replaced with your own identifying
196621Sbt150084  * information: Portions Copyright [yyyy] [name of copyright owner]
206621Sbt150084  *
216621Sbt150084  * CDDL HEADER END
226621Sbt150084  */
236621Sbt150084 
246621Sbt150084 /*
258490SPaul.Guo@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
26*9353SSamuel.Tu@Sun.COM  * Use is subject to license terms.
276621Sbt150084  */
286621Sbt150084 
296621Sbt150084 #include "ixgbe_sw.h"
306621Sbt150084 #include "ixgbe_debug.h"
316621Sbt150084 
326621Sbt150084 #ifdef IXGBE_DEBUG
336621Sbt150084 extern ddi_device_acc_attr_t ixgbe_regs_acc_attr;
346621Sbt150084 
356621Sbt150084 /*
366621Sbt150084  * Dump interrupt-related registers & structures
376621Sbt150084  */
386621Sbt150084 void
396621Sbt150084 ixgbe_dump_interrupt(void *adapter, char *tag)
406621Sbt150084 {
416621Sbt150084 	ixgbe_t *ixgbe = (ixgbe_t *)adapter;
426621Sbt150084 	struct ixgbe_hw	*hw = &ixgbe->hw;
43*9353SSamuel.Tu@Sun.COM 	ixgbe_intr_vector_t	*vect;
446621Sbt150084 	uint32_t		ivar, reg;
456621Sbt150084 	int i, j;
466621Sbt150084 
476621Sbt150084 	/*
486621Sbt150084 	 * interrupt control registers
496621Sbt150084 	 */
506621Sbt150084 	ixgbe_log(ixgbe, "interrupt: %s\n", tag);
516621Sbt150084 	ixgbe_log(ixgbe, "..eims: 0x%x\n", IXGBE_READ_REG(hw, IXGBE_EIMS));
526621Sbt150084 	ixgbe_log(ixgbe, "..eimc: 0x%x\n", IXGBE_READ_REG(hw, IXGBE_EIMC));
536621Sbt150084 	ixgbe_log(ixgbe, "..eiac: 0x%x\n", IXGBE_READ_REG(hw, IXGBE_EIAC));
546621Sbt150084 	ixgbe_log(ixgbe, "..eiam: 0x%x\n", IXGBE_READ_REG(hw, IXGBE_EIAM));
556621Sbt150084 	ixgbe_log(ixgbe, "..gpie: 0x%x\n", IXGBE_READ_REG(hw, IXGBE_GPIE));
568490SPaul.Guo@Sun.COM 	ixgbe_log(ixgbe, "otherflag: 0x%x\n", ixgbe->capab->other_intr);
578490SPaul.Guo@Sun.COM 	ixgbe_log(ixgbe, "eims_mask: 0x%x\n", ixgbe->eims);
586621Sbt150084 
596621Sbt150084 	/* ivar: interrupt vector allocation registers */
606621Sbt150084 	for (i = 0; i < IXGBE_IVAR_REG_NUM; i++) {
616621Sbt150084 		if (ivar = IXGBE_READ_REG(hw, IXGBE_IVAR(i))) {
626621Sbt150084 			ixgbe_log(ixgbe, "ivar[%d]: 0x%x\n", i, ivar);
636621Sbt150084 		}
646621Sbt150084 	}
656621Sbt150084 
666621Sbt150084 	/* each allocated vector */
676621Sbt150084 	for (i = 0; i < ixgbe->intr_cnt; i++) {
686621Sbt150084 	vect =  &ixgbe->vect_map[i];
696621Sbt150084 	ixgbe_log(ixgbe,
706621Sbt150084 	    "vector %d  rx rings %d  tx rings %d  eitr: 0x%x\n",
716621Sbt150084 	    i, vect->rxr_cnt, vect->txr_cnt,
726621Sbt150084 	    IXGBE_READ_REG(hw, IXGBE_EITR(i)));
736621Sbt150084 
746621Sbt150084 	/* for each rx ring bit set */
756621Sbt150084 	j = bt_getlowbit(vect->rx_map, 0, (ixgbe->num_rx_rings - 1));
766621Sbt150084 	while (j >= 0) {
776621Sbt150084 		ixgbe_log(ixgbe, "rx %d  ivar %d  rxdctl: 0x%x  srrctl: 0x%x\n",
786621Sbt150084 		    j, IXGBE_IVAR_RX_QUEUE(j),
796621Sbt150084 		    IXGBE_READ_REG(hw, IXGBE_RXDCTL(j)),
806621Sbt150084 		    IXGBE_READ_REG(hw, IXGBE_SRRCTL(j)));
816621Sbt150084 		j = bt_getlowbit(vect->rx_map, (j + 1),
826621Sbt150084 		    (ixgbe->num_rx_rings - 1));
836621Sbt150084 	}
846621Sbt150084 
856621Sbt150084 	/* for each tx ring bit set */
866621Sbt150084 	j = bt_getlowbit(vect->tx_map, 0, (ixgbe->num_tx_rings - 1));
876621Sbt150084 	while (j >= 0) {
886621Sbt150084 		ixgbe_log(ixgbe, "tx %d  ivar %d  txdctl: 0x%x\n",
896621Sbt150084 		    j, IXGBE_IVAR_TX_QUEUE(j),
906621Sbt150084 		    IXGBE_READ_REG(hw, IXGBE_TXDCTL(j)));
916621Sbt150084 		j = bt_getlowbit(vect->tx_map, (j + 1),
926621Sbt150084 		    (ixgbe->num_tx_rings - 1));
936621Sbt150084 	}
946621Sbt150084 	}
956621Sbt150084 
966621Sbt150084 	/* reta: RSS redirection table */
976621Sbt150084 	for (i = 0; i < 32; i++) {
986621Sbt150084 		ixgbe_log(ixgbe, "reta(%d): 0x%x\n",
996621Sbt150084 		    i, IXGBE_READ_REG(hw, IXGBE_RETA(i)));
1006621Sbt150084 	}
1016621Sbt150084 
1026621Sbt150084 	/* rssrk: RSS random key */
1036621Sbt150084 	for (i = 0; i < 10; i++) {
1046621Sbt150084 		ixgbe_log(ixgbe, "rssrk(%d): 0x%x\n",
1056621Sbt150084 		    i, IXGBE_READ_REG(hw, IXGBE_RSSRK(i)));
1066621Sbt150084 	}
1076621Sbt150084 
1086621Sbt150084 	/* check ral/rah */
1096621Sbt150084 	ixgbe_log(ixgbe, "-- ral/rah --\n");
1106621Sbt150084 	for (i = 0; i < 16; i++) {
1116621Sbt150084 		if (reg = IXGBE_READ_REG(hw, IXGBE_RAL(i))) {
1126621Sbt150084 			ixgbe_log(ixgbe, "ral(%d): 0x%x  rah(%d): 0x%x\n",
1136621Sbt150084 			    i, reg, i, IXGBE_READ_REG(hw, IXGBE_RAH(i)));
1146621Sbt150084 		}
1156621Sbt150084 	}
1166621Sbt150084 
1176621Sbt150084 	/* check mta */
1186621Sbt150084 	ixgbe_log(ixgbe, "-- mta --\n");
1196621Sbt150084 	for (i = 0; i < 128; i++) {
1206621Sbt150084 		if (reg = IXGBE_READ_REG(hw, IXGBE_MTA(i))) {
1216621Sbt150084 			ixgbe_log(ixgbe, "mta(%d): 0x%x\n", i, reg);
1226621Sbt150084 		}
1236621Sbt150084 	}
1246621Sbt150084 
1256621Sbt150084 	/* check vfta */
1266621Sbt150084 	{
1276621Sbt150084 	uint32_t off = IXGBE_VFTA(0);
1286621Sbt150084 	ixgbe_log(ixgbe, "-- vfta --\n");
1296621Sbt150084 	for (i = 0; i < 640; i++) {
1306621Sbt150084 		if (reg = IXGBE_READ_REG(hw, off)) {
1316621Sbt150084 			ixgbe_log(ixgbe, "vfta(0x%x): 0x%x\n", off, reg);
1326621Sbt150084 		}
1336621Sbt150084 		off += 4;
1346621Sbt150084 	}
1356621Sbt150084 	}
1366621Sbt150084 
1376621Sbt150084 	/* check mdef */
1386621Sbt150084 	ixgbe_log(ixgbe, "-- mdef --\n");
1396621Sbt150084 	for (i = 0; i < 8; i++) {
1406621Sbt150084 		if (reg = IXGBE_READ_REG(hw, IXGBE_MDEF(i))) {
1416621Sbt150084 			ixgbe_log(ixgbe, "mdef(%d): 0x%x\n", i, reg);
1426621Sbt150084 		}
1436621Sbt150084 	}
1446621Sbt150084 }
1456621Sbt150084 
1466621Sbt150084 /*
1476621Sbt150084  * Dump an ethernet address
1486621Sbt150084  */
1496621Sbt150084 void
1506621Sbt150084 ixgbe_dump_addr(void *adapter, char *tag, const uint8_t *addr)
1516621Sbt150084 {
1526621Sbt150084 	ixgbe_t *ixgbe = (ixgbe_t *)adapter;
1536621Sbt150084 	char		form[25];
1546621Sbt150084 
1556621Sbt150084 	(void) sprintf(form, "%02x:%02x:%02x:%02x:%02x:%02x",
1566621Sbt150084 	    *addr, *(addr + 1), *(addr + 2),
1576621Sbt150084 	    *(addr + 3), *(addr + 4), *(addr + 5));
1586621Sbt150084 
1596621Sbt150084 	ixgbe_log(ixgbe, "%s %s\n", tag, form);
1606621Sbt150084 }
1616621Sbt150084 
1626621Sbt150084 void
1636621Sbt150084 ixgbe_pci_dump(void *arg)
1646621Sbt150084 {
1656621Sbt150084 	ixgbe_t *ixgbe = (ixgbe_t *)arg;
1666621Sbt150084 	ddi_acc_handle_t handle;
1676621Sbt150084 	uint8_t cap_ptr;
1686621Sbt150084 	uint8_t next_ptr;
1696621Sbt150084 	uint32_t msix_bar;
1706621Sbt150084 	uint32_t msix_ctrl;
1716621Sbt150084 	uint32_t msix_tbl_sz;
1726621Sbt150084 	uint32_t tbl_offset;
1736621Sbt150084 	uint32_t tbl_bir;
1746621Sbt150084 	uint32_t pba_offset;
1756621Sbt150084 	uint32_t pba_bir;
1766621Sbt150084 	off_t offset;
1776621Sbt150084 	off_t mem_size;
1786621Sbt150084 	uintptr_t base;
1796621Sbt150084 	ddi_acc_handle_t acc_hdl;
1806621Sbt150084 	int i;
1816621Sbt150084 
1826621Sbt150084 	handle = ixgbe->osdep.cfg_handle;
1836621Sbt150084 
1846621Sbt150084 	ixgbe_log(ixgbe, "Begin dump PCI config space");
1856621Sbt150084 
1866621Sbt150084 	ixgbe_log(ixgbe,
1876621Sbt150084 	    "PCI_CONF_VENID:\t0x%x\n",
1886621Sbt150084 	    pci_config_get16(handle, PCI_CONF_VENID));
1896621Sbt150084 	ixgbe_log(ixgbe,
1906621Sbt150084 	    "PCI_CONF_DEVID:\t0x%x\n",
1916621Sbt150084 	    pci_config_get16(handle, PCI_CONF_DEVID));
1926621Sbt150084 	ixgbe_log(ixgbe,
1936621Sbt150084 	    "PCI_CONF_COMMAND:\t0x%x\n",
1946621Sbt150084 	    pci_config_get16(handle, PCI_CONF_COMM));
1956621Sbt150084 	ixgbe_log(ixgbe,
1966621Sbt150084 	    "PCI_CONF_STATUS:\t0x%x\n",
1976621Sbt150084 	    pci_config_get16(handle, PCI_CONF_STAT));
1986621Sbt150084 	ixgbe_log(ixgbe,
1996621Sbt150084 	    "PCI_CONF_REVID:\t0x%x\n",
2006621Sbt150084 	    pci_config_get8(handle, PCI_CONF_REVID));
2016621Sbt150084 	ixgbe_log(ixgbe,
2026621Sbt150084 	    "PCI_CONF_PROG_CLASS:\t0x%x\n",
2036621Sbt150084 	    pci_config_get8(handle, PCI_CONF_PROGCLASS));
2046621Sbt150084 	ixgbe_log(ixgbe,
2056621Sbt150084 	    "PCI_CONF_SUB_CLASS:\t0x%x\n",
2066621Sbt150084 	    pci_config_get8(handle, PCI_CONF_SUBCLASS));
2076621Sbt150084 	ixgbe_log(ixgbe,
2086621Sbt150084 	    "PCI_CONF_BAS_CLASS:\t0x%x\n",
2096621Sbt150084 	    pci_config_get8(handle, PCI_CONF_BASCLASS));
2106621Sbt150084 	ixgbe_log(ixgbe,
2116621Sbt150084 	    "PCI_CONF_CACHE_LINESZ:\t0x%x\n",
2126621Sbt150084 	    pci_config_get8(handle, PCI_CONF_CACHE_LINESZ));
2136621Sbt150084 	ixgbe_log(ixgbe,
2146621Sbt150084 	    "PCI_CONF_LATENCY_TIMER:\t0x%x\n",
2156621Sbt150084 	    pci_config_get8(handle, PCI_CONF_LATENCY_TIMER));
2166621Sbt150084 	ixgbe_log(ixgbe,
2176621Sbt150084 	    "PCI_CONF_HEADER_TYPE:\t0x%x\n",
2186621Sbt150084 	    pci_config_get8(handle, PCI_CONF_HEADER));
2196621Sbt150084 	ixgbe_log(ixgbe,
2206621Sbt150084 	    "PCI_CONF_BIST:\t0x%x\n",
2216621Sbt150084 	    pci_config_get8(handle, PCI_CONF_BIST));
2226621Sbt150084 	ixgbe_log(ixgbe,
2236621Sbt150084 	    "PCI_CONF_BASE0:\t0x%x\n",
2246621Sbt150084 	    pci_config_get32(handle, PCI_CONF_BASE0));
2256621Sbt150084 	ixgbe_log(ixgbe,
2266621Sbt150084 	    "PCI_CONF_BASE1:\t0x%x\n",
2276621Sbt150084 	    pci_config_get32(handle, PCI_CONF_BASE1));
2286621Sbt150084 	ixgbe_log(ixgbe,
2296621Sbt150084 	    "PCI_CONF_BASE2:\t0x%x\n",
2306621Sbt150084 	    pci_config_get32(handle, PCI_CONF_BASE2));
2316621Sbt150084 
2326621Sbt150084 	/* MSI-X BAR */
2336621Sbt150084 	msix_bar = pci_config_get32(handle, PCI_CONF_BASE3);
2346621Sbt150084 	ixgbe_log(ixgbe,
2356621Sbt150084 	    "PCI_CONF_BASE3:\t0x%x\n", msix_bar);
2366621Sbt150084 
2376621Sbt150084 	ixgbe_log(ixgbe,
2386621Sbt150084 	    "PCI_CONF_BASE4:\t0x%x\n",
2396621Sbt150084 	    pci_config_get32(handle, PCI_CONF_BASE4));
2406621Sbt150084 	ixgbe_log(ixgbe,
2416621Sbt150084 	    "PCI_CONF_BASE5:\t0x%x\n",
2426621Sbt150084 	    pci_config_get32(handle, PCI_CONF_BASE5));
2436621Sbt150084 	ixgbe_log(ixgbe,
2446621Sbt150084 	    "PCI_CONF_CIS:\t0x%x\n",
2456621Sbt150084 	    pci_config_get32(handle, PCI_CONF_CIS));
2466621Sbt150084 	ixgbe_log(ixgbe,
2476621Sbt150084 	    "PCI_CONF_SUBVENID:\t0x%x\n",
2486621Sbt150084 	    pci_config_get16(handle, PCI_CONF_SUBVENID));
2496621Sbt150084 	ixgbe_log(ixgbe,
2506621Sbt150084 	    "PCI_CONF_SUBSYSID:\t0x%x\n",
2516621Sbt150084 	    pci_config_get16(handle, PCI_CONF_SUBSYSID));
2526621Sbt150084 	ixgbe_log(ixgbe,
2536621Sbt150084 	    "PCI_CONF_ROM:\t0x%x\n",
2546621Sbt150084 	    pci_config_get32(handle, PCI_CONF_ROM));
2556621Sbt150084 
2566621Sbt150084 	cap_ptr = pci_config_get8(handle, PCI_CONF_CAP_PTR);
2576621Sbt150084 
2586621Sbt150084 	ixgbe_log(ixgbe,
2596621Sbt150084 	    "PCI_CONF_CAP_PTR:\t0x%x\n", cap_ptr);
2606621Sbt150084 	ixgbe_log(ixgbe,
2616621Sbt150084 	    "PCI_CONF_ILINE:\t0x%x\n",
2626621Sbt150084 	    pci_config_get8(handle, PCI_CONF_ILINE));
2636621Sbt150084 	ixgbe_log(ixgbe,
2646621Sbt150084 	    "PCI_CONF_IPIN:\t0x%x\n",
2656621Sbt150084 	    pci_config_get8(handle, PCI_CONF_IPIN));
2666621Sbt150084 	ixgbe_log(ixgbe,
2676621Sbt150084 	    "PCI_CONF_MIN_G:\t0x%x\n",
2686621Sbt150084 	    pci_config_get8(handle, PCI_CONF_MIN_G));
2696621Sbt150084 	ixgbe_log(ixgbe,
2706621Sbt150084 	    "PCI_CONF_MAX_L:\t0x%x\n",
2716621Sbt150084 	    pci_config_get8(handle, PCI_CONF_MAX_L));
2726621Sbt150084 
2736621Sbt150084 	/* Power Management */
2746621Sbt150084 	offset = cap_ptr;
2756621Sbt150084 
2766621Sbt150084 	ixgbe_log(ixgbe,
2776621Sbt150084 	    "PCI_PM_CAP_ID:\t0x%x\n",
2786621Sbt150084 	    pci_config_get8(handle, offset));
2796621Sbt150084 
2806621Sbt150084 	next_ptr = pci_config_get8(handle, offset + 1);
2816621Sbt150084 
2826621Sbt150084 	ixgbe_log(ixgbe,
2836621Sbt150084 	    "PCI_PM_NEXT_PTR:\t0x%x\n", next_ptr);
2846621Sbt150084 	ixgbe_log(ixgbe,
2856621Sbt150084 	    "PCI_PM_CAP:\t0x%x\n",
2866621Sbt150084 	    pci_config_get16(handle, offset + PCI_PMCAP));
2876621Sbt150084 	ixgbe_log(ixgbe,
2886621Sbt150084 	    "PCI_PM_CSR:\t0x%x\n",
2896621Sbt150084 	    pci_config_get16(handle, offset + PCI_PMCSR));
2906621Sbt150084 	ixgbe_log(ixgbe,
2916621Sbt150084 	    "PCI_PM_CSR_BSE:\t0x%x\n",
2926621Sbt150084 	    pci_config_get8(handle, offset + PCI_PMCSR_BSE));
2936621Sbt150084 	ixgbe_log(ixgbe,
2946621Sbt150084 	    "PCI_PM_DATA:\t0x%x\n",
2956621Sbt150084 	    pci_config_get8(handle, offset + PCI_PMDATA));
2966621Sbt150084 
2976621Sbt150084 	/* MSI Configuration */
2986621Sbt150084 	offset = next_ptr;
2996621Sbt150084 
3006621Sbt150084 	ixgbe_log(ixgbe,
3016621Sbt150084 	    "PCI_MSI_CAP_ID:\t0x%x\n",
3026621Sbt150084 	    pci_config_get8(handle, offset));
3036621Sbt150084 
3046621Sbt150084 	next_ptr = pci_config_get8(handle, offset + 1);
3056621Sbt150084 
3066621Sbt150084 	ixgbe_log(ixgbe,
3076621Sbt150084 	    "PCI_MSI_NEXT_PTR:\t0x%x\n", next_ptr);
3086621Sbt150084 	ixgbe_log(ixgbe,
3096621Sbt150084 	    "PCI_MSI_CTRL:\t0x%x\n",
3106621Sbt150084 	    pci_config_get16(handle, offset + PCI_MSI_CTRL));
3116621Sbt150084 	ixgbe_log(ixgbe,
3126621Sbt150084 	    "PCI_MSI_ADDR:\t0x%x\n",
3136621Sbt150084 	    pci_config_get32(handle, offset + PCI_MSI_ADDR_OFFSET));
3146621Sbt150084 	ixgbe_log(ixgbe,
3156621Sbt150084 	    "PCI_MSI_ADDR_HI:\t0x%x\n",
3166621Sbt150084 	    pci_config_get32(handle, offset + 0x8));
3176621Sbt150084 	ixgbe_log(ixgbe,
3186621Sbt150084 	    "PCI_MSI_DATA:\t0x%x\n",
3196621Sbt150084 	    pci_config_get16(handle, offset + 0xC));
3206621Sbt150084 
3216621Sbt150084 	/* MSI-X Configuration */
3226621Sbt150084 	offset = next_ptr;
3236621Sbt150084 
3246621Sbt150084 	ixgbe_log(ixgbe,
3256621Sbt150084 	    "PCI_MSIX_CAP_ID:\t0x%x\n",
3266621Sbt150084 	    pci_config_get8(handle, offset));
3276621Sbt150084 
3286621Sbt150084 	next_ptr = pci_config_get8(handle, offset + 1);
3296621Sbt150084 	ixgbe_log(ixgbe,
3306621Sbt150084 	    "PCI_MSIX_NEXT_PTR:\t0x%x\n", next_ptr);
3316621Sbt150084 
3326621Sbt150084 	msix_ctrl = pci_config_get16(handle, offset + PCI_MSIX_CTRL);
3336621Sbt150084 	msix_tbl_sz = msix_ctrl & 0x7ff;
3346621Sbt150084 	ixgbe_log(ixgbe,
3356621Sbt150084 	    "PCI_MSIX_CTRL:\t0x%x\n", msix_ctrl);
3366621Sbt150084 
3376621Sbt150084 	tbl_offset = pci_config_get32(handle, offset + PCI_MSIX_TBL_OFFSET);
3386621Sbt150084 	tbl_bir = tbl_offset & PCI_MSIX_TBL_BIR_MASK;
3396621Sbt150084 	tbl_offset = tbl_offset & ~PCI_MSIX_TBL_BIR_MASK;
3406621Sbt150084 	ixgbe_log(ixgbe,
3416621Sbt150084 	    "PCI_MSIX_TBL_OFFSET:\t0x%x\n", tbl_offset);
3426621Sbt150084 	ixgbe_log(ixgbe,
3436621Sbt150084 	    "PCI_MSIX_TBL_BIR:\t0x%x\n", tbl_bir);
3446621Sbt150084 
3456621Sbt150084 	pba_offset = pci_config_get32(handle, offset + PCI_MSIX_PBA_OFFSET);
3466621Sbt150084 	pba_bir = pba_offset & PCI_MSIX_PBA_BIR_MASK;
3476621Sbt150084 	pba_offset = pba_offset & ~PCI_MSIX_PBA_BIR_MASK;
3486621Sbt150084 	ixgbe_log(ixgbe,
3496621Sbt150084 	    "PCI_MSIX_PBA_OFFSET:\t0x%x\n", pba_offset);
3506621Sbt150084 	ixgbe_log(ixgbe,
3516621Sbt150084 	    "PCI_MSIX_PBA_BIR:\t0x%x\n", pba_bir);
3526621Sbt150084 
3536621Sbt150084 	/* PCI Express Configuration */
3546621Sbt150084 	offset = next_ptr;
3556621Sbt150084 
3566621Sbt150084 	ixgbe_log(ixgbe,
3576621Sbt150084 	    "PCIE_CAP_ID:\t0x%x\n",
3586621Sbt150084 	    pci_config_get8(handle, offset + PCIE_CAP_ID));
3596621Sbt150084 
3606621Sbt150084 	next_ptr = pci_config_get8(handle, offset + PCIE_CAP_NEXT_PTR);
3616621Sbt150084 
3626621Sbt150084 	ixgbe_log(ixgbe,
3636621Sbt150084 	    "PCIE_CAP_NEXT_PTR:\t0x%x\n", next_ptr);
3646621Sbt150084 	ixgbe_log(ixgbe,
3656621Sbt150084 	    "PCIE_PCIECAP:\t0x%x\n",
3666621Sbt150084 	    pci_config_get16(handle, offset + PCIE_PCIECAP));
3676621Sbt150084 	ixgbe_log(ixgbe,
3686621Sbt150084 	    "PCIE_DEVCAP:\t0x%x\n",
3696621Sbt150084 	    pci_config_get32(handle, offset + PCIE_DEVCAP));
3706621Sbt150084 	ixgbe_log(ixgbe,
3716621Sbt150084 	    "PCIE_DEVCTL:\t0x%x\n",
3726621Sbt150084 	    pci_config_get16(handle, offset + PCIE_DEVCTL));
3736621Sbt150084 	ixgbe_log(ixgbe,
3746621Sbt150084 	    "PCIE_DEVSTS:\t0x%x\n",
3756621Sbt150084 	    pci_config_get16(handle, offset + PCIE_DEVSTS));
3766621Sbt150084 	ixgbe_log(ixgbe,
3776621Sbt150084 	    "PCIE_LINKCAP:\t0x%x\n",
3786621Sbt150084 	    pci_config_get32(handle, offset + PCIE_LINKCAP));
3796621Sbt150084 	ixgbe_log(ixgbe,
3806621Sbt150084 	    "PCIE_LINKCTL:\t0x%x\n",
3816621Sbt150084 	    pci_config_get16(handle, offset + PCIE_LINKCTL));
3826621Sbt150084 	ixgbe_log(ixgbe,
3836621Sbt150084 	    "PCIE_LINKSTS:\t0x%x\n",
3846621Sbt150084 	    pci_config_get16(handle, offset + PCIE_LINKSTS));
3856621Sbt150084 
3866621Sbt150084 	/* MSI-X Memory Space */
3876621Sbt150084 	if (ddi_dev_regsize(ixgbe->dip, 4, &mem_size) != DDI_SUCCESS) {
3886621Sbt150084 		ixgbe_log(ixgbe, "ddi_dev_regsize() failed");
3896621Sbt150084 		return;
3906621Sbt150084 	}
3916621Sbt150084 
3926621Sbt150084 	if ((ddi_regs_map_setup(ixgbe->dip, 4, (caddr_t *)&base, 0, mem_size,
3936621Sbt150084 	    &ixgbe_regs_acc_attr, &acc_hdl)) != DDI_SUCCESS) {
3946621Sbt150084 		ixgbe_log(ixgbe, "ddi_regs_map_setup() failed");
3956621Sbt150084 		return;
3966621Sbt150084 	}
3976621Sbt150084 
3986621Sbt150084 	ixgbe_log(ixgbe, "MSI-X Memory Space: (mem_size = %d, base = %x)",
3996621Sbt150084 	    mem_size, base);
4006621Sbt150084 
4016621Sbt150084 	for (i = 0; i <= msix_tbl_sz; i++) {
4026621Sbt150084 		ixgbe_log(ixgbe, "MSI-X Table Entry(%d):", i);
4036621Sbt150084 		ixgbe_log(ixgbe, "lo_addr:\t%x",
4046621Sbt150084 		    ddi_get32(acc_hdl,
4056621Sbt150084 		    (uint32_t *)(base + tbl_offset + (i * 16))));
4066621Sbt150084 		ixgbe_log(ixgbe, "up_addr:\t%x",
4076621Sbt150084 		    ddi_get32(acc_hdl,
4086621Sbt150084 		    (uint32_t *)(base + tbl_offset + (i * 16) + 4)));
4096621Sbt150084 		ixgbe_log(ixgbe, "msg_data:\t%x",
4106621Sbt150084 		    ddi_get32(acc_hdl,
4116621Sbt150084 		    (uint32_t *)(base + tbl_offset + (i * 16) + 8)));
4126621Sbt150084 		ixgbe_log(ixgbe, "vct_ctrl:\t%x",
4136621Sbt150084 		    ddi_get32(acc_hdl,
4146621Sbt150084 		    (uint32_t *)(base + tbl_offset + (i * 16) + 12)));
4156621Sbt150084 	}
4166621Sbt150084 
4176621Sbt150084 	ixgbe_log(ixgbe, "MSI-X Pending Bits:\t%x",
4186621Sbt150084 	    ddi_get32(acc_hdl, (uint32_t *)(base + pba_offset)));
4196621Sbt150084 
4206621Sbt150084 	ddi_regs_map_free(&acc_hdl);
4216621Sbt150084 }
422*9353SSamuel.Tu@Sun.COM 
423*9353SSamuel.Tu@Sun.COM /*
424*9353SSamuel.Tu@Sun.COM  * Dump registers
425*9353SSamuel.Tu@Sun.COM  */
426*9353SSamuel.Tu@Sun.COM void
427*9353SSamuel.Tu@Sun.COM ixgbe_dump_regs(void *adapter)
428*9353SSamuel.Tu@Sun.COM {
429*9353SSamuel.Tu@Sun.COM 	ixgbe_t *ixgbe = (ixgbe_t *)adapter;
430*9353SSamuel.Tu@Sun.COM 	uint32_t reg_val;
431*9353SSamuel.Tu@Sun.COM 	struct ixgbe_hw *hw = &ixgbe->hw;
432*9353SSamuel.Tu@Sun.COM 	int i;
433*9353SSamuel.Tu@Sun.COM 	DEBUGFUNC("ixgbe_dump_regs");
434*9353SSamuel.Tu@Sun.COM 
435*9353SSamuel.Tu@Sun.COM 	/* Dump basic's like CTRL, STATUS, CTRL_EXT. */
436*9353SSamuel.Tu@Sun.COM 	ixgbe_log(ixgbe, "Basic IXGBE registers..");
437*9353SSamuel.Tu@Sun.COM 	reg_val = IXGBE_READ_REG(hw, IXGBE_CTRL);
438*9353SSamuel.Tu@Sun.COM 	ixgbe_log(ixgbe, "\tCTRL=%x\n", reg_val);
439*9353SSamuel.Tu@Sun.COM 	reg_val = IXGBE_READ_REG(hw, IXGBE_STATUS);
440*9353SSamuel.Tu@Sun.COM 	ixgbe_log(ixgbe, "\tSTATUS=%x\n", reg_val);
441*9353SSamuel.Tu@Sun.COM 	reg_val = IXGBE_READ_REG(hw, IXGBE_CTRL_EXT);
442*9353SSamuel.Tu@Sun.COM 	ixgbe_log(ixgbe, "\tCTRL_EXT=%x\n", reg_val);
443*9353SSamuel.Tu@Sun.COM 	reg_val = IXGBE_READ_REG(hw, IXGBE_FCTRL);
444*9353SSamuel.Tu@Sun.COM 	ixgbe_log(ixgbe, "\tFCTRL=%x\n", reg_val);
445*9353SSamuel.Tu@Sun.COM 
446*9353SSamuel.Tu@Sun.COM 	/* Misc Interrupt regs */
447*9353SSamuel.Tu@Sun.COM 	ixgbe_log(ixgbe, "Some IXGBE interrupt registers..");
448*9353SSamuel.Tu@Sun.COM 
449*9353SSamuel.Tu@Sun.COM 	reg_val = IXGBE_READ_REG(hw, IXGBE_GPIE);
450*9353SSamuel.Tu@Sun.COM 	ixgbe_log(ixgbe, "\tGPIE=%x\n", reg_val);
451*9353SSamuel.Tu@Sun.COM 
452*9353SSamuel.Tu@Sun.COM 	reg_val = IXGBE_READ_REG(hw, IXGBE_IVAR(0));
453*9353SSamuel.Tu@Sun.COM 	ixgbe_log(ixgbe, "\tIVAR(0)=%x\n", reg_val);
454*9353SSamuel.Tu@Sun.COM 
455*9353SSamuel.Tu@Sun.COM 	reg_val = IXGBE_READ_REG(hw, IXGBE_IVAR_MISC);
456*9353SSamuel.Tu@Sun.COM 	ixgbe_log(ixgbe, "\tIVAR_MISC=%x\n", reg_val);
457*9353SSamuel.Tu@Sun.COM 
458*9353SSamuel.Tu@Sun.COM 	/* Dump RX related reg's */
459*9353SSamuel.Tu@Sun.COM 	ixgbe_log(ixgbe, "Receive registers...");
460*9353SSamuel.Tu@Sun.COM 	reg_val = IXGBE_READ_REG(hw, IXGBE_RXCTRL);
461*9353SSamuel.Tu@Sun.COM 	ixgbe_log(ixgbe, "\tRXCTRL=%x\n", reg_val);
462*9353SSamuel.Tu@Sun.COM 	for (i = 0; i < ixgbe->num_rx_rings; i++) {
463*9353SSamuel.Tu@Sun.COM 		reg_val = IXGBE_READ_REG(hw, IXGBE_RXDCTL(i));
464*9353SSamuel.Tu@Sun.COM 		ixgbe_log(ixgbe, "\tRXDCTL(%d)=%x\n", i, reg_val);
465*9353SSamuel.Tu@Sun.COM 		reg_val = IXGBE_READ_REG(hw, IXGBE_SRRCTL(i));
466*9353SSamuel.Tu@Sun.COM 		ixgbe_log(ixgbe, "\tSRRCTL(%d)=%x\n", i, reg_val);
467*9353SSamuel.Tu@Sun.COM 	}
468*9353SSamuel.Tu@Sun.COM 	reg_val = IXGBE_READ_REG(hw, IXGBE_RXCSUM);
469*9353SSamuel.Tu@Sun.COM 	ixgbe_log(ixgbe, "\tRXCSUM=%x\n", reg_val);
470*9353SSamuel.Tu@Sun.COM 	reg_val = IXGBE_READ_REG(hw, IXGBE_MRQC);
471*9353SSamuel.Tu@Sun.COM 	ixgbe_log(ixgbe, "\tMRQC=%x\n", reg_val);
472*9353SSamuel.Tu@Sun.COM 	reg_val = IXGBE_READ_REG(hw, IXGBE_RDRXCTL);
473*9353SSamuel.Tu@Sun.COM 	ixgbe_log(ixgbe, "\tRDRXCTL=%x\n", reg_val);
474*9353SSamuel.Tu@Sun.COM 
475*9353SSamuel.Tu@Sun.COM 	/* Dump TX related regs */
476*9353SSamuel.Tu@Sun.COM 	ixgbe_log(ixgbe, "Some transmit registers..");
477*9353SSamuel.Tu@Sun.COM 	reg_val = IXGBE_READ_REG(hw, IXGBE_DMATXCTL);
478*9353SSamuel.Tu@Sun.COM 	ixgbe_log(ixgbe, "\tDMATXCTL=%x\n", reg_val);
479*9353SSamuel.Tu@Sun.COM 	for (i = 0; i < ixgbe->num_tx_rings; i++) {
480*9353SSamuel.Tu@Sun.COM 		reg_val = IXGBE_READ_REG(hw, IXGBE_TXDCTL(i));
481*9353SSamuel.Tu@Sun.COM 		ixgbe_log(ixgbe, "\tTXDCTL(%d)=%x\n", i, reg_val);
482*9353SSamuel.Tu@Sun.COM 		reg_val = IXGBE_READ_REG(hw, IXGBE_TDWBAL(i));
483*9353SSamuel.Tu@Sun.COM 		ixgbe_log(ixgbe, "\tTDWBAL(%d)=%x\n", i, reg_val);
484*9353SSamuel.Tu@Sun.COM 		reg_val = IXGBE_READ_REG(hw, IXGBE_TDWBAH(i));
485*9353SSamuel.Tu@Sun.COM 		ixgbe_log(ixgbe, "\tTDWBAH(%d)=%x\n", i, reg_val);
486*9353SSamuel.Tu@Sun.COM 		reg_val = IXGBE_READ_REG(hw, IXGBE_TXPBSIZE(i));
487*9353SSamuel.Tu@Sun.COM 		ixgbe_log(ixgbe, "\tTXPBSIZE(%d)=%x\n", i, reg_val);
488*9353SSamuel.Tu@Sun.COM 	}
489*9353SSamuel.Tu@Sun.COM }
490*9353SSamuel.Tu@Sun.COM 
4916621Sbt150084 #endif
492