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