Home | History | Annotate | Line # | Download | only in ic
mlxvar.h revision 1.9
      1  1.9  perry /*	$NetBSD: mlxvar.h,v 1.9 2005/02/27 00:27:02 perry Exp $	*/
      2  1.1     ad 
      3  1.1     ad /*-
      4  1.1     ad  * Copyright (c) 2001 The NetBSD Foundation, Inc.
      5  1.1     ad  * All rights reserved.
      6  1.1     ad  *
      7  1.1     ad  * This code is derived from software contributed to The NetBSD Foundation
      8  1.1     ad  * by Andrew Doran.
      9  1.1     ad  *
     10  1.1     ad  * Redistribution and use in source and binary forms, with or without
     11  1.1     ad  * modification, are permitted provided that the following conditions
     12  1.1     ad  * are met:
     13  1.1     ad  * 1. Redistributions of source code must retain the above copyright
     14  1.1     ad  *    notice, this list of conditions and the following disclaimer.
     15  1.1     ad  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.1     ad  *    notice, this list of conditions and the following disclaimer in the
     17  1.1     ad  *    documentation and/or other materials provided with the distribution.
     18  1.1     ad  * 3. All advertising materials mentioning features or use of this software
     19  1.1     ad  *    must display the following acknowledgement:
     20  1.1     ad  *        This product includes software developed by the NetBSD
     21  1.1     ad  *        Foundation, Inc. and its contributors.
     22  1.1     ad  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  1.1     ad  *    contributors may be used to endorse or promote products derived
     24  1.1     ad  *    from this software without specific prior written permission.
     25  1.1     ad  *
     26  1.1     ad  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  1.1     ad  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  1.1     ad  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  1.1     ad  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  1.1     ad  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  1.1     ad  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  1.1     ad  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  1.1     ad  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  1.1     ad  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  1.1     ad  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  1.1     ad  * POSSIBILITY OF SUCH DAMAGE.
     37  1.1     ad  */
     38  1.1     ad 
     39  1.1     ad /*-
     40  1.1     ad  * Copyright (c) 1999 Michael Smith
     41  1.1     ad  * All rights reserved.
     42  1.1     ad  *
     43  1.1     ad  * Redistribution and use in source and binary forms, with or without
     44  1.1     ad  * modification, are permitted provided that the following conditions
     45  1.1     ad  * are met:
     46  1.1     ad  * 1. Redistributions of source code must retain the above copyright
     47  1.1     ad  *    notice, this list of conditions and the following disclaimer.
     48  1.1     ad  * 2. Redistributions in binary form must reproduce the above copyright
     49  1.1     ad  *    notice, this list of conditions and the following disclaimer in the
     50  1.1     ad  *    documentation and/or other materials provided with the distribution.
     51  1.1     ad  *
     52  1.1     ad  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
     53  1.1     ad  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     54  1.1     ad  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     55  1.1     ad  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
     56  1.1     ad  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     57  1.1     ad  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     58  1.1     ad  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     59  1.1     ad  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     60  1.1     ad  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     61  1.1     ad  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     62  1.1     ad  * SUCH DAMAGE.
     63  1.1     ad  *
     64  1.1     ad  * from FreeBSD: mlxvar.h,v 1.5.2.2 2000/04/24 19:40:50 msmith Exp
     65  1.1     ad  */
     66  1.1     ad 
     67  1.1     ad #ifndef _IC_MLXVAR_H_
     68  1.1     ad #define	_IC_MLXVAR_H_
     69  1.1     ad 
     70  1.1     ad /* Older boards allow up to 17 segments and 64kB transfers. */
     71  1.1     ad #define	MLX_MAX_SEGS		17
     72  1.1     ad #define	MLX_MAX_XFER		65536
     73  1.1     ad #define MLX_SGL_SIZE		(sizeof(struct mlx_sgentry) * MLX_MAX_SEGS)
     74  1.1     ad 
     75  1.1     ad /* This shouldn't be ajusted lightly... */
     76  1.1     ad #define MLX_MAX_DRIVES		32
     77  1.1     ad 
     78  1.1     ad /* Maximum queue depth, matching the older controllers. */
     79  1.1     ad #define	MLX_MAX_QUEUECNT	63
     80  1.1     ad 
     81  1.7     ad /* Number of CCBs to reserve for control operations. */
     82  1.7     ad #define	MLX_NCCBS_CONTROL	7
     83  1.1     ad 
     84  1.1     ad /* Structure describing a system drive as attached to the controller. */
     85  1.1     ad struct mlx_sysdrive {
     86  1.1     ad 	u_int32_t	ms_size;
     87  1.1     ad 	u_short		ms_state;
     88  1.1     ad 	u_short		ms_raidlevel;
     89  1.1     ad 	struct device	*ms_dv;
     90  1.1     ad };
     91  1.1     ad 
     92  1.1     ad /* Optional per-CCB context. */
     93  1.1     ad struct mlx_ccb;
     94  1.1     ad struct mlx_context {
     95  1.1     ad 	void	(*mx_handler)(struct mlx_ccb *);
     96  1.1     ad 	void 	*mx_context;
     97  1.1     ad 	struct	device	*mx_dv;
     98  1.1     ad };
     99  1.1     ad 
    100  1.1     ad /* Command control block. */
    101  1.1     ad struct mlx_ccb {
    102  1.1     ad 	union {
    103  1.1     ad 		SIMPLEQ_ENTRY(mlx_ccb) simpleq;
    104  1.1     ad 		SLIST_ENTRY(mlx_ccb) slist;
    105  1.1     ad 		TAILQ_ENTRY(mlx_ccb) tailq;
    106  1.1     ad 	} mc_chain;
    107  1.1     ad 	u_int		mc_flags;
    108  1.1     ad 	u_int		mc_status;
    109  1.1     ad 	u_int		mc_ident;
    110  1.1     ad 	time_t		mc_expiry;
    111  1.1     ad 	u_int		mc_nsgent;
    112  1.1     ad 	u_int		mc_xfer_size;
    113  1.1     ad 	bus_addr_t	mc_xfer_phys;
    114  1.1     ad 	bus_dmamap_t	mc_xfer_map;
    115  1.1     ad 	struct mlx_context mc_mx;
    116  1.1     ad 	u_int8_t	mc_mbox[16];
    117  1.1     ad };
    118  1.1     ad #define	MC_XFER_IN	MU_XFER_IN	/* Map describes inbound xfer */
    119  1.1     ad #define	MC_XFER_OUT	MU_XFER_OUT	/* Map describes outbound xfer */
    120  1.1     ad #define	MC_WAITING	0x0400		/* We have waiters */
    121  1.7     ad #define	MC_CONTROL	0x0800		/* Control operation */
    122  1.1     ad 
    123  1.1     ad /*
    124  1.1     ad  * Per-controller state.
    125  1.1     ad  */
    126  1.1     ad struct mlx_softc {
    127  1.1     ad 	struct device		mlx_dv;
    128  1.1     ad 	bus_space_tag_t		mlx_iot;
    129  1.1     ad 	bus_space_handle_t	mlx_ioh;
    130  1.1     ad 	bus_dma_tag_t		mlx_dmat;
    131  1.1     ad 	bus_dmamap_t		mlx_dmamap;
    132  1.1     ad 	void			*mlx_ih;
    133  1.1     ad 
    134  1.1     ad 	SLIST_HEAD(, mlx_ccb)	mlx_ccb_freelist;
    135  1.1     ad 	TAILQ_HEAD(, mlx_ccb)	mlx_ccb_worklist;
    136  1.1     ad 	SIMPLEQ_HEAD(, mlx_ccb)	mlx_ccb_queue;
    137  1.1     ad 	struct mlx_ccb		*mlx_ccbs;
    138  1.1     ad 	int			mlx_nccbs;
    139  1.7     ad 	int			mlx_nccbs_ctrl;
    140  1.1     ad 
    141  1.1     ad 	caddr_t			mlx_sgls;
    142  1.1     ad 	bus_addr_t		mlx_sgls_paddr;
    143  1.1     ad 
    144  1.1     ad 	int	(*mlx_submit)(struct mlx_softc *, struct mlx_ccb *);
    145  1.1     ad 	int	(*mlx_findcomplete)(struct mlx_softc *, u_int *, u_int *);
    146  1.1     ad 	void	(*mlx_intaction)(struct mlx_softc *, int);
    147  1.1     ad 	int	(*mlx_fw_handshake)(struct mlx_softc *, int *, int *, int *);
    148  1.2     ad 	int	(*mlx_reset)(struct mlx_softc *);
    149  1.1     ad 
    150  1.1     ad 	int			mlx_max_queuecnt;
    151  1.6     ad 	struct mlx_cinfo	mlx_ci;
    152  1.1     ad 
    153  1.1     ad 	time_t			mlx_lastpoll;
    154  1.1     ad 	u_int			mlx_lastevent;
    155  1.1     ad 	u_int			mlx_currevent;
    156  1.1     ad 	u_int			mlx_bg;
    157  1.1     ad 	struct mlx_rebuild_status mlx_rebuildstat;
    158  1.1     ad 	struct mlx_pause	mlx_pause;
    159  1.1     ad 	int			mlx_flags;
    160  1.1     ad 
    161  1.1     ad 	struct mlx_sysdrive	mlx_sysdrive[MLX_MAX_DRIVES];
    162  1.3     ad 	int			mlx_numsysdrives;
    163  1.1     ad };
    164  1.1     ad 
    165  1.1     ad #define MLX_BG_CHECK		1	/* we started a check */
    166  1.1     ad #define MLX_BG_REBUILD		2	/* we started a rebuild */
    167  1.1     ad #define MLX_BG_SPONTANEOUS	3	/* it just happened somehow */
    168  1.1     ad 
    169  1.1     ad #define MLXF_SPINUP_REPORTED	0x0001	/* "spinning up drives" displayed */
    170  1.1     ad #define MLXF_EVENTLOG_BUSY	0x0002	/* currently reading event log */
    171  1.1     ad #define MLXF_FW_INITTED		0x0004	/* firmware init crap done */
    172  1.1     ad #define MLXF_PAUSEWORKS		0x0008	/* channel pause works as expected */
    173  1.1     ad #define MLXF_OPEN		0x0010	/* control device is open */
    174  1.5    wiz #define	MLXF_INITOK		0x0020	/* controller initialised OK */
    175  1.1     ad #define	MLXF_PERIODIC_CTLR	0x0040	/* periodic check running */
    176  1.1     ad #define	MLXF_PERIODIC_DRIVE	0x0080	/* periodic check running */
    177  1.1     ad #define	MLXF_PERIODIC_REBUILD	0x0100	/* periodic check running */
    178  1.4     ad #define	MLXF_RESCANNING		0x0400	/* rescanning drive table */
    179  1.1     ad 
    180  1.1     ad struct mlx_attach_args {
    181  1.1     ad 	int		mlxa_unit;
    182  1.1     ad };
    183  1.1     ad 
    184  1.1     ad int	mlx_flush(struct mlx_softc *, int);
    185  1.1     ad void	mlx_init(struct mlx_softc *, const char *);
    186  1.1     ad int	mlx_intr(void *);
    187  1.1     ad 
    188  1.1     ad int	mlx_ccb_alloc(struct mlx_softc *, struct mlx_ccb **, int);
    189  1.1     ad const char *mlx_ccb_diagnose(struct mlx_ccb *);
    190  1.1     ad void	mlx_ccb_enqueue(struct mlx_softc *, struct mlx_ccb *);
    191  1.1     ad void	mlx_ccb_free(struct mlx_softc *, struct mlx_ccb *);
    192  1.1     ad int	mlx_ccb_map(struct mlx_softc *, struct mlx_ccb *, void *, int, int);
    193  1.1     ad int	mlx_ccb_poll(struct mlx_softc *, struct mlx_ccb *, int);
    194  1.1     ad void	mlx_ccb_unmap(struct mlx_softc *, struct mlx_ccb *);
    195  1.1     ad int	mlx_ccb_wait(struct mlx_softc *, struct mlx_ccb *);
    196  1.1     ad 
    197  1.1     ad static __inline__ void	mlx_make_type1(struct mlx_ccb *, u_int8_t, u_int16_t,
    198  1.1     ad 				       u_int32_t, u_int8_t, u_int32_t,
    199  1.1     ad 				       u_int8_t);
    200  1.1     ad static __inline__ void	mlx_make_type2(struct mlx_ccb *, u_int8_t, u_int8_t,
    201  1.1     ad 				       u_int8_t, u_int8_t, u_int8_t,
    202  1.1     ad 				       u_int8_t, u_int8_t, u_int32_t,
    203  1.1     ad 				       u_int8_t);
    204  1.1     ad static __inline__ void	mlx_make_type3(struct mlx_ccb *, u_int8_t, u_int8_t,
    205  1.1     ad 				       u_int8_t, u_int16_t, u_int8_t,
    206  1.1     ad 				       u_int8_t, u_int32_t, u_int8_t);
    207  1.1     ad static __inline__ void	mlx_make_type4(struct mlx_ccb *, u_int8_t, u_int16_t,
    208  1.1     ad 				       u_int32_t, u_int32_t, u_int8_t);
    209  1.1     ad static __inline__ void	mlx_make_type5(struct mlx_ccb *, u_int8_t,  u_int8_t,
    210  1.1     ad 				       u_int8_t, u_int32_t, u_int32_t,
    211  1.1     ad 				       u_int8_t);
    212  1.1     ad 
    213  1.1     ad static __inline__ u_int8_t	mlx_inb(struct mlx_softc *, int);
    214  1.1     ad static __inline__ u_int16_t	mlx_inw(struct mlx_softc *, int);
    215  1.1     ad static __inline__ u_int32_t	mlx_inl(struct mlx_softc *, int);
    216  1.1     ad static __inline__ void		mlx_outb(struct mlx_softc *, int, u_int8_t);
    217  1.1     ad static __inline__ void		mlx_outw(struct mlx_softc *, int, u_int16_t);
    218  1.1     ad static __inline__ void		mlx_outl(struct mlx_softc *, int, u_int32_t);
    219  1.1     ad 
    220  1.1     ad static __inline__ void
    221  1.1     ad mlx_make_type1(struct mlx_ccb *mc, u_int8_t code, u_int16_t f1, u_int32_t f2,
    222  1.9  perry 	       u_int8_t f3, u_int32_t f4, u_int8_t f5)
    223  1.1     ad {
    224  1.1     ad 
    225  1.1     ad 	mc->mc_mbox[0x0] = code;
    226  1.1     ad 	mc->mc_mbox[0x2] = f1;
    227  1.7     ad 	mc->mc_mbox[0x3] = ((f2 >> 18) & 0xc0) | ((f1 >> 8) & 0x3f);
    228  1.1     ad 	mc->mc_mbox[0x4] = f2;
    229  1.1     ad 	mc->mc_mbox[0x5] = (f2 >> 8);
    230  1.1     ad 	mc->mc_mbox[0x6] = (f2 >> 16);
    231  1.1     ad 	mc->mc_mbox[0x7] = f3;
    232  1.1     ad 	mc->mc_mbox[0x8] = f4;
    233  1.1     ad 	mc->mc_mbox[0x9] = (f4 >> 8);
    234  1.1     ad 	mc->mc_mbox[0xa] = (f4 >> 16);
    235  1.1     ad 	mc->mc_mbox[0xb] = (f4 >> 24);
    236  1.1     ad 	mc->mc_mbox[0xc] = f5;
    237  1.1     ad }
    238  1.1     ad 
    239  1.1     ad static __inline__ void
    240  1.1     ad mlx_make_type2(struct mlx_ccb *mc, u_int8_t code, u_int8_t f1, u_int8_t f2,
    241  1.1     ad 	       u_int8_t f3, u_int8_t f4, u_int8_t f5, u_int8_t f6,
    242  1.1     ad 	       u_int32_t f7, u_int8_t f8)
    243  1.1     ad {
    244  1.1     ad 
    245  1.1     ad 	mc->mc_mbox[0x0] = code;
    246  1.1     ad 	mc->mc_mbox[0x2] = f1;
    247  1.1     ad 	mc->mc_mbox[0x3] = f2;
    248  1.1     ad 	mc->mc_mbox[0x4] = f3;
    249  1.1     ad 	mc->mc_mbox[0x5] = f4;
    250  1.1     ad 	mc->mc_mbox[0x6] = f5;
    251  1.1     ad 	mc->mc_mbox[0x7] = f6;
    252  1.1     ad 	mc->mc_mbox[0x8] = f7;
    253  1.1     ad 	mc->mc_mbox[0x9] = (f7 >> 8);
    254  1.1     ad 	mc->mc_mbox[0xa] = (f7 >> 16);
    255  1.1     ad 	mc->mc_mbox[0xb] = (f7 >> 24);
    256  1.1     ad 	mc->mc_mbox[0xc] = f8;
    257  1.1     ad }
    258  1.1     ad 
    259  1.1     ad static __inline__ void
    260  1.1     ad mlx_make_type3(struct mlx_ccb *mc, u_int8_t code, u_int8_t f1, u_int8_t f2,
    261  1.1     ad 	       u_int16_t f3, u_int8_t f4, u_int8_t f5, u_int32_t f6,
    262  1.1     ad 	       u_int8_t f7)
    263  1.1     ad {
    264  1.1     ad 
    265  1.1     ad 	mc->mc_mbox[0x0] = code;
    266  1.1     ad 	mc->mc_mbox[0x2] = f1;
    267  1.1     ad 	mc->mc_mbox[0x3] = f2;
    268  1.1     ad 	mc->mc_mbox[0x4] = f3;
    269  1.1     ad 	mc->mc_mbox[0x5] = (f3 >> 8);
    270  1.1     ad 	mc->mc_mbox[0x6] = f4;
    271  1.1     ad 	mc->mc_mbox[0x7] = f5;
    272  1.1     ad 	mc->mc_mbox[0x8] = f6;
    273  1.1     ad 	mc->mc_mbox[0x9] = (f6 >> 8);
    274  1.1     ad 	mc->mc_mbox[0xa] = (f6 >> 16);
    275  1.1     ad 	mc->mc_mbox[0xb] = (f6 >> 24);
    276  1.1     ad 	mc->mc_mbox[0xc] = f7;
    277  1.1     ad }
    278  1.1     ad 
    279  1.1     ad static __inline__ void
    280  1.1     ad mlx_make_type4(struct mlx_ccb *mc, u_int8_t code,  u_int16_t f1, u_int32_t f2,
    281  1.1     ad 	       u_int32_t f3, u_int8_t f4)
    282  1.1     ad {
    283  1.1     ad 
    284  1.1     ad 	mc->mc_mbox[0x0] = code;
    285  1.1     ad 	mc->mc_mbox[0x2] = f1;
    286  1.1     ad 	mc->mc_mbox[0x3] = (f1 >> 8);
    287  1.1     ad 	mc->mc_mbox[0x4] = f2;
    288  1.1     ad 	mc->mc_mbox[0x5] = (f2 >> 8);
    289  1.1     ad 	mc->mc_mbox[0x6] = (f2 >> 16);
    290  1.1     ad 	mc->mc_mbox[0x7] = (f2 >> 24);
    291  1.1     ad 	mc->mc_mbox[0x8] = f3;
    292  1.1     ad 	mc->mc_mbox[0x9] = (f3 >> 8);
    293  1.1     ad 	mc->mc_mbox[0xa] = (f3 >> 16);
    294  1.1     ad 	mc->mc_mbox[0xb] = (f3 >> 24);
    295  1.1     ad 	mc->mc_mbox[0xc] = f4;
    296  1.1     ad }
    297  1.1     ad 
    298  1.1     ad static __inline__ void
    299  1.1     ad mlx_make_type5(struct mlx_ccb *mc, u_int8_t code, u_int8_t f1, u_int8_t f2,
    300  1.1     ad 	       u_int32_t f3, u_int32_t f4, u_int8_t f5)
    301  1.1     ad {
    302  1.1     ad 
    303  1.1     ad 	mc->mc_mbox[0x0] = code;
    304  1.1     ad 	mc->mc_mbox[0x2] = f1;
    305  1.1     ad 	mc->mc_mbox[0x3] = f2;
    306  1.1     ad 	mc->mc_mbox[0x4] = f3;
    307  1.1     ad 	mc->mc_mbox[0x5] = (f3 >> 8);
    308  1.1     ad 	mc->mc_mbox[0x6] = (f3 >> 16);
    309  1.1     ad 	mc->mc_mbox[0x7] = (f3 >> 24);
    310  1.1     ad 	mc->mc_mbox[0x8] = f4;
    311  1.1     ad 	mc->mc_mbox[0x9] = (f4 >> 8);
    312  1.1     ad 	mc->mc_mbox[0xa] = (f4 >> 16);
    313  1.1     ad 	mc->mc_mbox[0xb] = (f4 >> 24);
    314  1.1     ad 	mc->mc_mbox[0xc] = f5;
    315  1.1     ad }
    316  1.1     ad 
    317  1.1     ad static __inline__ u_int8_t
    318  1.1     ad mlx_inb(struct mlx_softc *mlx, int off)
    319  1.1     ad {
    320  1.1     ad 
    321  1.1     ad 	bus_space_barrier(mlx->mlx_iot, mlx->mlx_ioh, off, 1,
    322  1.1     ad 	    BUS_SPACE_BARRIER_WRITE | BUS_SPACE_BARRIER_READ);
    323  1.1     ad 	return (bus_space_read_1(mlx->mlx_iot, mlx->mlx_ioh, off));
    324  1.1     ad }
    325  1.1     ad 
    326  1.1     ad static __inline__ u_int16_t
    327  1.1     ad mlx_inw(struct mlx_softc *mlx, int off)
    328  1.1     ad {
    329  1.1     ad 
    330  1.1     ad 	bus_space_barrier(mlx->mlx_iot, mlx->mlx_ioh, off, 2,
    331  1.1     ad 	    BUS_SPACE_BARRIER_WRITE | BUS_SPACE_BARRIER_READ);
    332  1.1     ad 	return (bus_space_read_2(mlx->mlx_iot, mlx->mlx_ioh, off));
    333  1.1     ad }
    334  1.1     ad 
    335  1.1     ad static __inline__ u_int32_t
    336  1.1     ad mlx_inl(struct mlx_softc *mlx, int off)
    337  1.1     ad {
    338  1.1     ad 
    339  1.1     ad 	bus_space_barrier(mlx->mlx_iot, mlx->mlx_ioh, off, 4,
    340  1.1     ad 	    BUS_SPACE_BARRIER_WRITE | BUS_SPACE_BARRIER_READ);
    341  1.1     ad 	return (bus_space_read_4(mlx->mlx_iot, mlx->mlx_ioh, off));
    342  1.1     ad }
    343  1.1     ad 
    344  1.1     ad static __inline__ void
    345  1.1     ad mlx_outb(struct mlx_softc *mlx, int off, u_int8_t val)
    346  1.1     ad {
    347  1.1     ad 
    348  1.1     ad 	bus_space_write_1(mlx->mlx_iot, mlx->mlx_ioh, off, val);
    349  1.1     ad 	bus_space_barrier(mlx->mlx_iot, mlx->mlx_ioh, off, 1,
    350  1.1     ad 	    BUS_SPACE_BARRIER_WRITE);
    351  1.1     ad }
    352  1.1     ad 
    353  1.1     ad static __inline__ void
    354  1.1     ad mlx_outw(struct mlx_softc *mlx, int off, u_int16_t val)
    355  1.1     ad {
    356  1.1     ad 
    357  1.1     ad 	bus_space_write_2(mlx->mlx_iot, mlx->mlx_ioh, off, val);
    358  1.1     ad 	bus_space_barrier(mlx->mlx_iot, mlx->mlx_ioh, off, 2,
    359  1.1     ad 	    BUS_SPACE_BARRIER_WRITE);
    360  1.1     ad }
    361  1.1     ad 
    362  1.1     ad static __inline__ void
    363  1.1     ad mlx_outl(struct mlx_softc *mlx, int off, u_int32_t val)
    364  1.1     ad {
    365  1.1     ad 
    366  1.1     ad 	bus_space_write_4(mlx->mlx_iot, mlx->mlx_ioh, off, val);
    367  1.1     ad 	bus_space_barrier(mlx->mlx_iot, mlx->mlx_ioh, off, 4,
    368  1.1     ad 	    BUS_SPACE_BARRIER_WRITE);
    369  1.1     ad }
    370  1.1     ad 
    371  1.1     ad #endif	/* !_IC_MLXVAR_H_ */
    372