[net.sources] Two Unibus adaptors on VAX 11/750s

charliep@tekgds.UUCP (Charles E. Perkins) (10/01/83)

This note contains modifications to allow 4.1bsd to run on VAX 11/750's
with 2 Unibus adapters.  As distributed, Berkeley code works for 780's
because that machine allows Unibus interrupt vectors to be located
anywhere in physical memory.  This does not hold for 750's which must
have their Unibus vectors located in low memory.  Note particularly
that for 780's one of the four possible Unibus adapters has its vectors
located statically in low core, but the other three adapters have vectors
stored in dynamically allocated memory.  This strategy for additional
adapters will not work on 750's for the reason stated above.

I have finally gotten around to posting this note many months after
having installed the changes.  We have had not problems at all with it.
This code was mostly given to us by the kind folks at Rice University,
particularly Mike Caplinger and Scott Comer, and we have their permission to
distribute it.  As indicated in another note, they also have a nice
"universal" boot block program that uses the 750 boot rom, so that
you can theortically boot from any disk that will boot VMS (e.g.).
I have used their boot block program with RM05, RA80, RA81, and RL02 disks.

PS. After putting this together I see that diff -c5 might have been too much
    context; oh well, better too much than too little!
===============================================================================
---------------------------
diffs for scb.h Oscb.h
---------------------------
*** h/scb.h	Mon Jun 20 22:27:28 1983
--- h/Oscb.h	Mon Jun 20 22:18:03 1983
***************
*** 42,54
  	int	(*scb_ipl14[16])();	/* device interrupts IPL 14 */
  	int	(*scb_ipl15[16])();	/*   "		"    IPL 15 */
  	int	(*scb_ipl16[16])();	/*   "		"    IPL 16 */
  	int	(*scb_ipl17[16])();	/*   "		"    IPL 17 */
  	int	(*scb_ubaint[128])();	/* Unibus device intr */
- #ifdef VAX750
- 	int	(*scb_uba1int[128])();	/* 750 2nd unibus device intr */
- #endif
  };
  
  #ifdef KERNEL
  extern	struct scb scb;
  /* scb.scb_ubaint is the same as UNIvec */

--- 42,51 -----
  	int	(*scb_ipl14[16])();	/* device interrupts IPL 14 */
  	int	(*scb_ipl15[16])();	/*   "		"    IPL 15 */
  	int	(*scb_ipl16[16])();	/*   "		"    IPL 16 */
  	int	(*scb_ipl17[16])();	/*   "		"    IPL 17 */
  	int	(*scb_ubaint[128])();	/* Unibus device intr */
  };
  
  #ifdef KERNEL
  extern	struct scb scb;
  /* scb.scb_ubaint is the same as UNIvec */
-----------------------------------------


---------------------------
diffs for ubavar.h Oubavar.h
---------------------------
*** h/ubavar.h	Mon Jun 20 22:27:11 1983
--- h/Oubavar.h	Mon Jun 20 22:22:04 1983
***************
*** 169,181
   * vector just adjacent to the system control block, we must
   * allocate space there when running on ``any'' cpu.  This space is
   * used for the vector for uba0 on all cpu's.
   */
  extern	int (*UNIvec[])();			/* unibus vec for uba0 */
- #ifdef	VAX750
- extern	int (*UNI1vec[])();			/* 2nd unibus vec for 750's */
- #endif
  
  #if VAX780
  /*
   * On 780's, we must set the scb vectors for the nexus of the
   * UNIbus adaptors to vector to locore unibus adaptor interrupt dispatchers

--- 169,178 -----
   * vector just adjacent to the system control block, we must
   * allocate space there when running on ``any'' cpu.  This space is
   * used for the vector for uba0 on all cpu's.
   */
  extern	int (*UNIvec[])();			/* unibus vec for uba0 */
  
  #if VAX780
  /*
   * On 780's, we must set the scb vectors for the nexus of the
   * UNIbus adaptors to vector to locore unibus adaptor interrupt dispatchers
-----------------------------------------



---------------------------
diffs for Oautoconf.c autoconf.c 
---------------------------
*** dev/autoconf.c	Thu Jun 23 12:49:09 1983
--- dev/Oautoconf.c	Mon Jun 20 22:08:34 1983
***************
*** 137,149
  			mbafind(nxv, nxp);
  			nummba++;
  #endif
  			break;
  
- 		case NEX_UBA0:
- 		case NEX_UBA1:
- 		case NEX_UBA2:
  		case NEX_UBA3:
  			printf("uba%d at tr%d\n", numuba, nexnum);
  			if (numuba >= 4) {
  				printf("5 uba's");
  				goto unsupp;

--- 137,146 -----
  			mbafind(nxv, nxp);
  			nummba++;
  #endif
  			break;
  
  		case NEX_UBA3:
  		case NEX_UBA2:
  		case NEX_UBA1: continue;
  		case NEX_UBA0:
  			printf("uba%d at tr%d\n", numuba, nexnum);
***************
*** 141,150
  
  		case NEX_UBA0:
  		case NEX_UBA1:
  		case NEX_UBA2:
  		case NEX_UBA3:
  			printf("uba%d at tr%d\n", numuba, nexnum);
  			if (numuba >= 4) {
  				printf("5 uba's");
  				goto unsupp;
  			}

--- 138,150 -----
  			nummba++;
  #endif
  			break;
  
  		case NEX_UBA3:
+ 		case NEX_UBA2:
+ 		case NEX_UBA1: continue;
+ 		case NEX_UBA0:
  			printf("uba%d at tr%d\n", numuba, nexnum);
  			if (numuba >= 4) {
  				printf("5 uba's");
  				goto unsupp;
  			}
***************
*** 385,397
  	uhp->uh_uba = vubp;
  	uhp->uh_physuba = pubp;
  /* HAVE TO DO SOMETHING SPECIAL FOR SECOND UNIBUS ON COMETS HERE */
  	if (numuba == 0)
  		uhp->uh_vec = UNIvec;
- #ifdef VAX750
- 	else if (numuba == 1)
- 		uhp->uh_vec = UNI1vec;
  	else
  		printf ("Only 2 UNIBUS adapters supported for VAX 11/750");
  #else
  	else
  		uhp->uh_vec = (int(**)())calloc(512);

--- 385,394 -----
  	uhp->uh_uba = vubp;
  	uhp->uh_physuba = pubp;
  /* HAVE TO DO SOMETHING SPECIAL FOR SECOND UNIBUS ON COMETS HERE */
  	if (numuba == 0)
  		uhp->uh_vec = UNIvec;
  	else
  		uhp->uh_vec = (int(**)())calloc(512);
  	printf("vectors @ %x\n", uhp->uh_vec);
  	for (i = 0; i < 128; i++)
  		uhp->uh_vec[i] =
***************
*** 389,401
  		uhp->uh_vec = UNIvec;
  #ifdef VAX750
  	else if (numuba == 1)
  		uhp->uh_vec = UNI1vec;
  	else
- 		printf ("Only 2 UNIBUS adapters supported for VAX 11/750");
- #else
- 	else
  		uhp->uh_vec = (int(**)())calloc(512);
  #endif
  	for (i = 0; i < 128; i++)
  		uhp->uh_vec[i] =
  		    scbentry(&catcher[i*2], SCB_ISTACK);

--- 386,395 -----
  	uhp->uh_physuba = pubp;
  /* HAVE TO DO SOMETHING SPECIAL FOR SECOND UNIBUS ON COMETS HERE */
  	if (numuba == 0)
  		uhp->uh_vec = UNIvec;
  	else
  		uhp->uh_vec = (int(**)())calloc(512);
  	printf("vectors @ %x\n", uhp->uh_vec);
  	for (i = 0; i < 128; i++)
  		uhp->uh_vec[i] =
  		    scbentry(&catcher[i*2], SCB_ISTACK);
***************
*** 393,403
  	else
  		printf ("Only 2 UNIBUS adapters supported for VAX 11/750");
  #else
  	else
  		uhp->uh_vec = (int(**)())calloc(512);
! #endif
  	for (i = 0; i < 128; i++)
  		uhp->uh_vec[i] =
  		    scbentry(&catcher[i*2], SCB_ISTACK);
  	/*
  	 * Set last free interrupt vector for devices with

--- 387,397 -----
  /* HAVE TO DO SOMETHING SPECIAL FOR SECOND UNIBUS ON COMETS HERE */
  	if (numuba == 0)
  		uhp->uh_vec = UNIvec;
  	else
  		uhp->uh_vec = (int(**)())calloc(512);
! 	printf("vectors @ %x\n", uhp->uh_vec);
  	for (i = 0; i < 128; i++)
  		uhp->uh_vec[i] =
  		    scbentry(&catcher[i*2], SCB_ISTACK);
  	/*
  	 * Set last free interrupt vector for devices with
-----------------------------------------



------------------------------
diffs for locore.s, Olocore.s
------------------------------
*** sys/locore.s	Mon Jun 20 23:51:40 1983
--- sys/Olocore.s	Mon Jun 20 18:41:53 1983
***************
*** 48,58
   */
  	.align	2
  	.globl	_doadump
  _doadump:
  	nop; nop				# .word 0x0101
- #ifndef VAX750
  #define	_rpbmap	_Sysmap+8			# scb, UNIvec, rpb, istack*4
  #else
  #define	_rpbmap	_Sysmap+12			# scb, UNIvec, rpb, istack*4
  #endif
  	bicl2	$PG_PROT,_rpbmap

--- 48,57 -----
   */
  	.align	2
  	.globl	_doadump
  _doadump:
  	nop; nop				# .word 0x0101
  #define	_rpbmap	_Sysmap+8			# scb, UNIvec, rpb, istack*4
  	bicl2	$PG_PROT,_rpbmap
  	bisl2	$PG_KW,_rpbmap
  	tstl	_rpb+RP_FLAG			# dump only once!
  	bneq	1f
***************
*** 50,62
  	.globl	_doadump
  _doadump:
  	nop; nop				# .word 0x0101
  #ifndef VAX750
  #define	_rpbmap	_Sysmap+8			# scb, UNIvec, rpb, istack*4
- #else
- #define	_rpbmap	_Sysmap+12			# scb, UNIvec, rpb, istack*4
- #endif
  	bicl2	$PG_PROT,_rpbmap
  	bisl2	$PG_KW,_rpbmap
  	tstl	_rpb+RP_FLAG			# dump only once!
  	bneq	1f
  	incl	_rpb+RP_FLAG

--- 49,58 -----
  	.align	2
  	.globl	_doadump
  _doadump:
  	nop; nop				# .word 0x0101
  #define	_rpbmap	_Sysmap+8			# scb, UNIvec, rpb, istack*4
  	bicl2	$PG_PROT,_rpbmap
  	bisl2	$PG_KW,_rpbmap
  	tstl	_rpb+RP_FLAG			# dump only once!
  	bneq	1f
  	incl	_rpb+RP_FLAG
-----------------------------------------


------------------------------
diffs for Locore.c, OLocore.c
------------------------------
*** sys/Locore.c	Fri Aug 12 17:47:30 1983
--- sys/OLocore.c	Mon Jun 20 18:41:51 1983
***************
*** 20,32
   * Pseudo file for lint to show what is used/defined in locore.s.
   */
  
  struct	scb scb;
  int	(*UNIvec[128])();
- #ifdef VAX750
- int	(*UNI1vec[128])();	/* 750 2nd unibus device intr */
- #endif
  struct	rpb rpb;
  int	intstack[3*128];
  
  int	masterpaddr;		/* p_addr of current process on master cpu */
  

--- 20,29 -----
   * Pseudo file for lint to show what is used/defined in locore.s.
   */
  
  struct	scb scb;
  int	(*UNIvec[128])();
  struct	rpb rpb;
  int	intstack[3*128];
  
  int	masterpaddr;		/* p_addr of current process on master cpu */
  
***************
*** 58,70
  	 * Routines called from interrupt vectors.
  	 */
  	panic("Machine check");
  	printf("Write timeout");
  	(*UNIvec[0])();
- #ifdef VAX750
- 	(*UNI1vec[0])();
- #endif
  	ubaerror(0, (struct uba_hd *)0, 0, 0, (struct uba_regs *)0);
  	cnrint(0);
  	cnxint(0);
  	consdin();
  	consdout();

--- 55,64 -----
  	 * Routines called from interrupt vectors.
  	 */
  	panic("Machine check");
  	printf("Write timeout");
  	(*UNIvec[0])();
  	ubaerror(0, (struct uba_hd *)0, 0, 0, (struct uba_regs *)0);
  	cnrint(0);
  	cnxint(0);
  	consdin();
  	consdout();
-----------------------------------------

Charles Perkins
Logic Design Systems

thomson@utcsrgv.UUCP (Brian Thomson) (11/12/83)

We have taken Charles Perkins (tekgds!charliep) 4.1BSD mods posted
to this newsgroup Oct 1 and used them to produce a 2-unibus 750 /vmunix.
For anyone else contemplating this we offer the following errata:

The mods did not mention changing ../sys/scb.s to declare the
second unibus interrupt vectors.  Just add a declaration of _UNI1vec
after that of UNIvec.

In file ../h/ubareg.h, change
	#define	NUBA750	1
to
	#define NUBA750 2
and change
	#if VAX780
	#define	MAXNUBA	4
	#else
	#define	MAXNUBA	1
	#endif
to
	#if VAX780
	#define	MAXNUBA	4
	#else
	#if VAX750
	#define MAXNUBA 2
	#else
	#define MAXNUBA	1
	#endif
	#endif
This should cause assym.s to be regenerated, but the makefile
doesn't realize that assym.s depends on ubaregs.h, so you should
add that dependency.

Finally, the mods as posted will not permit you to generate a generic
unix that handles more than 2 unibuses on a 780.  A well placed
	if(cpu == VAX_750)
in autoconf.c/unifind() will fix that.
-- 
			Brian Thomson,	    CSRG Univ. of Toronto
			{linus,ihnp4,uw-beaver,floyd,utzoo}!utcsrgv!thomson