14249382dSDoug Rabson /*- 24249382dSDoug Rabson * Copyright (c) 1999 Doug Rabson 34249382dSDoug Rabson * All rights reserved. 44249382dSDoug Rabson * 54249382dSDoug Rabson * Redistribution and use in source and binary forms, with or without 64249382dSDoug Rabson * modification, are permitted provided that the following conditions 74249382dSDoug Rabson * are met: 84249382dSDoug Rabson * 1. Redistributions of source code must retain the above copyright 94249382dSDoug Rabson * notice, this list of conditions and the following disclaimer. 104249382dSDoug Rabson * 2. Redistributions in binary form must reproduce the above copyright 114249382dSDoug Rabson * notice, this list of conditions and the following disclaimer in the 124249382dSDoug Rabson * documentation and/or other materials provided with the distribution. 134249382dSDoug Rabson * 144249382dSDoug Rabson * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 154249382dSDoug Rabson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 164249382dSDoug Rabson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 174249382dSDoug Rabson * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 184249382dSDoug Rabson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 194249382dSDoug Rabson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 204249382dSDoug Rabson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 214249382dSDoug Rabson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 224249382dSDoug Rabson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 234249382dSDoug Rabson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 244249382dSDoug Rabson * SUCH DAMAGE. 254249382dSDoug Rabson * 264249382dSDoug Rabson * $FreeBSD$ 274249382dSDoug Rabson */ 284249382dSDoug Rabson 294249382dSDoug Rabson #ifndef _ISA_PNPVAR_H_ 304249382dSDoug Rabson #define _ISA_PNPVAR_H_ 314249382dSDoug Rabson 32c4473420SPeter Wemm #ifdef _KERNEL 334249382dSDoug Rabson 344249382dSDoug Rabson #if 0 354249382dSDoug Rabson void pnp_write(int d, u_char r); /* used by Luigi's sound driver */ 364249382dSDoug Rabson u_char pnp_read(int d); /* currently unused, but who knows... */ 374249382dSDoug Rabson #endif 384249382dSDoug Rabson 394249382dSDoug Rabson #define PNP_HEXTONUM(c) ((c) >= 'a' \ 404249382dSDoug Rabson ? (c) - 'a' + 10 \ 414249382dSDoug Rabson : ((c) >= 'A' \ 424249382dSDoug Rabson ? (c) - 'A' + 10 \ 434249382dSDoug Rabson : (c) - '0')) 444249382dSDoug Rabson 454249382dSDoug Rabson #define PNP_EISAID(s) \ 464249382dSDoug Rabson ((((s[0] - '@') & 0x1f) << 2) \ 474249382dSDoug Rabson | (((s[1] - '@') & 0x18) >> 3) \ 484249382dSDoug Rabson | (((s[1] - '@') & 0x07) << 13) \ 494249382dSDoug Rabson | (((s[2] - '@') & 0x1f) << 8) \ 504249382dSDoug Rabson | (PNP_HEXTONUM(s[4]) << 16) \ 514249382dSDoug Rabson | (PNP_HEXTONUM(s[3]) << 20) \ 524249382dSDoug Rabson | (PNP_HEXTONUM(s[6]) << 24) \ 534249382dSDoug Rabson | (PNP_HEXTONUM(s[5]) << 28)) 544249382dSDoug Rabson 55c3959391SKazutaka YOKOTA typedef int pnp_scan_cb(device_t dev, u_char tag, u_char *res, int len, 56c3959391SKazutaka YOKOTA struct isa_config *config, int ldn); 57c3959391SKazutaka YOKOTA 58bb2b9030SDoug Rabson char *pnp_eisaformat(u_int32_t id); 59c3959391SKazutaka YOKOTA void pnp_printf(u_int32_t id, char *fmt, ...); 60c3959391SKazutaka YOKOTA void pnp_parse_resources(device_t dev, u_char *resources, int len, int ldn); 61c3959391SKazutaka YOKOTA u_char *pnp_parse_dependant(device_t dev, u_char *resources, int len, 62c3959391SKazutaka YOKOTA struct isa_config *config, int ldn); 63c3959391SKazutaka YOKOTA u_char *pnp_scan_resources(device_t dev, u_char *resources, int len, 64c3959391SKazutaka YOKOTA struct isa_config *config, int ldn, pnp_scan_cb *cb); 65fb0ef528SSeigo Tanimura 66fb0ef528SSeigo Tanimura void pnp_check_quirks(u_int32_t vendor_id, u_int32_t logical_id, int ldn, struct isa_config *config); 675b45337dSDoug Rabson 68c4473420SPeter Wemm #endif /* _KERNEL */ 694249382dSDoug Rabson 704249382dSDoug Rabson #endif /* !_ISA_PNPVAR_H_ */ 71