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$
2750769Sdfr */
2850769Sdfr
2950769Sdfr#ifndef _ISA_PNPVAR_H_
3050769Sdfr#define _ISA_PNPVAR_H_
3150769Sdfr
3255206Speter#ifdef _KERNEL
3350769Sdfr
3450769Sdfr#define PNP_HEXTONUM(c)	((c) >= 'a'		\
3550769Sdfr			 ? (c) - 'a' + 10	\
3650769Sdfr			 : ((c) >= 'A'		\
3750769Sdfr			    ? (c) - 'A' + 10	\
3850769Sdfr			    : (c) - '0'))
3950769Sdfr
4050769Sdfr#define PNP_EISAID(s)				\
4150769Sdfr	((((s[0] - '@') & 0x1f) << 2)		\
4250769Sdfr	 | (((s[1] - '@') & 0x18) >> 3)		\
4350769Sdfr	 | (((s[1] - '@') & 0x07) << 13)	\
4450769Sdfr	 | (((s[2] - '@') & 0x1f) << 8)		\
4550769Sdfr	 | (PNP_HEXTONUM(s[4]) << 16)		\
4650769Sdfr	 | (PNP_HEXTONUM(s[3]) << 20)		\
4750769Sdfr	 | (PNP_HEXTONUM(s[6]) << 24)		\
4850769Sdfr	 | (PNP_HEXTONUM(s[5]) << 28))
4950769Sdfr
5083051Syokotatypedef int pnp_scan_cb(device_t dev, u_char tag, u_char *res, int len,
51139268Simp    struct isa_config *config, int ldn);
5283051Syokota
53139268Simpchar *pnp_eisaformat(uint32_t id);
54139268Simpvoid pnp_printf(uint32_t id, char *fmt, ...);
5583051Syokotavoid pnp_parse_resources(device_t dev, u_char *resources, int len, int ldn);
5683051Syokotau_char *pnp_parse_dependant(device_t dev, u_char *resources, int len,
57139268Simp    struct isa_config *config, int ldn);
5883051Syokotau_char *pnp_scan_resources(device_t dev, u_char *resources, int len,
59139268Simp    struct isa_config *config, int ldn, pnp_scan_cb *cb);
6052059Sdfr
61139268Simpvoid pnp_check_quirks(uint32_t vendor_id, uint32_t logical_id, int ldn,
62139268Simp    struct isa_config *config);
6362947Stanimura
6455206Speter#endif /* _KERNEL */
6550769Sdfr
6650769Sdfr#endif /* !_ISA_PNPVAR_H_ */
67