Home | History | Annotate | Line # | Download | only in mba
mba.c revision 1.1
      1 
      2 /*	$NetBSD: mba.c,v 1.1 1995/02/13 00:44:02 ragge Exp $ */
      3 /*
      4  * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
      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, this list of conditions and the following disclaimer.
     12  * 2. Redistributions in binary form must reproduce the above copyright
     13  *    notice, this list of conditions and the following disclaimer in the
     14  *    documentation and/or other materials provided with the distribution.
     15  * 3. All advertising materials mentioning features or use of this software
     16  *    must display the following acknowledgement:
     17  *     This product includes software developed at Ludd, University of Lule}.
     18  * 4. The name of the author may not be used to endorse or promote products
     19  *    derived from this software without specific prior written permission
     20  *
     21  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     22  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     23  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     24  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     26  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     30  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     31  */
     32 
     33  /* All bugs are subject to removal without further notice */
     34 
     35 
     36 
     37 /* mba.c - main mba routines, 930312/ragge */
     38 
     39 #include "mba.h"
     40 #include "nexus.h"
     41 #include "vax/mba/mbavar.h"
     42 #include "vax/mba/mbareg.h"
     43 
     44 struct mba_ctrl mba_ctrl[NMBA];
     45 
     46 extern mba_0(), mba_1(), mba_2(), mba_3();
     47 int   (*mbaintv[4])() = { mba_0, mba_1, mba_2, mba_3 };
     48 #if NMBA > 4
     49         Need to expand the table for more than 4 massbus adaptors
     50 #endif
     51 
     52 mbainterrupt(mba){
     53 
     54 	if(mba_hd[mba].mh_mba->mba_sr&MBA_NED){
     55 		printf("Adresserat icke existerande massbussenhet.\n");
     56 		mba_hd[mba].mh_mba->mba_sr=MBA_NED+MBA_MCPE;
     57 		return;
     58 	}
     59 	printf("Interrupt fr}n massbussadapter %d\n",mba);
     60 	printf("mba_hd[mba]->mba_sr: %x\n",mba_hd[mba].mh_mba->mba_sr);
     61 }
     62 
     63 /*
     64  * mbafind() set up interrupt vectors for each found mba and calls
     65  * config routines for hp disks, tu and mt tapes (currently only hp).
     66  */
     67 
     68 mbafind(nexnum,nexaddr){
     69 	struct mba_regs *mbr;
     70 	struct mba_device *mi;
     71 
     72 	mba_ctrl[nmba].mba_regs= (struct mba_regs *)nexaddr;
     73 	mbr=&(mba_ctrl[nmba].mba_regs);
     74 /*
     75  * Set up interruptvectors and enable interrupt
     76  */
     77 	nex_vec_num(14,nexnum)=nex_vec_num(15,nexnum)=
     78                 nex_vec_num(16,nexnum)=nex_vec_num(17,nexnum)=
     79 		(caddr_t)mbaintv[nmba];
     80 	mbr->mba_cr=MBCR_INIT;
     81 	mbr->mba_cr=MBCR_IE;
     82 /*
     83  * Loop thru all massbuss devices and check for existance
     84  */
     85 
     86 	for(i=0;i<8;i++){
     87 		if(!mbr->mba_drv[i].rmds&MBDS_DPR) continue;
     88 /*
     89  * Device found; check if generated
     90  */
     91 		for(mi = mbdinit; mi->driver; mi++) {
     92 			if(mi->alive) continue; /* Already config'd */
     93 		}
     94 	}
     95 
     96 
     97 }
     98 
     99 
    100