/*
* 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 2008 NetXen, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/ethernet.h>
#include <sys/dditypes.h>
#include <sys/sysmacros.h>
#include "unm_nic_hw.h"
#include "unm_nic.h"
#include "nic_phan_reg.h"
#include "nic_cmn.h"
typedef unsigned int nx_rcode_t;
#include "nx_errorcode.h"
#include "nxhal_nic_interface.h"
/*
* All responses must have the NX_CDRP_CMD_BIT cleared
* in the crb NX_CDRP_CRB_OFFSET.
*/
/*
* All commands must have the NX_CDRP_CMD_BIT set in
* the crb NX_CDRP_CRB_OFFSET.
*/
#define NX_DESTROY_CTX_RESET 0
/*
* Context state
*/
#define NX_HOST_CTX_STATE_FREED 0
static int
{
for (;;) {
/* Acquire PCIE HW semaphore5 */
if (done == 1)
break;
if (++timeout >= NX_OS_CRB_RETRY_COUNT) {
return (-1);
}
drv_usecwait(1000);
}
#if 0
#endif
return (0);
}
static void
{
/* Release PCIE HW semaphore5 */
}
static u32
{
int timeout = 0;
do {
/* give atleast 1ms for firmware to respond */
drv_usecwait(1000);
if (++timeout > NX_OS_CRB_RETRY_COUNT)
return (NX_CDRP_RSP_TIMEOUT);
&raw_rsp, 4);
} while (!NX_CDRP_IS_RSP(rsp));
return (rsp);
}
static u32
{
/* Acquire semaphore before accessing CRB */
if (netxen_api_lock(adapter))
return (NX_RCODE_TIMEOUT);
if (rsp == NX_CDRP_RSP_TIMEOUT) {
} else if (rsp == NX_CDRP_RSP_FAIL) {
&rcode, 4);
}
/* Release semaphore */
return (rcode);
}
int
{
mtu,
0,
if (rcode != NX_RCODE_SUCCESS)
return (-EIO);
return (0);
}
static int
{
void *addr;
/* only one sds ring for now */
nsds_rings = 1;
rq_size =
rsp_size =
return (-ENOMEM);
goto out_free_rq;
}
cap |= (NX_CAP0_JUMBO_CONTIGUOUS);
prq->rds_ring_offset = 0;
(sizeof (nx_hostrq_rds_ring_t) * nrds_rings);
for (i = 0; i < nrds_rings; i++) {
}
prq_sds[0].host_phys_addr =
/* only one msix vector for now */
/* now byteswap offsets */
if (err) {
err);
goto out_free_rsp;
}
}
return (err);
}
static void
{
if (netxen_issue_cmd(adapter,
0,
}
}
static int
{
int err = 0;
return (-ENOMEM);
goto out_free_rq;
}
prq->interrupt_ctl = 0;
if (err == NX_RCODE_SUCCESS) {
#if 0
#endif
} else {
err);
}
return (err);
}
static void
{
if (netxen_issue_cmd(adapter,
0,
}
}
};
struct netxen_recv_crb {
};
/* Instance 0 */
{
/* crb_rcv_producer: */
{
UNM_NIC_REG(0x100),
/* Jumbo frames */
UNM_NIC_REG(0x110),
/* LRO */
UNM_NIC_REG(0x120)
},
/* crb_sts_consumer: */
UNM_NIC_REG(0x138),
},
/* Instance 1 */
{
/* crb_rcv_producer: */
{
UNM_NIC_REG(0x144),
/* Jumbo frames */
UNM_NIC_REG(0x154),
/* LRO */
UNM_NIC_REG(0x164)
},
/* crb_sts_consumer: */
UNM_NIC_REG(0x17c),
},
/* Instance 2 */
{
/* crb_rcv_producer: */
{
UNM_NIC_REG(0x1d8),
/* Jumbo frames */
UNM_NIC_REG(0x1f8),
/* LRO */
UNM_NIC_REG(0x208)
},
/* crb_sts_consumer: */
UNM_NIC_REG(0x220),
},
/* Instance 3 */
{
/* crb_rcv_producer: */
{
UNM_NIC_REG(0x22c),
/* Jumbo frames */
UNM_NIC_REG(0x23c),
/* LRO */
UNM_NIC_REG(0x24c)
},
/* crb_sts_consumer: */
UNM_NIC_REG(0x264),
},
};
};
static int
{
unsigned int temp;
}
}
&temp, 4);
&temp, 4);
&temp, 4);
return (0);
}
void
{
}
}
int
{
int err;
if (err)
return (err);
if (err)
return (err);
} else {
return (netxen_init_old_ctx(adapter));
}
}