USG_PG3/usr/source/head/elog.h

/*
 * "True" major device numbers for block devices.
 * Used for error logging purposes only.
 */

#define RK	0
#define RP	1
#define RF	2
#define TM	3
#define TC	4
#define HP	5
#define HT	6
#define HS	7

/*
 * IO statistics are kept for each physical unit of each block
 * device. Primary purpose is to establish a guesstimate
 * of error rates during error logging.
 */

struct iostat {
	long	io_ops;			/* number of read/writes */
	long	io_misc;		/* number of "other" operations */
	int	io_unlog;		/* number of unlogged errors */
};

/*
 * Template for the system configuration information
 * that is placed in the error log startup record.
 */

struct econfig {
	int	e_bconf;		/* block device configuration */
	int	e_cconf;		/* character device configuration */
};

/*
 * Error log startup record template.
 */

struct estart {
	int	e_type;			/* error log record type */
	long	e_ctime;		/* current time */
	int	es_cpu;			/* type of cpu */
	int	es_mmr3;		/* contents of Mem Mgmt Reg 3 */
	char	es_nbdev;		/* number of block devices */
	char	es_ncdev;		/* number of character devices */
	struct	econfig es_conf;	/* device configuration for system */
};

/*
 * Error log termination record template.
 */

struct eend {
	int	e_type;			/* error log record type */
	long	e_ctime;		/* current time */
};

/*
 * Error log time change record template.
 */

struct etchg {
	int	e_type;			/* error log record type */
	long	e_ctime;		/* current time */
	long	e_ntime;		/* "new" time */
};

/*
 * Error log block device record template.
 */

struct eblock {
	int	e_type;			/* error log record type */
	long	e_ctime;		/* current time */
	int	e_dev;			/* "true" major + minor device numbers */
	struct	iostat e_stat;		/* IO statistics to date for this unit */
	int	e_bacty;		/* other active block devices */
	int	e_cacty;		/* other active character devices */
	char	e_rtry;			/* number of retries */
	char	e_nreg;			/* number of device registers logged */
	int	e_rloc;			/* starting address of device registers */
	int	eb_bflg;		/* buffer header flags */
	int	eb_wcnt;		/* buffer header word count */
	long	eb_maddr;		/* buffer memory address */
	int	eb_bno;			/* block number on logical device */
};

/*
 * Error log message types
 */

#define E_NOACK	64

#define E_GO	010			/* startup record number */
#define E_STOP	011			/* stop record number */
#define E_TCHG	012			/* time change record number */

#define E_TYPE	060			/* device type mask */
#define E_BLK	020			/* block device error record number */
#define E_CHR	040			/* character device error record number */
#define E_CPU	060			/* cpu error record number */
#define E_RH70	0100			/* device uses RH controller */

#define E_FIRST	0
#define E_RETRY	1
#define E_EARLY	2

/*
 * Device error table.
 * Keeps information precious to the error logging routines.
 */

struct errtab {
	char	e_devtyp;		/* type of device*/
	char	e_nunit;		/* number of physical units */
	int	e_devnum;		/* "true" major + minor device number */
	struct	iostat *e_iostat;	/* IO statistics array for this device */
	struct	iostat *e_aunit;	/* IO statistics for currently active unit */
	int	*e_emsg;		/* pointer to error record message */
};

/*
 * Macro for initializing the errtab
 */

#define etabinit(typ,nu,dn,is)	typ,nu,(dn<<8),is,0,0