17956Sxiuyan.wang@Sun.COM /* 27956Sxiuyan.wang@Sun.COM * CDDL HEADER START 37956Sxiuyan.wang@Sun.COM * 47956Sxiuyan.wang@Sun.COM * The contents of this file are subject to the terms of the 57956Sxiuyan.wang@Sun.COM * Common Development and Distribution License (the "License"). 67956Sxiuyan.wang@Sun.COM * You may not use this file except in compliance with the License. 77956Sxiuyan.wang@Sun.COM * 87956Sxiuyan.wang@Sun.COM * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97956Sxiuyan.wang@Sun.COM * or http://www.opensolaris.org/os/licensing. 107956Sxiuyan.wang@Sun.COM * See the License for the specific language governing permissions 117956Sxiuyan.wang@Sun.COM * and limitations under the License. 127956Sxiuyan.wang@Sun.COM * 137956Sxiuyan.wang@Sun.COM * When distributing Covered Code, include this CDDL HEADER in each 147956Sxiuyan.wang@Sun.COM * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157956Sxiuyan.wang@Sun.COM * If applicable, add the following below this CDDL HEADER, with the 167956Sxiuyan.wang@Sun.COM * fields enclosed by brackets "[]" replaced with your own identifying 177956Sxiuyan.wang@Sun.COM * information: Portions Copyright [yyyy] [name of copyright owner] 187956Sxiuyan.wang@Sun.COM * 197956Sxiuyan.wang@Sun.COM * CDDL HEADER END 207956Sxiuyan.wang@Sun.COM */ 218687SJing.Xiong@Sun.COM 227956Sxiuyan.wang@Sun.COM /* 237956Sxiuyan.wang@Sun.COM * Copyright 2008 NetXen, Inc. All rights reserved. 247956Sxiuyan.wang@Sun.COM * Use is subject to license terms. 257956Sxiuyan.wang@Sun.COM */ 267956Sxiuyan.wang@Sun.COM /* 278687SJing.Xiong@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 287956Sxiuyan.wang@Sun.COM * Use is subject to license terms. 297956Sxiuyan.wang@Sun.COM */ 308687SJing.Xiong@Sun.COM 317956Sxiuyan.wang@Sun.COM #ifndef _UNM_NIC_ 327956Sxiuyan.wang@Sun.COM #define _UNM_NIC_ 337956Sxiuyan.wang@Sun.COM 348687SJing.Xiong@Sun.COM #ifdef __cplusplus 358687SJing.Xiong@Sun.COM extern "C" { 368687SJing.Xiong@Sun.COM #endif 378687SJing.Xiong@Sun.COM 387956Sxiuyan.wang@Sun.COM #include <sys/inttypes.h> 397956Sxiuyan.wang@Sun.COM #include <sys/rwlock.h> 407956Sxiuyan.wang@Sun.COM #include <sys/mutex.h> 417956Sxiuyan.wang@Sun.COM #include <sys/ddi.h> 427956Sxiuyan.wang@Sun.COM 437956Sxiuyan.wang@Sun.COM #include <sys/sunddi.h> 447956Sxiuyan.wang@Sun.COM #include <sys/types.h> 457956Sxiuyan.wang@Sun.COM #include <sys/stream.h> 467956Sxiuyan.wang@Sun.COM #include <sys/strsun.h> 477956Sxiuyan.wang@Sun.COM #include <sys/strsubr.h> 487956Sxiuyan.wang@Sun.COM #include <sys/dlpi.h> 497956Sxiuyan.wang@Sun.COM #include <sys/devops.h> 507956Sxiuyan.wang@Sun.COM #include <sys/stat.h> 517956Sxiuyan.wang@Sun.COM #include <sys/pci.h> 527956Sxiuyan.wang@Sun.COM #include <sys/note.h> 537956Sxiuyan.wang@Sun.COM #include <sys/modctl.h> 547956Sxiuyan.wang@Sun.COM #include <sys/kstat.h> 557956Sxiuyan.wang@Sun.COM #include <sys/ethernet.h> 567956Sxiuyan.wang@Sun.COM #include <sys/errno.h> 577956Sxiuyan.wang@Sun.COM #include <netinet/ip6.h> 587956Sxiuyan.wang@Sun.COM #include <inet/common.h> 597956Sxiuyan.wang@Sun.COM #include <sys/pattr.h> 607956Sxiuyan.wang@Sun.COM #include <inet/mi.h> 617956Sxiuyan.wang@Sun.COM #include <inet/nd.h> 627956Sxiuyan.wang@Sun.COM 63*9436SJing.Xiong@Sun.COM #ifdef SOLARIS11 648275SEric Cheng #include <sys/mac_provider.h> 657956Sxiuyan.wang@Sun.COM #include <sys/mac_ether.h> 66*9436SJing.Xiong@Sun.COM #else 67*9436SJing.Xiong@Sun.COM #include "mac.h" 68*9436SJing.Xiong@Sun.COM #include "mac_ether.h" 69*9436SJing.Xiong@Sun.COM #endif 707956Sxiuyan.wang@Sun.COM #include <sys/miiregs.h> /* by fjlite out of intel */ 717956Sxiuyan.wang@Sun.COM 727956Sxiuyan.wang@Sun.COM #include "unm_nic_hw.h" 737956Sxiuyan.wang@Sun.COM #include "nic_cmn.h" 747956Sxiuyan.wang@Sun.COM #include "unm_inc.h" /* For MAX_RCV_CTX */ 757956Sxiuyan.wang@Sun.COM #include "unm_brdcfg.h" 767956Sxiuyan.wang@Sun.COM #include "unm_version.h" 777956Sxiuyan.wang@Sun.COM #include "nic_phan_reg.h" 787956Sxiuyan.wang@Sun.COM #include "unm_nic_ioctl.h" 797956Sxiuyan.wang@Sun.COM 807956Sxiuyan.wang@Sun.COM #define MAX_ADDR_LEN 6 817956Sxiuyan.wang@Sun.COM 827956Sxiuyan.wang@Sun.COM #define ADDR_IN_WINDOW1(off) \ 837956Sxiuyan.wang@Sun.COM ((off > UNM_CRB_PCIX_HOST2) && (off < UNM_CRB_MAX)) ? 1 : 0 847956Sxiuyan.wang@Sun.COM 857956Sxiuyan.wang@Sun.COM typedef unsigned long uptr_t; 867956Sxiuyan.wang@Sun.COM 877956Sxiuyan.wang@Sun.COM #define FIRST_PAGE_GROUP_START 0 887956Sxiuyan.wang@Sun.COM #define FIRST_PAGE_GROUP_END 0x100000 897956Sxiuyan.wang@Sun.COM 907956Sxiuyan.wang@Sun.COM #define SECOND_PAGE_GROUP_START 0x6000000 917956Sxiuyan.wang@Sun.COM #define SECOND_PAGE_GROUP_END 0x68BC000 927956Sxiuyan.wang@Sun.COM 937956Sxiuyan.wang@Sun.COM #define THIRD_PAGE_GROUP_START 0x70E4000 947956Sxiuyan.wang@Sun.COM #define THIRD_PAGE_GROUP_END 0x8000000 957956Sxiuyan.wang@Sun.COM 967956Sxiuyan.wang@Sun.COM #define FIRST_PAGE_GROUP_SIZE FIRST_PAGE_GROUP_END - FIRST_PAGE_GROUP_START 977956Sxiuyan.wang@Sun.COM #define SECOND_PAGE_GROUP_SIZE SECOND_PAGE_GROUP_END - SECOND_PAGE_GROUP_START 987956Sxiuyan.wang@Sun.COM #define THIRD_PAGE_GROUP_SIZE THIRD_PAGE_GROUP_END - THIRD_PAGE_GROUP_START 997956Sxiuyan.wang@Sun.COM 1007956Sxiuyan.wang@Sun.COM /* 1017956Sxiuyan.wang@Sun.COM * normalize a 64MB crb address to 32MB PCI window 1027956Sxiuyan.wang@Sun.COM * To use CRB_NORMALIZE, window _must_ be set to 1 1037956Sxiuyan.wang@Sun.COM */ 1047956Sxiuyan.wang@Sun.COM #define CRB_NORMAL(reg) \ 1057956Sxiuyan.wang@Sun.COM (reg) - UNM_CRB_PCIX_HOST2 + UNM_CRB_PCIX_HOST 1067956Sxiuyan.wang@Sun.COM #define CRB_NORMALIZE(adapter, reg) \ 1077956Sxiuyan.wang@Sun.COM (void *)(unsigned long)(pci_base_offset(adapter, CRB_NORMAL(reg))) 1087956Sxiuyan.wang@Sun.COM 1097956Sxiuyan.wang@Sun.COM #define DB_NORMALIZE(adapter, off) \ 1107956Sxiuyan.wang@Sun.COM (void *)((unsigned long)adapter->ahw.db_base + (off)) 1117956Sxiuyan.wang@Sun.COM 1127956Sxiuyan.wang@Sun.COM #define find_diff_among(a, b, range) \ 1137956Sxiuyan.wang@Sun.COM ((a) < (b)?((b)-(a)):((b)+(range)-(a))) 1147956Sxiuyan.wang@Sun.COM 1157956Sxiuyan.wang@Sun.COM #define __FUNCTION__ __func__ 1167956Sxiuyan.wang@Sun.COM #define nx_msleep(_msecs_) delay(drv_usectohz(_msecs_ * 1000)) 1177956Sxiuyan.wang@Sun.COM 1187956Sxiuyan.wang@Sun.COM #define HOST_TO_LE_64 LE_64 1197956Sxiuyan.wang@Sun.COM #define HOST_TO_LE_32 LE_32 1207956Sxiuyan.wang@Sun.COM #define LE_TO_HOST_32 LE_32 1217956Sxiuyan.wang@Sun.COM #define HOST_TO_LE_16 LE_16 1227956Sxiuyan.wang@Sun.COM #define LE_TO_HOST_16 LE_16 1237956Sxiuyan.wang@Sun.COM 1247956Sxiuyan.wang@Sun.COM #define dbwritel(DATA, ADDRESS) \ 1257956Sxiuyan.wang@Sun.COM ddi_put32(adapter->db_handle, (uint32_t *)(ADDRESS), (DATA)) 1267956Sxiuyan.wang@Sun.COM 1277956Sxiuyan.wang@Sun.COM /* 1287956Sxiuyan.wang@Sun.COM * Following macros require the mapped addresses to access 1297956Sxiuyan.wang@Sun.COM * the Phantom memory. 1307956Sxiuyan.wang@Sun.COM */ 1317956Sxiuyan.wang@Sun.COM #define UNM_NIC_PCI_READ_8(ADDRESS) \ 1327956Sxiuyan.wang@Sun.COM ddi_get8(adapter->regs_handle, (uint8_t *)(ADDRESS)) 1337956Sxiuyan.wang@Sun.COM #define UNM_NIC_PCI_READ_16(ADDRESS) \ 1347956Sxiuyan.wang@Sun.COM ddi_get16(adapter->regs_handle, (uint16_t *)(ADDRESS)) 1357956Sxiuyan.wang@Sun.COM #define UNM_NIC_PCI_READ_32(ADDRESS) \ 1367956Sxiuyan.wang@Sun.COM ddi_get32(adapter->regs_handle, (uint32_t *)(ADDRESS)) 1377956Sxiuyan.wang@Sun.COM #define UNM_NIC_PCI_READ_64(ADDRESS) \ 1387956Sxiuyan.wang@Sun.COM ddi_get64(adapter->regs_handle, (uint64_t *)(ADDRESS)) 1397956Sxiuyan.wang@Sun.COM 1407956Sxiuyan.wang@Sun.COM #define UNM_NIC_PCI_WRITE_8(DATA, ADDRESS) \ 1417956Sxiuyan.wang@Sun.COM ddi_put8(adapter->regs_handle, (uint8_t *)(ADDRESS), (DATA)) 1427956Sxiuyan.wang@Sun.COM #define UNM_NIC_PCI_WRITE_16(DATA, ADDRESS) \ 1437956Sxiuyan.wang@Sun.COM ddi_put16(adapter->regs_handle, (uint16_t *)(ADDRESS), (DATA)) 1447956Sxiuyan.wang@Sun.COM #define UNM_NIC_PCI_WRITE_32(DATA, ADDRESS) \ 1457956Sxiuyan.wang@Sun.COM ddi_put32(adapter->regs_handle, (uint32_t *)(ADDRESS), (DATA)) 1467956Sxiuyan.wang@Sun.COM #define UNM_NIC_PCI_WRITE_64(DATA, ADDRESS) \ 1477956Sxiuyan.wang@Sun.COM ddi_put64(adapter->regs_handle, (uint64_t *)(ADDRESS), (DATA)) 1487956Sxiuyan.wang@Sun.COM 1497956Sxiuyan.wang@Sun.COM #ifdef DEBUG_LEVEL 1507956Sxiuyan.wang@Sun.COM #define DPRINTF(n, args) if (DEBUG_LEVEL > (n)) cmn_err args; 1517956Sxiuyan.wang@Sun.COM #else 1527956Sxiuyan.wang@Sun.COM #define DPRINTF(n, args) 1537956Sxiuyan.wang@Sun.COM #endif 1547956Sxiuyan.wang@Sun.COM 1557956Sxiuyan.wang@Sun.COM #define UNM_SPIN_LOCK(_lp_) mutex_enter((_lp_)) 1567956Sxiuyan.wang@Sun.COM #define UNM_SPIN_UNLOCK(_lp_) mutex_exit((_lp_)) 1577956Sxiuyan.wang@Sun.COM #define UNM_SPIN_LOCK_ISR(_lp_) mutex_enter((_lp_)) 1587956Sxiuyan.wang@Sun.COM #define UNM_SPIN_UNLOCK_ISR(_lp_) mutex_exit((_lp_)) 1597956Sxiuyan.wang@Sun.COM 1607956Sxiuyan.wang@Sun.COM #define UNM_WRITE_LOCK(_lp_) rw_enter((_lp_), RW_WRITER) 1617956Sxiuyan.wang@Sun.COM #define UNM_WRITE_UNLOCK(_lp_) rw_exit((_lp_)) 1627956Sxiuyan.wang@Sun.COM #define UNM_READ_LOCK(_lp_) rw_enter((_lp_), RW_READER) 1637956Sxiuyan.wang@Sun.COM #define UNM_READ_UNLOCK(_lp_) rw_exit((_lp_)) 1647956Sxiuyan.wang@Sun.COM #define UNM_WRITE_LOCK_IRQS(_lp_, _fl_) rw_enter((_lp_), RW_WRITER) 1657956Sxiuyan.wang@Sun.COM #define UNM_WRITE_UNLOCK_IRQR(_lp_, _fl_) rw_exit((_lp_)) 1667956Sxiuyan.wang@Sun.COM 1677956Sxiuyan.wang@Sun.COM extern char unm_nic_driver_name[]; 1687956Sxiuyan.wang@Sun.COM extern int verbmsg; 1697956Sxiuyan.wang@Sun.COM 1707956Sxiuyan.wang@Sun.COM typedef struct unm_dmah_node { 1717956Sxiuyan.wang@Sun.COM struct unm_dmah_node *next; 1727956Sxiuyan.wang@Sun.COM ddi_dma_handle_t dmahdl; 1737956Sxiuyan.wang@Sun.COM }unm_dmah_node_t; 1747956Sxiuyan.wang@Sun.COM 1757956Sxiuyan.wang@Sun.COM typedef struct dma_area { 1767956Sxiuyan.wang@Sun.COM ddi_acc_handle_t acc_hdl; /* handle for memory */ 1777956Sxiuyan.wang@Sun.COM ddi_dma_handle_t dma_hdl; /* DMA handle */ 1787956Sxiuyan.wang@Sun.COM uint32_t ncookies; 1797956Sxiuyan.wang@Sun.COM u64 dma_addr; 1807956Sxiuyan.wang@Sun.COM void *vaddr; 1817956Sxiuyan.wang@Sun.COM } dma_area_t; 1827956Sxiuyan.wang@Sun.COM 1837956Sxiuyan.wang@Sun.COM struct unm_cmd_buffer { 1847956Sxiuyan.wang@Sun.COM dma_area_t dma_area; 1857956Sxiuyan.wang@Sun.COM mblk_t *msg; 1867956Sxiuyan.wang@Sun.COM unm_dmah_node_t *head, *tail; 1877956Sxiuyan.wang@Sun.COM }; 1887956Sxiuyan.wang@Sun.COM 1897956Sxiuyan.wang@Sun.COM typedef struct pkt_info { 1907956Sxiuyan.wang@Sun.COM uint32_t total_len; 1917956Sxiuyan.wang@Sun.COM uint16_t mblk_no; 1927956Sxiuyan.wang@Sun.COM uint16_t etype; 1937956Sxiuyan.wang@Sun.COM uint16_t mac_hlen; 1947956Sxiuyan.wang@Sun.COM uint16_t ip_hlen; 1957956Sxiuyan.wang@Sun.COM uint16_t l4_proto; 1967956Sxiuyan.wang@Sun.COM } pktinfo_t; 1977956Sxiuyan.wang@Sun.COM 1987956Sxiuyan.wang@Sun.COM typedef struct unm_rcv_desc_context_s unm_rcv_desc_ctx_t; 1997956Sxiuyan.wang@Sun.COM typedef struct unm_adapter_s unm_adapter; 2007956Sxiuyan.wang@Sun.COM 2017956Sxiuyan.wang@Sun.COM typedef struct unm_rx_buffer { 2027956Sxiuyan.wang@Sun.COM struct unm_rx_buffer *next; 2037956Sxiuyan.wang@Sun.COM dma_area_t dma_info; 2047956Sxiuyan.wang@Sun.COM frtn_t rx_recycle; /* recycle function */ 2057956Sxiuyan.wang@Sun.COM mblk_t *mp; 2067956Sxiuyan.wang@Sun.COM unm_rcv_desc_ctx_t *rcv_desc; 2077956Sxiuyan.wang@Sun.COM unm_adapter *adapter; 2087956Sxiuyan.wang@Sun.COM }unm_rx_buffer_t; 2097956Sxiuyan.wang@Sun.COM 2107956Sxiuyan.wang@Sun.COM /* Board types */ 2117956Sxiuyan.wang@Sun.COM #define UNM_NIC_GBE 0x01 2127956Sxiuyan.wang@Sun.COM #define UNM_NIC_XGBE 0x02 2137956Sxiuyan.wang@Sun.COM 2147956Sxiuyan.wang@Sun.COM /* 2157956Sxiuyan.wang@Sun.COM * One hardware_context{} per adapter 2167956Sxiuyan.wang@Sun.COM * contains interrupt info as well shared hardware info. 2177956Sxiuyan.wang@Sun.COM */ 2187956Sxiuyan.wang@Sun.COM typedef struct _hardware_context { 2197956Sxiuyan.wang@Sun.COM unsigned long pci_base0; 2207956Sxiuyan.wang@Sun.COM unsigned long pci_len0; 2217956Sxiuyan.wang@Sun.COM unsigned long pci_base1; 2227956Sxiuyan.wang@Sun.COM unsigned long pci_len1; 2237956Sxiuyan.wang@Sun.COM unsigned long pci_base2; 2247956Sxiuyan.wang@Sun.COM unsigned long pci_len2; 2257956Sxiuyan.wang@Sun.COM unsigned long first_page_group_end; 2267956Sxiuyan.wang@Sun.COM unsigned long first_page_group_start; 2277956Sxiuyan.wang@Sun.COM uint8_t revision_id; 2287956Sxiuyan.wang@Sun.COM uint8_t cut_through; 2297956Sxiuyan.wang@Sun.COM uint16_t board_type; 2307956Sxiuyan.wang@Sun.COM int pci_func; 2317956Sxiuyan.wang@Sun.COM uint16_t max_ports; 2327956Sxiuyan.wang@Sun.COM unm_board_info_t boardcfg; 2337956Sxiuyan.wang@Sun.COM uint32_t linkup; 2347956Sxiuyan.wang@Sun.COM 2357956Sxiuyan.wang@Sun.COM struct unm_adapter_s *adapter; 2367956Sxiuyan.wang@Sun.COM cmdDescType0_t *cmdDescHead; 2377956Sxiuyan.wang@Sun.COM 2387956Sxiuyan.wang@Sun.COM uint32_t cmdProducer; 2397956Sxiuyan.wang@Sun.COM uint32_t cmdConsumer; 2407956Sxiuyan.wang@Sun.COM uint32_t rcvFlag; 2417956Sxiuyan.wang@Sun.COM uint32_t crb_base; 2427956Sxiuyan.wang@Sun.COM unsigned long db_base; /* base of mapped db memory */ 2437956Sxiuyan.wang@Sun.COM unsigned long db_len; /* length of mapped db memory */ 2447956Sxiuyan.wang@Sun.COM 2457956Sxiuyan.wang@Sun.COM 2467956Sxiuyan.wang@Sun.COM uint64_t cmdDesc_physAddr; 2477956Sxiuyan.wang@Sun.COM int qdr_sn_window, ddr_mn_window; 2487956Sxiuyan.wang@Sun.COM unsigned long mn_win_crb, ms_win_crb; 2497956Sxiuyan.wang@Sun.COM ddi_dma_handle_t cmd_desc_dma_handle; 2507956Sxiuyan.wang@Sun.COM ddi_acc_handle_t cmd_desc_acc_handle; 2517956Sxiuyan.wang@Sun.COM ddi_dma_cookie_t cmd_desc_dma_cookie; 2527956Sxiuyan.wang@Sun.COM } hardware_context, *phardware_context; 2537956Sxiuyan.wang@Sun.COM 2547956Sxiuyan.wang@Sun.COM #define NX_CT_DEFAULT_RX_BUF_LEN 2048 2557956Sxiuyan.wang@Sun.COM #define MTU_SIZE 1500 256*9436SJing.Xiong@Sun.COM #define MAX_COOKIES_PER_CMD 15 2577956Sxiuyan.wang@Sun.COM #define UNM_DB_MAPSIZE_BYTES 0x1000 2587956Sxiuyan.wang@Sun.COM #define EXTRA_HANDLES 512 2597956Sxiuyan.wang@Sun.COM #define UNM_TX_BCOPY_THRESHOLD 128 2607956Sxiuyan.wang@Sun.COM #define UNM_RX_BCOPY_THRESHOLD 128 2617956Sxiuyan.wang@Sun.COM #define NX_MIN_DRIVER_RDS_SIZE 64 2627956Sxiuyan.wang@Sun.COM 2637956Sxiuyan.wang@Sun.COM typedef struct unm_pauseparam { 2647956Sxiuyan.wang@Sun.COM uint16_t rx_pause; 2657956Sxiuyan.wang@Sun.COM uint16_t tx_pause; 2667956Sxiuyan.wang@Sun.COM } unm_pauseparam_t; 2677956Sxiuyan.wang@Sun.COM 2687956Sxiuyan.wang@Sun.COM /* 2697956Sxiuyan.wang@Sun.COM * The driver supports the NDD ioctls ND_GET/ND_SET, and the loopback 2707956Sxiuyan.wang@Sun.COM * ioctls LB_GET_INFO_SIZE/LB_GET_INFO/LB_GET_MODE/LB_SET_MODE 2717956Sxiuyan.wang@Sun.COM * 2727956Sxiuyan.wang@Sun.COM * These are the values to use with LD_SET_MODE. 2737956Sxiuyan.wang@Sun.COM */ 2747956Sxiuyan.wang@Sun.COM #define UNM_LOOP_NONE 0 2757956Sxiuyan.wang@Sun.COM #define UNM_LOOP_INTERNAL_PHY 1 2767956Sxiuyan.wang@Sun.COM #define UNM_LOOP_INTERNAL_MAC 2 2777956Sxiuyan.wang@Sun.COM 2787956Sxiuyan.wang@Sun.COM /* 2797956Sxiuyan.wang@Sun.COM * Named Data (ND) Parameter Management Structure 2807956Sxiuyan.wang@Sun.COM */ 2817956Sxiuyan.wang@Sun.COM typedef struct { 2827956Sxiuyan.wang@Sun.COM int ndp_info; 2837956Sxiuyan.wang@Sun.COM int ndp_min; 2847956Sxiuyan.wang@Sun.COM int ndp_max; 2857956Sxiuyan.wang@Sun.COM int ndp_val; 2867956Sxiuyan.wang@Sun.COM char *ndp_name; 2877956Sxiuyan.wang@Sun.COM } nd_param_t; /* 0x18 (24) bytes */ 2887956Sxiuyan.wang@Sun.COM 2897956Sxiuyan.wang@Sun.COM /* 2907956Sxiuyan.wang@Sun.COM * NDD parameter indexes, divided into: 2917956Sxiuyan.wang@Sun.COM * 2927956Sxiuyan.wang@Sun.COM * read-only parameters describing the hardware's capabilities 2937956Sxiuyan.wang@Sun.COM * read-write parameters controlling the advertised capabilities 2947956Sxiuyan.wang@Sun.COM * read-only parameters describing the partner's capabilities 2957956Sxiuyan.wang@Sun.COM * read-only parameters describing the link state 2967956Sxiuyan.wang@Sun.COM */ 2977956Sxiuyan.wang@Sun.COM enum { 2987956Sxiuyan.wang@Sun.COM PARAM_AUTONEG_CAP = 0, 2997956Sxiuyan.wang@Sun.COM PARAM_PAUSE_CAP, 3007956Sxiuyan.wang@Sun.COM PARAM_ASYM_PAUSE_CAP, 3017956Sxiuyan.wang@Sun.COM PARAM_10000FDX_CAP, 3027956Sxiuyan.wang@Sun.COM PARAM_1000FDX_CAP, 3037956Sxiuyan.wang@Sun.COM PARAM_1000HDX_CAP, 3047956Sxiuyan.wang@Sun.COM PARAM_100T4_CAP, 3057956Sxiuyan.wang@Sun.COM PARAM_100FDX_CAP, 3067956Sxiuyan.wang@Sun.COM PARAM_100HDX_CAP, 3077956Sxiuyan.wang@Sun.COM PARAM_10FDX_CAP, 3087956Sxiuyan.wang@Sun.COM PARAM_10HDX_CAP, 3097956Sxiuyan.wang@Sun.COM 3107956Sxiuyan.wang@Sun.COM PARAM_ADV_AUTONEG_CAP, 3117956Sxiuyan.wang@Sun.COM PARAM_ADV_PAUSE_CAP, 3127956Sxiuyan.wang@Sun.COM PARAM_ADV_ASYM_PAUSE_CAP, 3137956Sxiuyan.wang@Sun.COM PARAM_ADV_10000FDX_CAP, 3147956Sxiuyan.wang@Sun.COM PARAM_ADV_1000FDX_CAP, 3157956Sxiuyan.wang@Sun.COM PARAM_ADV_1000HDX_CAP, 3167956Sxiuyan.wang@Sun.COM PARAM_ADV_100T4_CAP, 3177956Sxiuyan.wang@Sun.COM PARAM_ADV_100FDX_CAP, 3187956Sxiuyan.wang@Sun.COM PARAM_ADV_100HDX_CAP, 3197956Sxiuyan.wang@Sun.COM PARAM_ADV_10FDX_CAP, 3207956Sxiuyan.wang@Sun.COM PARAM_ADV_10HDX_CAP, 3217956Sxiuyan.wang@Sun.COM 3227956Sxiuyan.wang@Sun.COM PARAM_LINK_STATUS, 3237956Sxiuyan.wang@Sun.COM PARAM_LINK_SPEED, 3247956Sxiuyan.wang@Sun.COM PARAM_LINK_DUPLEX, 3257956Sxiuyan.wang@Sun.COM 3267956Sxiuyan.wang@Sun.COM PARAM_LOOP_MODE, 3277956Sxiuyan.wang@Sun.COM 3287956Sxiuyan.wang@Sun.COM PARAM_COUNT 3297956Sxiuyan.wang@Sun.COM }; 3307956Sxiuyan.wang@Sun.COM 3317956Sxiuyan.wang@Sun.COM struct unm_adapter_stats { 3327956Sxiuyan.wang@Sun.COM uint64_t rcvdbadmsg; 3337956Sxiuyan.wang@Sun.COM uint64_t xmitcalled; 3347956Sxiuyan.wang@Sun.COM uint64_t xmitedframes; 3357956Sxiuyan.wang@Sun.COM uint64_t xmitfinished; 3367956Sxiuyan.wang@Sun.COM uint64_t badmsglen; 3377956Sxiuyan.wang@Sun.COM uint64_t nocmddescriptor; 3387956Sxiuyan.wang@Sun.COM uint64_t polled; 3397956Sxiuyan.wang@Sun.COM uint64_t uphappy; 3407956Sxiuyan.wang@Sun.COM uint64_t updropped; 3417956Sxiuyan.wang@Sun.COM uint64_t uplcong; 3427956Sxiuyan.wang@Sun.COM uint64_t uphcong; 3437956Sxiuyan.wang@Sun.COM uint64_t upmcong; 3447956Sxiuyan.wang@Sun.COM uint64_t updunno; 3457956Sxiuyan.wang@Sun.COM uint64_t msgfreed; 3467956Sxiuyan.wang@Sun.COM uint64_t txdropped; 3477956Sxiuyan.wang@Sun.COM uint64_t txnullmsg; 3487956Sxiuyan.wang@Sun.COM uint64_t csummed; 3497956Sxiuyan.wang@Sun.COM uint64_t no_rcv; 3507956Sxiuyan.wang@Sun.COM uint64_t rxbytes; 3517956Sxiuyan.wang@Sun.COM uint64_t txbytes; 3527956Sxiuyan.wang@Sun.COM uint64_t ints; 3537956Sxiuyan.wang@Sun.COM uint64_t desballocfailed; 3547956Sxiuyan.wang@Sun.COM uint64_t txcopyed; 3557956Sxiuyan.wang@Sun.COM uint64_t txmapped; 3567956Sxiuyan.wang@Sun.COM uint64_t outoftxdmahdl; 3577956Sxiuyan.wang@Sun.COM uint64_t outofcmddesc; 3587956Sxiuyan.wang@Sun.COM uint64_t rxcopyed; 3597956Sxiuyan.wang@Sun.COM uint64_t rxmapped; 3607956Sxiuyan.wang@Sun.COM uint64_t outofrxbuf; 3617956Sxiuyan.wang@Sun.COM uint64_t promiscmode; 3627956Sxiuyan.wang@Sun.COM uint64_t rxbufshort; 3637956Sxiuyan.wang@Sun.COM uint64_t allocbfailed; 3647956Sxiuyan.wang@Sun.COM }; 3657956Sxiuyan.wang@Sun.COM 3667956Sxiuyan.wang@Sun.COM /* descriptor types */ 3677956Sxiuyan.wang@Sun.COM #define RCV_RING_STD RCV_DESC_NORMAL 3687956Sxiuyan.wang@Sun.COM #define RCV_RING_JUMBO RCV_DESC_JUMBO 3697956Sxiuyan.wang@Sun.COM #define RCV_RING_LRO RCV_DESC_LRO 3707956Sxiuyan.wang@Sun.COM 3717956Sxiuyan.wang@Sun.COM /* 3727956Sxiuyan.wang@Sun.COM * Rcv Descriptor Context. One such per Rcv Descriptor. There may 3737956Sxiuyan.wang@Sun.COM * be one Rcv Descriptor for normal packets, one for jumbo, 3747956Sxiuyan.wang@Sun.COM * one for LRO and may be expanded. 3757956Sxiuyan.wang@Sun.COM */ 3767956Sxiuyan.wang@Sun.COM struct unm_rcv_desc_context_s { 3777956Sxiuyan.wang@Sun.COM uint32_t producer; 3787956Sxiuyan.wang@Sun.COM 3797956Sxiuyan.wang@Sun.COM uint64_t phys_addr; 3807956Sxiuyan.wang@Sun.COM dev_info_t *phys_pdev; 3817956Sxiuyan.wang@Sun.COM /* address of rx ring in Phantom */ 3827956Sxiuyan.wang@Sun.COM rcvDesc_t *desc_head; 3837956Sxiuyan.wang@Sun.COM 3847956Sxiuyan.wang@Sun.COM uint32_t MaxRxDescCount; 3857956Sxiuyan.wang@Sun.COM uint32_t rx_desc_handled; 3867956Sxiuyan.wang@Sun.COM uint32_t rx_buf_card; 3877956Sxiuyan.wang@Sun.COM uint32_t rx_buf_total; 3887956Sxiuyan.wang@Sun.COM uint32_t rx_buf_free; 3897956Sxiuyan.wang@Sun.COM uint32_t rx_buf_recycle; 3907956Sxiuyan.wang@Sun.COM unm_rx_buffer_t *rx_buf_pool; 3917956Sxiuyan.wang@Sun.COM unm_rx_buffer_t *pool_list; 3927956Sxiuyan.wang@Sun.COM unm_rx_buffer_t *recycle_list; 3937956Sxiuyan.wang@Sun.COM kmutex_t pool_lock[1]; /* buffer pool lock */ 3947956Sxiuyan.wang@Sun.COM kmutex_t recycle_lock[1]; /* buffer recycle lock */ 3957956Sxiuyan.wang@Sun.COM /* size of the receive buf */ 3967956Sxiuyan.wang@Sun.COM uint32_t buf_size; 3977956Sxiuyan.wang@Sun.COM /* rx buffers for receive */ 3987956Sxiuyan.wang@Sun.COM 3997956Sxiuyan.wang@Sun.COM ddi_dma_handle_t rx_desc_dma_handle; 4007956Sxiuyan.wang@Sun.COM ddi_acc_handle_t rx_desc_acc_handle; 4017956Sxiuyan.wang@Sun.COM ddi_dma_cookie_t rx_desc_dma_cookie; 4027956Sxiuyan.wang@Sun.COM uint32_t host_rx_producer; 4037956Sxiuyan.wang@Sun.COM uint32_t dma_size; 4047956Sxiuyan.wang@Sun.COM }; 4057956Sxiuyan.wang@Sun.COM 4067956Sxiuyan.wang@Sun.COM /* 4077956Sxiuyan.wang@Sun.COM * Receive context. There is one such structure per instance of the 4087956Sxiuyan.wang@Sun.COM * receive processing. Any state information that is relevant to 4097956Sxiuyan.wang@Sun.COM * the receive, and is must be in this structure. The global data may be 4107956Sxiuyan.wang@Sun.COM * present elsewhere. 4117956Sxiuyan.wang@Sun.COM */ 4127956Sxiuyan.wang@Sun.COM typedef struct unm_recv_context_s { 4137956Sxiuyan.wang@Sun.COM unm_rcv_desc_ctx_t rcv_desc[NUM_RCV_DESC_RINGS]; 4147956Sxiuyan.wang@Sun.COM 4157956Sxiuyan.wang@Sun.COM uint32_t statusRxConsumer; 4167956Sxiuyan.wang@Sun.COM 4177956Sxiuyan.wang@Sun.COM uint64_t rcvStatusDesc_physAddr; 4187956Sxiuyan.wang@Sun.COM statusDesc_t *rcvStatusDescHead; 4197956Sxiuyan.wang@Sun.COM 4207956Sxiuyan.wang@Sun.COM ddi_dma_handle_t status_desc_dma_handle; 4217956Sxiuyan.wang@Sun.COM ddi_acc_handle_t status_desc_acc_handle; 4227956Sxiuyan.wang@Sun.COM ddi_dma_cookie_t status_desc_dma_cookie; 4237956Sxiuyan.wang@Sun.COM 4247956Sxiuyan.wang@Sun.COM uint32_t state, host_sds_consumer; 4257956Sxiuyan.wang@Sun.COM uint16_t context_id, virt_port; 4267956Sxiuyan.wang@Sun.COM } unm_recv_context_t; 4277956Sxiuyan.wang@Sun.COM 4287956Sxiuyan.wang@Sun.COM #define UNM_NIC_MSI_ENABLED 0x02 4297956Sxiuyan.wang@Sun.COM #define UNM_NIC_MSIX_ENABLED 0x04 4307956Sxiuyan.wang@Sun.COM #define UNM_IS_MSI_FAMILY(ADAPTER) \ 4317956Sxiuyan.wang@Sun.COM ((ADAPTER)->flags & (UNM_NIC_MSI_ENABLED | UNM_NIC_MSIX_ENABLED)) 4327956Sxiuyan.wang@Sun.COM 4337956Sxiuyan.wang@Sun.COM #define NX_USE_MSIX 4347956Sxiuyan.wang@Sun.COM 4357956Sxiuyan.wang@Sun.COM /* msix defines */ 4367956Sxiuyan.wang@Sun.COM #define MSIX_ENTRIES_PER_ADAPTER 8 4377956Sxiuyan.wang@Sun.COM #define UNM_MSIX_TBL_SPACE 8192 4387956Sxiuyan.wang@Sun.COM #define UNM_PCI_REG_MSIX_TBL 0x44 4397956Sxiuyan.wang@Sun.COM 4407956Sxiuyan.wang@Sun.COM /* 4417956Sxiuyan.wang@Sun.COM * Bug: word or char write on MSI-X capcabilities register (0x40) in PCI config 4427956Sxiuyan.wang@Sun.COM * space has no effect on register values. Need to write dword. 4437956Sxiuyan.wang@Sun.COM */ 4447956Sxiuyan.wang@Sun.COM #define UNM_HWBUG_8_WORKAROUND 4457956Sxiuyan.wang@Sun.COM 4467956Sxiuyan.wang@Sun.COM /* 4477956Sxiuyan.wang@Sun.COM * Bug: Can not reset bit 32 (msix enable bit) on MSI-X capcabilities 4487956Sxiuyan.wang@Sun.COM * register (0x40) independently. 4497956Sxiuyan.wang@Sun.COM * Need to write 0x0 (zero) to MSI-X capcabilities register in order to reset 4507956Sxiuyan.wang@Sun.COM * msix enable bit. On writing zero rest of the bits are not touched. 4517956Sxiuyan.wang@Sun.COM */ 4527956Sxiuyan.wang@Sun.COM #define UNM_HWBUG_9_WORKAROUND 4537956Sxiuyan.wang@Sun.COM 4547956Sxiuyan.wang@Sun.COM #define UNM_MC_COUNT 38 /* == ((UNM_ADDR_L2LU_COUNT-1)/4) -2 */ 4557956Sxiuyan.wang@Sun.COM 4567956Sxiuyan.wang@Sun.COM /* Following structure is for specific port information */ 4577956Sxiuyan.wang@Sun.COM struct unm_adapter_s { 4587956Sxiuyan.wang@Sun.COM hardware_context ahw; 4597956Sxiuyan.wang@Sun.COM uint8_t id[32]; 4607956Sxiuyan.wang@Sun.COM uint16_t portnum; 4617956Sxiuyan.wang@Sun.COM uint16_t physical_port; 4627956Sxiuyan.wang@Sun.COM uint16_t link_speed; 4637956Sxiuyan.wang@Sun.COM uint16_t link_duplex; 4647956Sxiuyan.wang@Sun.COM 4657956Sxiuyan.wang@Sun.COM struct unm_adapter_stats stats; 4667956Sxiuyan.wang@Sun.COM int rx_csum; 4677956Sxiuyan.wang@Sun.COM int status; 4687956Sxiuyan.wang@Sun.COM kmutex_t stats_lock; 4697956Sxiuyan.wang@Sun.COM unsigned char mac_addr[MAX_ADDR_LEN]; 4707956Sxiuyan.wang@Sun.COM int mtu; /* active mtu */ 4717956Sxiuyan.wang@Sun.COM int maxmtu; /* max possible mtu value */ 4727956Sxiuyan.wang@Sun.COM uint32_t promisc; 4737956Sxiuyan.wang@Sun.COM 4747956Sxiuyan.wang@Sun.COM mac_resource_handle_t mac_rx_ring_ha; 4757956Sxiuyan.wang@Sun.COM mac_handle_t mach; 4767956Sxiuyan.wang@Sun.COM int flags; 4777956Sxiuyan.wang@Sun.COM 4787956Sxiuyan.wang@Sun.COM int instance; 4797956Sxiuyan.wang@Sun.COM dev_info_t *dip; 4807956Sxiuyan.wang@Sun.COM ddi_acc_handle_t pci_cfg_handle; 4817956Sxiuyan.wang@Sun.COM ddi_acc_handle_t regs_handle; 4827956Sxiuyan.wang@Sun.COM ddi_dma_attr_t gc_dma_attr_desc; 4837956Sxiuyan.wang@Sun.COM 4847956Sxiuyan.wang@Sun.COM struct ddi_device_acc_attr gc_attr_desc; 4857956Sxiuyan.wang@Sun.COM ddi_iblock_cookie_t iblock_cookie; 4867956Sxiuyan.wang@Sun.COM const char *name; 4877956Sxiuyan.wang@Sun.COM ddi_acc_handle_t db_handle; 4887956Sxiuyan.wang@Sun.COM 4897956Sxiuyan.wang@Sun.COM ddi_intr_handle_t intr_handle; 4907956Sxiuyan.wang@Sun.COM int intr_type; 4917956Sxiuyan.wang@Sun.COM uint_t intr_pri; 4927956Sxiuyan.wang@Sun.COM unm_dmah_node_t *dmahdl_pool; 4937956Sxiuyan.wang@Sun.COM unm_dmah_node_t tx_dma_hdls[MAX_CMD_DESCRIPTORS+EXTRA_HANDLES]; 4947956Sxiuyan.wang@Sun.COM uint64_t freehdls; 4957956Sxiuyan.wang@Sun.COM uint64_t freecmds; 4967956Sxiuyan.wang@Sun.COM int tx_bcopy_threshold; 4977956Sxiuyan.wang@Sun.COM kmutex_t tx_lock; 4987956Sxiuyan.wang@Sun.COM krwlock_t adapter_lock; 4997956Sxiuyan.wang@Sun.COM kmutex_t lock; 5007956Sxiuyan.wang@Sun.COM struct nx_legacy_intr_set legacy_intr; 5017956Sxiuyan.wang@Sun.COM timeout_id_t watchdog_timer; 5027956Sxiuyan.wang@Sun.COM kstat_t *kstats[1]; 5037956Sxiuyan.wang@Sun.COM 5047956Sxiuyan.wang@Sun.COM uint32_t curr_window; 5057956Sxiuyan.wang@Sun.COM uint32_t crb_win; 5067956Sxiuyan.wang@Sun.COM uint32_t cmdProducer; 5077956Sxiuyan.wang@Sun.COM uint32_t *cmdConsumer; 5087956Sxiuyan.wang@Sun.COM 5097956Sxiuyan.wang@Sun.COM uint32_t interrupt_crb; 5107956Sxiuyan.wang@Sun.COM uint32_t fw_major; 5117956Sxiuyan.wang@Sun.COM uint32_t crb_addr_cmd_producer; 5127956Sxiuyan.wang@Sun.COM uint32_t crb_addr_cmd_consumer; 5137956Sxiuyan.wang@Sun.COM uint16_t tx_context_id; 5147956Sxiuyan.wang@Sun.COM short context_alloced; 5157956Sxiuyan.wang@Sun.COM int max_rds_rings; 5167956Sxiuyan.wang@Sun.COM 5177956Sxiuyan.wang@Sun.COM uint32_t lastCmdConsumer; 5187956Sxiuyan.wang@Sun.COM /* Num of bufs posted in phantom */ 5197956Sxiuyan.wang@Sun.COM uint32_t pendingCmdCount; 5207956Sxiuyan.wang@Sun.COM uint32_t MaxTxDescCount; 5217956Sxiuyan.wang@Sun.COM uint32_t MaxRxDescCount; 5227956Sxiuyan.wang@Sun.COM uint32_t MaxJumboRxDescCount; 5237956Sxiuyan.wang@Sun.COM uint32_t MaxLroRxDescCount; 5247956Sxiuyan.wang@Sun.COM /* Num of instances active on cmd buffer ring */ 5257956Sxiuyan.wang@Sun.COM int resched_needed; 5267956Sxiuyan.wang@Sun.COM 5277956Sxiuyan.wang@Sun.COM int driver_mismatch; 5287956Sxiuyan.wang@Sun.COM uint32_t temp; 5297956Sxiuyan.wang@Sun.COM 5307956Sxiuyan.wang@Sun.COM struct unm_cmd_buffer *cmd_buf_arr; /* Command buffers for xmit */ 5317956Sxiuyan.wang@Sun.COM int rx_bcopy_threshold; 5327956Sxiuyan.wang@Sun.COM 5337956Sxiuyan.wang@Sun.COM /* 5347956Sxiuyan.wang@Sun.COM * Receive instances. These can be either one per port, 5357956Sxiuyan.wang@Sun.COM * or one per peg, etc. 5367956Sxiuyan.wang@Sun.COM */ 5377956Sxiuyan.wang@Sun.COM unm_recv_context_t recv_ctx[MAX_RCV_CTX]; 5387956Sxiuyan.wang@Sun.COM int is_up; 5397956Sxiuyan.wang@Sun.COM 5407956Sxiuyan.wang@Sun.COM /* context interface shared between card and host */ 5417956Sxiuyan.wang@Sun.COM RingContext *ctxDesc; 5427956Sxiuyan.wang@Sun.COM uint64_t ctxDesc_physAddr; 5437956Sxiuyan.wang@Sun.COM ddi_dma_handle_t ctxDesc_dma_handle; 5447956Sxiuyan.wang@Sun.COM ddi_acc_handle_t ctxDesc_acc_handle; 5457956Sxiuyan.wang@Sun.COM 5467956Sxiuyan.wang@Sun.COM struct { 5477956Sxiuyan.wang@Sun.COM void *addr; 5487956Sxiuyan.wang@Sun.COM uint64_t phys_addr; 5497956Sxiuyan.wang@Sun.COM ddi_dma_handle_t dma_handle; 5507956Sxiuyan.wang@Sun.COM ddi_acc_handle_t acc_handle; 5517956Sxiuyan.wang@Sun.COM } dummy_dma; 5527956Sxiuyan.wang@Sun.COM 5537956Sxiuyan.wang@Sun.COM void (*unm_nic_pci_change_crbwindow)(struct unm_adapter_s *, 5547956Sxiuyan.wang@Sun.COM uint32_t); 5557956Sxiuyan.wang@Sun.COM int (*unm_crb_writelit_adapter)(struct unm_adapter_s *, 5567956Sxiuyan.wang@Sun.COM unsigned long, int); 5577956Sxiuyan.wang@Sun.COM unsigned long long 5587956Sxiuyan.wang@Sun.COM (*unm_nic_pci_set_window)(struct unm_adapter_s *, 5597956Sxiuyan.wang@Sun.COM unsigned long long); 5607956Sxiuyan.wang@Sun.COM int (*unm_nic_fill_statistics)(struct unm_adapter_s *, 5617956Sxiuyan.wang@Sun.COM struct unm_statistics *); 5627956Sxiuyan.wang@Sun.COM int (*unm_nic_clear_statistics)(struct unm_adapter_s *); 5637956Sxiuyan.wang@Sun.COM int (*unm_nic_hw_write_wx)(struct unm_adapter_s *, u64, 5647956Sxiuyan.wang@Sun.COM void *, int); 5657956Sxiuyan.wang@Sun.COM int (*unm_nic_hw_read_wx)(struct unm_adapter_s *, u64, void *, int); 5667956Sxiuyan.wang@Sun.COM int (*unm_nic_hw_write_ioctl)(struct unm_adapter_s *, u64, void *, 5677956Sxiuyan.wang@Sun.COM int); 5687956Sxiuyan.wang@Sun.COM int (*unm_nic_hw_read_ioctl)(struct unm_adapter_s *, u64, void *, 5697956Sxiuyan.wang@Sun.COM int); 5707956Sxiuyan.wang@Sun.COM int (*unm_nic_pci_mem_write)(struct unm_adapter_s *, u64, void *, 5717956Sxiuyan.wang@Sun.COM int); 5727956Sxiuyan.wang@Sun.COM int (*unm_nic_pci_mem_read)(struct unm_adapter_s *, u64, void *, 5737956Sxiuyan.wang@Sun.COM int); 5747956Sxiuyan.wang@Sun.COM int (*unm_nic_pci_write_immediate)(struct unm_adapter_s *, u64, 5757956Sxiuyan.wang@Sun.COM u32 *); 5767956Sxiuyan.wang@Sun.COM int (*unm_nic_pci_read_immediate)(struct unm_adapter_s *, u64, 5777956Sxiuyan.wang@Sun.COM u32 *); 5787956Sxiuyan.wang@Sun.COM void (*unm_nic_pci_write_normalize)(struct unm_adapter_s *, u64, 5797956Sxiuyan.wang@Sun.COM u32); 5807956Sxiuyan.wang@Sun.COM u32 (*unm_nic_pci_read_normalize)(struct unm_adapter_s *, u64); 5817956Sxiuyan.wang@Sun.COM 5827956Sxiuyan.wang@Sun.COM caddr_t nd_data_p; 5837956Sxiuyan.wang@Sun.COM nd_param_t nd_params[PARAM_COUNT]; 5847956Sxiuyan.wang@Sun.COM }; /* unm_adapter structure */ 5857956Sxiuyan.wang@Sun.COM 5867956Sxiuyan.wang@Sun.COM #define UNM_HOST_DUMMY_DMA_SIZE 1024 5877956Sxiuyan.wang@Sun.COM 5887956Sxiuyan.wang@Sun.COM /* Following structure is for specific port information */ 5897956Sxiuyan.wang@Sun.COM 5907956Sxiuyan.wang@Sun.COM #define PCI_OFFSET_FIRST_RANGE(adapter, off) \ 5917956Sxiuyan.wang@Sun.COM ((adapter)->ahw.pci_base0 + off) 5927956Sxiuyan.wang@Sun.COM #define PCI_OFFSET_SECOND_RANGE(adapter, off) \ 5937956Sxiuyan.wang@Sun.COM ((adapter)->ahw.pci_base1 + off - SECOND_PAGE_GROUP_START) 5947956Sxiuyan.wang@Sun.COM #define PCI_OFFSET_THIRD_RANGE(adapter, off) \ 5957956Sxiuyan.wang@Sun.COM ((adapter)->ahw.pci_base2 + off - THIRD_PAGE_GROUP_START) 5967956Sxiuyan.wang@Sun.COM 5977956Sxiuyan.wang@Sun.COM #define pci_base_offset(adapter, off) \ 5987956Sxiuyan.wang@Sun.COM ((((off) < ((adapter)->ahw.first_page_group_end)) && \ 5997956Sxiuyan.wang@Sun.COM ((off) >= ((adapter)->ahw.first_page_group_start))) ? \ 6007956Sxiuyan.wang@Sun.COM ((adapter)->ahw.pci_base0 + (off)) : \ 6017956Sxiuyan.wang@Sun.COM ((((off) < SECOND_PAGE_GROUP_END) && \ 6027956Sxiuyan.wang@Sun.COM ((off) >= SECOND_PAGE_GROUP_START)) ? \ 6037956Sxiuyan.wang@Sun.COM ((adapter)->ahw.pci_base1 + \ 6047956Sxiuyan.wang@Sun.COM (off) - SECOND_PAGE_GROUP_START) : \ 6057956Sxiuyan.wang@Sun.COM ((((off) < THIRD_PAGE_GROUP_END) && \ 6067956Sxiuyan.wang@Sun.COM ((off) >= THIRD_PAGE_GROUP_START)) ? \ 6077956Sxiuyan.wang@Sun.COM ((adapter)->ahw.pci_base2 + (off) - \ 6087956Sxiuyan.wang@Sun.COM THIRD_PAGE_GROUP_START) : \ 6097956Sxiuyan.wang@Sun.COM 0))) 6107956Sxiuyan.wang@Sun.COM #define unm_nic_reg_write(_adp_, _off_, _val_) \ 6117956Sxiuyan.wang@Sun.COM { \ 6127956Sxiuyan.wang@Sun.COM __uint32_t _v1_ = (_val_); \ 6137956Sxiuyan.wang@Sun.COM ((_adp_)->unm_nic_hw_write_wx((_adp_), (_off_), \ 6147956Sxiuyan.wang@Sun.COM &_v1_, 4)); \ 6157956Sxiuyan.wang@Sun.COM } 6167956Sxiuyan.wang@Sun.COM 6177956Sxiuyan.wang@Sun.COM #define unm_nic_reg_read(_adp_, _off_, _ptr_) \ 6187956Sxiuyan.wang@Sun.COM ((_adp_)->unm_nic_hw_read_wx((_adp_), (_off_), (_ptr_), 4)) 6197956Sxiuyan.wang@Sun.COM 6207956Sxiuyan.wang@Sun.COM 6217956Sxiuyan.wang@Sun.COM #define unm_nic_write_w0(_adp_, _idx_, _val_) \ 6227956Sxiuyan.wang@Sun.COM ((_adp_)->unm_nic_hw_write_wx((_adp_), (_idx_), &(_val_), 4)) 6237956Sxiuyan.wang@Sun.COM 6247956Sxiuyan.wang@Sun.COM #define unm_nic_read_w0(_adp_, _idx_, _val_) \ 6257956Sxiuyan.wang@Sun.COM ((_adp_)->unm_nic_hw_read_wx((_adp_), (_idx_), (_val_), 4)) 6267956Sxiuyan.wang@Sun.COM 6277956Sxiuyan.wang@Sun.COM /* Functions available from unm_nic_hw.c */ 6287956Sxiuyan.wang@Sun.COM int unm_nic_get_board_info(struct unm_adapter_s *adapter); 6297956Sxiuyan.wang@Sun.COM void _unm_nic_write_crb(struct unm_adapter_s *adapter, uint32_t index, 6307956Sxiuyan.wang@Sun.COM uint32_t value); 6317956Sxiuyan.wang@Sun.COM void unm_nic_write_crb(struct unm_adapter_s *adapter, uint32_t index, 6327956Sxiuyan.wang@Sun.COM uint32_t value); 6337956Sxiuyan.wang@Sun.COM void _unm_nic_read_crb(struct unm_adapter_s *adapter, uint32_t index, 6347956Sxiuyan.wang@Sun.COM uint32_t *value); 6357956Sxiuyan.wang@Sun.COM void unm_nic_read_crb(struct unm_adapter_s *adapter, uint32_t index, 6367956Sxiuyan.wang@Sun.COM uint32_t *value); 6377956Sxiuyan.wang@Sun.COM // int unm_nic_reg_read (unm_adapter *adapter, u64 off); 6387956Sxiuyan.wang@Sun.COM int _unm_nic_hw_write(struct unm_adapter_s *adapter, 6397956Sxiuyan.wang@Sun.COM u64 off, void *data, int len); 6407956Sxiuyan.wang@Sun.COM int unm_nic_hw_write(struct unm_adapter_s *adapter, 6417956Sxiuyan.wang@Sun.COM u64 off, void *data, int len); 6427956Sxiuyan.wang@Sun.COM int _unm_nic_hw_read(struct unm_adapter_s *adapter, 6437956Sxiuyan.wang@Sun.COM u64 off, void *data, int len); 6447956Sxiuyan.wang@Sun.COM int unm_nic_hw_read(struct unm_adapter_s *adapter, 6457956Sxiuyan.wang@Sun.COM u64 off, void *data, int len); 6467956Sxiuyan.wang@Sun.COM void _unm_nic_hw_block_read(struct unm_adapter_s *adapter, 6477956Sxiuyan.wang@Sun.COM u64 off, void *data, int num_words); 6487956Sxiuyan.wang@Sun.COM void unm_nic_hw_block_read(struct unm_adapter_s *adapter, 6497956Sxiuyan.wang@Sun.COM u64 off, void *data, int num_words); 6507956Sxiuyan.wang@Sun.COM void _unm_nic_hw_block_write(struct unm_adapter_s *adapter, 6517956Sxiuyan.wang@Sun.COM u64 off, void *data, int num_words); 6527956Sxiuyan.wang@Sun.COM void unm_nic_hw_block_write(struct unm_adapter_s *adapter, 6537956Sxiuyan.wang@Sun.COM u64 off, void *data, int num_words); 6547956Sxiuyan.wang@Sun.COM int unm_nic_pci_mem_write(struct unm_adapter_s *adapter, 6557956Sxiuyan.wang@Sun.COM u64 off, void *data, int size); 6567956Sxiuyan.wang@Sun.COM void unm_nic_mem_block_read(struct unm_adapter_s *adapter, u64 off, 6577956Sxiuyan.wang@Sun.COM void *data, int num_words); 6587956Sxiuyan.wang@Sun.COM void unm_nic_mem_block_write(struct unm_adapter_s *adapter, u64 off, 6597956Sxiuyan.wang@Sun.COM void *data, int num_words); 6607956Sxiuyan.wang@Sun.COM int unm_nic_hw_read_ioctl(unm_adapter *adapter, u64 off, void *data, int len); 6617956Sxiuyan.wang@Sun.COM int unm_nic_hw_write_ioctl(unm_adapter *adapter, u64 off, void *data, int len); 6627956Sxiuyan.wang@Sun.COM int unm_nic_macaddr_set(struct unm_adapter_s *, __uint8_t *addr); 6637956Sxiuyan.wang@Sun.COM void unm_tcl_resetall(struct unm_adapter_s *adapter); 6647956Sxiuyan.wang@Sun.COM void unm_tcl_phaninit(struct unm_adapter_s *adapter); 6657956Sxiuyan.wang@Sun.COM void unm_tcl_postimage(struct unm_adapter_s *adapter); 6667956Sxiuyan.wang@Sun.COM int unm_nic_set_mtu(struct unm_adapter_s *adapter, int new_mtu); 6677956Sxiuyan.wang@Sun.COM long unm_nic_phy_read(unm_adapter *adapter, long reg, __uint32_t *); 6687956Sxiuyan.wang@Sun.COM long unm_nic_init_port(struct unm_adapter_s *adapter); 6697956Sxiuyan.wang@Sun.COM void unm_crb_write_adapter(unsigned long off, void *data, 6707956Sxiuyan.wang@Sun.COM struct unm_adapter_s *adapter); 6717956Sxiuyan.wang@Sun.COM int unm_crb_read_adapter(unsigned long off, void *data, 6727956Sxiuyan.wang@Sun.COM struct unm_adapter_s *adapter); 6737956Sxiuyan.wang@Sun.COM int unm_crb_read_val_adapter(unsigned long off, 6747956Sxiuyan.wang@Sun.COM struct unm_adapter_s *adapter); 6757956Sxiuyan.wang@Sun.COM void unm_nic_stop_port(struct unm_adapter_s *adapter); 6767956Sxiuyan.wang@Sun.COM int unm_nic_set_promisc_mode(struct unm_adapter_s *adapter); 6777956Sxiuyan.wang@Sun.COM int unm_nic_unset_promisc_mode(struct unm_adapter_s *adapter); 6787956Sxiuyan.wang@Sun.COM 6797956Sxiuyan.wang@Sun.COM /* unm_nic_hw.c */ 6807956Sxiuyan.wang@Sun.COM void unm_nic_pci_change_crbwindow_128M(unm_adapter *adapter, uint32_t wndw); 6817956Sxiuyan.wang@Sun.COM int unm_crb_writelit_adapter_128M(struct unm_adapter_s *, unsigned long, int); 6827956Sxiuyan.wang@Sun.COM int unm_nic_hw_write_wx_128M(unm_adapter *adapter, u64 off, void *data, 6837956Sxiuyan.wang@Sun.COM int len); 6847956Sxiuyan.wang@Sun.COM int unm_nic_hw_read_wx_128M(unm_adapter *adapter, u64 off, void *data, int len); 6857956Sxiuyan.wang@Sun.COM int unm_nic_hw_write_ioctl_128M(unm_adapter *adapter, u64 off, void *data, 6867956Sxiuyan.wang@Sun.COM int len); 6877956Sxiuyan.wang@Sun.COM int unm_nic_hw_read_ioctl_128M(unm_adapter *adapter, u64 off, void *data, 6887956Sxiuyan.wang@Sun.COM int len); 6897956Sxiuyan.wang@Sun.COM int unm_nic_pci_mem_write_128M(struct unm_adapter_s *adapter, u64 off, 6907956Sxiuyan.wang@Sun.COM void *data, int size); 6917956Sxiuyan.wang@Sun.COM int unm_nic_pci_mem_read_128M(struct unm_adapter_s *adapter, u64 off, 6927956Sxiuyan.wang@Sun.COM void *data, int size); 6937956Sxiuyan.wang@Sun.COM void unm_nic_pci_write_normalize_128M(unm_adapter *adapter, u64 off, u32 data); 6947956Sxiuyan.wang@Sun.COM u32 unm_nic_pci_read_normalize_128M(unm_adapter *adapter, u64 off); 6957956Sxiuyan.wang@Sun.COM int unm_nic_pci_write_immediate_128M(unm_adapter *adapter, u64 off, u32 *data); 6967956Sxiuyan.wang@Sun.COM int unm_nic_pci_read_immediate_128M(unm_adapter *adapter, u64 off, u32 *data); 6977956Sxiuyan.wang@Sun.COM unsigned long long unm_nic_pci_set_window_128M(unm_adapter *adapter, 6987956Sxiuyan.wang@Sun.COM unsigned long long addr); 6997956Sxiuyan.wang@Sun.COM int unm_nic_clear_statistics_128M(struct unm_adapter_s *adapter); 7007956Sxiuyan.wang@Sun.COM int unm_nic_fill_statistics_128M(struct unm_adapter_s *adapter, 7017956Sxiuyan.wang@Sun.COM struct unm_statistics *unm_stats); 7027956Sxiuyan.wang@Sun.COM 7037956Sxiuyan.wang@Sun.COM void unm_nic_pci_change_crbwindow_2M(unm_adapter *adapter, uint32_t wndw); 7047956Sxiuyan.wang@Sun.COM int unm_crb_writelit_adapter_2M(struct unm_adapter_s *, unsigned long, int); 7057956Sxiuyan.wang@Sun.COM int unm_nic_hw_write_wx_2M(unm_adapter *adapter, u64 off, void *data, int len); 7067956Sxiuyan.wang@Sun.COM int unm_nic_pci_mem_write_2M(struct unm_adapter_s *adapter, u64 off, 7077956Sxiuyan.wang@Sun.COM void *data, int size); 7087956Sxiuyan.wang@Sun.COM int unm_nic_pci_mem_read_2M(struct unm_adapter_s *adapter, u64 off, 7097956Sxiuyan.wang@Sun.COM void *data, int size); 7107956Sxiuyan.wang@Sun.COM int unm_nic_hw_read_wx_2M(unm_adapter *adapter, u64 off, void *data, int len); 7117956Sxiuyan.wang@Sun.COM void unm_nic_pci_write_normalize_2M(unm_adapter *adapter, u64 off, u32 data); 7127956Sxiuyan.wang@Sun.COM u32 unm_nic_pci_read_normalize_2M(unm_adapter *adapter, u64 off); 7137956Sxiuyan.wang@Sun.COM int unm_nic_pci_write_immediate_2M(unm_adapter *adapter, u64 off, u32 *data); 7147956Sxiuyan.wang@Sun.COM int unm_nic_pci_read_immediate_2M(unm_adapter *adapter, u64 off, u32 *data); 7157956Sxiuyan.wang@Sun.COM unsigned long long unm_nic_pci_set_window_2M(unm_adapter *adapter, 7167956Sxiuyan.wang@Sun.COM unsigned long long addr); 7177956Sxiuyan.wang@Sun.COM int unm_nic_clear_statistics_2M(struct unm_adapter_s *adapter); 7187956Sxiuyan.wang@Sun.COM int unm_nic_fill_statistics_2M(struct unm_adapter_s *adapter, 7197956Sxiuyan.wang@Sun.COM struct unm_statistics *unm_stats); 7207956Sxiuyan.wang@Sun.COM void nx_p3_nic_set_multi(unm_adapter *adapter); 7217956Sxiuyan.wang@Sun.COM 7227956Sxiuyan.wang@Sun.COM /* unm_nic_init.c */ 7237956Sxiuyan.wang@Sun.COM int phantom_init(struct unm_adapter_s *adapter, int first_time); 7247956Sxiuyan.wang@Sun.COM int load_from_flash(struct unm_adapter_s *adapter); 7257956Sxiuyan.wang@Sun.COM int pinit_from_rom(unm_adapter *adapter, int verbose); 7267956Sxiuyan.wang@Sun.COM int rom_fast_read(struct unm_adapter_s *adapter, int addr, int *valp); 7277956Sxiuyan.wang@Sun.COM 7287956Sxiuyan.wang@Sun.COM /* unm_nic_isr.c */ 7297956Sxiuyan.wang@Sun.COM void unm_nic_handle_phy_intr(unm_adapter *adapter); 7307956Sxiuyan.wang@Sun.COM 7317956Sxiuyan.wang@Sun.COM /* niu.c */ 7327956Sxiuyan.wang@Sun.COM native_t unm_niu_set_promiscuous_mode(struct unm_adapter_s *adapter, 7337956Sxiuyan.wang@Sun.COM unm_niu_prom_mode_t mode); 7347956Sxiuyan.wang@Sun.COM native_t unm_niu_xg_set_promiscuous_mode(struct unm_adapter_s *adapter, 7357956Sxiuyan.wang@Sun.COM unm_niu_prom_mode_t mode); 7367956Sxiuyan.wang@Sun.COM 7377956Sxiuyan.wang@Sun.COM int unm_niu_xg_macaddr_set(struct unm_adapter_s *adapter, 7387956Sxiuyan.wang@Sun.COM unm_ethernet_macaddr_t addr); 7397956Sxiuyan.wang@Sun.COM native_t unm_niu_disable_xg_port(struct unm_adapter_s *adapter); 7407956Sxiuyan.wang@Sun.COM 7417956Sxiuyan.wang@Sun.COM long unm_niu_gbe_init_port(long port); 7427956Sxiuyan.wang@Sun.COM native_t unm_niu_enable_gbe_port(struct unm_adapter_s *adapter, 7437956Sxiuyan.wang@Sun.COM unm_niu_gbe_ifmode_t mode); 7447956Sxiuyan.wang@Sun.COM native_t unm_niu_disable_gbe_port(struct unm_adapter_s *adapter); 7457956Sxiuyan.wang@Sun.COM 7467956Sxiuyan.wang@Sun.COM int unm_niu_macaddr_get(struct unm_adapter_s *adapter, unsigned char *addr); 7477956Sxiuyan.wang@Sun.COM int unm_niu_macaddr_set(struct unm_adapter_s *adapter, 7487956Sxiuyan.wang@Sun.COM unm_ethernet_macaddr_t addr); 7497956Sxiuyan.wang@Sun.COM 7507956Sxiuyan.wang@Sun.COM int unm_niu_xg_set_tx_flow_ctl(struct unm_adapter_s *adapter, int enable); 7517956Sxiuyan.wang@Sun.COM int unm_niu_gbe_set_rx_flow_ctl(struct unm_adapter_s *adapter, int enable); 7527956Sxiuyan.wang@Sun.COM int unm_niu_gbe_set_tx_flow_ctl(struct unm_adapter_s *adapter, int enable); 7537956Sxiuyan.wang@Sun.COM long unm_niu_gbe_disable_phy_interrupts(struct unm_adapter_s *); 7547956Sxiuyan.wang@Sun.COM long unm_niu_gbe_phy_read(struct unm_adapter_s *, 7557956Sxiuyan.wang@Sun.COM long reg, unm_crbword_t *readval); 7567956Sxiuyan.wang@Sun.COM 7577956Sxiuyan.wang@Sun.COM /* unm_nic_ctx.c */ 7587956Sxiuyan.wang@Sun.COM int netxen_create_rxtx(struct unm_adapter_s *adapter); 7597956Sxiuyan.wang@Sun.COM void netxen_destroy_rxtx(struct unm_adapter_s *adapter); 7607956Sxiuyan.wang@Sun.COM int nx_fw_cmd_set_mtu(struct unm_adapter_s *adapter, int mtu); 7617956Sxiuyan.wang@Sun.COM 7627956Sxiuyan.wang@Sun.COM /* unm_nic_main.c */ 7637956Sxiuyan.wang@Sun.COM int receive_peg_ready(struct unm_adapter_s *adapter); 7647956Sxiuyan.wang@Sun.COM void unm_nic_update_cmd_producer(struct unm_adapter_s *adapter, 7657956Sxiuyan.wang@Sun.COM uint32_t crb_producer); 7667956Sxiuyan.wang@Sun.COM void unm_desc_dma_sync(ddi_dma_handle_t handle, uint_t start, uint_t count, 7677956Sxiuyan.wang@Sun.COM uint_t range, uint_t unit_size, uint_t direction); 7687956Sxiuyan.wang@Sun.COM int unm_pci_alloc_consistent(unm_adapter *, int, caddr_t *, 7697956Sxiuyan.wang@Sun.COM ddi_dma_cookie_t *, ddi_dma_handle_t *, ddi_acc_handle_t *); 7707956Sxiuyan.wang@Sun.COM void unm_pci_free_consistent(ddi_dma_handle_t *, ddi_acc_handle_t *); 7717956Sxiuyan.wang@Sun.COM 7727956Sxiuyan.wang@Sun.COM /* unm_ndd.c */ 7737956Sxiuyan.wang@Sun.COM int unm_nd_init(unm_adapter *adapter); 7747956Sxiuyan.wang@Sun.COM enum ioc_reply unm_nd_ioctl(unm_adapter *adapter, queue_t *wq, 7757956Sxiuyan.wang@Sun.COM mblk_t *mp, struct iocblk *iocp); 7767956Sxiuyan.wang@Sun.COM void unm_nd_cleanup(unm_adapter *adapter); 7777956Sxiuyan.wang@Sun.COM 7787956Sxiuyan.wang@Sun.COM /* unm_gem.c */ 7797956Sxiuyan.wang@Sun.COM void unm_destroy_intr(unm_adapter *adapter); 7807956Sxiuyan.wang@Sun.COM void unm_free_dummy_dma(unm_adapter *adapter); 7817956Sxiuyan.wang@Sun.COM 7827956Sxiuyan.wang@Sun.COM /* 7837956Sxiuyan.wang@Sun.COM * (Internal) return values from ioctl subroutines 7847956Sxiuyan.wang@Sun.COM */ 7857956Sxiuyan.wang@Sun.COM enum ioc_reply { 7867956Sxiuyan.wang@Sun.COM IOC_INVAL = -1, /* bad, NAK with EINVAL */ 7877956Sxiuyan.wang@Sun.COM IOC_DONE, /* OK, reply sent */ 7887956Sxiuyan.wang@Sun.COM IOC_ACK, /* OK, just send ACK */ 7897956Sxiuyan.wang@Sun.COM IOC_REPLY, /* OK, just send reply */ 7907956Sxiuyan.wang@Sun.COM IOC_RESTART_ACK, /* OK, restart & ACK */ 7917956Sxiuyan.wang@Sun.COM IOC_RESTART_REPLY /* OK, restart & reply */ 7927956Sxiuyan.wang@Sun.COM }; 7937956Sxiuyan.wang@Sun.COM 7947956Sxiuyan.wang@Sun.COM /* 7957956Sxiuyan.wang@Sun.COM * Shorthand for the NDD parameters 7967956Sxiuyan.wang@Sun.COM */ 7977956Sxiuyan.wang@Sun.COM #define param_adv_autoneg nd_params[PARAM_ADV_AUTONEG_CAP].ndp_val 7987956Sxiuyan.wang@Sun.COM #define param_adv_pause nd_params[PARAM_ADV_PAUSE_CAP].ndp_val 7997956Sxiuyan.wang@Sun.COM #define param_adv_asym_pause nd_params[PARAM_ADV_ASYM_PAUSE_CAP].ndp_val 8007956Sxiuyan.wang@Sun.COM #define param_adv_10000fdx nd_params[PARAM_ADV_10000FDX_CAP].ndp_val 8017956Sxiuyan.wang@Sun.COM #define param_adv_1000fdx nd_params[PARAM_ADV_1000FDX_CAP].ndp_val 8027956Sxiuyan.wang@Sun.COM #define param_adv_1000hdx nd_params[PARAM_ADV_1000HDX_CAP].ndp_val 8037956Sxiuyan.wang@Sun.COM #define param_adv_100fdx nd_params[PARAM_ADV_100FDX_CAP].ndp_val 8047956Sxiuyan.wang@Sun.COM #define param_adv_100hdx nd_params[PARAM_ADV_100HDX_CAP].ndp_val 8057956Sxiuyan.wang@Sun.COM #define param_adv_10fdx nd_params[PARAM_ADV_10FDX_CAP].ndp_val 8067956Sxiuyan.wang@Sun.COM #define param_adv_10hdx nd_params[PARAM_ADV_10HDX_CAP].ndp_val 8077956Sxiuyan.wang@Sun.COM #define param_link_up nd_params[PARAM_LINK_STATUS].ndp_val 8087956Sxiuyan.wang@Sun.COM #define param_link_speed nd_params[PARAM_LINK_SPEED].ndp_val 8097956Sxiuyan.wang@Sun.COM #define param_link_duplex nd_params[PARAM_LINK_DUPLEX].ndp_val 8107956Sxiuyan.wang@Sun.COM #define param_loop_mode nd_params[PARAM_LOOP_MODE].ndp_val 8117956Sxiuyan.wang@Sun.COM 8127956Sxiuyan.wang@Sun.COM /* 8137956Sxiuyan.wang@Sun.COM * Property lookups 8147956Sxiuyan.wang@Sun.COM */ 8157956Sxiuyan.wang@Sun.COM #define UNM_PROP_EXISTS(d, n) \ 8167956Sxiuyan.wang@Sun.COM ddi_prop_exists(DDI_DEV_T_ANY, (d), DDI_PROP_DONTPASS, (n)) 8177956Sxiuyan.wang@Sun.COM #define UNM_PROP_GET_INT(d, n) \ 8187956Sxiuyan.wang@Sun.COM ddi_prop_get_int(DDI_DEV_T_ANY, (d), DDI_PROP_DONTPASS, (n), -1) 8197956Sxiuyan.wang@Sun.COM 8207956Sxiuyan.wang@Sun.COM /* 8217956Sxiuyan.wang@Sun.COM * Bit flags in the 'debug' word ... 8227956Sxiuyan.wang@Sun.COM */ 8237956Sxiuyan.wang@Sun.COM #define UNM_DBG_TRACE 0x00000002 /* general flow tracing */ 8247956Sxiuyan.wang@Sun.COM #define UNM_DBG_NDD 0x20000000 /* NDD operations */ 8257956Sxiuyan.wang@Sun.COM 8267956Sxiuyan.wang@Sun.COM #define MBPS_10 10 8277956Sxiuyan.wang@Sun.COM #define MBPS_100 100 8287956Sxiuyan.wang@Sun.COM #define MBPS_1000 1000 8297956Sxiuyan.wang@Sun.COM 8308687SJing.Xiong@Sun.COM #ifdef __cplusplus 8318687SJing.Xiong@Sun.COM } 8328687SJing.Xiong@Sun.COM #endif 8338687SJing.Xiong@Sun.COM 8347956Sxiuyan.wang@Sun.COM #endif /* !_UNM_NIC_ */ 835