eisaconf.h revision 13691
1/* 2 * EISA bus device definitions 3 * 4 * Copyright (c) 1995 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. Absolutely no warranty of function or purpose is made by the author 17 * Justin T. Gibbs. 18 * 4. Modifications may be freely made to this file if the above conditions 19 * are met. 20 * 21 * $Id: eisaconf.h,v 1.6 1995/11/21 12:52:49 bde Exp $ 22 */ 23 24#ifndef _I386_EISA_EISACONF_H_ 25#define _I386_EISA_EISACONF_H_ 1 26 27#include <sys/queue.h> 28 29#define EISA_SLOTS 10 /* PCI clashes with higher ones.. fix later */ 30#define EISA_SLOT_SIZE 0x1000 31 32#define EISA_MFCTR_CHAR0(ID) (char)(((ID>>26) & 0x1F) | '@') /* Bits 26-30 */ 33#define EISA_MFCTR_CHAR1(ID) (char)(((ID>>21) & 0x1F) | '@') /* Bits 21-25 */ 34#define EISA_MFCTR_CHAR2(ID) (char)(((ID>>16) & 0x1F) | '@') /* Bits 16-20 */ 35#define EISA_MFCTR_ID(ID) (short)((ID>>16) & 0xFF) /* Bits 16-31 */ 36#define EISA_PRODUCT_ID(ID) (short)((ID>>4) & 0xFFF) /* Bits 4-15 */ 37#define EISA_REVISION_ID(ID) (u_char)(ID & 0x0F) /* Bits 0-3 */ 38 39extern struct linker_set eisadriver_set; 40 41typedef u_int32_t eisa_id_t; 42 43typedef struct resvaddr { 44 u_long addr; /* start address */ 45 u_long size; /* size of reserved area */ 46 int flags; 47#define RESVADDR_NONE 0x00 48#define RESVADDR_BITMASK 0x01 /* size is a mask of reserved 49 * bits at addr 50 */ 51#define RESVADDR_RELOCATABLE 0x02 52 LIST_ENTRY(resvaddr) links; /* List links */ 53} resvaddr_t; 54 55LIST_HEAD(resvlist, resvaddr); 56 57struct eisa_ioconf { 58 int slot; 59 struct resvlist ioaddrs; /* list of reserved I/O ranges */ 60 struct resvlist maddrs; /* list of reserved memory ranges */ 61 u_short irq; /* bitmask of interrupt */ 62}; 63 64struct kern_devconf; 65struct eisa_device; 66 67struct eisa_driver { 68 char* name; /* device name */ 69 int (*probe) __P((void)); 70 /* test whether device is present */ 71 int (*attach) __P((struct eisa_device *)); 72 /* setup driver for a device */ 73 int (*shutdown) __P((struct kern_devconf *, int)); 74 /* Return the device to a safe 75 * state before shutdown 76 */ 77 u_long *unit; /* Next availible unit */ 78}; 79 80/* To be replaced by the "super device" generic device structure... */ 81struct eisa_device { 82 eisa_id_t id; 83 u_long unit; 84 char* full_name; /* for use in the probe message */ 85 struct eisa_ioconf ioconf; 86 struct eisa_driver* driver; 87 struct kern_devconf* kdc; 88}; 89 90void eisa_configure __P((void)); 91struct eisa_device *eisa_match_dev __P((struct eisa_device *, char * (*)(eisa_id_t))); 92 93void eisa_reg_start __P((struct eisa_device *)); 94void eisa_reg_end __P((struct eisa_device *)); 95int eisa_add_intr __P((struct eisa_device *, int)); 96int eisa_reg_intr __P((struct eisa_device *, int, void (*)(void *), void *, u_int *, int)); 97int eisa_release_intr __P((struct eisa_device *, int, void (*)(void *))); 98int eisa_enable_intr __P((struct eisa_device *, int)); 99int eisa_add_iospace __P((struct eisa_device *, u_long, u_long, int)); 100int eisa_reg_iospace __P((struct eisa_device *, resvaddr_t *)); 101int eisa_add_mspace __P((struct eisa_device *, u_long, u_long, int)); 102int eisa_reg_mspace __P((struct eisa_device *, resvaddr_t *)); 103int eisa_registerdev __P((struct eisa_device *, struct eisa_driver *, struct kern_devconf *)); 104 105 106struct sysctl_req; 107int eisa_externalize (struct eisa_device *, struct sysctl_req*); 108 109int eisa_generic_externalize (struct kern_devconf *, struct sysctl_req *); 110extern struct kern_devconf kdc_eisa0; 111 112#define EISA_EXTERNALLEN (sizeof(struct eisa_device)) 113 114#endif /* _I386_EISA_EISACONF_H_ */ 115