xref: /freebsd/sys/isa/isa_if.m (revision 031beb4e239bfce798af17f5fe8dba8bcaf13d99)
186cb007fSWarner Losh#-
2a3be63b3SDoug Rabson# Copyright (c) 1999 Doug Rabson
3a3be63b3SDoug Rabson# All rights reserved.
4a3be63b3SDoug Rabson#
5a3be63b3SDoug Rabson# Redistribution and use in source and binary forms, with or without
6a3be63b3SDoug Rabson# modification, are permitted provided that the following conditions
7a3be63b3SDoug Rabson# are met:
8a3be63b3SDoug Rabson# 1. Redistributions of source code must retain the above copyright
9a3be63b3SDoug Rabson#    notice, this list of conditions and the following disclaimer.
10a3be63b3SDoug Rabson# 2. Redistributions in binary form must reproduce the above copyright
11a3be63b3SDoug Rabson#    notice, this list of conditions and the following disclaimer in the
12a3be63b3SDoug Rabson#    documentation and/or other materials provided with the distribution.
13a3be63b3SDoug Rabson#
14a3be63b3SDoug Rabson# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15a3be63b3SDoug Rabson# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16a3be63b3SDoug Rabson# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17a3be63b3SDoug Rabson# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18a3be63b3SDoug Rabson# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19a3be63b3SDoug Rabson# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20a3be63b3SDoug Rabson# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21a3be63b3SDoug Rabson# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22a3be63b3SDoug Rabson# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23a3be63b3SDoug Rabson# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24a3be63b3SDoug Rabson# SUCH DAMAGE.
25a3be63b3SDoug Rabson#
26a3be63b3SDoug Rabson#
27a3be63b3SDoug Rabson
28f7b77691SDoug Rabson#include <sys/bus.h>
294249382dSDoug Rabson#include <isa/isavar.h>
304249382dSDoug Rabson
31a3be63b3SDoug RabsonINTERFACE isa;
32a3be63b3SDoug Rabson
33a3be63b3SDoug Rabson#
344249382dSDoug Rabson# Add a Plug-and-play configuration to the device. Configurations with
354249382dSDoug Rabson# a lower priority are preferred.
364249382dSDoug Rabson#
374249382dSDoug RabsonMETHOD int add_config {
384249382dSDoug Rabson	device_t	dev;
394249382dSDoug Rabson	device_t	child;
404249382dSDoug Rabson	int		priority;
414249382dSDoug Rabson	struct isa_config *config;
424249382dSDoug Rabson};
434249382dSDoug Rabson
444249382dSDoug Rabson#
454249382dSDoug Rabson# Register a function which can be called to configure a device with
464249382dSDoug Rabson# a given set of resources. The function will be called with a struct
474249382dSDoug Rabson# isa_config representing the desired configuration and a flag to
484249382dSDoug Rabson# state whether the device should be enabled.
494249382dSDoug Rabson#
504249382dSDoug RabsonMETHOD void set_config_callback {
514249382dSDoug Rabson	device_t	dev;
524249382dSDoug Rabson	device_t	child;
534249382dSDoug Rabson	isa_config_cb	*fn;
544249382dSDoug Rabson	void		*arg;
554249382dSDoug Rabson};
564249382dSDoug Rabson
574249382dSDoug Rabson#
584249382dSDoug Rabson# A helper method for implementing probe methods for PnP compatible
594249382dSDoug Rabson# drivers. The driver calls this method with a list of PnP ids and
604249382dSDoug Rabson# descriptions and it returns zero if one of the ids matches or ENXIO
614249382dSDoug Rabson# otherwise.
624249382dSDoug Rabson#
634249382dSDoug Rabson# If the device is not plug-and-play compatible, this method returns
644249382dSDoug Rabson# ENOENT, allowing the caller to fall back to heuristic probing
654249382dSDoug Rabson# techniques.
664249382dSDoug Rabson#
674249382dSDoug RabsonMETHOD int pnp_probe {
684249382dSDoug Rabson	device_t	dev;
694249382dSDoug Rabson	device_t	child;
704249382dSDoug Rabson	struct isa_pnp_id *ids;
714249382dSDoug Rabson};
72