dvcfg.h revision 139743
1219974Smav/* $FreeBSD: head/sys/compat/netbsd/dvcfg.h 139743 2005-01-05 22:34:37Z imp $ */
2219974Smav/*	$NetBSD$	*/
3219974Smav/*-
4219974Smav * [NetBSD for NEC PC98 series]
5219974Smav *  Copyright (c) 1996 NetBSD/pc98 porting staff.
6219974Smav *  All rights reserved.
7219974Smav *
8219974Smav *  Redistribution and use in source and binary forms, with or without
9219974Smav *  modification, are permitted provided that the following conditions
10219974Smav *  are met:
11219974Smav *  1. Redistributions of source code must retain the above copyright
12219974Smav *     notice, this list of conditions and the following disclaimer.
13219974Smav *  2. Redistributions in binary form must reproduce the above copyright
14219974Smav *     notice, this list of conditions and the following disclaimer in the
15219974Smav *     documentation and/or other materials provided with the distribution.
16219974Smav *  3. The name of the author may not be used to endorse or promote products
17219974Smav *     derived from this software without specific prior written permission.
18219974Smav *
19219974Smav * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20219974Smav * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21219974Smav * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22219974Smav * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
23219974Smav * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24219974Smav * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25219974Smav * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26219974Smav * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27219974Smav * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28219974Smav * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29219974Smav * POSSIBILITY OF SUCH DAMAGE.
30219974Smav */
31219974Smav/*
32219974Smav * Copyright (c) 1996 Naofumi HONDA.  All rights reserved.
33219974Smav */
34219974Smav
35219974Smav#ifndef _COMPAT_NETBSD_DVCFG_H_
36219974Smav#define _COMPAT_NETBSD_DVCFG_H_
37219974Smav
38219974Smavtypedef void *dvcfg_hw_t;
39219974Smav
40219974Smavstruct dvcfg_hwsel {
41219974Smav	int cfg_max;
42219974Smav
43219974Smav	dvcfg_hw_t *cfg_sel;
44219974Smav};
45219974Smav
46219974Smav#define	DVCFG_MAJOR(dvcfg)	(((u_int)(dvcfg)) >> 16)
47219974Smav#define	DVCFG_MINOR(dvcfg)	(((u_int)(dvcfg)) & 0xffff)
48219974Smav
49219974Smav#define	DVCFG_MKCFG(major, minor) ((((u_int)(major)) << 16) | ((minor) & 0xffff))
50219974Smav
51219974Smav#define	DVCFG_HWSEL_SZ(array)	(sizeof(array) / sizeof(dvcfg_hw_t))
52219974Smav
53219974Smavstatic __inline dvcfg_hw_t dvcfg_hw(struct dvcfg_hwsel *, u_int);
54242649Smav
55242649Smavstatic __inline dvcfg_hw_t
56219974Smavdvcfg_hw(selp, num)
57242649Smav	struct dvcfg_hwsel *selp;
58219974Smav	u_int num;
59219974Smav{
60219974Smav
61219974Smav	return ((num >= selp->cfg_max) ? 0 : selp->cfg_sel[num]);
62219974Smav}
63219974Smav
64219974Smav#define	DVCFG_HW(SELP, NUM)	dvcfg_hw((SELP), (NUM))
65219974Smav#endif	/* _COMPAT_NETBSD_DVCFG_H_ */
66219974Smav