freebsd-skq/sys/i386/isa/isa_device.h
Stefan Eßer b56fdd903a BEWARE: Interface change of register_intr() !
Changed the fifth parameter to register_intr() from u_int mask into
u_int *maskptr in preparation for new features (shared interrupts and
removable devices, eg. for PCMCIA).
1994-10-25 23:06:16 +00:00

149 lines
5.9 KiB
C

/*-
* Copyright (c) 1991 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)isa_device.h 7.1 (Berkeley) 5/9/91
* $Id: isa_device.h,v 1.15 1994/10/23 21:27:27 wollman Exp $
*/
#ifndef _I386_ISA_ISA_DEVICE_H_
#define _I386_ISA_ISA_DEVICE_H_ 1
/*
* ISA Bus Autoconfiguration
*/
#define IDTVEC(name) __CONCAT(X,name)
/*
* Type of the first (asm) part of an interrupt handler.
*/
typedef void inthand_t __P((u_int cs, u_int ef, u_int esp, u_int ss));
/*
* Usual type of the second (C) part of an interrupt handler. Some bogus
* ones need the arg to be the interrupt frame (and not a copy of it, which
* is all that is possible in C).
*/
typedef void inthand2_t __P((int unit));
/*
* Per device structure.
*/
struct isa_device {
int id_id; /* device id */
struct isa_driver *id_driver;
int id_iobase; /* base i/o address */
u_short id_irq; /* interrupt request */
short id_drq; /* DMA request */
caddr_t id_maddr; /* physical i/o memory address on bus (if any)*/
int id_msize; /* size of i/o memory */
inthand2_t *id_intr; /* interrupt interface routine */
int id_unit; /* unit number */
int id_flags; /* flags */
int id_scsiid; /* scsi id if needed */
int id_alive; /* device is present */
#define RI_FAST 1 /* fast interrupt handler */
u_int id_ri_flags; /* flags for register_intr() */
int id_reconfig; /* hot eject device support (such as PCMCIA) */
};
/*
* Per-driver structure.
*
* Each device driver defines entries for a set of routines
* as well as an array of types which are acceptable to it.
* These are used at boot time by the configuration program.
*/
struct isa_driver {
int (*probe) __P((struct isa_device *idp));
/* test whether device is present */
int (*attach) __P((struct isa_device *idp));
/* setup driver for a device */
char *name; /* device name */
int sensitive_hw; /* true if other probes confuse us */
};
#define ISA_EXTERNALLEN (sizeof(struct isa_device))
#define EISA_EXTERNALLEN (sizeof(struct isa_device) + sizeof(int))
#ifdef KERNEL
extern char eintrnames[]; /* end of intrnames[] */
extern u_long intrcnt[]; /* counts for for each device and stray */
extern char intrnames[]; /* string table containing device names */
extern u_long *intr_countp[]; /* indirectors into intrcnt[] */
extern inthand2_t *intr_handler[]; /* C entry points of intr handlers */
extern u_int intr_mask[]; /* sets of intrs masked during handling of 1 */
extern int intr_unit[]; /* cookies to pass to intr handlers */
extern struct isa_device isa_devtab_bio[], isa_devtab_tty[], isa_devtab_net[],
isa_devtab_null[], isa_biotab_wdc[], isa_biotab_fdc[];
inthand_t
IDTVEC(fastintr0), IDTVEC(fastintr1),
IDTVEC(fastintr2), IDTVEC(fastintr3),
IDTVEC(fastintr4), IDTVEC(fastintr5),
IDTVEC(fastintr6), IDTVEC(fastintr7),
IDTVEC(fastintr8), IDTVEC(fastintr9),
IDTVEC(fastintr10), IDTVEC(fastintr11),
IDTVEC(fastintr12), IDTVEC(fastintr13),
IDTVEC(fastintr14), IDTVEC(fastintr15);
struct isa_device *find_isadev __P((struct isa_device *table,
struct isa_driver *driverp, int unit));
inthand_t
IDTVEC(intr0), IDTVEC(intr1), IDTVEC(intr2), IDTVEC(intr3),
IDTVEC(intr4), IDTVEC(intr5), IDTVEC(intr6), IDTVEC(intr7),
IDTVEC(intr8), IDTVEC(intr9), IDTVEC(intr10), IDTVEC(intr11),
IDTVEC(intr12), IDTVEC(intr13), IDTVEC(intr14), IDTVEC(intr15);
void isa_configure __P((void));
void isa_defaultirq __P((void));
void isa_dmacascade __P((unsigned chan));
void isa_dmadone __P((int, caddr_t, int, int));
void isa_dmastart __P((int, caddr_t, unsigned, unsigned));
int isa_irq_pending __P((struct isa_device *dvp));
int isa_nmi __P((int cd));
int register_intr __P((int intr, int device_id, u_int flags,
inthand2_t *handler, u_int *maskptr, int unit));
int unregister_intr __P((int intr, inthand2_t *handler));
extern int isa_externalize(struct isa_device *, void *, size_t *);
extern int isa_internalize(struct isa_device *, void **, size_t *);
extern int eisa_externalize(struct isa_device *, int, void *, size_t *);
struct kern_devconf;
extern int isa_generic_externalize(struct proc *, struct kern_devconf *, void *, size_t);
extern int eisa_generic_externalize(struct proc *,struct kern_devconf *, void *, size_t);
extern struct kern_devconf kdc_isa0;
#endif /* KERNEL */
#endif /* _I386_ISA_ISA_DEVICE_H_ */