nxge_common_impl.h revision 4496171313bed39e96f21bc2f9faf2868e267ae3
/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_NXGE_NXGE_COMMON_IMPL_H
#define _SYS_NXGE_NXGE_COMMON_IMPL_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#if defined(NXGE_DEBUG_DMA) || defined(NXGE_DEBUG_TXC)
#define __NXGE_STATIC
#define __NXGE_INLINE
#else
#define __NXGE_STATIC static
#define __NXGE_INLINE inline
#endif
#ifdef AXIS_DEBUG
#define AXIS_WAIT (100000)
#define AXIS_LONG_WAIT (100000)
#define AXIS_WAIT_W (80000)
#define AXIS_WAIT_R (100000)
#define AXIS_WAIT_LOOP (4000)
#endif
#define NO_DEBUG 0x0000000000000000ULL
#define MDT_CTL 0x0000000000000001ULL
#define RX_CTL 0x0000000000000002ULL
#define TX_CTL 0x0000000000000004ULL
#define OBP_CTL 0x0000000000000008ULL
#define VPD_CTL 0x0000000000000010ULL
#define DDI_CTL 0x0000000000000020ULL
#define MEM_CTL 0x0000000000000040ULL
#define SAP_CTL 0x0000000000000080ULL
#define IOC_CTL 0x0000000000000100ULL
#define MOD_CTL 0x0000000000000200ULL
#define DMA_CTL 0x0000000000000400ULL
#define STR_CTL 0x0000000000000800ULL
#define INT_CTL 0x0000000000001000ULL
#define SYSERR_CTL 0x0000000000002000ULL
#define KST_CTL 0x0000000000004000ULL
#define PCS_CTL 0x0000000000008000ULL
#define MII_CTL 0x0000000000010000ULL
#define MIF_CTL 0x0000000000020000ULL
#define FCRAM_CTL 0x0000000000040000ULL
#define MAC_CTL 0x0000000000080000ULL
#define IPP_CTL 0x0000000000100000ULL
#define DMA2_CTL 0x0000000000200000ULL
#define RX2_CTL 0x0000000000400000ULL
#define TX2_CTL 0x0000000000800000ULL
#define MEM2_CTL 0x0000000001000000ULL
#define MEM3_CTL 0x0000000002000000ULL
#define NXGE_CTL 0x0000000004000000ULL
#define NDD_CTL 0x0000000008000000ULL
#define NDD2_CTL 0x0000000010000000ULL
#define TCAM_CTL 0x0000000020000000ULL
#define CFG_CTL 0x0000000040000000ULL
#define CFG2_CTL 0x0000000080000000ULL
#define VIR_CTL 0x0000000100000000ULL
#define VIR2_CTL 0x0000000200000000ULL
#define NXGE_NOTE 0x0000001000000000ULL
#define NXGE_ERR_CTL 0x0000002000000000ULL
#define DUMP_ALWAYS 0x2000000000000000ULL
/* NPI Debug and Error defines */
#define NPI_RDC_CTL 0x0000000000000001ULL
#define NPI_TDC_CTL 0x0000000000000002ULL
#define NPI_TXC_CTL 0x0000000000000004ULL
#define NPI_IPP_CTL 0x0000000000000008ULL
#define NPI_XPCS_CTL 0x0000000000000010ULL
#define NPI_PCS_CTL 0x0000000000000020ULL
#define NPI_ESR_CTL 0x0000000000000040ULL
#define NPI_BMAC_CTL 0x0000000000000080ULL
#define NPI_XMAC_CTL 0x0000000000000100ULL
#define NPI_ZCP_CTL 0x0000000000000200ULL
#define NPI_TCAM_CTL 0x0000000000000400ULL
#define NPI_FCRAM_CTL 0x0000000000000800ULL
#define NPI_VIR_CTL 0x0000000000001000ULL
#define NPI_PIO_CTL 0x0000000000002000ULL
#define NPI_VIO_CTL 0x0000000000004000ULL
#define NPI_REG_CTL 0x0000000040000000ULL
#define NPI_CTL 0x0000000080000000ULL
#define NPI_ERR_CTL 0x0000000080000000ULL
#include <sys/dditypes.h>
#include <sys/ethernet.h>
#ifdef NXGE_DEBUG
#else
#define NXGE_DEBUG_MSG(params)
#endif
#if 1
#else
#define NXGE_ERROR_MSG(params)
#define NXGE_WARN_MSG(params)
#endif
typedef kmutex_t nxge_os_mutex_t;
typedef krwlock_t nxge_os_rwlock_t;
typedef dev_info_t nxge_dev_info_t;
typedef ddi_iblock_cookie_t nxge_intr_cookie_t;
typedef ddi_acc_handle_t nxge_os_acc_handle_t;
typedef nxge_os_acc_handle_t npi_reg_handle_t;
typedef uint64_t npi_reg_ptr_t;
typedef ddi_dma_handle_t nxge_os_dma_handle_t;
typedef struct _nxge_dma_common_t nxge_os_dma_common_t;
typedef struct _nxge_block_mv_t nxge_os_block_mv_t;
typedef frtn_t nxge_os_frtn_t;
#define NXGE_MUTEX_DRIVER MUTEX_DRIVER
#ifdef SW_SIM
#else
#endif
#ifdef SW_SIM
}
#else
#endif
#define NXGE_MEM_PIO_READ8(npi_handle) \
#define NXGE_MEM_PIO_READ16(npi_handle) \
#define NXGE_MEM_PIO_READ32(npi_handle) \
#define NXGE_MEM_PIO_READ64(npi_handle) \
#define SERVICE_LOST DDI_SERVICE_LOST
#define SERVICE_DEGRADED DDI_SERVICE_DEGRADED
#define SERVICE_RESTORED DDI_SERVICE_RESTORED
#define DATAPATH_FAULT DDI_DATAPATH_FAULT
#define DEVICE_FAULT DDI_DEVICE_FAULT
#define EXTERNAL_FAULT DDI_EXTERNAL_FAULT
#define NOTE_LINK_UP DL_NOTE_LINK_UP
#define NOTE_LINK_DOWN DL_NOTE_LINK_DOWN
#define NOTE_SPEED DL_NOTE_SPEED
#define NOTE_PHYS_ADDR DL_NOTE_PHYS_ADDR
#define NOTE_AGGR_AVAIL DL_NOTE_AGGR_AVAIL
#define FM_CHECK_DEV_HANDLE(nxgep)\
#define FM_GET_DEVSTATE(nxgep)\
#ifdef NXGE_FM
#define FM_SERVICE_RESTORED(nxgep)\
#else
#define FM_SERVICE_RESTORED(nxgep)
#endif
#include <linux/compiler.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <net/checksum.h>
#include <asm/byteorder.h>
typedef unsigned char uchar_t;
typedef unsigned short ushort_t;
typedef unsigned int uint_t;
typedef unsigned long ulong_t;
#define uintptr_t unsigned long
#define ETHERADDRL ETH_ALEN
/*
* Ethernet address - 6 octets
*/
struct ether_addr {
};
typedef enum {
B_FALSE = 0,
B_TRUE = 1
} boolean_t;
typedef enum {
#ifdef NXGE_DEBUG
#else
#define NXGE_DEBUG_MSG(params)
#define NXGE_WARN_MSG(params)
#endif
(int)val);
#define IS_PORT_NUM_VALID(portn) \
(portn < 4)
typedef spinlock_t nxge_os_mutex_t;
typedef rwlock_t nxge_os_rwlock_t;
typedef struct pci_dev nxge_dev_info_t;
typedef void * nxge_intr_cookie_t;
typedef void * nxge_os_acc_handle_t;
typedef nxge_os_acc_handle_t npi_reg_handle_t;
typedef char *npi_reg_ptr_t;
typedef void * nxge_os_dma_handle_t;
typedef void nxge_os_dma_common_t;
typedef void nxge_os_block_mv_t;
typedef int nxge_os_frtn_t;
#define MUTEX_DESTROY(lock)
#define RW_DESTROY(lock)
{
return (ptr);
}
#ifndef readq
{
ret <<= 32;
return (ret);
}
#endif
#ifndef writeq
{
}
/*
* In 32 bit modes, some registers have to be written in a
* particular order to expect correct hardware operation. The
* macro SPECIAL_REG_WRITE is used to perform such ordered
* writes. Defines UF(Upper First) and LF(Lower First) will
* be used to specify the required write order.
*/
#define UF 1
#define LF 2
{
} else {
}
}
#else
#endif
#ifdef SW_SIM
mdelay(100); \
}
#else
#endif
#ifdef SW_SIM
mdelay(100); \
}
#else
#endif
#ifndef SW_SIM
#else
#endif /* SW_SIM */
#ifndef SW_SIM
#else
#endif /* SW_SIM */
#include <ne_sim_solaris.h>
#endif
#ifdef NXGE_DEBUG
#else
#define NXGE_DEBUG_MSG(params)
#define NXGE_ERROR_MSG(params)
#endif
#if !defined(ETHERADDRL)
#define ETHERADDRL 6
/*
* Ethernet address - 6 octets
*/
struct ether_addr {
};
#endif
#ifdef LINUX
#include <stdint.h>
#include <stdio.h>
#include <stdarg.h>
#ifndef COSIM_LINUX_DEF
#define COSIM_LINUX_DEF
typedef uint64_t dma_addr_t;
typedef enum {
B_FALSE = 0,
B_TRUE = 1
} boolean_t;
#endif
typedef enum {
#define IS_PORT_NUM_VALID(portn) \
(portn < 4)
#define GFP_KERNEL 0
#endif /* LINUX in COSIM */
#include <ht_client.h>
#include <ht_lib.h>
#include <pthread.h>
typedef pthread_mutex_t nxge_os_mutex_t;
typedef unsigned int nxge_os_rwlock_t;
typedef void * nxge_dev_info_t;
typedef void * nxge_intr_cookie_t;
typedef void * nxge_os_dma_handle_t;
typedef void * nxge_os_acc_handle_t;
typedef nxge_os_acc_handle_t npi_reg_handle_t;
typedef uint64_t npi_reg_ptr_t;
#if defined(IODIAG)
#define timeout(a, b, c) ()
#define untimeout(a) ()
#define drv_usectohz(a) ()
#define drv_usecwait(a)
typedef int nxge_os_dma_common_t;
typedef int nxge_os_block_mv_t;
typedef int nxge_os_frtn_t;
typedef void * p_mblk_t;
typedef void * MBLKP;
#define NXGE_MUTEX_DRIVER NULL
#else
typedef struct _nxge_dma_common_t nxge_os_dma_common_t;
typedef struct _nxge_block_mv_t nxge_os_block_mv_t;
typedef frtn_t nxge_os_frtn_t;
#define NXGE_MUTEX_DRIVER NULL
#define MUTEX_ENTER(lock)
#define MUTEX_TRY_ENTER(lock)
#define MUTEX_EXIT(lock)
#define MUTEX_DESTROY(lock)
#endif
#if defined(IODIAG)
#else
#endif
#define RW_ENTER_WRITER(lock)
#define RW_ENTER_READER(lock)
#define RW_EXIT_READ(lock)
#define RW_DESTROY(lock)
#define FM_SERVICE_RESTORED(nxgep)
#define SERVICE_LOST NULL
#define SERVICE_DEGRADED NULL
#define SERVICE_UNAFFECTED NULL
#define SERVICE_RESTORED NULL
#define DATAPATH_FAULT NULL
#define DEVICE_FAULT NULL
#define EXTERNAL_FAULT NULL
#define NOTE_LINK_UP NULL
#define NOTE_LINK_DOWN NULL
#define NOTE_SPEED NULL
#define NOTE_PHYS_ADDR NULL
#define NOTE_AGGR_AVAIL NULL
#define NOTE_AGGR_UNAVAIL NULL
#define NXGE_DELAY(microseconds)
#ifdef IODIAG_NEPTUNE
us_delay(100000); \
}
#else
#endif
typedef unsigned int nxge_os_mutex_t;
typedef unsigned int nxge_os_rwlock_t;
typedef unsigned int nxge_dev_info_t;
typedef void * nxge_intr_cookie_t;
typedef void * nxge_os_acc_handle_t;
typedef nxge_os_acc_handle_t npi_reg_handle_t;
typedef uint64_t npi_reg_ptr_t;
typedef unsigned int nxge_os_dma_handle_t;
typedef unsigned int nxge_os_dma_common_t;
typedef unsigned int nxge_os_block_mv_t;
typedef int nxge_os_frtn_t;
typedef void * p_mblk_t;
#define NXGE_MUTEX_DRIVER MUTEX_DRIVER
#define RW_ENTER_WRITER(lock)
#define RW_ENTER_READER(lock)
#define RW_DESTROY(lock)
#define NXGE_DELAY(microseconds)
#endif
#if defined(REG_TRACE)
}
/*
* Send 0xbadbad to tell rs_show_reg that we do not have
* a valid RTBUF index to pass
*/
}
int n; \
for (n = 0; n < AXIS_WAIT_LOOP; n++) { \
*(val_p) = 0; \
if (*(val_p) != (~0)) { \
break; \
} \
if (n < 20) { \
"REG 0x%x(0x%llx)", \
} \
} \
if (n >= AXIS_WAIT_LOOP) { \
"with -1!!!", offset); \
} \
}
#else
}
#endif
/*
* In COSIM mode, we could loop for very long time when polling
* for the completion of a Clause45 frame MDIO operations. Display
* one rtrace line for each poll can result in messy screen. Add
* this MACRO for no rtrace show.
*/
}
#if defined(REG_TRACE)
}
/*
* Send 0xbadbad to tell rs_show_reg that we do not have
* a valid RTBUF index to pass
*/
}
#else
}
#endif
#ifdef __cplusplus
}
#endif
#endif /* _SYS_NXGE_NXGE_COMMON_IMPL_H */