12675Szh199473 /* 22675Szh199473 * CDDL HEADER START 32675Szh199473 * 42675Szh199473 * The contents of this file are subject to the terms of the 52675Szh199473 * Common Development and Distribution License (the "License"). 62675Szh199473 * You may not use this file except in compliance with the License. 72675Szh199473 * 82675Szh199473 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 92675Szh199473 * or http://www.opensolaris.org/os/licensing. 102675Szh199473 * See the License for the specific language governing permissions 112675Szh199473 * and limitations under the License. 122675Szh199473 * 132675Szh199473 * When distributing Covered Code, include this CDDL HEADER in each 142675Szh199473 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 152675Szh199473 * If applicable, add the following below this CDDL HEADER, with the 162675Szh199473 * fields enclosed by brackets "[]" replaced with your own identifying 172675Szh199473 * information: Portions Copyright [yyyy] [name of copyright owner] 182675Szh199473 * 192675Szh199473 * CDDL HEADER END 202675Szh199473 */ 212675Szh199473 222675Szh199473 /* 233918Sml149210 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 242675Szh199473 * Use is subject to license terms. 252675Szh199473 */ 262675Szh199473 272675Szh199473 #ifndef _SYS_BGE_H 282675Szh199473 #define _SYS_BGE_H 292675Szh199473 302675Szh199473 #pragma ident "%Z%%M% %I% %E% SMI" 312675Szh199473 322675Szh199473 #ifdef __cplusplus 332675Szh199473 extern "C" { 342675Szh199473 #endif 352675Szh199473 362675Szh199473 #include <sys/types.h> 372675Szh199473 382675Szh199473 /* 392675Szh199473 * Name of the driver 402675Szh199473 */ 412675Szh199473 #define BGE_DRIVER_NAME "bge" 422675Szh199473 432675Szh199473 /* 442675Szh199473 * The driver supports the NDD ioctls ND_GET/ND_SET, and the loopback 452675Szh199473 * ioctls LB_GET_INFO_SIZE/LB_GET_INFO/LB_GET_MODE/LB_SET_MODE 462675Szh199473 * 472675Szh199473 * These are the values to use with LD_SET_MODE. 482675Szh199473 * Note: they may not all be supported on any given chip/driver. 492675Szh199473 */ 502675Szh199473 #define BGE_LOOP_NONE 0 512675Szh199473 #define BGE_LOOP_EXTERNAL_1000 1 /* with Gbit loopback cable */ 522675Szh199473 #define BGE_LOOP_EXTERNAL_100 2 /* with loopback cable */ 532675Szh199473 #define BGE_LOOP_EXTERNAL_10 3 /* with loopback cable */ 542675Szh199473 #define BGE_LOOP_INTERNAL_PHY 4 552675Szh199473 #define BGE_LOOP_INTERNAL_MAC 5 562675Szh199473 572675Szh199473 /* 582675Szh199473 * BGE-specific ioctls ... 592675Szh199473 */ 602675Szh199473 #define BGE_IOC ((((('B' << 8) + 'G') << 8) + 'E') << 8) 612675Szh199473 622675Szh199473 /* 632675Szh199473 * PHY register read/write ioctls, used by cable test software 642675Szh199473 */ 652675Szh199473 #define BGE_MII_READ (BGE_IOC|1) 662675Szh199473 #define BGE_MII_WRITE (BGE_IOC|2) 672675Szh199473 682675Szh199473 struct bge_mii_rw { 692675Szh199473 uint32_t mii_reg; /* PHY register number [0..31] */ 702675Szh199473 uint32_t mii_data; /* data to write/data read */ 712675Szh199473 }; 722675Szh199473 732675Szh199473 /* 742675Szh199473 * SEEPROM read/write ioctls, for use by SEEPROM upgrade utility 752675Szh199473 * 762675Szh199473 * Note: SEEPROMs can only be accessed as 32-bit words, so <see_addr> 772675Szh199473 * must be a multiple of 4. Not all systems have a SEEPROM fitted! 782675Szh199473 */ 792675Szh199473 #define BGE_SEE_READ (BGE_IOC|3) 802675Szh199473 #define BGE_SEE_WRITE (BGE_IOC|4) 812675Szh199473 822675Szh199473 struct bge_see_rw { 832675Szh199473 uint32_t see_addr; /* Byte offset within SEEPROM */ 842675Szh199473 uint32_t see_data; /* Data read/data to write */ 852675Szh199473 }; 862675Szh199473 872675Szh199473 /* 882675Szh199473 * Flash read/write ioctls, for flash upgrade utility 892675Szh199473 * 902675Szh199473 * Note: flash can only be accessed as 32-bit words, so <flash_addr> 912675Szh199473 * must be a multiple of 4. Not all systems have flash fitted! 922675Szh199473 */ 932675Szh199473 #define BGE_FLASH_READ (BGE_IOC|5) 942675Szh199473 #define BGE_FLASH_WRITE (BGE_IOC|6) 952675Szh199473 962675Szh199473 struct bge_flash_rw { 972675Szh199473 uint32_t flash_addr; /* Byte offset within flash */ 982675Szh199473 uint32_t flash_data; /* Data read/data to write */ 992675Szh199473 }; 1002675Szh199473 1012675Szh199473 /* 1022675Szh199473 * These diagnostic IOCTLS are enabled only in DEBUG drivers 1032675Szh199473 */ 1042675Szh199473 #define BGE_DIAG (BGE_IOC|10) /* currently a no-op */ 1052675Szh199473 #define BGE_PEEK (BGE_IOC|11) 1062675Szh199473 #define BGE_POKE (BGE_IOC|12) 1072675Szh199473 #define BGE_PHY_RESET (BGE_IOC|13) 1082675Szh199473 #define BGE_SOFT_RESET (BGE_IOC|14) 1092675Szh199473 #define BGE_HARD_RESET (BGE_IOC|15) 1102675Szh199473 1112675Szh199473 typedef struct { 1122675Szh199473 uint64_t pp_acc_size; /* in bytes: 1,2,4,8 */ 1132675Szh199473 uint64_t pp_acc_space; /* See #defines below */ 1142675Szh199473 uint64_t pp_acc_offset; 1152675Szh199473 uint64_t pp_acc_data; /* output for peek */ 1162675Szh199473 /* input for poke */ 1172675Szh199473 } bge_peekpoke_t; 1182675Szh199473 1192675Szh199473 #define BGE_PP_SPACE_CFG 0 /* PCI config space */ 1202675Szh199473 #define BGE_PP_SPACE_REG 1 /* PCI memory space */ 1212675Szh199473 #define BGE_PP_SPACE_NIC 2 /* on-chip memory */ 1222675Szh199473 #define BGE_PP_SPACE_MII 3 /* PHY's MII registers */ 1232675Szh199473 #define BGE_PP_SPACE_BGE 4 /* driver's soft state */ 1242675Szh199473 #define BGE_PP_SPACE_TXDESC 5 /* TX descriptors */ 1252675Szh199473 #define BGE_PP_SPACE_TXBUFF 6 /* TX buffers */ 1262675Szh199473 #define BGE_PP_SPACE_RXDESC 7 /* RX descriptors */ 1272675Szh199473 #define BGE_PP_SPACE_RXBUFF 8 /* RX buffers */ 1282675Szh199473 #define BGE_PP_SPACE_STATUS 9 /* status block */ 1292675Szh199473 #define BGE_PP_SPACE_STATISTICS 10 /* statistics block */ 1302675Szh199473 #define BGE_PP_SPACE_SEEPROM 11 /* SEEPROM (if fitted) */ 1312675Szh199473 #define BGE_PP_SPACE_FLASH 12 /* FLASH (if fitted) */ 1322675Szh199473 1332675Szh199473 #define BGE_IPMI_ASF 134*4029Sml149210 135*4029Sml149210 /* 136*4029Sml149210 * Enable BGE_NETCONSOLE only with SPARC 137*4029Sml149210 */ 138*4029Sml149210 #ifdef __sparc 1393918Sml149210 #define BGE_NETCONSOLE 140*4029Sml149210 #endif 1413918Sml149210 1423918Sml149210 /* 1433918Sml149210 * BGE_MAXPKT_RCVED is defined to make sure bge does not stick 1443918Sml149210 * in a receiving loop too long. This value is the tuning result 1453918Sml149210 * of performance testing on sparc/x86 platforms, with regarding 1463918Sml149210 * to throughput/latency/CPU utilization, TCP/UDP 1473918Sml149210 */ 1483918Sml149210 #define BGE_MAXPKT_RCVED 32 1492675Szh199473 1502675Szh199473 #ifdef __cplusplus 1512675Szh199473 } 1522675Szh199473 #endif 1532675Szh199473 1542675Szh199473 #endif /* _SYS_BGE_H */ 155