/*	@(#)txinfo.h	13.5 (RC International) 91/09/06	*/

/*
 *  txinfo.h -- rpu-upu common area
 *
 *  NOTE:  if you add items to the txinfo structure, add them
 *	   immediately before one of the three tx_reserved areas and
 *	   then decrease the size of the reserved area by an amount
 *	   equal to what you add!
 *  NOTE:  if you delete items from the txinfo structure, replace them
 *	   with a reserved area of the same size.
 *  NOTE:  The word 'please' is intentionally left out in the above notes.
 */

#ifdef	LANGUAGE_C


#ifndef	DST_NONE
#include <sys/time.h>
#endif	DST_NONE

#ifndef	SHMLBA
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/sem.h>
#endif	SHMLBA


#endif	LANGUAGE_C

#define	TXINFO_MAGIC		777122750

#ifdef	LANGUAGE_C
/*
 *  Customer changeable configuration and upu<->rpu common.
 */

struct txinfo
{
    /*
     *  The following entries are system parameters (constants);
     *  and may be edited by the customers.
     */

    short			tx_nep;		/* number of endpoints */
    short			reserved4;	/* unused - was: no of ports */
    short			tx_bpercent;	/* percent(phys mem) for bufs */
    short			tx_hz;		/* hertz */
    short			tx_tick;	/* tick */
    short			tx_nquota;	/* number of quotas */
    short			tx_ndquota;	/* number of disk quotas */
    short			tx_npty;	/* number of pty's */
    int				tx_ntext;	/* number of text segments */
    int				tx_nproc;	/* number of processes */
    int				tx_ninode;	/* number of inodes */
    int				tx_nfile;	/* number of open files */
    int				tx_ncallout;	/* number of callouts */
    int				tx_nclist;	/* number of clists */
    struct timezone		tx_tz;		/* time zone */
    struct shminfo		tx_shminfo;	/* SYSV shared memory info */
    int				tx_nshmsema;	/* number of mem board sema. */
					/* should be in shminfo (compat.)*/
    struct seminfo		tx_seminfo;	/* SYSV semaphore info */
    caddr_t			tx_customer;	/* customer's table pointer */
    int				tx_timeout;	/* timeout value (seconds) */
    struct uid_queue		*tx_async_io_q;	/* queues to do async io done */
    struct inode		*tx_connection_head;
						/* head of connection inodes */
    UID_T			tx_cache_daemon_uid;
						/* uid of cache uid_queue */	
    char			*tx_panic_rpu;	/* rpu panic string */

    int				tx_mxipc_opens;	/* max # opens per MXIPC file */
    int				tx_timeout_reopen;
						/* reopen timeout value (sec) */
    int				tx_nuproc;	/* max processes per process */
    char			reserved1[96];	/* reserved for future use */

    /*
     *  The following entries are NOT customer settable.
     *  They are addresses needed by both the upu and the rpu.
     *  The addresses are set up by the upu unless otherwise noted.
     */

    short			tx_maxslp;	/* # sec's to very swappable */
    short			tx_XXNSWAP;	/* was tx_nswap (see below) */
    short			tx_dmmin;	/* min. # disk pages (swap) */
    short			tx_dmmax;	/* max. # disk pages (swap) */
    short			tx_dmtext;	/* text pages (swap) */
    short			tx_dmshm;	/* shared memory (swap) */
    short			tx_nstty_buf;	/* # of short.tty buffers */
    short			tx_nltty_buf;	/* # of long.tty buffers */
    short			tx_minus_s;	/* -s /txload argument */
    int				tx_ecmx;	/* last core map entry */
#ifdef	FLOAT
    double			tx_ccpu;	/* cpu quanta */
    double			tx_avenrun[3];	/* load average */
#else	FLOAT
    int				tx_ccpu;	/* cpu quanta */
    int				tx_avenrun[3];	/* load average */
    int				tx_avenscale;	/* scale factor for avenrun */
#endif	FLOAT
    char			*tx_version;	/* version string */
    int				tx_upuvers;	/* upu os version # */
    int				tx_rpuvers;	/* rpu os version # */
    int				tx_rtevers;	/* rte (rpu) os version # */
    struct timeval		tx_boottime;	/* time system came up */
    char			*tx_panic;	/* panic string */
    int				reserved1b;	/* not used: old tx_debug */
    int				tx_nswap;	/* # DEV_BSIZE swap blocks */
    u_int			*tx_panicregs;	/* upu regs saved on panic */
    int				reserved1a;	/* was tx_Ptb0_base */
    int				tx_upu_physmem;	/* # bytes upu phys memory */
    struct cmap			*tx_ecmap;	/* end core map table */
    caddr_t			tx_common;	/* start of common UPU/RPU memory */
    caddr_t			tx_common_end;	/* end of common memory */
    int				(*tx_cgetp)();	/* for diagnostics */
    int				(*tx_cfreep)();	/* for diagnostics */
    int				tx_tr_enabled;	/* 1 if active coordinator */
    int				tx_avefree;	/* average free memory */
    char			tx_watchdog;	/* watchdog timer */
    char			tx_virtual_swap;/* != 0 if virtual swp used */
    u_short			tx_panicflag;	/* panic flags */
    struct inode		*tx_acctp;	/* accounting inode pointer */
    struct rwlock		*tx_subpurw;	/* subpu list r/w-lock */
    struct comm_subpu		**tx_subpuinfo;	/* subpu list */
    struct txstats		*tx_stats;	/* misc tx statistics */
    int				tx_mxipc_hwm;	/* high water mark */
    int				tx_mxipc_lwm;	/* low water mark */
    struct mxipc_info		**tx_mxipc;	/* mxipc hash table */
    struct txipc_info		*tx_ipcinfo;	/* txipc shared stuff */
    struct mxipc_fc		*tx_mxipc_fc;	/* mxipc flow control list */
    int				tx_mxipc_bytes;	/* mxipc total bytes */
    struct kprof		*tx_rte_kprof;	/* rte profiling info */
    struct trace_info		*tx_trace_info;	/* tx trace facility info */
    struct txqueue		*tx_rdnoilock_service_q;
						/* rpu/upu io queue comm. */
    struct IMCsysinfo		*tx_imcnameinfo;/* A chain with all IMC names*/
    int				tx_byte_lock_count;
						/* current nuber of byte 
						   locks */
    caddr_t			tx_uarea_addr;	/* virtual address of u. */
    struct dlock_info		*tx_dlock_log;	/* lock deadlock log table */
    int				tx_max_locks_sbb; /* maximun number of block
						     and file locks allowed
						     on this PU */
    int				tx_num_locks_sbb; /* current number of block
						     and file locks allowed
						     on this PU */
    char			reserved2[4];	/* reserved for future use */

    int				tx_nbuf;	/* number of buffers */
    struct log_client_info	*tx_log_clients;/* log manager */

						/* buffer manager tables */
    struct buflinksonly		*tx_bufhash;
    struct buflinksonly		*tx_buf_avail_list;
    spin_t			*tx_buf_avail_lock;
    struct io_wait_entry	*tx_io_wait_table;
    int				tx_io_wait_next;

						/* transaction coordinator */
    UID_T			tx_tr_coord_uid;
    struct trhshdr		*tx_trhash;

    struct inode		*tx_swapvol;	/* initial swap volume */
    UID_T			tx_swpq_uid;	/* swap I/O server */
    struct txqueue		*tx_io_service_q;
						/* rpu/upu io queue comm. */
    u_int			tx_my_pu_id;	/* local short pu id */
    u_int			tx_log_net_id;	/* logical net id */
    UID_T			tx_fxq_uid;	/* file system mount server */
    struct txqueue_info		*tx_txqueue;	/* tx queues & semaphores */
    struct cs_info		*tx_csinfo;	/* connection system */
    struct cmem_info		*tx_cmeminfo;	/* typed mem allocator */
    struct rteinfo		*tx_rteinfo;	/* RTEINFO stuff */
    struct fxinfo		*tx_fxinfo;	/* file system */
    struct semaphore		*tx_trlock;	/* transaction table */

						/* lock manager tables */
    struct lock			**tx_los;	/* lock hash table */
    struct w_node		**tx_nodes;	/* wait-for graph hash table */

						/* resource manager tables */
    struct bufhdr		*tx_buf_hdrs;	/* buffer headers */
    struct file			*tx_file;	/* file table */
    struct proc			*tx_proc;	/* process table */
    struct text			*tx_text;	/* text table */
    struct cblock		*tx_cfree;	/* free clist table */
    struct callout		*tx_callout;	/* callout table */
    struct map			*tx_argmap;	/* arg map table */
    struct map			*tx_swapmap;	/* swap map table */
    struct map			*tx_kernelmap;	/* kernel map table */
    struct cmap			*tx_cmap;	/* core map table */
    struct inode		*tx_inode;	/* inode table */
    struct quota		*tx_quota;	/* quota table */
    struct dquot		*tx_dquota;	/* disk quota table */
    struct msgbuf		*tx_msgbuf;	/* message buffer */
						
						/* device driver tables */
    struct tape_drive		*tx_tapeinfo;	/* tape drive table */
    struct disk_drive		*tx_diskinfo;	/* disk drive table */

    struct disk_stats		*tx_diskstats;	/* disk drive stats */
    int				*tx_diskbusy;	/* disk busy bit array */

						/* SYSV shared memory tables */
    struct shmid_ds		*tx_shmem;	/* ptr (->) to shm id structs */
    struct shmsema_id		*tx_shmsema;	/* ptr to mem board semaphores*/
    struct shmstat		*tx_shmstat;	/* ptr to shm stat struct */

						/* SYSV semaphore tables */
    struct semid_ds		*tx_sema;	/* -> to sem id structs */
    struct sem			*tx_sem;	/* -> to sem structs */
    struct map			*tx_semmap;	/* -> to sem map */
    struct sem_undo		**tx_sem_undo;	/* -> to sem undo ptr struct */
    struct sem_undo		*tx_semu;	/* -> to op adj on exit table */

						/* Profiling tables */
    struct kprof		*tx_upu_kprof;	/* upu profiling info */
    struct kprof		*tx_rpu_kprof;	/* rpu profiling info */
    struct txqueue		*tx_io_fast_service_q;	
						/* rpu/upu io queue comm. */
    struct vmstat_info		*tx_vmstat_info;/* ptr to vm stat info */
    struct semaphore		*tx_log_list_lock;
						/* lock for log list */
    struct log_status		*tx_log_status_list;
						/*  list of log structures */

    struct timeval		tx_time;	/* the time of day */
    struct txqueue		*tx_alloc_service_q;
						/* uid to get io allocation */
    struct inode		*tx_trmgr_lvp;	/* NULL, or coordinator lvp  */
    spin_t			tx_refcntlock;	/* for mbuf reference counts */
    struct prochshdr		*tx_proclock;	/* for proc lock table */
    u_int			*tx_firstfree;	/* for mbuf reference counts */

    struct net_stat		*tx_net_stat;	/* network statistics info */
    struct tcp_debug		*tx_tcp_debug;	/* tcp debugging table */
    int				*tx_tcp_debx;	/* tcp debugging index */

    struct devinfo		**tx_devinfo;	/* Device info table */
    struct semaphore		*tx_devinfo_sem;/* Lock for tx_devinfo tbl */
    struct raw_head		*tx_raw_head;	/* raw buf header */
    struct semaphore		*tx_lock_sema;	/* lock manager semaphore */
    UID_T			tx_fsquid;	/* dispatch q for fd requests */
    struct blkhshdr		*tx_blkhash;
    short			*tx_pidhash;	/* proc structs hashed by pid */
    UID_T			tx_upmquid;	/* upu proc management q uid */
    UID_T			tx_rpmquid;	/* rpu proc management q uid */
    spin_t			tx_ipc_lock;	/* txipc flow control lock */
    UID_T			tx_dbquid;	/* debug msgs q uid */
    spin_t			tx_sel_lock;	/* select graph lock */
    struct dbmonstate		*tx_dbmon_state;/* debug monitor state */
    struct le_info		*tx_leinfo;	/* -> log error structs */
    struct pte			*tx_wmap;	/* pt of kernel windows */
    struct pte			*tx_ewmap;	/* pt top of kernel windows */
    struct txqueue		*tx_log_sync_queue;
						/* request queue for logsync */
    u_int			tx_log_sync_request;
						/* logsync request fleg */
    struct txqueue		*tx_lookahead_service_q;	
						/* rpu/upu io queue comm. */
    struct fifo_info		*tx_fifo;	/* Head of open fifo info's */
    spin_t			tx_fifo_lock;	/* tx fifo_info queue lock */
    int				reserved3[49];	/* for future use */
    int				tx_magic;	/* magic number */
};

#if SINGLEPROC || defined(RPUONLY)

struct txinfo		txi;
#define tx_info		(&txi)

#else

#if RPU

#define TX_INFO_ADDR	0xc0000400
struct txinfo		*txinfo;		/* for dbx */

#else

#define TX_INFO_ADDR	0xc0000400

#endif

#define tx_info		((struct txinfo *)TX_INFO_ADDR)

#endif

#else	!LANGUAGE_C

#define	TX_INFO_ADDR	0xc0000400

#endif	LANGUAGE_C
