Home | History | Annotate | Line # | Download | only in ic
mlxvar.h revision 1.3.2.2
      1  1.3.2.2  thorpej /*	$NetBSD: mlxvar.h,v 1.3.2.2 2002/01/10 19:54:52 thorpej 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 #include "locators.h"
     71      1.1       ad 
     72      1.1       ad /* Older boards allow up to 17 segments and 64kB transfers. */
     73      1.1       ad #define	MLX_MAX_SEGS		17
     74      1.1       ad #define	MLX_MAX_XFER		65536
     75      1.1       ad #define MLX_SGL_SIZE		(sizeof(struct mlx_sgentry) * MLX_MAX_SEGS)
     76      1.1       ad 
     77      1.1       ad /* This shouldn't be ajusted lightly... */
     78      1.1       ad #define MLX_MAX_DRIVES		32
     79      1.1       ad 
     80      1.1       ad /* Maximum queue depth, matching the older controllers. */
     81      1.1       ad #define	MLX_MAX_QUEUECNT	63
     82      1.1       ad 
     83      1.1       ad /* Number of CCBs to reserve for `special' operations. */
     84      1.1       ad #define	MLX_NCCBS_RESERVE	7
     85      1.1       ad 
     86      1.1       ad /* Structure describing a system drive as attached to the controller. */
     87      1.1       ad struct mlx_sysdrive {
     88      1.1       ad 	u_int32_t	ms_size;
     89      1.1       ad 	u_short		ms_state;
     90      1.1       ad 	u_short		ms_raidlevel;
     91      1.1       ad 	struct device	*ms_dv;
     92      1.1       ad };
     93      1.1       ad 
     94      1.1       ad /* Optional per-CCB context. */
     95      1.1       ad struct mlx_ccb;
     96      1.1       ad struct mlx_context {
     97      1.1       ad 	void	(*mx_handler)(struct mlx_ccb *);
     98      1.1       ad 	void 	*mx_context;
     99      1.1       ad 	struct	device	*mx_dv;
    100      1.1       ad };
    101      1.1       ad 
    102      1.1       ad /* Command control block. */
    103      1.1       ad struct mlx_ccb {
    104      1.1       ad 	union {
    105      1.1       ad 		SIMPLEQ_ENTRY(mlx_ccb) simpleq;
    106      1.1       ad 		SLIST_ENTRY(mlx_ccb) slist;
    107      1.1       ad 		TAILQ_ENTRY(mlx_ccb) tailq;
    108      1.1       ad 	} mc_chain;
    109      1.1       ad 	u_int		mc_flags;
    110      1.1       ad 	u_int		mc_status;
    111      1.1       ad 	u_int		mc_ident;
    112      1.1       ad 	time_t		mc_expiry;
    113      1.1       ad 	u_int		mc_nsgent;
    114      1.1       ad 	u_int		mc_xfer_size;
    115      1.1       ad 	bus_addr_t	mc_xfer_phys;
    116      1.1       ad 	bus_dmamap_t	mc_xfer_map;
    117      1.1       ad 	struct mlx_context mc_mx;
    118      1.1       ad 	u_int8_t	mc_mbox[16];
    119      1.1       ad };
    120      1.1       ad #define	MC_XFER_IN	MU_XFER_IN	/* Map describes inbound xfer */
    121      1.1       ad #define	MC_XFER_OUT	MU_XFER_OUT	/* Map describes outbound xfer */
    122      1.1       ad #define	MC_WAITING	0x0400		/* We have waiters */
    123      1.1       ad 
    124      1.1       ad /*
    125      1.1       ad  * Per-controller state.
    126      1.1       ad  */
    127      1.1       ad struct mlx_softc {
    128      1.1       ad 	struct device		mlx_dv;
    129      1.1       ad 	bus_space_tag_t		mlx_iot;
    130      1.1       ad 	bus_space_handle_t	mlx_ioh;
    131      1.1       ad 	bus_dma_tag_t		mlx_dmat;
    132      1.1       ad 	bus_dmamap_t		mlx_dmamap;
    133      1.1       ad 	void			*mlx_ih;
    134      1.1       ad 
    135      1.1       ad 	SLIST_HEAD(, mlx_ccb)	mlx_ccb_freelist;
    136      1.1       ad 	TAILQ_HEAD(, mlx_ccb)	mlx_ccb_worklist;
    137      1.1       ad 	SIMPLEQ_HEAD(, mlx_ccb)	mlx_ccb_queue;
    138      1.1       ad 	struct mlx_ccb		*mlx_ccbs;
    139      1.1       ad 	int			mlx_nccbs;
    140      1.1       ad 	int			mlx_nccbs_free;
    141      1.1       ad 
    142      1.1       ad 	caddr_t			mlx_sgls;
    143      1.1       ad 	bus_addr_t		mlx_sgls_paddr;
    144      1.1       ad 
    145      1.1       ad 	int	(*mlx_submit)(struct mlx_softc *, struct mlx_ccb *);
    146      1.1       ad 	int	(*mlx_findcomplete)(struct mlx_softc *, u_int *, u_int *);
    147      1.1       ad 	void	(*mlx_intaction)(struct mlx_softc *, int);
    148      1.1       ad 	int	(*mlx_fw_handshake)(struct mlx_softc *, int *, int *, int *);
    149      1.2       ad 	int	(*mlx_reset)(struct mlx_softc *);
    150      1.1       ad 
    151      1.1       ad 	int			mlx_max_queuecnt;
    152      1.1       ad 	struct mlx_enquiry2	*mlx_enq2;
    153      1.1       ad 	int			mlx_iftype;
    154      1.1       ad 
    155      1.1       ad 	time_t			mlx_lastpoll;
    156      1.1       ad 	u_int			mlx_lastevent;
    157      1.1       ad 	u_int			mlx_currevent;
    158      1.1       ad 	u_int			mlx_bg;
    159      1.1       ad 	struct mlx_rebuild_status mlx_rebuildstat;
    160      1.1       ad 	struct mlx_pause	mlx_pause;
    161      1.1       ad 	int			mlx_flags;
    162      1.1       ad 
    163      1.1       ad 	struct mlx_sysdrive	mlx_sysdrive[MLX_MAX_DRIVES];
    164      1.3       ad 	int			mlx_numsysdrives;
    165      1.1       ad };
    166      1.1       ad 
    167      1.1       ad #define MLX_BG_CHECK		1	/* we started a check */
    168      1.1       ad #define MLX_BG_REBUILD		2	/* we started a rebuild */
    169      1.1       ad #define MLX_BG_SPONTANEOUS	3	/* it just happened somehow */
    170      1.1       ad 
    171      1.1       ad #define MLXF_SPINUP_REPORTED	0x0001	/* "spinning up drives" displayed */
    172      1.1       ad #define MLXF_EVENTLOG_BUSY	0x0002	/* currently reading event log */
    173      1.1       ad #define MLXF_FW_INITTED		0x0004	/* firmware init crap done */
    174      1.1       ad #define MLXF_PAUSEWORKS		0x0008	/* channel pause works as expected */
    175      1.1       ad #define MLXF_OPEN		0x0010	/* control device is open */
    176  1.3.2.2  thorpej #define	MLXF_INITOK		0x0020	/* controller initialised OK */
    177      1.1       ad #define	MLXF_PERIODIC_CTLR	0x0040	/* periodic check running */
    178      1.1       ad #define	MLXF_PERIODIC_DRIVE	0x0080	/* periodic check running */
    179      1.1       ad #define	MLXF_PERIODIC_REBUILD	0x0100	/* periodic check running */
    180      1.1       ad #define	MLXF_EISA		0x0200	/* EISA board */
    181  1.3.2.1    lukem #define	MLXF_RESCANNING		0x0400	/* rescanning drive table */
    182      1.1       ad 
    183      1.1       ad struct mlx_attach_args {
    184      1.1       ad 	int		mlxa_unit;
    185      1.1       ad };
    186      1.1       ad 
    187      1.1       ad #define	mlxacf_unit	cf_loc[MLXCF_UNIT]
    188      1.1       ad 
    189      1.1       ad int	mlx_flush(struct mlx_softc *, int);
    190      1.1       ad void	mlx_init(struct mlx_softc *, const char *);
    191      1.1       ad int	mlx_intr(void *);
    192      1.1       ad 
    193      1.1       ad int	mlx_ccb_alloc(struct mlx_softc *, struct mlx_ccb **, int);
    194      1.1       ad const char *mlx_ccb_diagnose(struct mlx_ccb *);
    195      1.1       ad void	mlx_ccb_enqueue(struct mlx_softc *, struct mlx_ccb *);
    196      1.1       ad void	mlx_ccb_free(struct mlx_softc *, struct mlx_ccb *);
    197      1.1       ad int	mlx_ccb_map(struct mlx_softc *, struct mlx_ccb *, void *, int, int);
    198      1.1       ad int	mlx_ccb_poll(struct mlx_softc *, struct mlx_ccb *, int);
    199      1.1       ad void	mlx_ccb_unmap(struct mlx_softc *, struct mlx_ccb *);
    200      1.1       ad int	mlx_ccb_wait(struct mlx_softc *, struct mlx_ccb *);
    201      1.1       ad 
    202      1.1       ad static __inline__ void	mlx_make_type1(struct mlx_ccb *, u_int8_t, u_int16_t,
    203      1.1       ad 				       u_int32_t, u_int8_t, u_int32_t,
    204      1.1       ad 				       u_int8_t);
    205      1.1       ad static __inline__ void	mlx_make_type2(struct mlx_ccb *, u_int8_t, u_int8_t,
    206      1.1       ad 				       u_int8_t, u_int8_t, u_int8_t,
    207      1.1       ad 				       u_int8_t, u_int8_t, u_int32_t,
    208      1.1       ad 				       u_int8_t);
    209      1.1       ad static __inline__ void	mlx_make_type3(struct mlx_ccb *, u_int8_t, u_int8_t,
    210      1.1       ad 				       u_int8_t, u_int16_t, u_int8_t,
    211      1.1       ad 				       u_int8_t, u_int32_t, u_int8_t);
    212      1.1       ad static __inline__ void	mlx_make_type4(struct mlx_ccb *, u_int8_t, u_int16_t,
    213      1.1       ad 				       u_int32_t, u_int32_t, u_int8_t);
    214      1.1       ad static __inline__ void	mlx_make_type5(struct mlx_ccb *, u_int8_t,  u_int8_t,
    215      1.1       ad 				       u_int8_t, u_int32_t, u_int32_t,
    216      1.1       ad 				       u_int8_t);
    217      1.1       ad 
    218      1.1       ad static __inline__ u_int8_t	mlx_inb(struct mlx_softc *, int);
    219      1.1       ad static __inline__ u_int16_t	mlx_inw(struct mlx_softc *, int);
    220      1.1       ad static __inline__ u_int32_t	mlx_inl(struct mlx_softc *, int);
    221      1.1       ad static __inline__ void		mlx_outb(struct mlx_softc *, int, u_int8_t);
    222      1.1       ad static __inline__ void		mlx_outw(struct mlx_softc *, int, u_int16_t);
    223      1.1       ad static __inline__ void		mlx_outl(struct mlx_softc *, int, u_int32_t);
    224      1.1       ad 
    225      1.1       ad static __inline__ void
    226      1.1       ad mlx_make_type1(struct mlx_ccb *mc, u_int8_t code, u_int16_t f1, u_int32_t f2,
    227      1.1       ad 	       u_int8_t f3, u_int32_t f4, u_int8_t f5)
    228      1.1       ad {
    229      1.1       ad 
    230      1.1       ad 	mc->mc_mbox[0x0] = code;
    231      1.1       ad 	mc->mc_mbox[0x2] = f1;
    232      1.1       ad 	mc->mc_mbox[0x3] = (((f2 >> 24) & 0x3) << 6) | ((f1 >> 8) & 0x3f);
    233      1.1       ad 	mc->mc_mbox[0x4] = f2;
    234      1.1       ad 	mc->mc_mbox[0x5] = (f2 >> 8);
    235      1.1       ad 	mc->mc_mbox[0x6] = (f2 >> 16);
    236      1.1       ad 	mc->mc_mbox[0x7] = f3;
    237      1.1       ad 	mc->mc_mbox[0x8] = f4;
    238      1.1       ad 	mc->mc_mbox[0x9] = (f4 >> 8);
    239      1.1       ad 	mc->mc_mbox[0xa] = (f4 >> 16);
    240      1.1       ad 	mc->mc_mbox[0xb] = (f4 >> 24);
    241      1.1       ad 	mc->mc_mbox[0xc] = f5;
    242      1.1       ad }
    243      1.1       ad 
    244      1.1       ad static __inline__ void
    245      1.1       ad mlx_make_type2(struct mlx_ccb *mc, u_int8_t code, u_int8_t f1, u_int8_t f2,
    246      1.1       ad 	       u_int8_t f3, u_int8_t f4, u_int8_t f5, u_int8_t f6,
    247      1.1       ad 	       u_int32_t f7, u_int8_t f8)
    248      1.1       ad {
    249      1.1       ad 
    250      1.1       ad 	mc->mc_mbox[0x0] = code;
    251      1.1       ad 	mc->mc_mbox[0x2] = f1;
    252      1.1       ad 	mc->mc_mbox[0x3] = f2;
    253      1.1       ad 	mc->mc_mbox[0x4] = f3;
    254      1.1       ad 	mc->mc_mbox[0x5] = f4;
    255      1.1       ad 	mc->mc_mbox[0x6] = f5;
    256      1.1       ad 	mc->mc_mbox[0x7] = f6;
    257      1.1       ad 	mc->mc_mbox[0x8] = f7;
    258      1.1       ad 	mc->mc_mbox[0x9] = (f7 >> 8);
    259      1.1       ad 	mc->mc_mbox[0xa] = (f7 >> 16);
    260      1.1       ad 	mc->mc_mbox[0xb] = (f7 >> 24);
    261      1.1       ad 	mc->mc_mbox[0xc] = f8;
    262      1.1       ad }
    263      1.1       ad 
    264      1.1       ad static __inline__ void
    265      1.1       ad mlx_make_type3(struct mlx_ccb *mc, u_int8_t code, u_int8_t f1, u_int8_t f2,
    266      1.1       ad 	       u_int16_t f3, u_int8_t f4, u_int8_t f5, u_int32_t f6,
    267      1.1       ad 	       u_int8_t f7)
    268      1.1       ad {
    269      1.1       ad 
    270      1.1       ad 	mc->mc_mbox[0x0] = code;
    271      1.1       ad 	mc->mc_mbox[0x2] = f1;
    272      1.1       ad 	mc->mc_mbox[0x3] = f2;
    273      1.1       ad 	mc->mc_mbox[0x4] = f3;
    274      1.1       ad 	mc->mc_mbox[0x5] = (f3 >> 8);
    275      1.1       ad 	mc->mc_mbox[0x6] = f4;
    276      1.1       ad 	mc->mc_mbox[0x7] = f5;
    277      1.1       ad 	mc->mc_mbox[0x8] = f6;
    278      1.1       ad 	mc->mc_mbox[0x9] = (f6 >> 8);
    279      1.1       ad 	mc->mc_mbox[0xa] = (f6 >> 16);
    280      1.1       ad 	mc->mc_mbox[0xb] = (f6 >> 24);
    281      1.1       ad 	mc->mc_mbox[0xc] = f7;
    282      1.1       ad }
    283      1.1       ad 
    284      1.1       ad static __inline__ void
    285      1.1       ad mlx_make_type4(struct mlx_ccb *mc, u_int8_t code,  u_int16_t f1, u_int32_t f2,
    286      1.1       ad 	       u_int32_t f3, u_int8_t f4)
    287      1.1       ad {
    288      1.1       ad 
    289      1.1       ad 	mc->mc_mbox[0x0] = code;
    290      1.1       ad 	mc->mc_mbox[0x2] = f1;
    291      1.1       ad 	mc->mc_mbox[0x3] = (f1 >> 8);
    292      1.1       ad 	mc->mc_mbox[0x4] = f2;
    293      1.1       ad 	mc->mc_mbox[0x5] = (f2 >> 8);
    294      1.1       ad 	mc->mc_mbox[0x6] = (f2 >> 16);
    295      1.1       ad 	mc->mc_mbox[0x7] = (f2 >> 24);
    296      1.1       ad 	mc->mc_mbox[0x8] = f3;
    297      1.1       ad 	mc->mc_mbox[0x9] = (f3 >> 8);
    298      1.1       ad 	mc->mc_mbox[0xa] = (f3 >> 16);
    299      1.1       ad 	mc->mc_mbox[0xb] = (f3 >> 24);
    300      1.1       ad 	mc->mc_mbox[0xc] = f4;
    301      1.1       ad }
    302      1.1       ad 
    303      1.1       ad static __inline__ void
    304      1.1       ad mlx_make_type5(struct mlx_ccb *mc, u_int8_t code, u_int8_t f1, u_int8_t f2,
    305      1.1       ad 	       u_int32_t f3, u_int32_t f4, u_int8_t f5)
    306      1.1       ad {
    307      1.1       ad 
    308      1.1       ad 	mc->mc_mbox[0x0] = code;
    309      1.1       ad 	mc->mc_mbox[0x2] = f1;
    310      1.1       ad 	mc->mc_mbox[0x3] = f2;
    311      1.1       ad 	mc->mc_mbox[0x4] = f3;
    312      1.1       ad 	mc->mc_mbox[0x5] = (f3 >> 8);
    313      1.1       ad 	mc->mc_mbox[0x6] = (f3 >> 16);
    314      1.1       ad 	mc->mc_mbox[0x7] = (f3 >> 24);
    315      1.1       ad 	mc->mc_mbox[0x8] = f4;
    316      1.1       ad 	mc->mc_mbox[0x9] = (f4 >> 8);
    317      1.1       ad 	mc->mc_mbox[0xa] = (f4 >> 16);
    318      1.1       ad 	mc->mc_mbox[0xb] = (f4 >> 24);
    319      1.1       ad 	mc->mc_mbox[0xc] = f5;
    320      1.1       ad }
    321      1.1       ad 
    322      1.1       ad static __inline__ u_int8_t
    323      1.1       ad mlx_inb(struct mlx_softc *mlx, int off)
    324      1.1       ad {
    325      1.1       ad 
    326      1.1       ad 	bus_space_barrier(mlx->mlx_iot, mlx->mlx_ioh, off, 1,
    327      1.1       ad 	    BUS_SPACE_BARRIER_WRITE | BUS_SPACE_BARRIER_READ);
    328      1.1       ad 	return (bus_space_read_1(mlx->mlx_iot, mlx->mlx_ioh, off));
    329      1.1       ad }
    330      1.1       ad 
    331      1.1       ad static __inline__ u_int16_t
    332      1.1       ad mlx_inw(struct mlx_softc *mlx, int off)
    333      1.1       ad {
    334      1.1       ad 
    335      1.1       ad 	bus_space_barrier(mlx->mlx_iot, mlx->mlx_ioh, off, 2,
    336      1.1       ad 	    BUS_SPACE_BARRIER_WRITE | BUS_SPACE_BARRIER_READ);
    337      1.1       ad 	return (bus_space_read_2(mlx->mlx_iot, mlx->mlx_ioh, off));
    338      1.1       ad }
    339      1.1       ad 
    340      1.1       ad static __inline__ u_int32_t
    341      1.1       ad mlx_inl(struct mlx_softc *mlx, int off)
    342      1.1       ad {
    343      1.1       ad 
    344      1.1       ad 	bus_space_barrier(mlx->mlx_iot, mlx->mlx_ioh, off, 4,
    345      1.1       ad 	    BUS_SPACE_BARRIER_WRITE | BUS_SPACE_BARRIER_READ);
    346      1.1       ad 	return (bus_space_read_4(mlx->mlx_iot, mlx->mlx_ioh, off));
    347      1.1       ad }
    348      1.1       ad 
    349      1.1       ad static __inline__ void
    350      1.1       ad mlx_outb(struct mlx_softc *mlx, int off, u_int8_t val)
    351      1.1       ad {
    352      1.1       ad 
    353      1.1       ad 	bus_space_write_1(mlx->mlx_iot, mlx->mlx_ioh, off, val);
    354      1.1       ad 	bus_space_barrier(mlx->mlx_iot, mlx->mlx_ioh, off, 1,
    355      1.1       ad 	    BUS_SPACE_BARRIER_WRITE);
    356      1.1       ad }
    357      1.1       ad 
    358      1.1       ad static __inline__ void
    359      1.1       ad mlx_outw(struct mlx_softc *mlx, int off, u_int16_t val)
    360      1.1       ad {
    361      1.1       ad 
    362      1.1       ad 	bus_space_write_2(mlx->mlx_iot, mlx->mlx_ioh, off, val);
    363      1.1       ad 	bus_space_barrier(mlx->mlx_iot, mlx->mlx_ioh, off, 2,
    364      1.1       ad 	    BUS_SPACE_BARRIER_WRITE);
    365      1.1       ad }
    366      1.1       ad 
    367      1.1       ad static __inline__ void
    368      1.1       ad mlx_outl(struct mlx_softc *mlx, int off, u_int32_t val)
    369      1.1       ad {
    370      1.1       ad 
    371      1.1       ad 	bus_space_write_4(mlx->mlx_iot, mlx->mlx_ioh, off, val);
    372      1.1       ad 	bus_space_barrier(mlx->mlx_iot, mlx->mlx_ioh, off, 4,
    373      1.1       ad 	    BUS_SPACE_BARRIER_WRITE);
    374      1.1       ad }
    375      1.1       ad 
    376      1.1       ad #endif	/* !_IC_MLXVAR_H_ */
    377