/*
* 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.
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _UNM_NIC_
#define _UNM_NIC_
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/inttypes.h>
#include <sys/ethernet.h>
#ifdef SOLARIS11
#include <sys/mac_provider.h>
#include <sys/mac_ether.h>
#else
#include "mac.h"
#include "mac_ether.h"
#endif
#include "unm_nic_hw.h"
#include "nic_cmn.h"
#include "unm_inc.h" /* For MAX_RCV_CTX */
#include "unm_brdcfg.h"
#include "unm_version.h"
#include "nic_phan_reg.h"
#include "unm_nic_ioctl.h"
typedef unsigned long uptr_t;
#define FIRST_PAGE_GROUP_START 0
/*
* normalize a 64MB crb address to 32MB PCI window
* To use CRB_NORMALIZE, window _must_ be set to 1
*/
((a) < (b)?((b)-(a)):((b)+(range)-(a)))
/*
* Following macros require the mapped addresses to access
* the Phantom memory.
*/
#ifdef DEBUG_LEVEL
#else
#endif
extern char unm_nic_driver_name[];
extern int verbmsg;
typedef struct unm_dmah_node {
typedef struct dma_area {
void *vaddr;
} dma_area_t;
struct unm_cmd_buffer {
};
typedef struct pkt_info {
} pktinfo_t;
typedef struct unm_rx_buffer {
/* Board types */
/*
* One hardware_context{} per adapter
* contains interrupt info as well shared hardware info.
*/
typedef struct _hardware_context {
unsigned long pci_base0;
unsigned long pci_len0;
unsigned long pci_base1;
unsigned long pci_len1;
unsigned long pci_base2;
unsigned long pci_len2;
unsigned long first_page_group_end;
unsigned long first_page_group_start;
int pci_func;
typedef struct unm_pauseparam {
/*
*
* These are the values to use with LD_SET_MODE.
*/
#define UNM_LOOP_NONE 0
/*
* Named Data (ND) Parameter Management Structure
*/
typedef struct {
int ndp_info;
int ndp_min;
int ndp_max;
int ndp_val;
char *ndp_name;
/*
* NDD parameter indexes, divided into:
*
* read-only parameters describing the hardware's capabilities
* read-write parameters controlling the advertised capabilities
* read-only parameters describing the partner's capabilities
* read-only parameters describing the link state
*/
enum {
PARAM_AUTONEG_CAP = 0,
};
struct unm_adapter_stats {
};
/* descriptor types */
/*
* Rcv Descriptor Context. One such per Rcv Descriptor. There may
* be one Rcv Descriptor for normal packets, one for jumbo,
* one for LRO and may be expanded.
*/
struct unm_rcv_desc_context_s {
/* address of rx ring in Phantom */
/* size of the receive buf */
/* rx buffers for receive */
};
/*
* Receive context. There is one such structure per instance of the
* receive processing. Any state information that is relevant to
* the receive, and is must be in this structure. The global data may be
* present elsewhere.
*/
typedef struct unm_recv_context_s {
#define NX_USE_MSIX
/* msix defines */
/*
* Bug: word or char write on MSI-X capcabilities register (0x40) in PCI config
* space has no effect on register values. Need to write dword.
*/
#define UNM_HWBUG_8_WORKAROUND
/*
* Bug: Can not reset bit 32 (msix enable bit) on MSI-X capcabilities
* register (0x40) independently.
* Need to write 0x0 (zero) to MSI-X capcabilities register in order to reset
* msix enable bit. On writing zero rest of the bits are not touched.
*/
#define UNM_HWBUG_9_WORKAROUND
/* Following structure is for specific port information */
struct unm_adapter_s {
int rx_csum;
int status;
int flags;
int instance;
const char *name;
int intr_type;
int tx_bcopy_threshold;
short context_alloced;
int max_rds_rings;
/* Num of bufs posted in phantom */
/* Num of instances active on cmd buffer ring */
int resched_needed;
int driver_mismatch;
int rx_bcopy_threshold;
/*
* Receive instances. These can be either one per port,
* or one per peg, etc.
*/
int is_up;
/* context interface shared between card and host */
struct {
void *addr;
} dummy_dma;
uint32_t);
unsigned long, int);
unsigned long long
unsigned long long);
struct unm_statistics *);
void *, int);
int);
int);
int);
int);
u32 *);
u32 *);
u32);
}; /* unm_adapter structure */
/* Following structure is for specific port information */
((((off) < SECOND_PAGE_GROUP_END) && \
((off) >= SECOND_PAGE_GROUP_START)) ? \
(off) - SECOND_PAGE_GROUP_START) : \
((((off) < THIRD_PAGE_GROUP_END) && \
((off) >= THIRD_PAGE_GROUP_START)) ? \
0)))
{ \
&_v1_, 4)); \
}
/* Functions available from unm_nic_hw.c */
// int unm_nic_reg_read (unm_adapter *adapter, u64 off);
struct unm_adapter_s *adapter);
struct unm_adapter_s *adapter);
int unm_crb_read_val_adapter(unsigned long off,
struct unm_adapter_s *adapter);
/* unm_nic_hw.c */
int unm_crb_writelit_adapter_128M(struct unm_adapter_s *, unsigned long, int);
int len);
int len);
int len);
unsigned long long addr);
struct unm_statistics *unm_stats);
int unm_crb_writelit_adapter_2M(struct unm_adapter_s *, unsigned long, int);
unsigned long long addr);
struct unm_statistics *unm_stats);
/* unm_nic_init.c */
/* unm_nic_isr.c */
/* niu.c */
long unm_niu_gbe_init_port(long port);
long unm_niu_gbe_disable_phy_interrupts(struct unm_adapter_s *);
long unm_niu_gbe_phy_read(struct unm_adapter_s *,
/* unm_nic_ctx.c */
/* unm_nic_main.c */
/* unm_ndd.c */
/* unm_gem.c */
/*
* (Internal) return values from ioctl subroutines
*/
enum ioc_reply {
};
/*
* Shorthand for the NDD parameters
*/
/*
* Property lookups
*/
#define UNM_PROP_EXISTS(d, n) \
#define UNM_PROP_GET_INT(d, n) \
/*
* Bit flags in the 'debug' word ...
*/
#ifdef __cplusplus
}
#endif
#endif /* !_UNM_NIC_ */