1*2675Szh199473 /* 2*2675Szh199473 * CDDL HEADER START 3*2675Szh199473 * 4*2675Szh199473 * The contents of this file are subject to the terms of the 5*2675Szh199473 * Common Development and Distribution License (the "License"). 6*2675Szh199473 * You may not use this file except in compliance with the License. 7*2675Szh199473 * 8*2675Szh199473 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*2675Szh199473 * or http://www.opensolaris.org/os/licensing. 10*2675Szh199473 * See the License for the specific language governing permissions 11*2675Szh199473 * and limitations under the License. 12*2675Szh199473 * 13*2675Szh199473 * When distributing Covered Code, include this CDDL HEADER in each 14*2675Szh199473 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*2675Szh199473 * If applicable, add the following below this CDDL HEADER, with the 16*2675Szh199473 * fields enclosed by brackets "[]" replaced with your own identifying 17*2675Szh199473 * information: Portions Copyright [yyyy] [name of copyright owner] 18*2675Szh199473 * 19*2675Szh199473 * CDDL HEADER END 20*2675Szh199473 */ 21*2675Szh199473 22*2675Szh199473 /* 23*2675Szh199473 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 24*2675Szh199473 * Use is subject to license terms. 25*2675Szh199473 */ 26*2675Szh199473 27*2675Szh199473 #ifndef _SYS_BGE_H 28*2675Szh199473 #define _SYS_BGE_H 29*2675Szh199473 30*2675Szh199473 #pragma ident "%Z%%M% %I% %E% SMI" 31*2675Szh199473 32*2675Szh199473 #ifdef __cplusplus 33*2675Szh199473 extern "C" { 34*2675Szh199473 #endif 35*2675Szh199473 36*2675Szh199473 #include <sys/types.h> 37*2675Szh199473 38*2675Szh199473 /* 39*2675Szh199473 * Name of the driver 40*2675Szh199473 */ 41*2675Szh199473 #define BGE_DRIVER_NAME "bge" 42*2675Szh199473 43*2675Szh199473 /* 44*2675Szh199473 * The driver supports the NDD ioctls ND_GET/ND_SET, and the loopback 45*2675Szh199473 * ioctls LB_GET_INFO_SIZE/LB_GET_INFO/LB_GET_MODE/LB_SET_MODE 46*2675Szh199473 * 47*2675Szh199473 * These are the values to use with LD_SET_MODE. 48*2675Szh199473 * Note: they may not all be supported on any given chip/driver. 49*2675Szh199473 */ 50*2675Szh199473 #define BGE_LOOP_NONE 0 51*2675Szh199473 #define BGE_LOOP_EXTERNAL_1000 1 /* with Gbit loopback cable */ 52*2675Szh199473 #define BGE_LOOP_EXTERNAL_100 2 /* with loopback cable */ 53*2675Szh199473 #define BGE_LOOP_EXTERNAL_10 3 /* with loopback cable */ 54*2675Szh199473 #define BGE_LOOP_INTERNAL_PHY 4 55*2675Szh199473 #define BGE_LOOP_INTERNAL_MAC 5 56*2675Szh199473 57*2675Szh199473 /* 58*2675Szh199473 * BGE-specific ioctls ... 59*2675Szh199473 */ 60*2675Szh199473 #define BGE_IOC ((((('B' << 8) + 'G') << 8) + 'E') << 8) 61*2675Szh199473 62*2675Szh199473 /* 63*2675Szh199473 * PHY register read/write ioctls, used by cable test software 64*2675Szh199473 */ 65*2675Szh199473 #define BGE_MII_READ (BGE_IOC|1) 66*2675Szh199473 #define BGE_MII_WRITE (BGE_IOC|2) 67*2675Szh199473 68*2675Szh199473 struct bge_mii_rw { 69*2675Szh199473 uint32_t mii_reg; /* PHY register number [0..31] */ 70*2675Szh199473 uint32_t mii_data; /* data to write/data read */ 71*2675Szh199473 }; 72*2675Szh199473 73*2675Szh199473 /* 74*2675Szh199473 * SEEPROM read/write ioctls, for use by SEEPROM upgrade utility 75*2675Szh199473 * 76*2675Szh199473 * Note: SEEPROMs can only be accessed as 32-bit words, so <see_addr> 77*2675Szh199473 * must be a multiple of 4. Not all systems have a SEEPROM fitted! 78*2675Szh199473 */ 79*2675Szh199473 #define BGE_SEE_READ (BGE_IOC|3) 80*2675Szh199473 #define BGE_SEE_WRITE (BGE_IOC|4) 81*2675Szh199473 82*2675Szh199473 struct bge_see_rw { 83*2675Szh199473 uint32_t see_addr; /* Byte offset within SEEPROM */ 84*2675Szh199473 uint32_t see_data; /* Data read/data to write */ 85*2675Szh199473 }; 86*2675Szh199473 87*2675Szh199473 /* 88*2675Szh199473 * Flash read/write ioctls, for flash upgrade utility 89*2675Szh199473 * 90*2675Szh199473 * Note: flash can only be accessed as 32-bit words, so <flash_addr> 91*2675Szh199473 * must be a multiple of 4. Not all systems have flash fitted! 92*2675Szh199473 */ 93*2675Szh199473 #define BGE_FLASH_READ (BGE_IOC|5) 94*2675Szh199473 #define BGE_FLASH_WRITE (BGE_IOC|6) 95*2675Szh199473 96*2675Szh199473 struct bge_flash_rw { 97*2675Szh199473 uint32_t flash_addr; /* Byte offset within flash */ 98*2675Szh199473 uint32_t flash_data; /* Data read/data to write */ 99*2675Szh199473 }; 100*2675Szh199473 101*2675Szh199473 /* 102*2675Szh199473 * These diagnostic IOCTLS are enabled only in DEBUG drivers 103*2675Szh199473 */ 104*2675Szh199473 #define BGE_DIAG (BGE_IOC|10) /* currently a no-op */ 105*2675Szh199473 #define BGE_PEEK (BGE_IOC|11) 106*2675Szh199473 #define BGE_POKE (BGE_IOC|12) 107*2675Szh199473 #define BGE_PHY_RESET (BGE_IOC|13) 108*2675Szh199473 #define BGE_SOFT_RESET (BGE_IOC|14) 109*2675Szh199473 #define BGE_HARD_RESET (BGE_IOC|15) 110*2675Szh199473 111*2675Szh199473 typedef struct { 112*2675Szh199473 uint64_t pp_acc_size; /* in bytes: 1,2,4,8 */ 113*2675Szh199473 uint64_t pp_acc_space; /* See #defines below */ 114*2675Szh199473 uint64_t pp_acc_offset; 115*2675Szh199473 uint64_t pp_acc_data; /* output for peek */ 116*2675Szh199473 /* input for poke */ 117*2675Szh199473 } bge_peekpoke_t; 118*2675Szh199473 119*2675Szh199473 #define BGE_PP_SPACE_CFG 0 /* PCI config space */ 120*2675Szh199473 #define BGE_PP_SPACE_REG 1 /* PCI memory space */ 121*2675Szh199473 #define BGE_PP_SPACE_NIC 2 /* on-chip memory */ 122*2675Szh199473 #define BGE_PP_SPACE_MII 3 /* PHY's MII registers */ 123*2675Szh199473 #define BGE_PP_SPACE_BGE 4 /* driver's soft state */ 124*2675Szh199473 #define BGE_PP_SPACE_TXDESC 5 /* TX descriptors */ 125*2675Szh199473 #define BGE_PP_SPACE_TXBUFF 6 /* TX buffers */ 126*2675Szh199473 #define BGE_PP_SPACE_RXDESC 7 /* RX descriptors */ 127*2675Szh199473 #define BGE_PP_SPACE_RXBUFF 8 /* RX buffers */ 128*2675Szh199473 #define BGE_PP_SPACE_STATUS 9 /* status block */ 129*2675Szh199473 #define BGE_PP_SPACE_STATISTICS 10 /* statistics block */ 130*2675Szh199473 #define BGE_PP_SPACE_SEEPROM 11 /* SEEPROM (if fitted) */ 131*2675Szh199473 #define BGE_PP_SPACE_FLASH 12 /* FLASH (if fitted) */ 132*2675Szh199473 133*2675Szh199473 #ifndef __sparc 134*2675Szh199473 #define BGE_IPMI_ASF 135*2675Szh199473 #endif 136*2675Szh199473 137*2675Szh199473 #ifdef __cplusplus 138*2675Szh199473 } 139*2675Szh199473 #endif 140*2675Szh199473 141*2675Szh199473 #endif /* _SYS_BGE_H */ 142