hpi_rxdma.c revision b83cd2c35abe58abb09c73f2ef35426f1384ad46
/*
* 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 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <hpi_rxdma.h>
#include <hxge_common.h>
#include <hxge_impl.h>
#define RXDMA_RESET_TRY_COUNT 5
#define RXDMA_RESET_DELAY 5
#define RXDMA_OP_DISABLE 0
#define RXDMA_OP_ENABLE 1
#define RXDMA_OP_RESET 2
#define RCR_TIMEOUT_ENABLE 1
#define RCR_TIMEOUT_DISABLE 2
#define RCR_THRESHOLD 4
{
if (!RXDMA_CHANNEL_VALID(rdc)) {
"rxdma_cfg_logical_page_handle"
" Illegal RDC number %d \n", rdc));
return (HPI_RXDMA_RDC_INVALID);
}
return (HPI_SUCCESS);
}
{
}
return (HPI_FAILURE);
return (HPI_SUCCESS);
}
/* RX DMA functions */
static hpi_status_t
{
if (!RXDMA_CHANNEL_VALID(rdc)) {
"hpi_rxdma_cfg_rdc_ctl Illegal RDC number %d \n", rdc));
return (HPI_RXDMA_RDC_INVALID);
}
switch (op) {
case RXDMA_OP_ENABLE:
}
return (HPI_FAILURE);
}
break;
case RXDMA_OP_DISABLE:
rdc) != HPI_SUCCESS) {
" hpi_rxdma_cfg_rdc_ctl"
" RXDMA_OP_DISABLE Failed for RDC %d \n",
rdc));
return (error);
}
break;
case RXDMA_OP_RESET:
}
if (count == 0) {
" hpi_rxdma_cfg_rdc_ctl"
" Reset Failed for RDC %d \n", rdc));
return (error);
}
break;
default:
return (HPI_RXDMA_SW_PARAM_ERROR);
}
return (HPI_SUCCESS);
}
{
}
{
}
{
}
static hpi_status_t
{
if (!RXDMA_CHANNEL_VALID(rdc)) {
"rxdma_cfg_rdc_rcr_ctl Illegal RDC number %d \n", rdc));
return (HPI_RXDMA_RDC_INVALID);
}
switch (op) {
case RCR_TIMEOUT_ENABLE:
break;
case RCR_THRESHOLD:
break;
case RCR_TIMEOUT_DISABLE:
break;
default:
"rxdma_cfg_rdc_rcr_ctl Illegal opcode %x \n", op));
return (HPI_RXDMA_OPCODE_INVALID(rdc));
}
return (HPI_SUCCESS);
}
{
}
{
}
/*
* Configure The RDC channel Rcv Buffer Ring
*/
{
if (!RXDMA_CHANNEL_VALID(rdc)) {
"rxdma_cfg_rdc_ring Illegal RDC number %d \n", rdc));
return (HPI_RXDMA_RDC_INVALID);
}
page_handle.value = 0;
/*
* Only after all the configurations are set, then
* enable the RDC or else configuration fatal error
* will be returned (especially if the Hypervisor
* set up the logical pages with non-zero values.
* This HPI function only sets up the configuration.
* Call the enable function to enable the RDMC!
*/
}
} else {
}
/* rbr config */
/* The remaining 20 bits in the DMA address form the handle */
/*
* The RBR ring size must be multiple of 64.
*/
"hpi_rxdma_cfg_rdc_ring Illegal RBR Queue Length %d \n",
rdc_desc_cfg->rbr_len));
}
/*
* The lower 6 bits are hardcoded to 0 and the higher 10 bits are
* stored in len.
*/
"hpi_rxdma_cfg_rdc_ring CFGA 0x%llx len %d (RBR LEN %d)\n",
/*
* bksize is 1 bit
* Buffer Block Size. b0 - 4K; b1 - 8K.
*/
else {
"rxdma_cfg_rdc_ring blksize: Illegal buffer size %d \n",
return (HPI_RXDMA_BUFSZIE_INVALID);
}
/*
* Size 0 of packet buffer. b00 - 256; b01 - 512; b10 - 1K; b11 - resvd.
*/
if (rdc_desc_cfg->valid0) {
else {
" rxdma_cfg_rdc_ring"
" blksize0: Illegal buffer size %x \n",
rdc_desc_cfg->size0));
return (HPI_RXDMA_BUFSZIE_INVALID);
}
} else {
}
/*
* Size 1 of packet buffer. b0 - 1K; b1 - 2K.
*/
if (rdc_desc_cfg->valid1) {
else {
" rxdma_cfg_rdc_ring"
" blksize1: Illegal buffer size %x \n",
rdc_desc_cfg->size1));
return (HPI_RXDMA_BUFSZIE_INVALID);
}
} else {
}
/*
* Size 2 of packet buffer. b0 - 2K; b1 - 4K.
*/
if (rdc_desc_cfg->valid2) {
else {
" rxdma_cfg_rdc_ring"
" blksize2: Illegal buffer size %x \n",
rdc_desc_cfg->size2));
return (HPI_RXDMA_BUFSZIE_INVALID);
}
} else {
}
/*
* The rcr len must be multiple of 32.
*/
" rxdma_cfg_rdc_ring Illegal RCR Queue Length %d \n",
rdc_desc_cfg->rcr_len));
}
/*
* Bits 15:5 of the maximum number of 8B entries in RCR. Bits 4:0 are
* hard-coded to zero. The maximum size is 2^16 - 32.
*/
/* check if the rcr timeout value is valid */
} else {
" rxdma_cfg_rdc_ring"
" Illegal RCR Timeout value %d \n",
}
} else {
}
/* check if the rcr threshold value is valid */
} else {
" rxdma_cfg_rdc_ring Illegal RCR Threshold value %d \n",
}
/* now do the actual HW configuration */
return (HPI_SUCCESS);
}
{
/*
* Hydra doesn't have details about these errors.
* It only provides the addresses of the errors.
*/
return (HPI_SUCCESS);
}
/* system wide conf functions */
{
" hpi_rxdma_cfg_clock_div_set: add 0x%llx "
"handle 0x%llx value 0x%llx",
return (HPI_SUCCESS);
}
{
if (!RXDMA_CHANNEL_VALID(rdc)) {
" rxdma_rdc_rbr_stat_get Illegal RDC Number %d \n", rdc));
return (HPI_RXDMA_RDC_INVALID);
}
return (HPI_SUCCESS);
}
{
if (!RXDMA_CHANNEL_VALID(rdc)) {
" rxdma_rdc_rcr_qlen_get Illegal RDC Number %d \n", rdc));
return (HPI_RXDMA_RDC_INVALID);
}
" rxdma_rdc_rcr_qlen_get RDC %d qlen %x qlen %x\n",
return (HPI_SUCCESS);
}
{
if (!RXDMA_CHANNEL_VALID(channel)) {
}
return (HPI_SUCCESS);
}
/*
* This function is called to operate on the control and status register.
*/
{
int status = HPI_SUCCESS;
if (!RXDMA_CHANNEL_VALID(channel)) {
}
switch (op_mode) {
case OP_GET:
break;
case OP_SET:
break;
case OP_UPDATE:
break;
default:
}
return (status);
}
/*
* This function is called to operate on the event mask
* register which is used for generating interrupts.
*/
{
int status = HPI_SUCCESS;
if (!RXDMA_CHANNEL_VALID(channel)) {
}
switch (op_mode) {
case OP_GET:
break;
case OP_SET:
break;
case OP_UPDATE:
break;
default:
}
return (status);
}