mlxvar.h (9eee27f16dfdce60dfd13b7f7a0486a65a2686b5) | mlxvar.h (da8bb3a3bf71a0579594e2faa0dd92b821689e12) |
---|---|
1/*- 2 * Copyright (c) 1999 Michael Smith 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 * $FreeBSD$ 27 */ 28 29/* | 1/*- 2 * Copyright (c) 1999 Michael Smith 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 * $FreeBSD$ 27 */ 28 29/* |
30 * We could actually use all 33 segments, but using only 32 means that 31 * each scatter/gather map is 256 bytes in size, and thus we don't have to worry about | 30 * Debugging levels: 31 * 0 - quiet, only emit warnings 32 * 1 - noisy, emit major function points and things done 33 * 2 - extremely noisy, emit trace items in loops, etc. 34 */ 35#ifdef MLX_DEBUG 36#define debug(level, fmt, args...) do { if (level <= MLX_DEBUG) printf("%s: " fmt "\n", __FUNCTION__ , ##args); } while(0) 37#define debug_called(level) do { if (level <= MLX_DEBUG) printf(__FUNCTION__ ": called\n"); } while(0) 38#else 39#define debug(level, fmt, args...) 40#define debug_called(level) 41#endif 42 43 44/* 45 * We could actually use all 17/33 segments, but using only 16/32 means that 46 * each scatter/gather map is 128/256 bytes in size, and thus we don't have to worry about |
32 * maps crossing page boundaries. 33 */ | 47 * maps crossing page boundaries. 48 */ |
34#define MLX_NSEG 32 /* max scatter/gather segments we use */ | 49#define MLX_NSEG_OLD 16 /* max scatter/gather segments we use 3.x and earlier */ 50#define MLX_NSEG_NEW 32 /* max scatter/gather segments we use 4.x and later */ |
35#define MLX_NSLOTS 256 /* max number of command slots */ 36 | 51#define MLX_NSLOTS 256 /* max number of command slots */ 52 |
37#define MLX_MAXDRIVES 32 | 53#define MLX_MAXDRIVES 32 /* max number of system drives */ |
38 39/* 40 * Structure describing a System Drive as attached to the controller. 41 */ 42struct mlx_sysdrive 43{ 44 /* from MLX_CMD_ENQSYSDRIVE */ 45 u_int32_t ms_size; --- 39 unchanged lines hidden (view full) --- 85 86/* 87 * Per-controller structure. 88 */ 89struct mlx_softc 90{ 91 /* bus connections */ 92 device_t mlx_dev; | 54 55/* 56 * Structure describing a System Drive as attached to the controller. 57 */ 58struct mlx_sysdrive 59{ 60 /* from MLX_CMD_ENQSYSDRIVE */ 61 u_int32_t ms_size; --- 39 unchanged lines hidden (view full) --- 101 102/* 103 * Per-controller structure. 104 */ 105struct mlx_softc 106{ 107 /* bus connections */ 108 device_t mlx_dev; |
109 dev_t mlx_dev_t; |
|
93 struct resource *mlx_mem; /* mailbox interface window */ 94 bus_space_handle_t mlx_bhandle; /* bus space handle */ 95 bus_space_tag_t mlx_btag; /* bus space tag */ 96 bus_dma_tag_t mlx_parent_dmat;/* parent DMA tag */ 97 bus_dma_tag_t mlx_buffer_dmat;/* data buffer DMA tag */ 98 struct resource *mlx_irq; /* interrupt */ 99 void *mlx_intr; /* interrupt handle */ 100 101 /* scatter/gather lists and their controller-visible mappings */ 102 struct mlx_sgentry *mlx_sgtable; /* s/g lists */ 103 u_int32_t mlx_sgbusaddr; /* s/g table base address in bus space */ 104 bus_dma_tag_t mlx_sg_dmat; /* s/g buffer DMA tag */ 105 bus_dmamap_t mlx_sg_dmamap; /* map for s/g buffers */ | 110 struct resource *mlx_mem; /* mailbox interface window */ 111 bus_space_handle_t mlx_bhandle; /* bus space handle */ 112 bus_space_tag_t mlx_btag; /* bus space tag */ 113 bus_dma_tag_t mlx_parent_dmat;/* parent DMA tag */ 114 bus_dma_tag_t mlx_buffer_dmat;/* data buffer DMA tag */ 115 struct resource *mlx_irq; /* interrupt */ 116 void *mlx_intr; /* interrupt handle */ 117 118 /* scatter/gather lists and their controller-visible mappings */ 119 struct mlx_sgentry *mlx_sgtable; /* s/g lists */ 120 u_int32_t mlx_sgbusaddr; /* s/g table base address in bus space */ 121 bus_dma_tag_t mlx_sg_dmat; /* s/g buffer DMA tag */ 122 bus_dmamap_t mlx_sg_dmamap; /* map for s/g buffers */ |
123 int mlx_sg_nseg; /* max number of s/g entries */ |
|
106 107 /* controller limits and features */ 108 struct mlx_enquiry2 *mlx_enq2; 109 int mlx_maxiop; /* hard maximum number of commands */ 110 int mlx_feature; /* controller features/quirks */ 111#define MLX_FEAT_PAUSEWORKS (1<<0) /* channel pause works as expected */ 112 113 /* controller queues and arrays */ --- 19 unchanged lines hidden (view full) --- 133 int mlx_lastevent; /* sequence number of the last event we recorded */ 134 int mlx_currevent; /* sequence number last time we looked */ 135 int mlx_rebuild; /* if >= 0, drive is being rebuilt */ 136 u_int32_t mlx_rebuildstat;/* blocks left to rebuild if active */ 137 int mlx_check; /* if >= 0, drive is being checked */ 138 struct mlx_pause mlx_pause; /* pending pause operation details */ 139 140 int mlx_locks; /* reentrancy avoidance */ | 124 125 /* controller limits and features */ 126 struct mlx_enquiry2 *mlx_enq2; 127 int mlx_maxiop; /* hard maximum number of commands */ 128 int mlx_feature; /* controller features/quirks */ 129#define MLX_FEAT_PAUSEWORKS (1<<0) /* channel pause works as expected */ 130 131 /* controller queues and arrays */ --- 19 unchanged lines hidden (view full) --- 151 int mlx_lastevent; /* sequence number of the last event we recorded */ 152 int mlx_currevent; /* sequence number last time we looked */ 153 int mlx_rebuild; /* if >= 0, drive is being rebuilt */ 154 u_int32_t mlx_rebuildstat;/* blocks left to rebuild if active */ 155 int mlx_check; /* if >= 0, drive is being checked */ 156 struct mlx_pause mlx_pause; /* pending pause operation details */ 157 158 int mlx_locks; /* reentrancy avoidance */ |
159 int mlx_flags; 160#define MLX_SPINUP_REPORTED (1<<0) /* "spinning up drives" message displayed */ |
|
141 142 /* interface-specific accessor functions */ 143 int mlx_iftype; /* interface protocol */ | 161 162 /* interface-specific accessor functions */ 163 int mlx_iftype; /* interface protocol */ |
164#define MLX_IFTYPE_2 2 |
|
144#define MLX_IFTYPE_3 3 145#define MLX_IFTYPE_4 4 146#define MLX_IFTYPE_5 5 147 int (* mlx_tryqueue)(struct mlx_softc *sc, struct mlx_command *mc); 148 int (* mlx_findcomplete)(struct mlx_softc *sc, u_int8_t *slot, u_int16_t *status); 149 void (* mlx_intaction)(struct mlx_softc *sc, int action); | 165#define MLX_IFTYPE_3 3 166#define MLX_IFTYPE_4 4 167#define MLX_IFTYPE_5 5 168 int (* mlx_tryqueue)(struct mlx_softc *sc, struct mlx_command *mc); 169 int (* mlx_findcomplete)(struct mlx_softc *sc, u_int8_t *slot, u_int16_t *status); 170 void (* mlx_intaction)(struct mlx_softc *sc, int action); |
171 int (* mlx_fw_handshake)(struct mlx_softc *sc, int *error, int *param1, int *param2); |
|
150#define MLX_INTACTION_DISABLE 0 151#define MLX_INTACTION_ENABLE 1 152}; 153 154/* 155 * Simple (stupid) locks. 156 * 157 * Note that these are designed to avoid reentrancy, not concurrency, and will --- 62 unchanged lines hidden --- | 172#define MLX_INTACTION_DISABLE 0 173#define MLX_INTACTION_ENABLE 1 174}; 175 176/* 177 * Simple (stupid) locks. 178 * 179 * Note that these are designed to avoid reentrancy, not concurrency, and will --- 62 unchanged lines hidden --- |