17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 567f02347Srandyf * Common Development and Distribution License (the "License"). 667f02347Srandyf * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 2167f02347Srandyf 227c478bd9Sstevel@tonic-gate /* 23a4de4ba2Sml * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate #ifndef _SYS_BGE_H 287c478bd9Sstevel@tonic-gate #define _SYS_BGE_H 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate #ifdef __cplusplus 317c478bd9Sstevel@tonic-gate extern "C" { 327c478bd9Sstevel@tonic-gate #endif 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate #include <sys/types.h> 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate /* 377c478bd9Sstevel@tonic-gate * Name of the driver 387c478bd9Sstevel@tonic-gate */ 397c478bd9Sstevel@tonic-gate #define BGE_DRIVER_NAME "bge" 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate /* 427c478bd9Sstevel@tonic-gate * The driver supports the NDD ioctls ND_GET/ND_SET, and the loopback 437c478bd9Sstevel@tonic-gate * ioctls LB_GET_INFO_SIZE/LB_GET_INFO/LB_GET_MODE/LB_SET_MODE 447c478bd9Sstevel@tonic-gate * 457c478bd9Sstevel@tonic-gate * These are the values to use with LD_SET_MODE. 467c478bd9Sstevel@tonic-gate * Note: they may not all be supported on any given chip/driver. 477c478bd9Sstevel@tonic-gate */ 487c478bd9Sstevel@tonic-gate #define BGE_LOOP_NONE 0 497c478bd9Sstevel@tonic-gate #define BGE_LOOP_EXTERNAL_1000 1 /* with Gbit loopback cable */ 507c478bd9Sstevel@tonic-gate #define BGE_LOOP_EXTERNAL_100 2 /* with loopback cable */ 517c478bd9Sstevel@tonic-gate #define BGE_LOOP_EXTERNAL_10 3 /* with loopback cable */ 527c478bd9Sstevel@tonic-gate #define BGE_LOOP_INTERNAL_PHY 4 537c478bd9Sstevel@tonic-gate #define BGE_LOOP_INTERNAL_MAC 5 547c478bd9Sstevel@tonic-gate 557c478bd9Sstevel@tonic-gate /* 567c478bd9Sstevel@tonic-gate * BGE-specific ioctls ... 577c478bd9Sstevel@tonic-gate */ 587c478bd9Sstevel@tonic-gate #define BGE_IOC ((((('B' << 8) + 'G') << 8) + 'E') << 8) 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gate /* 617c478bd9Sstevel@tonic-gate * PHY register read/write ioctls, used by cable test software 627c478bd9Sstevel@tonic-gate */ 637c478bd9Sstevel@tonic-gate #define BGE_MII_READ (BGE_IOC|1) 647c478bd9Sstevel@tonic-gate #define BGE_MII_WRITE (BGE_IOC|2) 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate struct bge_mii_rw { 677c478bd9Sstevel@tonic-gate uint32_t mii_reg; /* PHY register number [0..31] */ 687c478bd9Sstevel@tonic-gate uint32_t mii_data; /* data to write/data read */ 697c478bd9Sstevel@tonic-gate }; 707c478bd9Sstevel@tonic-gate 717c478bd9Sstevel@tonic-gate /* 727c478bd9Sstevel@tonic-gate * SEEPROM read/write ioctls, for use by SEEPROM upgrade utility 737c478bd9Sstevel@tonic-gate * 747c478bd9Sstevel@tonic-gate * Note: SEEPROMs can only be accessed as 32-bit words, so <see_addr> 757c478bd9Sstevel@tonic-gate * must be a multiple of 4. Not all systems have a SEEPROM fitted! 767c478bd9Sstevel@tonic-gate */ 777c478bd9Sstevel@tonic-gate #define BGE_SEE_READ (BGE_IOC|3) 787c478bd9Sstevel@tonic-gate #define BGE_SEE_WRITE (BGE_IOC|4) 797c478bd9Sstevel@tonic-gate 807c478bd9Sstevel@tonic-gate struct bge_see_rw { 817c478bd9Sstevel@tonic-gate uint32_t see_addr; /* Byte offset within SEEPROM */ 827c478bd9Sstevel@tonic-gate uint32_t see_data; /* Data read/data to write */ 837c478bd9Sstevel@tonic-gate }; 847c478bd9Sstevel@tonic-gate 857c478bd9Sstevel@tonic-gate /* 867c478bd9Sstevel@tonic-gate * Flash read/write ioctls, for flash upgrade utility 877c478bd9Sstevel@tonic-gate * 887c478bd9Sstevel@tonic-gate * Note: flash can only be accessed as 32-bit words, so <flash_addr> 897c478bd9Sstevel@tonic-gate * must be a multiple of 4. Not all systems have flash fitted! 907c478bd9Sstevel@tonic-gate */ 917c478bd9Sstevel@tonic-gate #define BGE_FLASH_READ (BGE_IOC|5) 927c478bd9Sstevel@tonic-gate #define BGE_FLASH_WRITE (BGE_IOC|6) 937c478bd9Sstevel@tonic-gate 947c478bd9Sstevel@tonic-gate struct bge_flash_rw { 957c478bd9Sstevel@tonic-gate uint32_t flash_addr; /* Byte offset within flash */ 967c478bd9Sstevel@tonic-gate uint32_t flash_data; /* Data read/data to write */ 977c478bd9Sstevel@tonic-gate }; 987c478bd9Sstevel@tonic-gate 997c478bd9Sstevel@tonic-gate /* 1007c478bd9Sstevel@tonic-gate * These diagnostic IOCTLS are enabled only in DEBUG drivers 1017c478bd9Sstevel@tonic-gate */ 1027c478bd9Sstevel@tonic-gate #define BGE_DIAG (BGE_IOC|10) /* currently a no-op */ 1037c478bd9Sstevel@tonic-gate #define BGE_PEEK (BGE_IOC|11) 1047c478bd9Sstevel@tonic-gate #define BGE_POKE (BGE_IOC|12) 1057c478bd9Sstevel@tonic-gate #define BGE_PHY_RESET (BGE_IOC|13) 1067c478bd9Sstevel@tonic-gate #define BGE_SOFT_RESET (BGE_IOC|14) 1077c478bd9Sstevel@tonic-gate #define BGE_HARD_RESET (BGE_IOC|15) 1087c478bd9Sstevel@tonic-gate 1097c478bd9Sstevel@tonic-gate typedef struct { 1107c478bd9Sstevel@tonic-gate uint64_t pp_acc_size; /* in bytes: 1,2,4,8 */ 1117c478bd9Sstevel@tonic-gate uint64_t pp_acc_space; /* See #defines below */ 1127c478bd9Sstevel@tonic-gate uint64_t pp_acc_offset; 1137c478bd9Sstevel@tonic-gate uint64_t pp_acc_data; /* output for peek */ 1147c478bd9Sstevel@tonic-gate /* input for poke */ 1157c478bd9Sstevel@tonic-gate } bge_peekpoke_t; 1167c478bd9Sstevel@tonic-gate 1177c478bd9Sstevel@tonic-gate #define BGE_PP_SPACE_CFG 0 /* PCI config space */ 1187c478bd9Sstevel@tonic-gate #define BGE_PP_SPACE_REG 1 /* PCI memory space */ 1197c478bd9Sstevel@tonic-gate #define BGE_PP_SPACE_NIC 2 /* on-chip memory */ 1207c478bd9Sstevel@tonic-gate #define BGE_PP_SPACE_MII 3 /* PHY's MII registers */ 1217c478bd9Sstevel@tonic-gate #define BGE_PP_SPACE_BGE 4 /* driver's soft state */ 1227c478bd9Sstevel@tonic-gate #define BGE_PP_SPACE_TXDESC 5 /* TX descriptors */ 1237c478bd9Sstevel@tonic-gate #define BGE_PP_SPACE_TXBUFF 6 /* TX buffers */ 1247c478bd9Sstevel@tonic-gate #define BGE_PP_SPACE_RXDESC 7 /* RX descriptors */ 1257c478bd9Sstevel@tonic-gate #define BGE_PP_SPACE_RXBUFF 8 /* RX buffers */ 1267c478bd9Sstevel@tonic-gate #define BGE_PP_SPACE_STATUS 9 /* status block */ 1277c478bd9Sstevel@tonic-gate #define BGE_PP_SPACE_STATISTICS 10 /* statistics block */ 1287c478bd9Sstevel@tonic-gate #define BGE_PP_SPACE_SEEPROM 11 /* SEEPROM (if fitted) */ 1297c478bd9Sstevel@tonic-gate #define BGE_PP_SPACE_FLASH 12 /* FLASH (if fitted) */ 1307c478bd9Sstevel@tonic-gate 13167f02347Srandyf #define BGE_IPMI_ASF 132*bd5c6927Sml 133*bd5c6927Sml /* 134*bd5c6927Sml * Enable BGE_NETCONSOLE only with SPARC 135*bd5c6927Sml */ 136*bd5c6927Sml #ifdef __sparc 137a4de4ba2Sml #define BGE_NETCONSOLE 138*bd5c6927Sml #endif 139a4de4ba2Sml 140a4de4ba2Sml /* 141a4de4ba2Sml * BGE_MAXPKT_RCVED is defined to make sure bge does not stick 142a4de4ba2Sml * in a receiving loop too long. This value is the tuning result 143a4de4ba2Sml * of performance testing on sparc/x86 platforms, with regarding 144a4de4ba2Sml * to throughput/latency/CPU utilization, TCP/UDP 145a4de4ba2Sml */ 146a4de4ba2Sml #define BGE_MAXPKT_RCVED 32 14767f02347Srandyf 1487c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1497c478bd9Sstevel@tonic-gate } 1507c478bd9Sstevel@tonic-gate #endif 1517c478bd9Sstevel@tonic-gate 1527c478bd9Sstevel@tonic-gate #endif /* _SYS_BGE_H */ 153