DataMuseum.dk

Presents historical artifacts from the history of:

Regnecentalen RC-900

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Regnecentalen RC-900

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download

⟦60d176c06⟧ TextFile

    Length: 7491 (0x1d43)
    Types: TextFile
    Notes: UNIX file
    Names: »hd.h«

Derivation

└─⟦a6ab2eb36⟧ Bits:30004042/kconfig3.imd SW95705I 386/ix Multi-user Release 1.2
└─⟦a6ab2eb36⟧ UNIX Filesystem
    └─⟦this⟧ »kc/new/usr/include/sys/hd.h« 

TextFile

/*
 * PC AD Hard disk controller definitions.
 */

/*
 * Copyrighted as an unpublished work.
 * (c) Copyright 1986 INTERACTIVE Systems Corporation
 * All rights reserved.
 *
 * RESTRICTED RIGHTS
 *
 * These programs are supplied under a license.  They may be used,
 * disclosed, and/or copied only as permitted under such license
 * agreement.  Any copy must contain the above copyright notice and
 * this restricted rights notice.  Use, copying, and/or disclosure
 * of the programs is strictly prohibited unless otherwise provided
 * in the license agreement.
 */

#ident "@(#)hd.h	1.4 - 87/11/04"

#define AD0     0x1F0   /* base for hard controller I/O port addresses */
#define FDR     0x3F6   /* I/O port address for fixed disk register */

/*
 * Bit 3 of the fixed disk register must be set to 1 to access heads
 * 8 - 15 of a hard disk on a stock AT controller.
 */
#define	AD_EXTRAADS	0x08	/* set into FDR to access high disk heads */
#define	AD_NOEXTRAADS	0x00	/* set into FDR if no high disk heads */
#define AD_INTRDISAB    0x02    /* set into FDR to disable interrupts */
#define AD_CTLRESET     0x04    /* set into FDR for 10 microsec to reset */

/*
 * port offsets from base above.
 */
#define	AD_DATA		0x00	/* data register */
#define	AD_ERROR	0x01	/* error register/write precomp */
#define	AD_PRECOMP	0x01	/* error register/write precomp */
#define	AD_NSECT	0x02	/* sector count */
#define	AD_SECT		0x03	/* sector number */
#define	AD_LCYL		0x04	/* cylinder low byte */
#define	AD_HCYL		0x05	/* cylinder high byte */
#define	AD_DRV		0x06	/* drive/head register */
#define	AD_STATUS	0x07	/* status/command register */
#define	AD_CMD		0x07	/* status/command register */

/*
 * Status bits
 */
#define	BUSY		0x80	/* controller busy */
#define	READY		0x40	/* drive ready */
#define	WRFAULT		0x20	/* write fault */
#define	SEEKDONE	0x10	/* seek operation complete */
#define	DATARQ		0x08	/* data request */
#define	ECC		0x04	/* ECC correction applied */
#define	INDEX		0x02	/* disk revolution index */
#define ERROR		0x01	/* error flag */

/*
 * Drive selectors
 */
#define	AD_DHFIXED	0xa0	/* bits always set in drive/head reg. */
#define	AD_DRIVE0	0x00	/* or into AD_DHFIXED to select drive 0 */
#define	AD_DRIVE1	0x10	/* or into AD_DHFIXED to select drive 1 */

/*
 * Hard disk commands. 
 */
#define	AD_RESTORE	0x10	/* restore cmd, bottom 4 bits set step rate */
#define	AD_SEEK		0x70	/* seek cmd, bottom 4 bits set step rate */
#define	AD_RDSEC	0x20	/* read sector cmd, bottom 2 bits set ECC and
					retry modes */
#define	AD_WRSEC	0x30	/* write sector cmd, bottom 2 bits set ECC and
					retry modes */
#define	AD_FORMAT	0x50	/* format track command */
#define	AD_RDVER	0x40	/* read verify cmd, bot. bit sets retry mode */
#define	AD_DIAG		0x90	/* diagnose command */
#define	AD_SETPARAM	0x91	/* set parameters command */
#define AD_SPECIAL      0xf0    /* Adaptec 'special command' (below) */
#define AD_READPARMS    0xec    /* WD1005-WAH Read Parameters command */

/*
 * Adaptec special commands -- these values are written to the AD_PRECOMP
 * register before an AD_SPECIAL command is issued.
 */

#define ADS_MODESEL     0x15    /* Mode Select */
#define ADS_MODESENSE   0x1a    /* Mode Sense */
#define ADS_RDBUF       0x1e    /* Read Data Buffer */
#define ADS_WRBUF       0x1f    /* Write Data Buffer */
#define ADS_RDSENSE     0x20    /* Read Sense Data */
#define ADS_RDRES       0x21    /* Read Reserved Sectors */
#define ADS_WRRES       0x22    /* Write Reserved Sectors */
#define ADS_FMTRES      0x23    /* Format Reserved Track */
#define ADS_SAVCMD      0x24    /* Save Command */
#define ADS_RETCMD      0x25    /* Retrieve Command */
#define ADS_UPDSTAT     0x26    /* Update Status Register */

#define NUMDRV  2	/* maximum number of drives */
#define SECSIZE 512	/* default sector size */
#define SECSHFT 9
#define SECMASK (SECSIZE-1)
#define cylin   av_back

/* Values of ad_state */
#define AD_OPEN		0x01	/* drive is open */
#define AD_OPENING	0x02	/* drive is being opened */
#define AD_DO_RST	0x04	/* hardware restore command should be issued */
#define AD_DO_FMT	0x08	/* track is being formatted */
#define AD_VTOC_OK	0x10	/* VTOC (pdinfo, vtoc, alts table) OK */
#define AD_FMT_RST	0x20	/* restore needs to happen before format */
#define AD_BADBLK	0x40	/* bad block is being remapped */

/*
 * the hard disk minor device number is interpreted as follows:
 *     bits:
 *	 7 5 4 3  0
 * 	+---+-+----+
 * 	|   |u|part|
 * 	+---+-+--+-+
 *     codes:
 *	u     - unit no. (0 or 1)
 *	part  - partition no. (0 - 15)
 */
#define PARTITION(x)	(minor(x) & 0x0F)
#define UNIT(x)		((minor(x) >> 4) & 0x01)
#define BASEDEV(x)	(dev_t)((x) & ~0x0F)

/*
 * Logical blocks to physical blocks
 */
#define lbtopb(lb) (((lb) << BSHIFT) >> SECSHFT)
#define pbtolb(pb) (((pb) << SECSHFT) >> BSHIFT)

/*
 * controller interface templates
 */
struct AD_cmd {
	unsigned char nad_precomp;	/* write precomp */
        unsigned char nad_nsect; /* decremented during operation - 0 == 256 */
	unsigned char nad_sect;                   /* starting sector number */
	unsigned int  nad_cyl;                      /* up to 1024 cylinders */
	/*
	 * must have
	 *	bit	7	1
	 *	bit	6	0
	 *	bit	5	1
	 *	bit	4	drive number
	 *	bits  3-0	head number
	 */
	unsigned char nad_drv;
	unsigned char nad_cmd;
};

/*
 * r3, r2, r1, r0 is stepping rate:
 *	0		 .35 micro-seconds
 *	1		 .5	milli-seconds
 *	2		1.0	milli-seconds
 *	2		1.0	milli-seconds
 *	.
 *	.
 *	.
 *	15		7.5	milli-seconds
 */

/*
 * bit	definition		value
 *			0			1
 * L	data mode	data only		data plus 4 byte ECC
 * T	retry mode	retries enabled		retries disabled
 */

/*
 * operational mode
 */
#define	DAM_NOT_FOUND	0x01
#define	TR000_ERR	0x02
#define	ABORTED		0x04
#define	ID_NOT_FOUND	0x10
#define	ECC_ERR		0x40
#define	BAD_BLK		0x80

/*
 * Structure to hold disk geometry parameters.
 * Information is copied from PC AT ROM BIOS.
 */
struct diskparam {
	short	dp_ncyl;	/* number of cylinders */
	short	dp_nhead;	/* number of heads */
	short	dp_wprecmp;	/* write precomp cylinder */
	short	dp_lz;		/* landing zone cylinder */
	short	dp_nsect;	/* sectors per track */
};

/*
 * Mode Select/Sense Buffer
 */
struct  admsbuf {
	unsigned char   adms_valid;     /* Must be 0x02 to be valid sense */
	unsigned char   adms_cylh;      /* High byte of number of cyls */
	unsigned char   adms_cyll;      /* Low byte of number of cyls */
	unsigned char   adms_nhds ;     /* head count */
	unsigned char   adms_nsect;     /* sector count per track */
	unsigned char   adms_rsrvd[4];  /* future space */
	unsigned char   adms_flags;     /* see below */
	unsigned char   adms_jumps;     /* jumpers installed on board */
	unsigned char   adms_secovhd;   /* # bytes of overhead per sector */
	} ;

#define ADMS_VALID      0x02            /* to check/set adms_valid byte */
#define RLL_NSECS       26              /* number of sectors/track for RLL */

/* flags from adms_flags */

#define ADMSF_VMS       0x80    /* Valid Mode Select */
#define ADMSF_VAC       0x40    /* Valid Auto-Configuration */
#define ADMSF_SKEW      0x20    /* Skew first sector in tracks */
#define ADMSF_CIDMSK    0x07    /* Mask to get Controller ID (below) */

/* Adaptec controller ID's */

#define ADCID_IBM       0       /* Stock IBM AT controller (not adaptec) */
#define ADCID_ESDI      1       /* "Norton" ESDI controller */
#define ADCID_RLL       2       /* "Eddie" RLL controller */
#define ADCID_ARLL      3       /* "Casper" ARLL controller */