dvcfg.h revision 28861
128861Skato/*	$NetBSD$	*/
228861Skato/*
328861Skato * [NetBSD for NEC PC98 series]
428861Skato *  Copyright (c) 1996 NetBSD/pc98 porting staff.
528861Skato *  All rights reserved.
628861Skato *
728861Skato *  Redistribution and use in source and binary forms, with or without
828861Skato *  modification, are permitted provided that the following conditions
928861Skato *  are met:
1028861Skato *  1. Redistributions of source code must retain the above copyright
1128861Skato *     notice, this list of conditions and the following disclaimer.
1228861Skato *  2. Redistributions in binary form must reproduce the above copyright
1328861Skato *     notice, this list of conditions and the following disclaimer in the
1428861Skato *     documentation and/or other materials provided with the distribution.
1528861Skato *  3. The name of the author may not be used to endorse or promote products
1628861Skato *     derived from this software without specific prior written permission.
1728861Skato *
1828861Skato * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1928861Skato * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2028861Skato * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
2128861Skato * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
2228861Skato * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
2328861Skato * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2428861Skato * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2528861Skato * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
2628861Skato * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
2728861Skato * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2828861Skato * POSSIBILITY OF SUCH DAMAGE.
2928861Skato */
3028861Skato/*
3128861Skato * Copyright (c) 1996 Naofumi HONDA.  All rights reserved.
3228861Skato */
3328861Skato
3428861Skato#ifndef _I386_DVCFG_H_
3528861Skato#define _I386_DVCFG_H_
3628861Skato
3728861Skatotypedef void *dvcfg_hw_t;
3828861Skato
3928861Skatostruct dvcfg_hwsel {
4028861Skato	int cfg_max;
4128861Skato
4228861Skato	dvcfg_hw_t *cfg_sel;
4328861Skato};
4428861Skato
4528861Skato#define	DVCFG_MAJOR(dvcfg)	(((u_int)(dvcfg)) >> 16)
4628861Skato#define	DVCFG_MINOR(dvcfg)	(((u_int)(dvcfg)) & 0xffff)
4728861Skato
4828861Skato#define	DVCFG_MKCFG(major, minor) ((((u_int)(major)) << 16) | ((minor) & 0xffff))
4928861Skato
5028861Skato#define	DVCFG_HWSEL_SZ(array)	(sizeof(array) / sizeof(dvcfg_hw_t))
5128861Skato
5228861Skatostatic inline dvcfg_hw_t dvcfg_hw __P((struct dvcfg_hwsel *, u_int));
5328861Skato
5428861Skatostatic inline dvcfg_hw_t
5528861Skatodvcfg_hw(selp, num)
5628861Skato	struct dvcfg_hwsel *selp;
5728861Skato	u_int num;
5828861Skato{
5928861Skato
6028861Skato	return ((num >= selp->cfg_max) ? NULL : selp->cfg_sel[num]);
6128861Skato}
6228861Skato
6328861Skato#define	DVCFG_HW(SELP, NUM)	dvcfg_hw((SELP), (NUM))
6428861Skato#endif	/* _I386_DVCFG_H_ */
65