eisaconf.h revision 18233
1/* 2 * EISA bus device definitions 3 * 4 * Copyright (c) 1995, 1996 Justin T. Gibbs. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice immediately at the beginning of the file, without modification, 12 * this list of conditions, and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 3. The name of the author may not be used to endorse or promote products 17 * derived from this software without specific prior written permission. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * SUCH DAMAGE. 30 * 31 * $Id: eisaconf.h,v 1.11 1996/09/08 10:43:42 phk Exp $ 32 */ 33 34#ifndef _I386_EISA_EISACONF_H_ 35#define _I386_EISA_EISACONF_H_ 1 36 37#include <sys/queue.h> 38 39#define EISA_SLOTS 10 /* PCI clashes with higher ones.. fix later */ 40#define EISA_SLOT_SIZE 0x1000 41 42#define EISA_MFCTR_CHAR0(ID) (char)(((ID>>26) & 0x1F) | '@') /* Bits 26-30 */ 43#define EISA_MFCTR_CHAR1(ID) (char)(((ID>>21) & 0x1F) | '@') /* Bits 21-25 */ 44#define EISA_MFCTR_CHAR2(ID) (char)(((ID>>16) & 0x1F) | '@') /* Bits 16-20 */ 45#define EISA_MFCTR_ID(ID) (short)((ID>>16) & 0xFF) /* Bits 16-31 */ 46#define EISA_PRODUCT_ID(ID) (short)((ID>>4) & 0xFFF) /* Bits 4-15 */ 47#define EISA_REVISION_ID(ID) (u_char)(ID & 0x0F) /* Bits 0-3 */ 48 49extern struct linker_set eisadriver_set; 50 51typedef u_int32_t eisa_id_t; 52 53typedef struct resvaddr { 54 u_long addr; /* start address */ 55 u_long size; /* size of reserved area */ 56 int flags; 57#define RESVADDR_NONE 0x00 58#define RESVADDR_BITMASK 0x01 /* size is a mask of reserved 59 * bits at addr 60 */ 61#define RESVADDR_RELOCATABLE 0x02 62 LIST_ENTRY(resvaddr) links; /* List links */ 63} resvaddr_t; 64 65LIST_HEAD(resvlist, resvaddr); 66 67struct eisa_ioconf { 68 int slot; 69 struct resvlist ioaddrs; /* list of reserved I/O ranges */ 70 struct resvlist maddrs; /* list of reserved memory ranges */ 71 u_short irq; /* bitmask of interrupt */ 72}; 73 74struct eisa_device; 75 76struct eisa_driver { 77 char* name; /* device name */ 78 int (*probe) __P((void)); 79 /* test whether device is present */ 80 int (*attach) __P((struct eisa_device *)); 81 /* setup driver for a device */ 82 int (*shutdown) __P((int)); 83 /* Return the device to a safe 84 * state before shutdown 85 */ 86 u_long *unit; /* Next available unit */ 87}; 88 89/* To be replaced by the "super device" generic device structure... */ 90struct eisa_device { 91 eisa_id_t id; 92 u_long unit; 93 char* full_name; /* for use in the probe message */ 94 struct eisa_ioconf ioconf; 95 struct eisa_driver* driver; 96}; 97 98void eisa_configure __P((void)); 99struct eisa_device *eisa_match_dev __P((struct eisa_device *, char * (*)(eisa_id_t))); 100 101void eisa_reg_start __P((struct eisa_device *)); 102void eisa_reg_end __P((struct eisa_device *)); 103int eisa_add_intr __P((struct eisa_device *, int)); 104int eisa_reg_intr __P((struct eisa_device *, int, void (*)(void *), void *, u_int *, int)); 105int eisa_release_intr __P((struct eisa_device *, int, void (*)(void *))); 106int eisa_enable_intr __P((struct eisa_device *, int)); 107int eisa_add_iospace __P((struct eisa_device *, u_long, u_long, int)); 108int eisa_reg_iospace __P((struct eisa_device *, resvaddr_t *)); 109int eisa_add_mspace __P((struct eisa_device *, u_long, u_long, int)); 110int eisa_reg_mspace __P((struct eisa_device *, resvaddr_t *)); 111int eisa_registerdev __P((struct eisa_device *, struct eisa_driver *)); 112 113#endif /* _I386_EISA_EISACONF_H_ */ 114