14249382dSDoug Rabson /*- 24d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause 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 294249382dSDoug Rabson #ifndef _ISA_PNPVAR_H_ 304249382dSDoug Rabson #define _ISA_PNPVAR_H_ 314249382dSDoug Rabson 32c4473420SPeter Wemm #ifdef _KERNEL 334249382dSDoug Rabson 344249382dSDoug Rabson #define PNP_HEXTONUM(c) ((c) >= 'a' \ 354249382dSDoug Rabson ? (c) - 'a' + 10 \ 364249382dSDoug Rabson : ((c) >= 'A' \ 374249382dSDoug Rabson ? (c) - 'A' + 10 \ 384249382dSDoug Rabson : (c) - '0')) 394249382dSDoug Rabson 404249382dSDoug Rabson #define PNP_EISAID(s) \ 414249382dSDoug Rabson ((((s[0] - '@') & 0x1f) << 2) \ 424249382dSDoug Rabson | (((s[1] - '@') & 0x18) >> 3) \ 434249382dSDoug Rabson | (((s[1] - '@') & 0x07) << 13) \ 444249382dSDoug Rabson | (((s[2] - '@') & 0x1f) << 8) \ 454249382dSDoug Rabson | (PNP_HEXTONUM(s[4]) << 16) \ 464249382dSDoug Rabson | (PNP_HEXTONUM(s[3]) << 20) \ 474249382dSDoug Rabson | (PNP_HEXTONUM(s[6]) << 24) \ 484249382dSDoug Rabson | (PNP_HEXTONUM(s[5]) << 28)) 494249382dSDoug Rabson 50c3959391SKazutaka YOKOTA typedef int pnp_scan_cb(device_t dev, u_char tag, u_char *res, int len, 51c3959391SKazutaka YOKOTA struct isa_config *config, int ldn); 52c3959391SKazutaka YOKOTA 537a83aa63SWarner Losh char *pnp_eisaformat(uint32_t id); 547a83aa63SWarner Losh void pnp_printf(uint32_t id, char *fmt, ...); 55c3959391SKazutaka YOKOTA void pnp_parse_resources(device_t dev, u_char *resources, int len, int ldn); 56c3959391SKazutaka YOKOTA u_char *pnp_parse_dependant(device_t dev, u_char *resources, int len, 57c3959391SKazutaka YOKOTA struct isa_config *config, int ldn); 58c3959391SKazutaka YOKOTA u_char *pnp_scan_resources(device_t dev, u_char *resources, int len, 59c3959391SKazutaka YOKOTA struct isa_config *config, int ldn, pnp_scan_cb *cb); 60fb0ef528SSeigo Tanimura 617a83aa63SWarner Losh void pnp_check_quirks(uint32_t vendor_id, uint32_t logical_id, int ldn, 627a83aa63SWarner Losh struct isa_config *config); 635b45337dSDoug Rabson 64c4473420SPeter Wemm #endif /* _KERNEL */ 654249382dSDoug Rabson 664249382dSDoug Rabson #endif /* !_ISA_PNPVAR_H_ */ 67