Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Mar 95 12:44 PST
From:      julian@tfs.com (Julian Elischer)
To:        hackers@FreeBSD.org
Subject:   slightly more fixed EISA config
Message-ID:  <m0roGyK-0003wKC@TFS.COM>

next in thread | raw e-mail | index | archive | help

Here is an EISA config that finds a buslogic 742 correctly, and also correctly
dissables it (and an aha) from the ISA config because of clashing ports..
i.e. if it finds the bt on EISA, it knows it has to no probe
anything it finds at the bt's ISA port addresses..

unfortunatly it doesn't quite work, because the interrupt doesn't
get registered.. so teh bt never get's it's interupts..

anyone out there who has experience in teh interrups
care to look at this?

the table in eisadevs.c should be automatically generated by config
but for now, by hand will do..
The version I posted last night won't get all the way through 
probing the EISA devices.. this has been fixed.. and the kernel 
get's allthe way to trying to mount root.. if the EISA device is not root,
then I guess it would probably boot correctly.. (till you try access the
EISA devices, when they will never get their interrupts..)

julian
#------------------------cut here--------------------
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	i386/eisa
#	i386/eisa/eisaconf.c
#	i386/eisa/eisaconf.h
#	i386/eisa/eisadevs.c
#	i386/eisa/patches
#
echo c - i386/eisa
mkdir -p i386/eisa > /dev/null 2>&1
echo x - i386/eisa/eisaconf.c
sed 's/^X//' >i386/eisa/eisaconf.c << 'END-of-i386/eisa/eisaconf.c'
X/*
X * Written by Billie Alsup (balsup@tfs.com)
X * for TRW Financial Systems for use under the MACH(2.5)and OSF/1 operating
X * systems.
X *
X * TRW Financial Systems, in accordance with their agreement with Carnegie
X * Mellon University, makes this software available to CMU to distribute
X * or use in any manner that they see fit as long as this message is kept with
X * the software. For this reason TFS also grants any other persons or
X * organisations permission to use or modify this software.
X *
X * TFS supplies this software to be publicly redistributed
X * on the understanding that TFS is not responsible for the correct
X * functioning of this software in any circumstances.
X *
X * $Id: eisaconf.c,v 1.1 1995/03/13 09:10:17 root Exp root $
X */
X
X/*
X * Ported to run under FreeBSD by Julian Elischer (julian@tfs.com) Sept 1992
X */
X
X
X#include <sys/param.h>
X#include <sys/systm.h>          /* isn't it a joy */
X#include <sys/kernel.h>         /* to have three of these */
X#include <sys/conf.h>
X
X#include "sys/types.h"
X#include "i386/isa/icu.h"
X#include "i386/isa/isa_device.h" /*we're a superset, so we need this */
X#include "eisaconf.h"
X
X
Xstruct isa_device eisaSlot[EISA_SLOTS];
Xstruct isa_device isa_devtab_eisa[EISA_SLOTS+1];
Xint nexttab = 0;
Xextern struct eisa_dev eisa_dev[];
X
X#define EISA_MAKEID(p) ((((p)[0]&0x1F)<<10)|(((p)[1]&0x1F)<<5)|(((p)[2]&0x1F)))
X#define EISA_ID0(i) ((((i)>>10)&0x1F)+0x40)
X#define EISA_ID1(i) ((((i)>>5)&0x1F)+0x40)
X#define EISA_ID2(i) (((i)&0x1F)+0x40)
X/*
X** probe for EISA devices
X*/
Xvoid
Xeisa_configure()
X{
X    int i,j,slot,found,numports;
X    unsigned int checkthese;
X    struct eisa_dev *edev_p;
X    int eisaBase = 0xC80;
X    unsigned short productID, productType;
X    unsigned char productRevision,controlBits;
X	static char hexdigit[] = "0123456789ABCDEF";
X#define HEXDIGIT(i) hexdigit[(i)&0x0f]
X
X    outb(eisaBase,0xFF);
X    productID = inb(eisaBase);
X    if (productID & 0x80) {
X      printf("Warning: running EISA kernel on non-EISA system board\n");
X      return;
X    } 
X    printf("Probing for devices on EISA bus\n");
X    productID = (productID<<8) | inb(eisaBase+1);
X    productRevision = inb(eisaBase+2);
X
X    printf("EISA0: %c%c%c v%d (System Board)\n"
X                ,EISA_ID0(productID)
X                ,EISA_ID1(productID)
X                ,EISA_ID2(productID)
X                ,(productRevision&7));
X
X    for (slot=1; eisaBase += 0x1000, slot < EISA_SLOTS; slot++) {
X      outb(eisaBase,0xFF);
X      productID = inb(eisaBase);
X      if (productID & 0x80) continue;  /* no EISA card in slot */
X
X      productID = (productID<<8) | inb(eisaBase+1);
X      productType = inb(eisaBase+2);
X      productRevision = inb(eisaBase+3);
X      productType = (productType<<4) | (productRevision>>4);
X      productRevision &= 15;
X      controlBits = inb(eisaBase+4);
X
X      printf("EISA%d: %c%c%c-%c%c%c.%x\n"
X        ,slot,EISA_ID0(productID),EISA_ID1(productID),EISA_ID2(productID)
X        ,HEXDIGIT(productType>>8)
X		,HEXDIGIT(productType>>4)
X		,HEXDIGIT(productType)
X		,productRevision);
X
X      if (!(controlBits & 1)) {
X        printf("...Card is disabled\n");
X		/* continue;*/
X      }
X
X      /*
X      ** See if we recognize this product
X      */
X
X      for (edev_p = eisa_dev,found=0; edev_p->productID[0]; edev_p++) {
X        struct isa_device *dev_p;
X        struct  isa_driver  *drv_p;
X        unsigned short configuredID;
X
X        configuredID = EISA_MAKEID(edev_p->productID);
X        if (configuredID != productID) continue;
X        if (edev_p->productType != productType) continue;
X        if (edev_p->productRevision > productRevision) continue;
X
X        /*
X        ** we're assuming:
X        **      if different drivers for the same board exist
X        **      (due to some revision incompatibility), that the
X        **      drivers will be listed in descending revision
X        **      order.  The revision in the eisaDevs structure
X        **      should indicate the lowest revision supported
X        **      by the code.
X        **
X        */
X        dev_p = &eisaSlot[slot];
X        memcpy(dev_p,&edev_p->isa_dev,sizeof(edev_p->isa_dev));
X
X        drv_p = dev_p->id_driver;
X        dev_p->id_iobase = eisaBase; /* may get ammended by driver */
X
X#if defined(DEBUG)
X        printf("eisaProbe: probing %s%d\n"
X                ,drv_p->driver_name, dev_p->id_unit);
X#endif /* defined(DEBUG) */
X
X        if (!(numports = drv_p->probe(dev_p))) {
X            continue;  /* try another eisa device */
X        }
X        edev_p->isa_dev.id_unit++; /*dubious*/
X/** this should all be put in some common routine **/
X	printf("%s%d", drv_p->name, dev_p->id_unit);
X	if (numports != -1) {
X		printf(" at 0x%x", dev_p->id_iobase);
X		if ((dev_p->id_iobase + numports - 1) != dev_p->id_iobase) {
X			printf("-0x%x", dev_p->id_iobase + numports - 1);
X		}
X	}
X
X	if (dev_p->id_irq)
X		printf(" irq %d", ffs(dev_p->id_irq) - 1);
X	if (dev_p->id_drq != -1)
X		printf(" drq %d", dev_p->id_drq);
X	if (dev_p->id_maddr)
X		printf(" maddr 0x%lx", kvtop(dev_p->id_maddr));
X	if (dev_p->id_msize)
X		printf(" msize %d", dev_p->id_msize);
X	if (dev_p->id_flags)
X		printf(" flags 0x%x", dev_p->id_flags);
X	if (dev_p->id_iobase) {
X		if (dev_p->id_iobase < 0x100) {
X			printf(" on motherboard\n");
X		} else {
X			if (dev_p->id_iobase >= 0x1000) {
X				printf (" on EISA\n");
X			} else {
X				printf (" on ISA emulation\n");
X			}
X		}
X	}
X        /*
X        ** Now look for any live devices with the same starting I/O port and
X	** give up if we clash
X        **
X        ** what i'd really like is to set is how many i/o ports are in use.
X        ** but that isn't in this structure...
X        **
X        */
X	checkthese = 0;
X	if(dev_p->id_iobase )	checkthese |= CC_IOADDR;
X	if(dev_p->id_drq != -1 ) checkthese |= CC_DRQ;
X	if(dev_p->id_irq )	checkthese |= CC_IRQ;
X	if(dev_p->id_maddr )	checkthese |= CC_MEMADDR;
X	/* this may be stupid, it's probably too late if we clash here */
X	if(haveseen_isadev( dev_p,checkthese))
X		break;	/* we can't proceed due to collision. bail */
X	/* mark ourselves in existence and then put us in the eisa list */
X	/* so that other things check against US for a clash */
X        dev_p->id_alive = (numports == -1? 1 : numports);
X	memcpy(&(isa_devtab_eisa[nexttab]),dev_p,sizeof(edev_p->isa_dev));
X        drv_p->attach(dev_p);
X
X	if (dev_p->id_irq) {
X		if (edev_p->imask)
X			INTRMASK(*(edev_p->imask), dev_p->id_irq);
X		register_intr(ffs(dev_p->id_irq) - 1, dev_p->id_id,
X			dev_p->id_ri_flags, dev_p->id_intr,
X			edev_p->imask, dev_p->id_unit);
X		INTREN(dev_p->id_irq);
X	}
X	found = 1;
X	nexttab++;
X        break; /* go look at next slot*/
X     }/* end of loop on known devices */
X     if (!found) {
X      printf("...No driver installed for board\n");
X     }
X  }/* end of loop on slots */
X}/* end of routine */
X
X
X
X
X
END-of-i386/eisa/eisaconf.c
echo x - i386/eisa/eisaconf.h
sed 's/^X//' >i386/eisa/eisaconf.h << 'END-of-i386/eisa/eisaconf.h'
X/*
X * Written by Billie Alsup (balsup@tfs.com)
X * for TRW Financial Systems for use under the MACH(2.5)and OSF/1 operating
X * systems.
X *
X * TRW Financial Systems, in accordance with their agreement with Carnegie
X * Mellon University, makes this software available to CMU to distribute
X * or use in any manner that they see fit as long as this message is kept with
X * the software. For this reason TFS also grants any other persons or
X * organisations permission to use or modify this software.
X *
X * TFS supplies this software to be publicly redistributed
X * on the understanding that TFS is not responsible for the correct
X * functioning of this software in any circumstances.
X *
X * $Id: eisaconf.h,v 1.1 1995/03/13 09:10:17 root Exp root $
X */
X
X/*
X * Ported to run under FreeBSD by Julian Elischer (julian@tfs.com) Sept 1992
X */
X
X#define EISA_SLOTS 10   /* PCI clashes with higher ones.. fix later */  
Xstruct eisa_dev {
X  char productID[4];
X  unsigned short productType;
X  unsigned char productRevision;
X  unsigned int *imask;
X  struct isa_device isa_dev;
X};
X
END-of-i386/eisa/eisaconf.h
echo x - i386/eisa/eisadevs.c
sed 's/^X//' >i386/eisa/eisadevs.c << 'END-of-i386/eisa/eisadevs.c'
X/*
X * Written by Billie Alsup (balsup@tfs.com)
X * for TRW Financial Systems for use under the MACH(2.5)and OSF/1 operating
X * systems.
X *
X * TRW Financial Systems, in accordance with their agreement with Carnegie
X * Mellon University, makes this software available to CMU to distribute
X * or use in any manner that they see fit as long as this message is kept with
X * the software. For this reason TFS also grants any other persons or
X * organisations permission to use or modify this software.
X *
X * TFS supplies this software to be publicly redistributed
X * on the understanding that TFS is not responsible for the correct
X * functioning of this software in any circumstances.
X *
X * $Id: eisadevs.c,v 1.1 1995/03/13 09:10:17 root Exp root $
X */
X
X/*
X * Ported to run under FreeBSD by Julian Elischer (julian@tfs.com) Sept 1992
X */
X/* This needs to be automatically generated.. */
X
X#include <sys/param.h>
X#include <sys/systm.h>          /* isn't it a joy */
X#include <sys/kernel.h>         /* to have three of these */
X#include <sys/conf.h>
X
X#include "i386/isa/isa_device.h"
X#include "eisaconf.h"
X#include "bt.h"
X#if NBT > 0
Xextern struct isa_driver btdriver;
Xint btintr();
X#endif
X
Xstruct eisa_dev eisa_dev[] = {
X#if NBT > 0
X  { "BUS",0x420,0,&bio_imask,{-1,&btdriver,0,0,-1,0,0,btintr,0,0,0,0,0}},
X  { "BUS",0x470,0,&bio_imask,{-1,&btdriver,0,0,-1,0,0,btintr,0,0,0,0,0}},
X#endif  /* NBT > 0 */
X/* add your devices here */
X
X  {0,0,0}
X};
X
END-of-i386/eisa/eisadevs.c
echo x - i386/eisa/patches
sed 's/^X//' >i386/eisa/patches << 'END-of-i386/eisa/patches'
X*** 1.1	1995/03/13 02:47:10
X--- i386/isa/bt742a.c	1995/03/13 09:12:58
X***************
X*** 12,18 ****
X   * on the understanding that TFS is not responsible for the correct
X   * functioning of this software in any circumstances.
X   *
X!  *      $Id: bt742a.c,v 1.1 1995/03/13 02:47:10 root Exp $
X   */
X  
X  /*
X--- 12,18 ----
X   * on the understanding that TFS is not responsible for the correct
X   * functioning of this software in any circumstances.
X   *
X!  *      $Id: bt742a.c,v 1.2 1995/03/13 09:12:47 root Exp root $
X   */
X  
X  /*
X***************
X*** 637,642 ****
X--- 637,658 ----
X  	}
X  	bzero(bt, sizeof(struct bt_data));
X  	btdata[unit] = bt;
X+         if(dev->id_iobase > 0xFFF) /*  an EISA card, we have an EISA port */
X+         {
X+                 int i = inb(dev->id_iobase + 0x0C);
X+                 static unsigned long bt_iobase[8] =
X+                 { 0x330,0x334,0x230,0x234,0x130,0x134,0x00,0x00 };
X+ 
X+                 if (!(dev->id_iobase = bt_iobase[i&7])) {
X+                         printf("bt_iobase disabled or invalid; index %d\n"
X+ 					,i&7);
X+                         return 0;
X+                 }
X+ #if defined(DEBUG)
X+                 printf("btprobe: Trying iobase 0x%x\n",dev->dev_addr);
X+ #endif /* defined(DEBUG) */
X+         }
X+ 
X  	bt->bt_base = dev->id_iobase;
X  
X  	/*
X*** 1.1	1995/03/13 02:55:03
X--- i386/isa/isa.c	1995/03/13 09:13:01
X***************
X*** 34,40 ****
X   * SUCH DAMAGE.
X   *
X   *	from: @(#)isa.c	7.2 (Berkeley) 5/13/91
X!  *	$Id: isa.c,v 1.1 1995/03/13 02:55:03 root Exp $
X   */
X  
X  /*
X--- 34,40 ----
X   * SUCH DAMAGE.
X   *
X   *	from: @(#)isa.c	7.2 (Berkeley) 5/13/91
X!  *	$Id: isa.c,v 1.2 1995/03/13 09:12:47 root Exp root $
X   */
X  
X  /*
X***************
X*** 86,100 ****
X  #define	DMA2_FFC	(IO_DMA2 + 2*12)	/* clear first/last FF */
X  
X  /*
X-  * Bits to specify the type and amount of conflict checking.
X-  */
X- #define	CC_ATTACH	(1 << 0)
X- #define	CC_DRQ		(1 << 1)
X- #define	CC_IOADDR	(1 << 2)
X- #define	CC_IRQ		(1 << 3)
X- #define	CC_MEMADDR	(1 << 4)
X- 
X- /*
X   * XXX these defines should be in a central place.
X   */
X  #define	read_eflags()		({u_long ef; \
X--- 86,91 ----
X***************
X*** 141,147 ****
X  			  char const *format));
X  static int haveseen __P((struct isa_device *dvp, struct isa_device *tmpdvp,
X  			 u_int checkbits));
X- static int haveseen_isadev __P((struct isa_device *dvp, u_int checkbits));
X  static inthand2_t isa_strayintr;
X  static void register_imask __P((struct isa_device *dvp, u_int mask));
X  
X--- 132,137 ----
X***************
X*** 243,249 ****
X   * Search through all the isa_devtab_* tables looking for anything that
X   * conflicts with the current device.
X   */
X! static int
X  haveseen_isadev(dvp, checkbits)
X  	struct isa_device *dvp;
X  	u_int	checkbits;
X--- 233,244 ----
X   * Search through all the isa_devtab_* tables looking for anything that
X   * conflicts with the current device.
X   */
X! #include "eisa.h"
X! #if NEISA > 0
X! extern struct isa_device isa_devtab_eisa[];
X! #endif
X! 
X! int
X  haveseen_isadev(dvp, checkbits)
X  	struct isa_device *dvp;
X  	u_int	checkbits;
X***************
X*** 271,276 ****
X--- 266,278 ----
X  		if (status)
X  			return status;
X  	}
X+ #if NEISA > 0
X+ 	for (tmpdvp = isa_devtab_eisa; tmpdvp->id_driver; tmpdvp++) {
X+ 		status |= haveseen(dvp, tmpdvp, checkbits);
X+ 		if (status)
X+ 			return status;
X+ 	}
X+ #endif
X  	return(status);
X  }
X  
X*** 1.1	1995/03/13 03:01:46
X--- i386/isa/isa_device.h	1995/03/13 09:13:03
X***************
X*** 31,37 ****
X   * SUCH DAMAGE.
X   *
X   *	from: @(#)isa_device.h	7.1 (Berkeley) 5/9/91
X!  *	$Id: isa_device.h,v 1.1 1995/03/13 03:01:46 root Exp $
X   */
X  
X  #ifndef _I386_ISA_ISA_DEVICE_H_
X--- 31,37 ----
X   * SUCH DAMAGE.
X   *
X   *	from: @(#)isa_device.h	7.1 (Berkeley) 5/9/91
X!  *	$Id: isa_device.h,v 1.2 1995/03/13 09:12:47 root Exp root $
X   */
X  
X  #ifndef _I386_ISA_ISA_DEVICE_H_
X***************
X*** 78,83 ****
X--- 78,92 ----
X  };
X  
X  /*
X+  * Bits to specify the type and amount of conflict checking.
X+  */
X+ #define CC_ATTACH       (1 << 0)
X+ #define CC_DRQ          (1 << 1)
X+ #define CC_IOADDR       (1 << 2)
X+ #define CC_IRQ          (1 << 3)
X+ #define CC_MEMADDR      (1 << 4)
X+ 
X+ /*
X   * Per-driver structure.
X   *
X   * Each device driver defines entries for a set of routines
X***************
X*** 126,131 ****
X--- 135,141 ----
X  	IDTVEC(intr8), IDTVEC(intr9), IDTVEC(intr10), IDTVEC(intr11),
X  	IDTVEC(intr12), IDTVEC(intr13), IDTVEC(intr14), IDTVEC(intr15);
X  void isa_configure __P((void));
X+ int haveseen_isadev __P((struct isa_device *dvp, u_int checkbits));
X  void isa_defaultirq __P((void));
X  void isa_dmacascade __P((unsigned chan));
X  void isa_dmadone __P((int, caddr_t, int, int));
X*** 1.1	1995/03/13 02:40:30
X--- i386/conf/files.i386	1995/03/13 09:12:15
X***************
X*** 1,7 ****
X  # This file tells config what files go into building a kernel,
X  # files marked standard are always included.
X  #
X! #	$Id: files.i386,v 1.1 1995/03/13 02:40:30 root Exp $
X  #
X  aic7xxx				optional	ahc	device-driver	   \
X  	dependency 	"$S/gnu/misc/aic7xxx/aic7xxx.c"			   \
X--- 1,7 ----
X  # This file tells config what files go into building a kernel,
X  # files marked standard are always included.
X  #
X! #	$Id: files.i386,v 1.2 1995/03/13 09:12:06 root Exp root $
X  #
X  aic7xxx				optional	ahc	device-driver	   \
X  	dependency 	"$S/gnu/misc/aic7xxx/aic7xxx.c"			   \
X***************
X*** 96,101 ****
X--- 96,103 ----
X  i386/isa/pcibus.c		optional	pci	device-driver
X  i386/isa/pcic.c			optional	ze	device-driver
X  i386/isa/pcic.c			optional	zp	device-driver
X+ i386/eisa/eisaconf.c		optional	eisa
X+ i386/eisa/eisadevs.c		optional	eisa
X  i386/isa/pcvt/pcvt_drv.c	optional	vt	device-driver
X  i386/isa/pcvt/pcvt_ext.c	optional	vt	device-driver
X  i386/isa/pcvt/pcvt_kbd.c	optional	vt	device-driver
X*** 1.1	1995/03/13 02:43:20
X--- i386/i386/autoconf.c	1995/03/13 09:13:34
X***************
X*** 34,40 ****
X   * SUCH DAMAGE.
X   *
X   *	from: @(#)autoconf.c	7.1 (Berkeley) 5/9/91
X!  *	$Id: autoconf.c,v 1.1 1995/03/13 02:43:20 root Exp $
X   */
X  
X  /*
X--- 34,40 ----
X   * SUCH DAMAGE.
X   *
X   *	from: @(#)autoconf.c	7.1 (Berkeley) 5/9/91
X!  *	$Id: autoconf.c,v 1.2 1995/03/13 09:13:20 root Exp root $
X   */
X  
X  /*
X***************
X*** 75,80 ****
X--- 75,81 ----
X  int nfs_mountroot __P((void));
X  #endif
X  
X+ #include "eisa.h"
X  #include "isa.h"
X  #if NISA > 0
X        #include <i386/isa/isa_device.h>
X***************
X*** 91,96 ****
X--- 92,101 ----
X  void
X  configure()
X  {
X+ 
X+ #if NEISA > 0
X+ 	eisa_configure();
X+ #endif
X  
X  #if NISA > 0
X  	isa_configure();
END-of-i386/eisa/patches
exit




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?m0roGyK-0003wKC>