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