pnpvar.h revision 83051
18876Srgrimes/*-
24Srgrimes * Copyright (c) 1999 Doug Rabson
34Srgrimes * All rights reserved.
44Srgrimes *
54Srgrimes * Redistribution and use in source and binary forms, with or without
64Srgrimes * modification, are permitted provided that the following conditions
74Srgrimes * are met:
84Srgrimes * 1. Redistributions of source code must retain the above copyright
94Srgrimes *    notice, this list of conditions and the following disclaimer.
104Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
114Srgrimes *    notice, this list of conditions and the following disclaimer in the
124Srgrimes *    documentation and/or other materials provided with the distribution.
134Srgrimes *
144Srgrimes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
154Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
164Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
174Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
184Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
194Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
204Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
214Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
224Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
234Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
244Srgrimes * SUCH DAMAGE.
254Srgrimes *
264Srgrimes *	$FreeBSD: head/sys/isa/pnpvar.h 83051 2001-09-05 03:54:33Z yokota $
274Srgrimes */
284Srgrimes
294Srgrimes#ifndef _ISA_PNPVAR_H_
304Srgrimes#define _ISA_PNPVAR_H_
314Srgrimes
324Srgrimes#ifdef _KERNEL
334Srgrimes
344Srgrimes#if 0
354Srgrimesvoid    pnp_write(int d, u_char r); /* used by Luigi's sound driver */
364Srgrimesu_char  pnp_read(int d); /* currently unused, but who knows... */
374Srgrimes#endif
384Srgrimes
394Srgrimes#define PNP_HEXTONUM(c)	((c) >= 'a'		\
404Srgrimes			 ? (c) - 'a' + 10	\
414Srgrimes			 : ((c) >= 'A'		\
424Srgrimes			    ? (c) - 'A' + 10	\
43607Srgrimes			    : (c) - '0'))
44607Srgrimes
4514243Sdyson#define PNP_EISAID(s)				\
464Srgrimes	((((s[0] - '@') & 0x1f) << 2)		\
474Srgrimes	 | (((s[1] - '@') & 0x18) >> 3)		\
484471Sbde	 | (((s[1] - '@') & 0x07) << 13)	\
494471Sbde	 | (((s[2] - '@') & 0x1f) << 8)		\
504Srgrimes	 | (PNP_HEXTONUM(s[4]) << 16)		\
511549Srgrimes	 | (PNP_HEXTONUM(s[3]) << 20)		\
524Srgrimes	 | (PNP_HEXTONUM(s[6]) << 24)		\
531246Sdg	 | (PNP_HEXTONUM(s[5]) << 28))
541246Sdg
554Srgrimestypedef int pnp_scan_cb(device_t dev, u_char tag, u_char *res, int len,
564Srgrimes			struct isa_config *config, int ldn);
57757Sdg
58757Sdgchar *pnp_eisaformat(u_int32_t id);
594Srgrimesvoid pnp_printf(u_int32_t id, char *fmt, ...);
60588Srgrimesvoid pnp_parse_resources(device_t dev, u_char *resources, int len, int ldn);
61974Sdgu_char *pnp_parse_dependant(device_t dev, u_char *resources, int len,
62974Sdg			    struct isa_config *config, int ldn);
63974Sdgu_char *pnp_scan_resources(device_t dev, u_char *resources, int len,
64974Sdg			   struct isa_config *config, int ldn, pnp_scan_cb *cb);
655455Sdg
665143Sdgvoid pnp_check_quirks(u_int32_t vendor_id, u_int32_t logical_id, int ldn, struct isa_config *config);
675455Sdg
685455Sdg#endif /* _KERNEL */
69974Sdg
705455Sdg#endif /* !_ISA_PNPVAR_H_ */
71974Sdg