isa_common.h revision 82863
147398Sdfr/*-
247398Sdfr * Copyright (c) 1999 Doug Rabson
347398Sdfr * All rights reserved.
447398Sdfr *
547398Sdfr * Redistribution and use in source and binary forms, with or without
647398Sdfr * modification, are permitted provided that the following conditions
747398Sdfr * are met:
847398Sdfr * 1. Redistributions of source code must retain the above copyright
947398Sdfr *    notice, this list of conditions and the following disclaimer.
1047398Sdfr * 2. Redistributions in binary form must reproduce the above copyright
1147398Sdfr *    notice, this list of conditions and the following disclaimer in the
1247398Sdfr *    documentation and/or other materials provided with the distribution.
1347398Sdfr *
1447398Sdfr * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1547398Sdfr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1647398Sdfr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1747398Sdfr * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1847398Sdfr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1947398Sdfr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2047398Sdfr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2147398Sdfr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2247398Sdfr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2347398Sdfr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2447398Sdfr * SUCH DAMAGE.
2547398Sdfr *
2650477Speter * $FreeBSD: head/sys/isa/isa_common.h 82863 2001-09-03 09:45:41Z yokota $
2747398Sdfr */
2847398Sdfr
2947398Sdfr/*
3047398Sdfr * Parts of the ISA bus implementation common to all architectures.
3147398Sdfr *
3247398Sdfr * Drivers must not depend on information in this file as it can change
3347398Sdfr * without notice.
3447398Sdfr */
3547398Sdfr
3647398SdfrMALLOC_DECLARE(M_ISADEV);
3747398Sdfr
3847398Sdfr/*
3950769Sdfr * PNP configurations are kept in a tailq.
4050769Sdfr */
4160938SjakeTAILQ_HEAD(isa_config_list, isa_config_entry);
4250769Sdfrstruct isa_config_entry {
4360938Sjake	TAILQ_ENTRY(isa_config_entry) ice_link;
4450769Sdfr	int			ice_priority;
4550769Sdfr	struct isa_config	ice_config;
4650769Sdfr};
4750769Sdfr
4850769Sdfr/*
4947398Sdfr * The structure used to attach devices to the isa bus.
5047398Sdfr */
5147398Sdfrstruct isa_device {
5247398Sdfr	struct resource_list	id_resources;
5347613Sdfr	u_int32_t		id_vendorid; /* pnp vendor id */
5447613Sdfr	u_int32_t		id_serial; /* pnp serial */
5547613Sdfr	u_int32_t		id_logicalid; /* pnp logical device id */
5647613Sdfr	u_int32_t		id_compatid; /* pnp compat device id */
5750769Sdfr	struct isa_config_list	id_configs; /* pnp config alternatives */
5850769Sdfr	isa_config_cb		*id_config_cb; /* callback function */
5950769Sdfr	void			*id_config_arg;	/* callback argument */
6082863Syokota	int			id_config_attr;	/* pnp config attributes */
6182863Syokota#define ISACFGATTR_CANDISABLE	(1 << 0)	/* can be disabled */
6282863Syokota#define ISACFGATTR_DYNAMIC	(1 << 1)	/* dynamic configuration */
6347398Sdfr};
6447398Sdfr
6547398Sdfr#define DEVTOISA(dev)	((struct isa_device *) device_get_ivars(dev))
6647398Sdfr
6747398Sdfr/*
6847398Sdfr * These functions are architecture dependant.
6947398Sdfr */
7047398Sdfrextern void isa_init(void);
7147398Sdfrextern struct resource *isa_alloc_resource(device_t bus, device_t child,
7247398Sdfr					   int type, int *rid,
7347398Sdfr					   u_long start, u_long end,
7447398Sdfr					   u_long count, u_int flags);
7547398Sdfrextern int isa_release_resource(device_t bus, device_t child,
7647398Sdfr				int type, int rid,
7747398Sdfr				struct resource *r);
7847398Sdfr
7947398Sdfr/* XXX alphe declares these elsewhere */
8047398Sdfr#ifndef __alpha__
8147398Sdfrextern int isa_setup_intr(device_t bus, device_t child,
8247398Sdfr			  struct resource *r, int flags,
8347398Sdfr			  void (*ihand)(void *), void *arg, void **cookiep);
8447398Sdfrextern int isa_teardown_intr(device_t bus, device_t child,
8547398Sdfr			     struct resource *r, void *cookie);
8647398Sdfr#endif
8747398Sdfr
88