Subject: Partial RP07 support (#136)
Index:	pdpuba/{hpreg.h,xp.c} etc/disktab 2.11BSD

Description:
	Support for the RP07 was missing from 2.11BSD.  The support
	added by the 4 patches below is called "partial" because
	the bootblocks and standalone 'xp' driver have not been
	modified (yet), thus is it possible to use an RP07 as a 
	data/user-files disk but not boot the kernel from an RP07.

	There was also a bug (introduced in version 1.6) in the xpsize() 
	routine:  the drive number rather than the partition number
	is extracted when determining the size of a partition.

Repeat-By:
	Examination.  Or attach a RP07 to the system and note that
	it is not useable.

Fix:
	Apply the patches below.  Recompilation of the kernel is not
	necessary at this time unless you have an immediate need to
	use an RP07.

	Many thanks to Johnny Billquist (bqt@knase.update.uu.se) for
	providing the changes below.

	Unshar the file below into /tmp and then:

		patch -p0 < /tmp/1
		patch -p0 < /tmp/5
		patch -p0 < /tmp/6
		patch -p0 < /tmp/14
---------------------------------cut here---------------------------
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
#	1
#	5
#	6
#	14
# This archive created: Fri Jul  2 19:45:06 1993
export PATH; PATH=/bin:/usr/bin:$PATH
if test -f '1'
then
	echo shar: "will not over-write existing file '1'"
else
sed 's/^X//' << \SHAR_EOF > '1'
X*** /etc/disktab.old	Fri Jan  1 17:53:02 1993
X--- /etc/disktab	Thu Jul  1 19:52:35 1993
X***************
X*** 99,104 ****
X--- 99,116 ----
X  	:pg#171798:bg#1024:fg#1024:\
X  	:ph#340522:bh#1024:fh#1024:
X  
X+ rp07|RP07|DEC RP07:\
X+ 	:ty=winchester:ns#50:nt#32:nc#630:sf:\
X+ 	:b0=/mdec/hpuboot:\
X+ 	:pa#19200:ba#1024:fa#1024:\
X+ 	:pb#51200:bb#1024:fb#1024:\
X+ 	:pc#1006400:bc#1024:fc#1024:\
X+ 	:pd#320000:bd#1024:fd#1024:\
X+ 	:pe#320000:be#1024:fe#1024:\
X+ 	:pf#296000:bf#1024:ff#1024:\
X+ 	:pg#936000:bg#1024:fg#1024:\
X+ 	:ph#1006400:bh#1024:fh#1024:
X+ 
X  rm2x|160|fuji|fuji160|Fujitsu 160:\
X  	:ty=winchester:ns#32:nt#10:nc#823:sf:\
X  	:b0=/mdec/si94uboot:\
SHAR_EOF
fi
if test -f '5'
then
	echo shar: "will not over-write existing file '5'"
else
sed 's/^X//' << \SHAR_EOF > '5'
X*** /usr/src/sys/pdpuba/xp.c.old	Thu Jul  1 20:10:10 1993
X--- /usr/src/sys/pdpuba/xp.c	Thu Jul  1 20:04:15 1993
X***************
X*** 3,9 ****
X   * All rights reserved.  The Berkeley software License Agreement
X   * specifies the terms and conditions for redistribution.
X   *
X!  *	@(#)xp.c	1.6 (2.11BSD GTE) 4/27/93
X   */
X  
X  /*
X--- 3,9 ----
X   * All rights reserved.  The Berkeley software License Agreement
X   * specifies the terms and conditions for redistribution.
X   *
X!  *	@(#)xp.c	1.7 (2.11BSD GTE) 7/1/93
X   */
X  
X  /*
X***************
X*** 12,17 ****
X--- 12,18 ----
X   * controllers.  If XP_PROBE is defined, it includes a probe routine that
X   * will determine the number and type of drives attached to each controller;
X   * otherwise, the data structures must be initialized.
X+  * Added RP07.  /BQT 930612
X   *
X   * For simplicity we use hpreg.h instead of an xpreg.h.
X   * The bits are the same.
X***************
X*** 178,183 ****
X--- 179,193 ----
X  	      0,	  0,	/* f: Not Defined */
X  	 171798,	  0,	/* g: cyl   0 - 410, whole RP04/05 */
X  	 340670,	  0,	/* h: cyl   0 - 814, whole RP06 */
X+ }, rp_sizes[8] = { /* RP07 */
X+ 	  19200,	  0,	/* a: cyl   0 - 11 */
X+ 	  51200,	 12,	/* b: cyl  12 - 43 */
X+ 	1008000,	  0,	/* c: cyl   0 - 629, whole RP07 */
X+ 	 320000,	 44,	/* d: cyl  44 - 243 */
X+ 	 320000,	244,	/* e: cyl 244 - 443 */
X+ 	 297600,	444,	/* f: cyl 444 - 629 */
X+ 	 937600,	 44,	/* g: cyl  44 - 629 */
X+ 	1008000,	  0,	/* h: cyl   0 - 629, whole RP07 */
X  }, rm_sizes[8] = { /* RM02/03 */
X  	   9600,	  0,	/* a: cyl   0 -  59 */
X  	   9600,	 60,	/* b: cyl  60 - 119 */
X***************
X*** 256,261 ****
X--- 266,272 ----
X  	{ RP04, HP_SECT,   HP_TRAC,   RP04_CYL, hp_sizes,   0 },
X  	{ RP05, HP_SECT,   HP_TRAC,   RP04_CYL, hp_sizes,   0 },
X  	{ RP06, HP_SECT,   HP_TRAC,   RP06_CYL, hp_sizes,   0 },
X+ 	{ RP07, RP7_SECT,  RP7_TRAC,  RP7_CYL,  rp_sizes,   0 },
X  	{ RM02, RM_SECT,   RM_TRAC,   RM_CYL,   rm_sizes,   XP_NOCC },
X  	{ RM03, RM_SECT,   RM_TRAC,   RM_CYL,   rm_sizes,   XP_NOCC },
X  	{ RM05, RM5_SECT,  RM5_TRAC,  RM5_CYL,  rm5_sizes,  XP_NOCC },
X***************
X*** 1102,1107 ****
X  	register struct xp_drive *xd;
X  
X  	xd = &xp_drive[xpunit(dev)];
X! 	return(xd->xp_sizes[xpunit(dev)].nblocks);
X  	}
X  #endif NXPD
X--- 1113,1118 ----
X  	register struct xp_drive *xd;
X  
X  	xd = &xp_drive[xpunit(dev)];
X! 	return(xd->xp_sizes[dev & 7].nblocks);
X  	}
X  #endif NXPD
SHAR_EOF
fi
if test -f '6'
then
	echo shar: "will not over-write existing file '6'"
else
sed 's/^X//' << \SHAR_EOF > '6'
X*** /usr/src/sys/pdpuba/hpreg.h.old	Thu Jan  5 21:46:20 1989
X--- /usr/src/sys/pdpuba/hpreg.h	Thu Jul  1 19:52:33 1993
X***************
X*** 9,14 ****
X--- 9,15 ----
X  /*
X   * Definitions for SMD-type disk drives and drivers.  That includes
X   * RM02/03/05's, RP04/05/06's, and everything using the XP driver.
X+  * Also added RP07. /BQT 930612
X   */
X  
X  /*
X***************
X*** 17,22 ****
X--- 18,24 ----
X  #define	RP04	020		/* RP04 */
X  #define	RP05	021		/* RP05 */
X  #define	RP06	022		/* RP06 */
X+ #define RP07	042		/* RP07 */
X  #define	RM03	024		/* RM03 */
X  #define	RM02	025		/* RM02 */
X  #define	RM05	027		/* RM05 or SI 9500, CDC 9766 */
X***************
X*** 38,43 ****
X--- 40,49 ----
X  #define	RP04_CYL	411	/* RP04/05 */
X  #define	RP06_CYL	815	/* RP06 */
X  
X+ #define RP7_SECT	50	/* DEC RP07 */
X+ #define RP7_TRAC	32
X+ #define RP7_CYL		630
X+ 
X  #define	RM_SECT		32	/* RM02/03 */
X  #define	RM_TRAC		5
X  #define	RM_CYL		823
X***************
X*** 175,187 ****
X  #define	HPDS_DPR	0000400		/* drive present */
X  #define	HPDS_DRY	0000200		/* drive ready */
X  #define	HPDS_VV		0000100		/* volume valid */
X! /* bits 5-1 are spare */
X  #define	HPDS_OM		0000001		/* offset mode */
X  
X  #define	HPDS_DREADY	(HPDS_DPR|HPDS_DRY|HPDS_MOL|HPDS_VV)
X  
X  #define	HPDS_BITS \
X! "\10\20ATA\17ERR\16PIP\15MOL\14WRL\13LST\12DAE\11DPR\10DRY\7VV\1OM"
X  
X  /* hper1 */
X  #define	HPER1_DCK	0100000		/* data check */
X--- 181,194 ----
X  #define	HPDS_DPR	0000400		/* drive present */
X  #define	HPDS_DRY	0000200		/* drive ready */
X  #define	HPDS_VV		0000100		/* volume valid */
X! /* bits 5-3, 1 are spare */
X! #define HPDS_ILV	0000004		/* interleaved */
X  #define	HPDS_OM		0000001		/* offset mode */
X  
X  #define	HPDS_DREADY	(HPDS_DPR|HPDS_DRY|HPDS_MOL|HPDS_VV)
X  
X  #define	HPDS_BITS \
X! "\10\20ATA\17ERR\16PIP\15MOL\14WRL\13LST\12DAE\11DPR\10DRY\7VV\3ILV\1OM"
X  
X  /* hper1 */
X  #define	HPER1_DCK	0100000		/* data check */
X***************
X*** 218,223 ****
X--- 225,231 ----
X  #define	HPDT_RM02	0000025		/* rm02, possibly rm03? */
X  #define	HPDT_RM03	0000024		/* rm03 */
X  #define	HPDT_RP06	0000022		/* rp06 */
X+ #define HPDT_RP07	0000042		/* rp07 */
X  
X  /* hpof */
X  #define	HPOF_FMT22	0010000		/* 16 bit format */
SHAR_EOF
fi
if test -f '14'
then
	echo shar: "will not over-write existing file '14'"
else
sed 's/^X//' << \SHAR_EOF > '14'
X*** /usr/src/sys/pdpdist/disktab.old	Fri Jan  1 17:53:02 1993
X--- /usr/src/sys/pdpdist/disktab	Thu Jul  1 19:52:35 1993
X***************
X*** 99,104 ****
X--- 99,116 ----
X  	:pg#171798:bg#1024:fg#1024:\
X  	:ph#340522:bh#1024:fh#1024:
X  
X+ rp07|RP07|DEC RP07:\
X+ 	:ty=winchester:ns#50:nt#32:nc#630:sf:\
X+ 	:b0=/mdec/hpuboot:\
X+ 	:pa#19200:ba#1024:fa#1024:\
X+ 	:pb#51200:bb#1024:fb#1024:\
X+ 	:pc#1006400:bc#1024:fc#1024:\
X+ 	:pd#320000:bd#1024:fd#1024:\
X+ 	:pe#320000:be#1024:fe#1024:\
X+ 	:pf#296000:bf#1024:ff#1024:\
X+ 	:pg#936000:bg#1024:fg#1024:\
X+ 	:ph#1006400:bh#1024:fh#1024:
X+ 
X  rm2x|160|fuji|fuji160|Fujitsu 160:\
X  	:ty=winchester:ns#32:nt#10:nc#823:sf:\
X  	:b0=/mdec/si94uboot:\
SHAR_EOF
fi
exit 0
#	End of shell archive
