sys/dev/netif/ae/if_aevar.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | /*- * Copyright (c) 2008 Stanislav Sedov <stas@FreeBSD.org>. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ae/if_aevar.h,v 1.1.2.1.4.1 2009/04/15 03:14:26 kensmith Exp $ */ #ifndef IF_AEVAR_H #define IF_AEVAR_H /* * Supported chips identifiers. */ #define VENDORID_ATTANSIC 0x1969 #define DEVICEID_ATTANSIC_L2 0x2048 /* How much to wait for reset to complete (10 microsecond units). */ #define AE_RESET_TIMEOUT 100 /* How much to wait for device to enter idle state (100 microsecond units). */ #define AE_IDLE_TIMEOUT 100 /* How much to wait for MDIO to do the work (2 microsecond units). */ #define AE_MDIO_TIMEOUT 10 /* How much to wait for VPD reading operation to complete (2 ms units). */ #define AE_VPD_TIMEOUT 10 /* How much to wait for send operation to complete (HZ units). */ #define AE_TX_TIMEOUT 5 /* Default PHY address. */ #define AE_PHYADDR_DEFAULT 0 /* Tx packet descriptor header format. */ struct ae_txd { uint16_t len; uint16_t vlan; } __packed; /* Tx status descriptor format. */ struct ae_txs { uint16_t len; uint16_t flags; } __packed; /* Rx packet descriptor format. */ struct ae_rxd { uint16_t len; uint16_t flags; uint16_t vlan; uint16_t __pad; uint8_t data[1528]; } __packed; /* Statistics. */ struct ae_stats { uint32_t rx_bcast; uint32_t rx_mcast; uint32_t rx_pause; uint32_t rx_ctrl; uint32_t rx_crcerr; uint32_t rx_codeerr; uint32_t rx_runt; uint32_t rx_frag; uint32_t rx_trunc; uint32_t rx_align; uint32_t tx_bcast; uint32_t tx_mcast; uint32_t tx_pause; uint32_t tx_ctrl; uint32_t tx_defer; uint32_t tx_excdefer; uint32_t tx_singlecol; uint32_t tx_multicol; uint32_t tx_latecol; uint32_t tx_abortcol; uint32_t tx_underrun; }; /* Software state structure. */ struct ae_softc { struct arpcom arpcom; device_t ae_dev; int ae_mem_rid; struct resource *ae_mem_res; bus_space_tag_t ae_mem_bt; bus_space_handle_t ae_mem_bh; int ae_irq_rid; struct resource *ae_irq_res; void *ae_irq_handle; int ae_phyaddr; device_t ae_miibus; int ae_rev; int ae_chip_rev; uint8_t ae_eaddr[ETHER_ADDR_LEN]; uint8_t ae_flags; int ae_if_flags; struct callout ae_tick_ch; /* DMA tags. */ bus_dma_tag_t dma_parent_tag; bus_dma_tag_t dma_rxd_tag; bus_dma_tag_t dma_txd_tag; bus_dma_tag_t dma_txs_tag; bus_dmamap_t dma_rxd_map; bus_dmamap_t dma_txd_map; bus_dmamap_t dma_txs_map; bus_addr_t dma_rxd_busaddr; bus_addr_t dma_txd_busaddr; bus_addr_t dma_txs_busaddr; uint8_t *rxd_base_dma; /* Start of allocated area. */ struct ae_rxd *rxd_base; /* Start of RxD ring. */ uint8_t *txd_base; /* Start of TxD ring. */ struct ae_txs *txs_base; /* Start of TxS ring. */ /* Ring pointers. */ unsigned int rxd_cur; unsigned int txd_cur; unsigned int txs_cur; unsigned int txs_ack; unsigned int txd_ack; int tx_inproc; /* Active Tx frames in ring. */ int wd_timer; /* XXX remove */ struct ae_stats stats; }; #define BUS_ADDR_LO(x) ((uint64_t) (x) & 0xFFFFFFFF) #define BUS_ADDR_HI(x) ((uint64_t) (x) >> 32) #define AE_FLAG_LINK 0x01 /* Has link. */ #define AE_FLAG_DETACH 0x02 /* Is detaching. */ #define AE_FLAG_TXAVAIL 0x04 /* Tx'es available. */ #define AE_FLAG_MSI 0x08 /* Using MSI. */ #define AE_FLAG_PMG 0x10 /* Supports PCI power management. */ #endif /* IF_AEVAR_H */ |