/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2010 QLogic Corporation. All rights reserved.
*/
#include <qlge.h>
static char ISP_8100_REGION[] = {
"nic: nic_boot, nic_param, nic_vpd \n"
"mpi: mpi_fw, mpi_config, edc_fw\n"
"fc: fc_boot, fc_fw, fc_nvram, fc_vpd"};
/*
* Get byte from I/O port
*/
{
return (ret);
}
/*
* Get word from I/O port
*/
{
return (ret);
}
/*
* Get double word from I/O port
*/
{
return (ret);
}
/*
* Send byte to I/O port
*/
void
{
}
/*
* Send word to I/O port
*/
void
{
}
/*
* Send double word to I/O port
*/
void
{
}
/*
* Read from a register
*/
{
return (data);
}
/*
* Write 32 bit data to a register
*/
void
{
}
/*
* Set semaphore register bit to lock access to a shared register
*/
int
{
}
/*
* Wait up to "delay" seconds until the register "reg"'s
* "wait_bit" is set
* Default wait time is 5 seconds if "delay" time was not set.
*/
int
{
if (delay != 0)
/*
* wait for Configuration register test bit to be set,
* if not, then it is still busy.
*/
do {
/* wait for bit set or reset? */
if (reg_status & wait_bit)
break;
else
} else {
if (reg_status & wait_bit)
else
break;
}
} while (--delay_ticks);
if (delay_ticks == 0) {
}
}
return (rtn_val);
}
/*
* Dump the value of control registers
*/
void
{
int i;
for (i = 0; i < 0xff; i = i+4) {
}
}
/*
* Prints string plus buffer.
*/
void
{
return;
switch (wd_size) {
case 8:
while (count) {
offset += 8;
buffer += 8;
}
break;
case 16:
while (count) {
offset += 16;
buffer += 16;
}
break;
case 32:
while (count) {
offset += 16;
buffer += 16;
}
break;
case 64:
while (count) {
offset += 16;
buffer += 16;
}
break;
default:
break;
}
}
/*
* Print as 8bit bytes
*/
static uint32_t
{
switch (count) {
case 1:
ql_printf("0x%016x : %02x\n",
*bp);
break;
case 2:
ql_printf("0x%016x : %02x %02x\n",
break;
case 3:
ql_printf("0x%016x : %02x %02x %02x\n",
break;
case 4:
ql_printf("0x%016x : %02x %02x %02x %02x\n",
break;
case 5:
ql_printf("0x%016x : %02x %02x %02x %02x %02x\n",
break;
case 6:
ql_printf("0x%016x : %02x %02x %02x %02x %02x %02x\n",
break;
case 7:
ql_printf("0x%016x : %02x %02x %02x %02x %02x %02x %02x\n",
break;
default:
ql_printf("0x%016x : %02x %02x %02x %02x %02x %02x %02x %02x\n",
*(bp+7));
break;
}
if (count < 8) {
count = 0;
} else {
count -= 8;
}
return (count);
}
/*
* Print as 16bit
*/
static uint32_t
{
switch (count) {
case 1:
ql_printf("0x%016x : %04x\n",
*bp);
break;
case 2:
ql_printf("0x%016x : %04x %04x\n",
break;
case 3:
ql_printf("0x%016x : %04x %04x %04x\n",
break;
case 4:
ql_printf("0x%016x : %04x %04x %04x %04x\n",
break;
case 5:
ql_printf("0x%016x : %04x %04x %04x %04x %04x\n",
break;
case 6:
ql_printf("0x%016x : %04x %04x %04x %04x %04x %04x\n",
break;
case 7:
ql_printf("0x%016x : %04x %04x %04x %04x %04x %04x %04x\n",
break;
default:
ql_printf("0x%016x : %04x %04x %04x %04x %04x %04x %04x %04x\n",
*(bp+7));
break;
}
if (count < 8) {
count = 0;
} else {
count -= 8;
}
return (count);
}
/*
* Print as 32bit
*/
static uint32_t
{
switch (count) {
case 1:
ql_printf("0x%016x : %08x\n",
*bp);
break;
case 2:
ql_printf("0x%016x : %08x %08x\n",
break;
case 3:
ql_printf("0x%016x : %08x %08x %08x\n",
break;
default:
ql_printf("0x%016x : %08x %08x %08x %08x\n",
break;
}
if (count < 4) {
count = 0;
} else {
count -= 4;
}
return (count);
}
/*
* Print as 64bit
*/
static uint32_t
{
switch (count) {
case 1:
ql_printf("0x%016x : %016x\n",
*bp);
break;
default:
ql_printf("0x%016x : %016x %016x\n",
break;
}
if (count < 2) {
count = 0;
} else {
count -= 2;
}
return (count);
}
/*
* Print CQICB control block information
*/
/* ARGSUSED */
void
{
ql_printf("ql_dump_cqicb:entered\n");
ql_printf("\t msix_vect = 0x%x\n",
ql_printf("\t reserved1 = 0x%x\n",
ql_printf("\t reserved2 = 0x%x\n",
ql_printf("\t flags = 0x%x\n",
ql_printf("\t len = 0x%x\n",
ql_printf("\t rid = 0x%x\n",
ql_printf("\t cq_base_addr_lo = 0x%x\n",
ql_printf("\t cq_base_addr_hi = 0x%x\n",
ql_printf("\t prod_idx_addr_lo = %x\n",
ql_printf("\t prod_idx_addr_hi = %x\n",
ql_printf("\t pkt_delay = %d\n",
ql_printf("\t irq_delay = 0x%x\n",
ql_printf("\t lbq_addr_lo = 0x%x\n",
ql_printf("\t lbq_addr_hi = 0x%x\n",
ql_printf("\t lbq_buf_size = 0x%x\n",
ql_printf("\t lbq_len = 0x%x\n",
ql_printf("\t sbq_addr_lo = 0x%x\n",
ql_printf("\t sbq_addr_hi = 0x%x\n",
ql_printf("\t sbq_buf_size = 0x%x\n",
ql_printf("\t sbq_len = 0x%x\n",
ql_printf("ql_dump_cqicb:exiting\n");
}
/*
* Print WQICB control block information
*/
/* ARGSUSED */
void
{
ql_printf("ql_dump_wqicb:entered\n");
ql_printf("\t len = %x\n",
ql_printf("\t flags = %x\n",
ql_printf("\t cq_id_rss = %x\n",
ql_printf("\t rid = 0x%x\n",
ql_printf("\t wq_addr_lo = 0x%x\n",
ql_printf("\t wq_addr_hi = 0x%x\n",
ql_printf("\t cnsmr_idx_addr_lo = %x\n",
ql_printf("\t cnsmr_idx_addr_hi = %x\n",
ql_printf("ql_dump_wqicb:exit\n");
}
/*
* Print request descriptor information
*/
void
int number)
{
int i = 0;
ql_printf("\t opcode = 0x%x\n",
ql_printf("\t flag0 = 0x%x\n",
ql_printf("\t flag1 = 0x%x\n",
ql_printf("\t flag2 = 0x%x\n",
ql_printf("\t frame_len = 0x%x\n",
ql_printf("\t transaction_id_low = 0x%x\n",
ql_printf("\t txq_idx = 0x%x\n",
ql_printf("\t protocol_hdr_len = 0x%x\n",
ql_printf("\t hdr_off = %d\n",
ql_printf("\t vlan_tci = %d\n",
ql_printf("\t mss = %d\n",
/* if OAL is needed */
if (number > TX_DESC_PER_IOCB) {
for (i = 0; i < TX_DESC_PER_IOCB; i++) {
ql_printf("\t buf_addr%d_low = 0x%x\n",
ql_printf("\t buf_addr%d_high = 0x%x\n",
ql_printf("\t buf%d_len = 0x%x\n",
}
ql_printf("\t additional %d tx descriptors in OAL\n",
ql_printf("\t buf_addr%d_low = 0x%x\n",
i, oal_entry[i].buf_addr_low);
ql_printf("\t buf_addr%d_high = 0x%x\n",
i, oal_entry[i].buf_addr_high);
ql_printf("\t buf%d_len = 0x%x\n",
}
} else {
for (i = 0; i < number; i++) {
ql_printf("\t buf_addr%d_low = 0x%x\n",
ql_printf("\t buf_addr%d_high = 0x%x\n",
ql_printf("\t buf%d_len = 0x%x\n",
}
}
ql_printf("ql_dump_req_pkt:exiting\n");
}
/*
* Print PCI configuration
*/
void
{
ql_printf("ql_dump_pci_config(%d): enter\n",
ql_printf("\tvendorid =0x%x.\n",
ql_printf("\tdeviceid =0x%x.\n",
ql_printf("\tcommand =0x%x.\n",
ql_printf("\tstatus =0x%x.\n",
ql_printf("\trevision id =0x%x.\n",
ql_printf("\tprogram class =0x%x.\n",
ql_printf("\tsubclass code =0x%x.\n",
ql_printf("\tbase class code =0x%x.\n",
ql_printf("\tcache line size =0x%x.\n",
ql_printf("\tlatency timer =0x%x.\n",
ql_printf("\theader =0x%x.\n",
ql_printf("\tI/O Base Register Address0 =0x%x.\n",
ql_printf("\tpci_cntl_reg_set_mem_base_address_lower =0x%x.\n",
ql_printf("\tpci_cntl_reg_set_mem_base_address_upper =0x%x.\n",
ql_printf("\tpci_doorbell_mem_base_address_lower =0x%x.\n",
ql_printf("\tpci_doorbell_mem_base_address_upper =0x%x.\n",
ql_printf("\tSubsytem Vendor Id =0x%x.\n",
ql_printf("\tSubsytem Id =0x%x.\n",
ql_printf("\tExpansion ROM Base Register =0x%x.\n",
ql_printf("\tInterrupt Line =0x%x.\n",
ql_printf("\tInterrupt Pin =0x%x.\n",
ql_printf("\tMin Grant =0x%x.\n",
ql_printf("\tMax Grant =0x%x.\n",
ql_printf("\tdevice_control =0x%x.\n",
ql_printf("\tlink_status =0x%x.\n",
ql_printf("\tmsi_msg_control =0x%x.\n",
ql_printf("\tmsi_x_msg_control =0x%x.\n",
}
}
/*
* Print a formated string
*/
void
{
}
/*
* Read all control registers value and save in a string
*/
static uint32_t
{
int i, j;
/* read Reg 0 -0xC4 */
for (i = 0, j = 0; i <= 0xfc; i += 4) {
if (i == REG_INTERRUPT_ENABLE) {
/* Read */
if (data & INTR_EN_EN) {
data);
} else {
data);
}
}
j++;
}
*bp = '\0';
bp++;
return (cnt);
}
/*
* Get address and size of image tables in flash memory
*/
static int
{
switch (region) {
case FLT_REGION_FDT:
break;
case FLT_REGION_FLT:
break;
case FLT_REGION_NIC_BOOT_CODE:
break;
case FLT_REGION_MPI_FW_USE:
break;
case FLT_REGION_MPI_RISC_FW:
break;
case FLT_REGION_VPD0:
break;
case FLT_REGION_NIC_PARAM0:
break;
case FLT_REGION_VPD1:
break;
case FLT_REGION_NIC_PARAM1:
break;
case FLT_REGION_MPI_CFG:
break;
case FLT_REGION_EDC_PHY_FW:
break;
case FLT_REGION_FC_BOOT_CODE:
break;
case FLT_REGION_FC_FW:
break;
default:
rval = DDI_FAILURE;
}
return (rval);
}
/*
* Get PCI bus information
*/
static int
{
int *options;
unsigned int noptions;
if (noptions != 0) {
*pci_bus_info_ptr = options[0];
rval = DDI_SUCCESS;
}
}
return (rval);
}
/*
* Build the first packet header in case that 1k+ data transfer is required
*/
void
{
qlge->ioctl_transferred_bytes = 0;
/*
* tell user total bytes prepare to receive in the
* following transactions
*/
pheader->payload_length = 0;
}
/*
* Do ioctl on hardware
*/
/* ARGSUSED */
enum ioc_reply
{
/*
* There should be a M_DATA mblk following
* the initial M_IOCTL mblk
*/
return (IOC_INVAL);
}
switch (cmd) {
case QLA_GET_DBGLEAVEL:
return (IOC_INVAL);
}
break;
case QLA_SET_DBGLEAVEL:
return (IOC_INVAL);
}
break;
case QLA_WRITE_REG:
return (IOC_INVAL);
}
break;
case QLA_READ_PCI_REG:
return (IOC_INVAL);
}
/* protect against bad addr values */
return (IOC_INVAL);
break;
case QLA_WRITE_PCI_REG:
return (IOC_INVAL);
}
/* protect against bad addr values */
return (IOC_INVAL);
break;
case QLA_PCI_STATUS:
"driver size 0x%x not 0x%x ",
(int)sizeof (pci_cfg_t));
return (IOC_INVAL);
}
/* get PCI configuration */
break;
case QLA_GET_PROP:
if (len != sizeof (struct qlnic_prop_info)) {
"driver size 0x%x not 0x%x ",
(int)sizeof (pci_cfg_t));
return (IOC_INVAL);
}
prop_ptr =
/* get various properties */
(void) ql_get_firmware_version(qlge,
&prop_ptr->mpi_version);
(void) qlge_get_link_status(qlge,
&prop_ptr->link_status);
break;
case QLA_LIST_ADAPTER_INFO:
/* count must be exactly same */
return (IOC_INVAL);
}
if (ql_get_pci_bus_info(qlge,
return (IOC_INVAL);
}
break;
case QLA_SHOW_REGION:
"regions %s", ISP_8100_REGION);
break;
case QLA_CONTINUE_COPY_OUT:
return (IOC_INVAL);
/* how many data bytes sent this time */
/* create packet header */
/* create packet payload */
" exported \n", payload_len));
if (qlge->ioctl_transferred_bytes >=
qlge->ioctl_buf_lenth = 0;
}
break;
case QLA_CONTINUE_COPY_IN:
return (IOC_INVAL);
/* create packet header */
/* get packet payload */
bp += IOCTL_HEADER_LEN;
"received \n", payload_len));
if (qlge->ioctl_transferred_bytes >=
(void) ql_get_flash_table_region_info(qlge,
" addr 0x%x, max size %d bytes\n",
(void) qlge_load_flash(qlge,
addr);
"clean up \n",
qlge->ioctl_buf_lenth = 0;
}
break;
IOCTL_MAX_BUF_SIZE; /* 512k */
KM_SLEEP);
"allocate ioctl buffer",
return (IOC_INVAL);
}
}
/* build initial ioctl packet header */
break;
case QLA_SUPPORTED_DUMP_TYPES: /* show available regions */
" types: %s", ISP_8100_AVAILABLE_DUMPS);
break;
case QLA_GET_BINARY_CORE_DUMP:
if (rval == DDI_SUCCESS) {
pheader =
/* build initial ioctl packet header */
} else {
return (IOC_INVAL);
}
break;
(void) ql_trigger_system_error_event(qlge);
break;
case QLA_READ_VPD:
IOCTL_MAX_BUF_SIZE; /* 512k */
KM_SLEEP);
"allocate ioctl buffer",
return (IOC_INVAL);
}
}
len));
(void) ql_flash_vpd(qlge,
/* build initial ioctl packet header */
break;
case QLA_MANUAL_READ_FLASH:
IOCTL_MAX_BUF_SIZE; /* 512k */
KM_SLEEP);
"allocate ioctl buffer",
return (IOC_INVAL);
}
}
if (rval != DDI_SUCCESS) {
return (IOC_INVAL);
}
/* build initial ioctl packet header */
break;
case QLA_READ_FLASH:
KM_SLEEP);
"allocate ioctl buffer",
return (IOC_INVAL);
}
}
&size) != DDI_SUCCESS)
return (IOC_INVAL);
if (rval != DDI_SUCCESS) {
return (IOC_INVAL);
}
/* build initial ioctl packet header */
break;
case QLA_WRITE_FLASH:
qlge->ioctl_transferred_bytes = 0;
KM_SLEEP);
"allocate ioctl buffer",
return (IOC_INVAL);
}
}
"%x, total buffer size 0x%x bytes\n",
break;
case QLA_READ_FW_IMAGE:
}
KM_SLEEP);
"allocate ioctl buffer",
return (IOC_INVAL);
}
(void *)qlge->ioctl_buf_ptr;
1 /* timestamp */;
/* where is the flash data saved */
for (i = 0; i < IMAGE_TABLE_IMAGE_DEFAULT_ENTRIES;
i++) {
return (IOC_INVAL);
/* Dump one image entry */
if (rval != DDI_SUCCESS) {
return (IOC_INVAL);
}
}
/* Last entry */
/* build initial ioctl packet header */
break;
if (len == 0)
return (IOC_INVAL);
"data length error!"
" %x bytes expected, %x received",
return (IOC_INVAL);
}
"0x%x entries\n",
ql_dump_buf("all copy in data:\n",
break;
case QLA_SOFT_RESET:
break;
default:
return (IOC_INVAL);
}
return (IOC_REPLY);
}
/*
* Loopback ioctl code
*/
};
/*
* Set Loopback mode
*/
static enum ioc_reply
{
/*
* If the mode is same as current mode ...
*/
return (IOC_ACK);
/*
* Validate the requested mode
*/
switch (mode) {
default:
return (IOC_INVAL);
case QLGE_LOOP_NONE:
case QLGE_LOOP_EXTERNAL_PHY:
break;
}
/*
* All OK; reprogram for the new mode ...
*/
(void) ql_set_loop_back_mode(qlge);
/* if loopback mode test is done */
if (mode == QLGE_LOOP_NONE) {
(void) ql_route_initialize(qlge);
}
return (IOC_REPLY);
}
/*
* Loopback ioctl
*/
/* ARGSUSED */
enum ioc_reply
{
int cmd;
/*
* Validate format of ioctl
*/
return (IOC_INVAL);
switch (cmd) {
default:
/* NOTREACHED */
return (IOC_INVAL);
case LB_GET_INFO_SIZE:
return (IOC_INVAL);
return (IOC_REPLY);
case LB_GET_INFO:
return (IOC_INVAL);
return (IOC_REPLY);
case LB_GET_MODE:
return (IOC_INVAL);
return (IOC_REPLY);
case LB_SET_MODE:
return (IOC_INVAL);
}
}
/*
* Dumps binary data from firmware.
*/
static int
{
(ql_dump_image_header_t *)(void *)bp;
/* point to real dump data area */
bp += sizeof (ql_dump_image_header_t);
/* total length: header + data image */
return (rval);
}
/*
* Dump registers value in binary format
*/
static int
{
int i;
(ql_dump_image_header_t *)(void *)bp;
/* point to real dump data area */
bp += sizeof (ql_dump_image_header_t);
for (i = 0; i <= 0xfc; i += 4) {
data_ptr++;
}
/* total length: header + data image */
*len_ptr));
return (rval);
}
/*
* Core dump in binary format
*/
static int
{
"%s(%d): Unable to allocate ioctl buffer",
goto out;
}
}
/* description info header */
/* add QTSB signature */
ql_dump_header_ptr->reserved = 0;
/* get dump creation timestamp */
timestamp = ddi_get_time();
timestamp *= 1000000;
/* point to first image header area */
length = sizeof (ql_dump_header_t);
/* if dumping all */
if ((requested_dumps & DUMP_REQUEST_ALL) != 0) {
} else if ((requested_dumps & DUMP_REQUEST_CORE) != 0) {
} else if ((requested_dumps & DUMP_REQUEST_REGISTER) != 0) {
} else {
goto out;
}
}
ql_dump_footer_ptr->reserved = 0;
timestamp = ddi_get_time();
timestamp *= 1000000;
rval = DDI_SUCCESS;
out:
return (rval);
}
/*
* build core dump segment header
*/
static void
{
}
/*
* Unpause MPI risc
*/
static int
{
/* Un-pause the RISC */
return (DDI_FAILURE);
return (DDI_SUCCESS);
}
/*
* Pause MPI risc
*/
static int
{
/* Pause the RISC */
do {
break;
qlge_delay(10);
count--;
} while (count);
}
/*
* Get Interrupt Status registers value
*/
static void
{
int i;
for (i = 0; i < MAX_RX_RINGS; i++, buf++) {
/* read the interrupt enable register for each rx ring */
}
}
/*
* Read serdes register
*/
static int
{
/* wait for reg to come ready */
goto exit;
/* set up for reg read */
/* wait for reg to come ready */
goto exit;
/* get the data */
exit:
return (rtn_val);
}
/*
* Read XGMAC register
*/
static int
{
int status;
int i;
switch (i) {
case PAUSE_SRC_LO :
case PAUSE_SRC_HI :
case GLOBAL_CFG :
case TX_CFG :
case RX_CFG :
case FLOW_CTL :
case PAUSE_OPCODE :
case PAUSE_TIMER :
case PAUSE_FRM_DEST_LO :
case PAUSE_FRM_DEST_HI :
case MAC_TX_PARAMS :
case MAC_RX_PARAMS :
case MAC_SYS_INT :
case MAC_SYS_INT_MASK :
case MAC_MGMT_INT :
case MAC_MGMT_IN_MASK :
case EXT_ARB_MODE :
case TX_PKTS :
case TX_PKTS_LO :
case TX_BYTES :
case TX_BYTES_LO :
case TX_MCAST_PKTS :
case TX_MCAST_PKTS_LO :
case TX_BCAST_PKTS :
case TX_BCAST_PKTS_LO :
case TX_UCAST_PKTS :
case TX_UCAST_PKTS_LO :
case TX_CTL_PKTS :
case TX_CTL_PKTS_LO :
case TX_PAUSE_PKTS :
case TX_PAUSE_PKTS_LO :
case TX_64_PKT :
case TX_64_PKT_LO :
case TX_65_TO_127_PKT :
case TX_65_TO_127_PKT_LO :
case TX_128_TO_255_PKT :
case TX_128_TO_255_PKT_LO :
case TX_256_511_PKT :
case TX_256_511_PKT_LO :
case TX_512_TO_1023_PKT :
case TX_512_TO_1023_PKT_LO :
case TX_1024_TO_1518_PKT :
case TX_1024_TO_1518_PKT_LO :
case TX_1519_TO_MAX_PKT :
case TX_1519_TO_MAX_PKT_LO :
case TX_UNDERSIZE_PKT :
case TX_UNDERSIZE_PKT_LO :
case TX_OVERSIZE_PKT :
case TX_OVERSIZE_PKT_LO :
case RX_HALF_FULL_DET :
case TX_HALF_FULL_DET_LO :
case RX_OVERFLOW_DET :
case TX_OVERFLOW_DET_LO :
case RX_HALF_FULL_MASK :
case TX_HALF_FULL_MASK_LO :
case RX_OVERFLOW_MASK :
case TX_OVERFLOW_MASK_LO :
case STAT_CNT_CTL :
case AUX_RX_HALF_FULL_DET :
case AUX_TX_HALF_FULL_DET :
case AUX_RX_OVERFLOW_DET :
case AUX_TX_OVERFLOW_DET :
case AUX_RX_HALF_FULL_MASK :
case AUX_TX_HALF_FULL_MASK :
case AUX_RX_OVERFLOW_MASK :
case AUX_TX_OVERFLOW_MASK :
case RX_BYTES :
case RX_BYTES_LO :
case RX_BYTES_OK :
case RX_BYTES_OK_LO :
case RX_PKTS :
case RX_PKTS_LO :
case RX_PKTS_OK :
case RX_PKTS_OK_LO :
case RX_BCAST_PKTS :
case RX_BCAST_PKTS_LO :
case RX_MCAST_PKTS :
case RX_MCAST_PKTS_LO :
case RX_UCAST_PKTS :
case RX_UCAST_PKTS_LO :
case RX_UNDERSIZE_PKTS :
case RX_UNDERSIZE_PKTS_LO :
case RX_OVERSIZE_PKTS :
case RX_OVERSIZE_PKTS_LO :
case RX_JABBER_PKTS :
case RX_JABBER_PKTS_LO :
case RX_UNDERSIZE_FCERR_PKTS :
case RX_UNDERSIZE_FCERR_PKTS_LO :
case RX_DROP_EVENTS :
case RX_DROP_EVENTS_LO :
case RX_FCERR_PKTS :
case RX_FCERR_PKTS_LO :
case RX_ALIGN_ERR :
case RX_ALIGN_ERR_LO :
case RX_SYMBOL_ERR :
case RX_SYMBOL_ERR_LO :
case RX_MAC_ERR :
case RX_MAC_ERR_LO :
case RX_CTL_PKTS :
case RX_CTL_PKTS_LO :
case RX_PAUSE_PKTS :
case RX_PAUSE_PKTS_LO :
case RX_64_PKTS :
case RX_64_PKTS_LO :
case RX_65_TO_127_PKTS :
case RX_65_TO_127_PKTS_LO :
case RX_128_255_PKTS :
case RX_128_255_PKTS_LO :
case RX_256_511_PKTS :
case RX_256_511_PKTS_LO :
case RX_512_TO_1023_PKTS :
case RX_512_TO_1023_PKTS_LO :
case RX_1024_TO_1518_PKTS :
case RX_1024_TO_1518_PKTS_LO :
case RX_1519_TO_MAX_PKTS :
case RX_1519_TO_MAX_PKTS_LO :
case RX_LEN_ERR_PKTS :
case RX_LEN_ERR_PKTS_LO :
case MDIO_TX_DATA :
case MDIO_RX_DATA :
case MDIO_CMD :
case MDIO_PHY_ADDR :
case MDIO_PORT :
case MDIO_STATUS :
case TX_CBFC_PAUSE_FRAMES0 :
case TX_CBFC_PAUSE_FRAMES0_LO :
case TX_CBFC_PAUSE_FRAMES1 :
case TX_CBFC_PAUSE_FRAMES1_LO :
case TX_CBFC_PAUSE_FRAMES2 :
case TX_CBFC_PAUSE_FRAMES2_LO :
case TX_CBFC_PAUSE_FRAMES3 :
case TX_CBFC_PAUSE_FRAMES3_LO :
case TX_CBFC_PAUSE_FRAMES4 :
case TX_CBFC_PAUSE_FRAMES4_LO :
case TX_CBFC_PAUSE_FRAMES5 :
case TX_CBFC_PAUSE_FRAMES5_LO :
case TX_CBFC_PAUSE_FRAMES6 :
case TX_CBFC_PAUSE_FRAMES6_LO :
case TX_CBFC_PAUSE_FRAMES7 :
case TX_CBFC_PAUSE_FRAMES7_LO :
case TX_FCOE_PKTS :
case TX_FCOE_PKTS_LO :
case TX_MGMT_PKTS :
case TX_MGMT_PKTS_LO :
case RX_CBFC_PAUSE_FRAMES0 :
case RX_CBFC_PAUSE_FRAMES0_LO :
case RX_CBFC_PAUSE_FRAMES1 :
case RX_CBFC_PAUSE_FRAMES1_LO :
case RX_CBFC_PAUSE_FRAMES2 :
case RX_CBFC_PAUSE_FRAMES2_LO :
case RX_CBFC_PAUSE_FRAMES3 :
case RX_CBFC_PAUSE_FRAMES3_LO :
case RX_CBFC_PAUSE_FRAMES4 :
case RX_CBFC_PAUSE_FRAMES4_LO :
case RX_CBFC_PAUSE_FRAMES5 :
case RX_CBFC_PAUSE_FRAMES5_LO :
case RX_CBFC_PAUSE_FRAMES6 :
case RX_CBFC_PAUSE_FRAMES6_LO :
case RX_CBFC_PAUSE_FRAMES7 :
case RX_CBFC_PAUSE_FRAMES7_LO :
case RX_FCOE_PKTS :
case RX_FCOE_PKTS_LO :
case RX_MGMT_PKTS :
case RX_MGMT_PKTS_LO :
case RX_NIC_FIFO_DROP :
case RX_NIC_FIFO_DROP_LO :
case RX_FCOE_FIFO_DROP :
case RX_FCOE_FIFO_DROP_LO :
case RX_MGMT_FIFO_DROP :
case RX_MGMT_FIFO_DROP_LO :
case RX_PKTS_PRIORITY0 :
case RX_PKTS_PRIORITY0_LO :
case RX_PKTS_PRIORITY1 :
case RX_PKTS_PRIORITY1_LO :
case RX_PKTS_PRIORITY2 :
case RX_PKTS_PRIORITY2_LO :
case RX_PKTS_PRIORITY3 :
case RX_PKTS_PRIORITY3_LO :
case RX_PKTS_PRIORITY4 :
case RX_PKTS_PRIORITY4_LO :
case RX_PKTS_PRIORITY5 :
case RX_PKTS_PRIORITY5_LO :
case RX_PKTS_PRIORITY6 :
case RX_PKTS_PRIORITY6_LO :
case RX_PKTS_PRIORITY7 :
case RX_PKTS_PRIORITY7_LO :
case RX_OCTETS_PRIORITY0 :
case RX_OCTETS_PRIORITY0_LO :
case RX_OCTETS_PRIORITY1 :
case RX_OCTETS_PRIORITY1_LO :
case RX_OCTETS_PRIORITY2 :
case RX_OCTETS_PRIORITY2_LO :
case RX_OCTETS_PRIORITY3 :
case RX_OCTETS_PRIORITY3_LO :
case RX_OCTETS_PRIORITY4 :
case RX_OCTETS_PRIORITY4_LO :
case RX_OCTETS_PRIORITY5 :
case RX_OCTETS_PRIORITY5_LO :
case RX_OCTETS_PRIORITY6 :
case RX_OCTETS_PRIORITY6_LO :
case RX_OCTETS_PRIORITY7 :
case RX_OCTETS_PRIORITY7_LO :
case TX_PKTS_PRIORITY0 :
case TX_PKTS_PRIORITY0_LO :
case TX_PKTS_PRIORITY1 :
case TX_PKTS_PRIORITY1_LO :
case TX_PKTS_PRIORITY2 :
case TX_PKTS_PRIORITY2_LO :
case TX_PKTS_PRIORITY3 :
case TX_PKTS_PRIORITY3_LO :
case TX_PKTS_PRIORITY4 :
case TX_PKTS_PRIORITY4_LO :
case TX_PKTS_PRIORITY5 :
case TX_PKTS_PRIORITY5_LO :
case TX_PKTS_PRIORITY6 :
case TX_PKTS_PRIORITY6_LO :
case TX_PKTS_PRIORITY7 :
case TX_PKTS_PRIORITY7_LO :
case TX_OCTETS_PRIORITY0 :
case TX_OCTETS_PRIORITY0_LO :
case TX_OCTETS_PRIORITY1 :
case TX_OCTETS_PRIORITY1_LO :
case TX_OCTETS_PRIORITY2 :
case TX_OCTETS_PRIORITY2_LO :
case TX_OCTETS_PRIORITY3 :
case TX_OCTETS_PRIORITY3_LO :
case TX_OCTETS_PRIORITY4 :
case TX_OCTETS_PRIORITY4_LO :
case TX_OCTETS_PRIORITY5 :
case TX_OCTETS_PRIORITY5_LO :
case TX_OCTETS_PRIORITY6 :
case TX_OCTETS_PRIORITY6_LO :
case TX_OCTETS_PRIORITY7 :
case TX_OCTETS_PRIORITY7_LO :
case RX_DISCARD_PRIORITY0 :
case RX_DISCARD_PRIORITY0_LO :
case RX_DISCARD_PRIORITY1 :
case RX_DISCARD_PRIORITY1_LO :
case RX_DISCARD_PRIORITY2 :
case RX_DISCARD_PRIORITY2_LO :
case RX_DISCARD_PRIORITY3 :
case RX_DISCARD_PRIORITY3_LO :
case RX_DISCARD_PRIORITY4 :
case RX_DISCARD_PRIORITY4_LO :
case RX_DISCARD_PRIORITY5 :
case RX_DISCARD_PRIORITY5_LO :
case RX_DISCARD_PRIORITY6 :
case RX_DISCARD_PRIORITY6_LO :
case RX_DISCARD_PRIORITY7 :
case RX_DISCARD_PRIORITY7_LO :
if (status != DDI_SUCCESS)
goto err;
break;
default:
break;
}
}
err:
return (status);
}
/*
* Read MPI related registers
*/
static int
{
!= DDI_SUCCESS) {
goto out;
}
}
out:
return (rtn_val);
}
/*
* Read processor "shadow" register "addr" value and save
* in "data".Assume all the locks&semaphore have been acquired
*/
static int
{
uint32_t i;
for (i = 0; i < MPI_CORE_SH_REGS_CNT; i++, buf++) {
goto end;
goto end;
}
end:
return (rtn_val);
}
static uint32_t *
{
if (mux_sel == 0) {
buf ++;
}
buf++;
buf++;
}
}
}
return (buf);
}
static int
{
1, /* 0x00 */
1, /* 0x01 */
1, /* 0x02 */
0, /* 0x03 */
1, /* 0x04 */
1, /* 0x05 */
1, /* 0x06 */
1, /* 0x07 */
1, /* 0x08 */
1, /* 0x09 */
1, /* 0x0A */
1, /* 0x0B */
1, /* 0x0C */
1, /* 0x0D */
1, /* 0x0E */
0, /* 0x0F */
1, /* 0x10 */
1, /* 0x11 */
1, /* 0x12 */
1, /* 0x13 */
0, /* 0x14 */
0, /* 0x15 */
0, /* 0x16 */
0, /* 0x17 */
0, /* 0x18 */
0, /* 0x19 */
0, /* 0x1A */
0, /* 0x1B */
0, /* 0x1C */
0, /* 0x1D */
0, /* 0x1E */
0 /* 0x1F */
};
1, /* 0x00 */
0, /* 0x01 */
0, /* 0x02 */
0, /* 0x03 */
0, /* 0x04 */
0, /* 0x05 */
1, /* 0x06 */
1, /* 0x07 */
0, /* 0x08 */
0, /* 0x09 */
0, /* 0x0A */
0, /* 0x0B */
0, /* 0x0C */
0, /* 0x0D */
1, /* 0x0E */
0, /* 0x0F */
0, /* 0x10 */
0, /* 0x11 */
0, /* 0x12 */
0, /* 0x13 */
0, /* 0x14 */
0, /* 0x15 */
0, /* 0x16 */
0, /* 0x17 */
0, /* 0x18 */
0, /* 0x19 */
0, /* 0x1A */
0, /* 0x1B */
0, /* 0x1C */
0, /* 0x1D */
0, /* 0x1E */
0 /* 0x1F */
};
1, /* 0x00 */
0, /* 0x01 */
0, /* 0x02 */
1, /* 0x03 */
0, /* 0x04 */
0, /* 0x05 */
0, /* 0x06 */
0, /* 0x07 */
1, /* 0x08 */
1, /* 0x09 */
0, /* 0x0A */
0, /* 0x0B */
1, /* 0x0C */
1, /* 0x0D */
1, /* 0x0E */
0, /* 0x0F */
1, /* 0x10 */
1, /* 0x11 */
0, /* 0x12 */
0, /* 0x13 */
0, /* 0x14 */
0, /* 0x15 */
0, /* 0x16 */
0, /* 0x17 */
0, /* 0x18 */
0, /* 0x19 */
0, /* 0x1A */
0, /* 0x1B */
0, /* 0x1C */
0, /* 0x1D */
0, /* 0x1E */
0 /* 0x1F */
};
1, /* 0x00 */
0, /* 0x01 */
0, /* 0x02 */
0, /* 0x03 */
0, /* 0x04 */
0, /* 0x05 */
0, /* 0x06 */
0, /* 0x07 */
0, /* 0x08 */
0, /* 0x09 */
0, /* 0x0A */
0, /* 0x0B */
1, /* 0x0C */
1, /* 0x0D */
0, /* 0x0E */
0, /* 0x0F */
0, /* 0x10 */
0, /* 0x11 */
0, /* 0x12 */
0, /* 0x13 */
0, /* 0x14 */
0, /* 0x15 */
0, /* 0x16 */
0, /* 0x17 */
0, /* 0x18 */
0, /* 0x19 */
0, /* 0x1A */
0, /* 0x1B */
0, /* 0x1C */
0, /* 0x1D */
0, /* 0x1E */
0 /* 0x1F */
};
/*
* First we have to enable the probe mux
*/
return (0);
}
/*
* Dump rounting index registers
*/
void
{
if (type < 2) {
index_max = 8;
} else {
index_max = 16;
}
result_index = 0;
while ((result_index & 0x40000000) == 0) {
}
buf ++;
buf ++;
*buf = result_index;
buf ++;
*buf = result_data;
buf ++;
}
}
}
/*
* Dump mac protocol registers
*/
void
{
switch (type) {
case 0: /* CAM */
max_index = 512;
max_offset = 3;
break;
case 1: /* Multicast MAC Address */
max_index = 32;
max_offset = 2;
break;
case 2: /* VLAN filter mask */
case 3: /* MC filter mask */
max_index = 4096;
max_offset = 1;
break;
case 4: /* FC MAC addresses */
max_index = 4;
max_offset = 2;
break;
case 5: /* Mgmt MAC addresses */
max_index = 8;
max_offset = 2;
break;
case 6: /* Mgmt VLAN addresses */
max_index = 16;
max_offset = 1;
break;
case 7: /* Mgmt IPv4 address */
max_index = 4;
max_offset = 1;
break;
case 8: /* Mgmt IPv6 address */
max_index = 4;
max_offset = 4;
break;
max_index = 4;
max_offset = 1;
break;
default:
max_index = 0;
max_offset = 0;
break;
}
| (offset);
result_index = 0;
while ((result_index & 0x40000000) == 0) {
}
*buf = result_index;
buf ++;
*buf = result_data;
buf ++;
}
}
}
}
/*
* Dump serdes registers
*/
static int
{
uint32_t i, j;
int status;
for (i = 0, j = 0; i <= 0x000000034; i += 4) {
&mpi_coredump->serdes_xaui_an[j++]);
if (status != DDI_SUCCESS) {
goto err;
}
}
for (i = 0x800, j = 0; i <= 0x880; i += 4) {
&mpi_coredump->serdes_xaui_hss_pcs[j++]);
if (status != DDI_SUCCESS) {
goto err;
}
}
for (i = 0x1000, j = 0; i <= 0x1034; i += 4) {
&mpi_coredump->serdes_xfi_an[j++]);
if (status != DDI_SUCCESS) {
goto err;
}
}
for (i = 0x1050, j = 0; i <= 0x107c; i += 4) {
&mpi_coredump->serdes_xfi_train[j++]);
if (status != DDI_SUCCESS) {
goto err;
}
}
for (i = 0x1800, j = 0; i <= 0x1838; i += 4) {
&mpi_coredump->serdes_xfi_hss_pcs[j++]);
if (status != DDI_SUCCESS) {
goto err;
}
}
for (i = 0x1c00, j = 0; i <= 0x1c1f; i++) {
&mpi_coredump->serdes_xfi_hss_tx[j++]);
if (status != DDI_SUCCESS) {
goto err;
}
}
for (i = 0x1c40, j = 0; i <= 0x1c5f; i++) {
&mpi_coredump->serdes_xfi_hss_rx[j++]);
if (status != DDI_SUCCESS) {
goto err;
}
}
for (i = 0x1e00, j = 0; i <= 0x1e1f; i++) {
&mpi_coredump->serdes_xfi_hss_pll[j++]);
if (status != DDI_SUCCESS) {
goto err;
}
}
err:
if (status != DDI_SUCCESS) {
}
return (status);
}
/*
* Dump ets registers
*/
static int
{
int i;
/*
* First read out the NIC ETS
*/
for (i = 0; i < 8; i++, buf++) {
i << 29 | 0x08000000);
/* wait for reg to come ready */
/* get the data */
}
/*
* Now read out the CNA ETS
*/
for (i = 0; i < 2; i ++, buf ++) {
i << 29 | 0x08000000);
/* wait for reg to come ready */
}
return (0);
}
/*
* Core dump in binary format
*/
int
{
int i;
return (rtn_val);
}
/* pause the risc */
"%s(%d) Wait for RISC paused timeout.",
goto out;
}
/* 0:make core dump header */
sizeof (mpi_coredump_global_header_t));
"MPI Coredump");
timestamp = ddi_get_time();
timestamp *= 1000000;
(uint32_t)(sizeof (ql_mpi_coredump_t));
sizeof (mpi_coredump_global_header_t);
"driver version is "VERSIONSTR);
/* 1:MPI Core Registers */
sizeof (mpi_coredump->mpi_core_regs) +
sizeof (mpi_coredump->mpi_core_sh_regs),
(uint8_t *)"Core Registers");
/* first, read 127 core registers */
/* read the next 16 shadow registers */
(void) ql_get_mpi_shadow_regs(qlge,
&mpi_coredump->mpi_core_sh_regs[0]);
/* 2:MPI Test Logic Registers */
sizeof (mpi_coredump_segment_header_t) +
sizeof (mpi_coredump->test_logic_regs),
(uint8_t *)"Test Logic Regs");
/* 3:RMII Registers */
sizeof (mpi_coredump_segment_header_t) +
sizeof (mpi_coredump->rmii_regs),
(uint8_t *)"RMII Registers");
/* 4:FCMAC1 Registers */
sizeof (mpi_coredump_segment_header_t) +
sizeof (mpi_coredump->fcmac1_regs),
(uint8_t *)"FCMAC1 Registers");
/* 5:FCMAC2 Registers */
sizeof (mpi_coredump_segment_header_t) +
sizeof (mpi_coredump->fcmac2_regs),
(uint8_t *)"FCMAC2 Registers");
/* 6:FC1 Mailbox Registers */
sizeof (mpi_coredump_segment_header_t) +
sizeof (mpi_coredump->fc1_mbx_regs),
(uint8_t *)"FC1 MBox Regs");
/* 7:IDE Registers */
sizeof (mpi_coredump_segment_header_t) +
sizeof (mpi_coredump->ide_regs),
(uint8_t *)"IDE Registers");
/* 8:Host1 Mailbox Registers */
sizeof (mpi_coredump_segment_header_t) +
sizeof (mpi_coredump->nic1_mbx_regs),
(uint8_t *)"NIC1 MBox Regs");
/* 9:SMBus Registers */
sizeof (mpi_coredump_segment_header_t) +
sizeof (mpi_coredump->smbus_regs),
(uint8_t *)"SMBus Registers");
/* 10:FC2 Mailbox Registers */
sizeof (mpi_coredump_segment_header_t) +
sizeof (mpi_coredump->fc2_mbx_regs),
(uint8_t *)"FC2 MBox Regs");
/* 11:Host2 Mailbox Registers */
sizeof (mpi_coredump_segment_header_t) +
sizeof (mpi_coredump->nic2_mbx_regs),
(uint8_t *)"NIC2 MBox Regs");
/* 12:i2C Registers */
sizeof (mpi_coredump_segment_header_t) +
sizeof (mpi_coredump->i2c_regs),
(uint8_t *)"I2C Registers");
/* 13:MEMC Registers */
sizeof (mpi_coredump_segment_header_t) +
sizeof (mpi_coredump->memc_regs),
(uint8_t *)"MEMC Registers");
/* 14:PBus Registers */
sizeof (mpi_coredump_segment_header_t) +
sizeof (mpi_coredump->pbus_regs),
(uint8_t *)"PBUS Registers");
/* 15:MDE Registers */
sizeof (mpi_coredump_segment_header_t) +
sizeof (mpi_coredump->mde_regs),
(uint8_t *)"MDE Registers");
sizeof (mpi_coredump_segment_header_t) +
sizeof (mpi_coredump->serdes_xaui_an),
(uint8_t *)"XAUI AN Registers");
sizeof (mpi_coredump_segment_header_t) +
sizeof (mpi_coredump->serdes_xaui_hss_pcs),
(uint8_t *)"XAUI HSS PCS Registers");
sizeof (mpi_coredump_segment_header_t) +
sizeof (mpi_coredump->serdes_xfi_an),
(uint8_t *)"XFI AN Registers");
sizeof (mpi_coredump_segment_header_t) +
sizeof (mpi_coredump->serdes_xfi_train),
(uint8_t *)"XFI TRAIN Registers");
sizeof (mpi_coredump_segment_header_t) +
sizeof (mpi_coredump->serdes_xfi_hss_pcs),
(uint8_t *)"XFI HSS PCS Registers");
sizeof (mpi_coredump_segment_header_t) +
sizeof (mpi_coredump->serdes_xfi_hss_tx),
(uint8_t *)"XFI HSS TX Registers");
sizeof (mpi_coredump_segment_header_t) +
sizeof (mpi_coredump->serdes_xfi_hss_rx),
(uint8_t *)"XFI HSS RX Registers");
sizeof (mpi_coredump_segment_header_t) +
sizeof (mpi_coredump->serdes_xfi_hss_pll),
(uint8_t *)"XFI HSS PLL Registers");
/* 16:NIC Ctrl Registers Port1 */
sizeof (mpi_coredump_segment_header_t) +
sizeof (mpi_coredump->nic_regs),
(uint8_t *)"NIC Registers");
i = 0;
addr += 4;
}
sizeof (mpi_coredump_segment_header_t) +
sizeof (mpi_coredump->intr_states),
(uint8_t *)"INTR States");
sizeof (mpi_coredump_segment_header_t) +
sizeof (mpi_coredump->xgmac),
(uint8_t *)"NIC XGMac Registers");
sizeof (mpi_coredump_segment_header_t) +
sizeof (mpi_coredump->probe_dump),
(uint8_t *)"Probe Dump");
sizeof (mpi_coredump_segment_header_t) +
sizeof (mpi_coredump->routing_regs),
(uint8_t *)"Routing Regs");
sizeof (mpi_coredump_segment_header_t) +
sizeof (mpi_coredump->mac_prot_regs),
(uint8_t *)"MAC Prot Regs");
sizeof (mpi_coredump_segment_header_t) +
sizeof (mpi_coredump->ets),
(uint8_t *)"ETS Registers");
/* clear the pause */
"Failed RISC unpause.");
goto out;
}
/* Reset the MPI Processor */
goto out;
}
/* 22:WCS MPI Ram ?? */
sizeof (mpi_coredump_segment_header_t) +
sizeof (mpi_coredump->code_ram),
(uint8_t *)"WCS RAM");
== DDI_SUCCESS) {
sizeof (mpi_coredump->code_ram));
} else {
goto out;
}
/* 23:MEMC Ram ?? */
sizeof (mpi_coredump_segment_header_t) +
sizeof (mpi_coredump->memc_ram),
(uint8_t *)"MEMC RAM");
== DDI_SUCCESS) {
sizeof (mpi_coredump->memc_ram));
} else {
goto out;
}
/*
* 24. Restart MPI
*/
}
out:
return (rtn_val);
}