Subject: Re: RD disk media IDs
To: None <port-vax@netbsd.org>
From: Sergey Svishchev <svs@ropnet.ru>
List: port-vax
Date: 10/19/1998 00:02:24
On Sun, Oct 18, 1998 at 11:02:29AM +0200, Tom Ivar Helbekkmo wrote:

> parameters figured out, but I need to know what the proper media IDs
> are for the various disks.  They're supposed to be rather large
> numbers that DEC disk drivers read from the disk to discover what type
> of disk it is.  For instance, I read somewhere that for the RD51 it is
> supposed to be 627327027.
> 
> Anyone have a list of these?  Source code to read where they're used?

>From sys/arch/vax/mscp/mscp.h:

/*
 * Macros to break up and build media IDs.  An ID encodes the port
 * type in the top 10 bits, and the drive type in the remaining 22.
 * The 10 bits, and 15 of the 22, are in groups of 5, with the value
 * 0 representing space and values 1..26 representing A..Z.  The low
 * 7 bits represent a number in 0..127.  Hence an RA81 on a UDA50
 * is <D><U><R><A>< >81, or 0x25641051.  This encoding scheme is known
 * in part in uda.c.
 *
 * The casts below are just to make pcc generate better code.
 */
#define	MSCP_MEDIA_PORT(id)	(((long)(id) >> 22) & 0x3ff)	/* port */
#define	MSCP_MEDIA_DRIVE(id)	((long)(id) & 0x003fffff)	/* drive */
#define	MSCP_MID_ECH(n, id)	(((long)(id) >> ((n) * 5 + 7)) & 0x1f)
#define	MSCP_MID_CHAR(n, id) \
	(MSCP_MID_ECH(n, id) ? MSCP_MID_ECH(n, id) + '@' : ' ')
#define	MSCP_MID_NUM(id)	((id) & 0x7f)
/* for, e.g., RA81 */
#define	MSCP_MKDRIVE2(a, b, n) \
	(((a) - '@') << 17 | ((b) - '@') << 12 | (n))
/* for, e.g., RRD50 */
#define	MSCP_MKDRIVE3(a, b, c, n) \
	(((a) - '@') << 17 | ((b) - '@') << 12 | ((c) - '@') << 7 | (n))

-- 
Sergey Svishchev -- svs{at}ropnet{dot}ru