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