xref: /freebsd/sys/isa/isa_common.h (revision 9dbf5b0e6876d8c93890754bcc9c748339de79c0)
1a3be63b3SDoug Rabson /*-
24d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3fe267a55SPedro F. Giffuni  *
4a3be63b3SDoug Rabson  * Copyright (c) 1999 Doug Rabson
5a3be63b3SDoug Rabson  * All rights reserved.
6a3be63b3SDoug Rabson  *
7a3be63b3SDoug Rabson  * Redistribution and use in source and binary forms, with or without
8a3be63b3SDoug Rabson  * modification, are permitted provided that the following conditions
9a3be63b3SDoug Rabson  * are met:
10a3be63b3SDoug Rabson  * 1. Redistributions of source code must retain the above copyright
11a3be63b3SDoug Rabson  *    notice, this list of conditions and the following disclaimer.
12a3be63b3SDoug Rabson  * 2. Redistributions in binary form must reproduce the above copyright
13a3be63b3SDoug Rabson  *    notice, this list of conditions and the following disclaimer in the
14a3be63b3SDoug Rabson  *    documentation and/or other materials provided with the distribution.
15a3be63b3SDoug Rabson  *
16a3be63b3SDoug Rabson  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17a3be63b3SDoug Rabson  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18a3be63b3SDoug Rabson  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19a3be63b3SDoug Rabson  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20a3be63b3SDoug Rabson  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21a3be63b3SDoug Rabson  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22a3be63b3SDoug Rabson  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23a3be63b3SDoug Rabson  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24a3be63b3SDoug Rabson  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25a3be63b3SDoug Rabson  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26a3be63b3SDoug Rabson  * SUCH DAMAGE.
27a3be63b3SDoug Rabson  */
28a3be63b3SDoug Rabson 
29a3be63b3SDoug Rabson /*
30a3be63b3SDoug Rabson  * Parts of the ISA bus implementation common to all architectures.
31a3be63b3SDoug Rabson  *
32a3be63b3SDoug Rabson  * Drivers must not depend on information in this file as it can change
33a3be63b3SDoug Rabson  * without notice.
34a3be63b3SDoug Rabson  */
35a3be63b3SDoug Rabson 
36a3be63b3SDoug Rabson /*
374249382dSDoug Rabson  * PNP configurations are kept in a tailq.
384249382dSDoug Rabson  */
39e3975643SJake Burkholder TAILQ_HEAD(isa_config_list, isa_config_entry);
404249382dSDoug Rabson struct isa_config_entry {
41e3975643SJake Burkholder 	TAILQ_ENTRY(isa_config_entry) ice_link;
424249382dSDoug Rabson 	int			ice_priority;
434249382dSDoug Rabson 	struct isa_config	ice_config;
444249382dSDoug Rabson };
454249382dSDoug Rabson 
464249382dSDoug Rabson /*
47a3be63b3SDoug Rabson  * The structure used to attach devices to the isa bus.
48a3be63b3SDoug Rabson  */
49a3be63b3SDoug Rabson struct isa_device {
50a3be63b3SDoug Rabson 	struct resource_list	id_resources;
5109aafea1SWarner Losh 	uint32_t		id_vendorid; /* pnp vendor id */
5209aafea1SWarner Losh 	uint32_t		id_serial; /* pnp serial */
5309aafea1SWarner Losh 	uint32_t		id_logicalid; /* pnp logical device id */
5409aafea1SWarner Losh 	uint32_t		id_compatid; /* pnp compat device id */
554249382dSDoug Rabson 	struct isa_config_list	id_configs; /* pnp config alternatives */
564249382dSDoug Rabson 	isa_config_cb		*id_config_cb; /* callback function */
574249382dSDoug Rabson 	void			*id_config_arg;	/* callback argument */
587abb4662SKazutaka YOKOTA 	int			id_config_attr;	/* pnp config attributes */
59132580b5SWarner Losh 	int			id_pnpbios_handle; /* pnp handle, if any */
60132580b5SWarner Losh 	int			id_pnp_csn; /* pnp Card Number */
61132580b5SWarner Losh 	int			id_pnp_ldn; /* pnp Logical device on card */
620d484d24SJohn Baldwin 	int			id_order;
63a3be63b3SDoug Rabson };
64a3be63b3SDoug Rabson 
65a3be63b3SDoug Rabson #define DEVTOISA(dev)	((struct isa_device *) device_get_ivars(dev))
66a3be63b3SDoug Rabson 
67a3be63b3SDoug Rabson /*
6855b05458SPedro F. Giffuni  * These functions are architecture dependent.
69a3be63b3SDoug Rabson  */
7001f1aed2SThomas Moestl extern void isa_init(device_t dev);
71a3be63b3SDoug Rabson extern struct resource *isa_alloc_resource(device_t bus, device_t child,
722dd1bdf1SJustin Hibbits     int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count,
732dd1bdf1SJustin Hibbits     u_int flags);
74a3be63b3SDoug Rabson extern int isa_release_resource(device_t bus, device_t child,
75*9dbf5b0eSJohn Baldwin     struct resource *r);
76a3be63b3SDoug Rabson 
77812fb8f2SWarner Losh extern driver_t isa_driver;
78