pnpvar.h revision 83051
150769Sdfr/*-
250769Sdfr * Copyright (c) 1999 Doug Rabson
350769Sdfr * All rights reserved.
450769Sdfr *
550769Sdfr * Redistribution and use in source and binary forms, with or without
650769Sdfr * modification, are permitted provided that the following conditions
750769Sdfr * are met:
850769Sdfr * 1. Redistributions of source code must retain the above copyright
950769Sdfr *    notice, this list of conditions and the following disclaimer.
1050769Sdfr * 2. Redistributions in binary form must reproduce the above copyright
1150769Sdfr *    notice, this list of conditions and the following disclaimer in the
1250769Sdfr *    documentation and/or other materials provided with the distribution.
1350769Sdfr *
1450769Sdfr * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1550769Sdfr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1650769Sdfr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1750769Sdfr * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1850769Sdfr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1950769Sdfr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2050769Sdfr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2150769Sdfr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2250769Sdfr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2350769Sdfr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2450769Sdfr * SUCH DAMAGE.
2550769Sdfr *
2650769Sdfr *	$FreeBSD: head/sys/isa/pnpvar.h 83051 2001-09-05 03:54:33Z yokota $
2750769Sdfr */
2850769Sdfr
2950769Sdfr#ifndef _ISA_PNPVAR_H_
3050769Sdfr#define _ISA_PNPVAR_H_
3150769Sdfr
3255206Speter#ifdef _KERNEL
3350769Sdfr
3450769Sdfr#if 0
3550769Sdfrvoid    pnp_write(int d, u_char r); /* used by Luigi's sound driver */
3650769Sdfru_char  pnp_read(int d); /* currently unused, but who knows... */
3750769Sdfr#endif
3850769Sdfr
3950769Sdfr#define PNP_HEXTONUM(c)	((c) >= 'a'		\
4050769Sdfr			 ? (c) - 'a' + 10	\
4150769Sdfr			 : ((c) >= 'A'		\
4250769Sdfr			    ? (c) - 'A' + 10	\
4350769Sdfr			    : (c) - '0'))
4450769Sdfr
4550769Sdfr#define PNP_EISAID(s)				\
4650769Sdfr	((((s[0] - '@') & 0x1f) << 2)		\
4750769Sdfr	 | (((s[1] - '@') & 0x18) >> 3)		\
4850769Sdfr	 | (((s[1] - '@') & 0x07) << 13)	\
4950769Sdfr	 | (((s[2] - '@') & 0x1f) << 8)		\
5050769Sdfr	 | (PNP_HEXTONUM(s[4]) << 16)		\
5150769Sdfr	 | (PNP_HEXTONUM(s[3]) << 20)		\
5250769Sdfr	 | (PNP_HEXTONUM(s[6]) << 24)		\
5350769Sdfr	 | (PNP_HEXTONUM(s[5]) << 28))
5450769Sdfr
5583051Syokotatypedef int pnp_scan_cb(device_t dev, u_char tag, u_char *res, int len,
5683051Syokota			struct isa_config *config, int ldn);
5783051Syokota
5852241Sdfrchar *pnp_eisaformat(u_int32_t id);
5983051Syokotavoid pnp_printf(u_int32_t id, char *fmt, ...);
6083051Syokotavoid pnp_parse_resources(device_t dev, u_char *resources, int len, int ldn);
6183051Syokotau_char *pnp_parse_dependant(device_t dev, u_char *resources, int len,
6283051Syokota			    struct isa_config *config, int ldn);
6383051Syokotau_char *pnp_scan_resources(device_t dev, u_char *resources, int len,
6483051Syokota			   struct isa_config *config, int ldn, pnp_scan_cb *cb);
6552059Sdfr
6662947Stanimuravoid pnp_check_quirks(u_int32_t vendor_id, u_int32_t logical_id, int ldn, struct isa_config *config);
6762947Stanimura
6855206Speter#endif /* _KERNEL */
6950769Sdfr
7050769Sdfr#endif /* !_ISA_PNPVAR_H_ */
71