Plan 9 from Bell Labs’s /usr/web/sources/extra/9hist/bitsy/dat.h

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


## diffname bitsy/dat.h 2000/0831
## diff -e /dev/null /n/emeliedump/2000/0831/sys/src/9/bitsy/dat.h
0a
typedef struct Conf	Conf;
typedef struct FPsave	FPsave;
typedef struct Label	Label;
typedef struct Lock	Lock;
typedef struct MMU	MMU;
typedef struct Mach	Mach;
typedef struct Notsave	Notsave;
typedef struct Page	Page;
typedef struct PMMU	PMMU;
typedef struct Proc	Proc;
typedef struct Ureg	Ureg;
typedef struct Vctl	Vctl;

/*
 *  parameters for sysproc.c
 */
#define AOUT_MAGIC	(I_MAGIC)

struct Lock
{
	ulong	key;
	ulong	sr;
	ulong	pc;
	Proc	*p;
	ushort	isilock;
};

struct Label
{
	ulong	sp;
	ulong	pc;
};

/*
 *  no floating point, hence nothing to save
 */
struct	FPsave
{
	int	dummy;
};

struct Conf
{
	ulong	nmach;		/* processors */
	ulong	nproc;		/* processes */
	ulong	monitor;	/* has monitor? */
	ulong	npage0;		/* total physical pages of memory */
	ulong	npage1;		/* total physical pages of memory */
	ulong	npage;		/* total physical pages of memory */
	ulong	upages;		/* user page pool */
	ulong	nimage;		/* number of page cache image headers */
	ulong	nswap;		/* number of swap pages */
	int	nswppo;		/* max # of pageouts per segment pass */
	ulong	base0;		/* base of bank 0 */
	ulong	base1;		/* base of bank 1 */
	ulong	copymode;	/* 0 is copy on write, 1 is copy on reference */
	ulong	ialloc;		/* max interrupt time allocation in bytes */
	ulong	pipeqsize;	/* size in bytes of pipe queues */
};

/*
 *  MMU stuff in proc
 */
#define NCOLOR 1
struct PMMU
{
	int dummy;
};

/*
 *  things saved in the Proc structure during a notify
 */
struct Notsave
{
	int dummy;
};

#include "../port/portdat.h"

struct Mach
{
	int	machno;			/* physical id of processor */
	ulong	splpc;			/* pc of last caller to splhi */

	ulong*	pdb;			/* page directory base for this processor (va) */

	Proc*	proc;			/* current process on this processor */
	Proc*	externup;		/* extern register Proc *up */

	Page*	pdbpool;
	int	pdbcnt;

	ulong	ticks;			/* of the clock since boot time */
	Label	sched;			/* scheduler wakeup */
	Lock	alarmlock;		/* access to alarm list */
	void*	alarm;			/* alarms bound to this clock */

	ulong	fairness;		/* for runproc */

	int	tlbfault;
	int	tlbpurge;
	int	pfault;
	int	cs;
	int	syscall;
	int	load;
	int	intr;
	vlong	fastclock;		/* last sampled value */
	vlong	intrts;			/* time stamp of last interrupt */
	int	flushmmu;		/* make current proc flush it's mmu state */

	ulong	spuriousintr;
	int	lastintr;

	int	loopconst;

	int	cpumhz;
	int	cpuhz;
	int	cpuidax;
	int	cpuiddx;
	char	cpuidid[16];
	char*	cpuidtype;

	vlong	mtrrcap;
	vlong	mtrrdef;
	vlong	mtrrfix[11];
	vlong	mtrrvar[32];		/* 256 max. */

	int	stack[1];
};

typedef struct Cycintr	Cycintr;

/*
 * fasttick timer interrupts
 */
struct Cycintr
{
	vlong	when;			/* fastticks when f should be called */
	void	(*f)(Ureg*, Cycintr*);
	void	*a;
	Cycintr	*next;
};

/*
 * Fake kmap
 */
typedef void		KMap;
#define	VA(k)		((ulong)(k))
#define	kmap(p)		(KMap*)((p)->pa|KZERO)
#define	kunmap(k)

struct
{
	Lock;
	int	machs;			/* bitmap of active CPUs */
	int	exiting;		/* shutdown */
	int	ispanic;		/* shutdown in response to a panic */
}active;

/*
 * Each processor sees its own Mach structure at address MACHADDR.
 * However, the Mach structures must also be available via the per-processor
 * MMU information array machp, mainly for disambiguation and access to
 * the clock which is only maintained by the bootstrap processor (0).
 */
Mach* machp[MAXMACH];
	
#define	MACHP(n)	(machp[n])

extern Mach	*m;
#define up	(((Mach*)MACHADDR)->externup)
.
## diffname bitsy/dat.h 2000/0902
## diff -e /n/emeliedump/2000/0831/sys/src/9/bitsy/dat.h /n/emeliedump/2000/0902/sys/src/9/bitsy/dat.h
36a

/*
 * FPsave.status
 */
enum
{
	FPinit,
	FPinactive,
};
.
## diffname bitsy/dat.h 2000/0905
## diff -e /n/emeliedump/2000/0902/sys/src/9/bitsy/dat.h /n/emeliedump/2000/0905/sys/src/9/bitsy/dat.h
66c
	int	monitor;
	ulong	ialloc;		/* bytes available for interrupt time allocation */
.
55d
## diffname bitsy/dat.h 2000/0907
## diff -e /n/emeliedump/2000/0905/sys/src/9/bitsy/dat.h /n/emeliedump/2000/0907/sys/src/9/bitsy/dat.h
180a

enum
{
	OneMeg=	1024*1024,
};
.
## diffname bitsy/dat.h 2000/0929
## diff -e /n/emeliedump/2000/0907/sys/src/9/bitsy/dat.h /n/emeliedump/2000/0929/sys/src/9/bitsy/dat.h
185a

.
170,173c
 *  Each processor sees its own Mach structure at address MACHADDR.
 *  However, the Mach structures must also be available via the per-processor
 *  MMU information array machp, mainly for disambiguation and access to
 *  the clock which is only maintained by the bootstrap processor (0).
.
## diffname bitsy/dat.h 2000/1007
## diff -e /n/emeliedump/2000/0929/sys/src/9/bitsy/dat.h /n/emeliedump/2000/1007/sys/src/9/bitsy/dat.h
135a

	/* save areas for exceptions */
	ulong	sfiq[5];
	ulong	sirq[5];
	ulong	sund[5];
	ulong	sabt[5];
.
12a
typedef struct PhysUart	PhysUart;
typedef struct Uart	Uart;
.
## diffname bitsy/dat.h 2000/1011
## diff -e /n/emeliedump/2000/1007/sys/src/9/bitsy/dat.h /n/emeliedump/2000/1011/sys/src/9/bitsy/dat.h
166c
#define	kmap(p)		(KMap*)((p)->pa)
.
162c
 * Fake kmap since we direct map dram
.
78c
	ulong	pid;		/* current pid (0 if none) */
	Page	*l1[Nmeg];	/* this's process' level 1 entries */
.
75c
enum
{
	NCOLOR=	1,	/* 1 level cache, don't worry about VCE's */
	Nmeg=	32,	/* maximum size of user space */
};

.
## diffname bitsy/dat.h 2000/1012
## diff -e /n/emeliedump/2000/1011/sys/src/9/bitsy/dat.h /n/emeliedump/2000/1012/sys/src/9/bitsy/dat.h
200d
140,144d
133,138c
	int	cpumhz;			/* speed of cpu */
	int	cpuhz;			/* ... *
.
131c
	int	flushmmu;		/* make current proc flush it's mmu state */
	Proc	*pid2proc[31];		/* what proc holds what pid */
	int	lastpid;		/* highest assigned pid slot */
.
126,127d
116a
	/* stats */
.
83c
	ulong	tlbpid;		/* current pid (0 if none) */
.
## diffname bitsy/dat.h 2000/1013
## diff -e /n/emeliedump/2000/1012/sys/src/9/bitsy/dat.h /n/emeliedump/2000/1013/sys/src/9/bitsy/dat.h
83,84c
	Page	*l1page[Nmeg];	/* this's process' level 1 entries */
	ulong	l1table[Nmeg];	/* ... */
.
## diffname bitsy/dat.h 2000/1014
## diff -e /n/emeliedump/2000/1013/sys/src/9/bitsy/dat.h /n/emeliedump/2000/1014/sys/src/9/bitsy/dat.h
175,183c
#define	MACHP(n)	((Mach*)MACHADDR)
.
107,109d
102,103d
## diffname bitsy/dat.h 2000/1015
## diff -e /n/emeliedump/2000/1014/sys/src/9/bitsy/dat.h /n/emeliedump/2000/1015/sys/src/9/bitsy/dat.h
170c
#define	MACHP(n)	((Mach *)(MACHADDR+(n)*BY2PG))
.
84a
	Page	*mmufree;	/* free mmu pages */
.
19c
#define AOUT_MAGIC	(E_MAGIC)
.
## diffname bitsy/dat.h 2000/1016
## diff -e /n/emeliedump/2000/1015/sys/src/9/bitsy/dat.h /n/emeliedump/2000/1016/sys/src/9/bitsy/dat.h
174c
extern Proc	*up;
.
103,104c
	Proc	*proc;			/* current process */
	ulong	mmupid;			/* process id currently in mmu & cache */
.
## diffname bitsy/dat.h 2000/1026
## diff -e /n/emeliedump/2000/1016/sys/src/9/bitsy/dat.h /n/emeliedump/2000/1026/sys/src/9/bitsy/dat.h
50c
	ulong	status;
	ulong	control;
	ulong	regs[8][3];	/* emulated fp */	
.
45,46c
	FPINIT,
	FPACTIVE,
	FPINACTIVE,
.
37,40d
1a
typedef struct FPU	FPU;
typedef struct FPenv	FPenv;
.
## diffname bitsy/dat.h 2000/1027
## diff -e /n/emeliedump/2000/1026/sys/src/9/bitsy/dat.h /n/emeliedump/2000/1027/sys/src/9/bitsy/dat.h
43,45c
	FPinit,
	FPactive,
	FPinactive,
.
## diffname bitsy/dat.h 2000/1106
## diff -e /n/emeliedump/2000/1027/sys/src/9/bitsy/dat.h /n/emeliedump/2000/1106/sys/src/9/bitsy/dat.h
110a
	int	inclockintr;
.
## diffname bitsy/dat.h 2000/1121
## diff -e /n/emeliedump/2000/1106/sys/src/9/bitsy/dat.h /n/emeliedump/2000/1121/sys/src/9/bitsy/dat.h
180a
};

/*
 *  routines to access UART hardware
 */
struct PhysUart
{
	void	(*enable)(Uart*, int);
	void	(*disable)(Uart*);
	void	(*kick)(Uart*);
	void	(*intr)(Ureg*, void*);
	void	(*dobreak)(Uart*, int);
	void	(*baud)(Uart*, int);
	void	(*bits)(Uart*, int);
	void	(*stop)(Uart*, int);
	void	(*parity)(Uart*, int);
	void	(*modemctl)(Uart*, int);
	void	(*rts)(Uart*, int);
	void	(*dtr)(Uart*, int);
	long	(*status)(Uart*, void*, long, long);
};

enum {
	Stagesize=	1024
};

/*
 *  software UART
 */
struct Uart
{
	QLock;
	int	type;
	int	dev;
	int	opens;
	void	*regs;
	PhysUart	*phys;

	int	enabled;
	Uart	*elist;			/* next enabled interface */
	char	name[NAMELEN];

	uchar	sticky[4];		/* sticky write register values */
	ulong	freq;			/* clock frequency */
	uchar	mask;			/* bits/char */
	int	baud;			/* baud rate */

	int	parity;			/* parity errors */
	int	frame;			/* framing errors */
	int	overrun;		/* rcvr overruns */

	/* buffers */
	int	(*putc)(Queue*, int);
	Queue	*iq;
	Queue	*oq;

	uchar	istage[Stagesize];
	uchar	*iw;
	uchar	*ir;
	uchar	*ie;

	Lock	tlock;			/* transmit */
	uchar	ostage[Stagesize];
	uchar	*op;
	uchar	*oe;

	int	modem;			/* hardware flow control on */
	int	xonoff;			/* software flow control on */
	int	blocked;
	int	cts, dsr, dcd, dcdts;		/* keep track of modem status */ 
	int	ctsbackoff;
	int	hup_dsr, hup_dcd;	/* send hangup upstream? */
	int	dohup;

	int	kinuse;		/* device in use by kernel */

	Rendez	r;
};

/*
 * PCMCIA structures known by both port/cis.c and the pcmcia driver
 */

/*
 * Map between ISA memory space and PCMCIA card memory space.
 */
struct PCMmap {
	ulong	ca;			/* card address */
	ulong	cea;			/* card end address */
	ulong	isa;			/* local virtual address */
	int	len;			/* length of the ISA area */
	int	attr;			/* attribute memory */
};

/*
 *  a PCMCIA configuration entry
 */
struct PCMconftab
{
	int	index;
	ushort	irqs;		/* legal irqs */
	uchar	irqtype;
	uchar	bit16;		/* true for 16 bit access */
	struct {
		ulong	start;
		ulong	len;
	} io[16];
	int	nio;
	uchar	vpp1;
	uchar	vpp2;
	uchar	memwait;
	ulong	maxwait;
	ulong	readywait;
	ulong	otherwait;
};

/*
 *  For walking a PCMCIA card's information structure
 */
struct Cisdat
{
	uchar	*cisbase;
	int	cispos;
	int	cisskip;
	int	cislen;
};

/*
 *  PCMCIA card slot
 */
struct PCMslot
{
	Ref;

	long	memlen;		/* memory length */
	uchar	slotno;		/* slot number */
	void	*regs;		/* i/o registers */
	void	*mem;		/* memory */
	void	*attr;		/* attribute memory */

	/* status */
	uchar	special;	/* in use for a special device */
	uchar	already;	/* already inited */
	uchar	occupied;
	uchar	battery;
	uchar	wrprot;
	uchar	powered;
	uchar	configed;
	uchar	enabled;
	uchar	busy;

	/* cis info */
	ulong	msec;		/* time of last slotinfo call */
	char	verstr[512];	/* version string */
	uchar	cpresent;	/* config registers present */
	ulong	caddr;		/* relative address of config registers */
	int	nctab;		/* number of config table entries */
	PCMconftab	ctab[8];
	PCMconftab	*def;		/* default conftab */

	/* for walking through cis */
	Cisdat;

	/* maps are fixed */
	PCMmap memmap;
	PCMmap attrmap;
.
144,145d
70a
	ulong	hz;		/* processor cycle freq */
	ulong	mhz;
.
1,16c
typedef struct Cisdat 		Cisdat;
typedef struct Conf		Conf;
typedef struct Cycintr		Cycintr;
typedef struct FPU		FPU;
typedef struct FPenv		FPenv;
typedef struct FPsave		FPsave;
typedef struct Label		Label;
typedef struct Lock		Lock;
typedef struct MMU		MMU;
typedef struct Mach		Mach;
typedef struct Notsave		Notsave;
typedef struct Page		Page;
typedef struct PCMmap		PCMmap;
typedef struct PCMslot		PCMslot;
typedef struct PCMconftab	PCMconftab;
typedef struct PhysUart		PhysUart;
typedef struct PMMU		PMMU;
typedef struct Proc		Proc;
typedef struct Uart		Uart;
typedef struct Ureg		Ureg;
typedef struct Vctl		Vctl;
typedef struct Uart		Uart;
.
## diffname bitsy/dat.h 2000/1122
## diff -e /n/emeliedump/2000/1121/sys/src/9/bitsy/dat.h /n/emeliedump/2000/1122/sys/src/9/bitsy/dat.h
319c
	Ref	ref;
.
## diffname bitsy/dat.h 2000/1128
## diff -e /n/emeliedump/2000/1122/sys/src/9/bitsy/dat.h /n/emeliedump/2000/1128/sys/src/9/bitsy/dat.h
338a
	int	cisread;	/* set when the cis has been read */
.
## diffname bitsy/dat.h 2000/1205
## diff -e /n/emeliedump/2000/1128/sys/src/9/bitsy/dat.h /n/emeliedump/2000/1205/sys/src/9/bitsy/dat.h
353a
};

/*
 *  hardware info about a device
 */
struct DevConf
{
	ulong	mem;		/* mapped memory address */
	ulong	port;		/* mapped i/o regs */
	int	size;		/* access size */
	int	itype;		/* type of interrupt */
	ulong	interrupt;	/* interrupt number */
	char	type[NAMELEN];	/* card type */
.
340d
328,336c
	uchar	occupied;	/* card in the slot */
	uchar	configed;	/* card configured */
.
318a
	RWlock;

.
23a
typedef void IntrHandler(Ureg*, void*);

.
6a
typedef struct DevConf		DevConf;
.
## diffname bitsy/dat.h 2001/0529
## diff -e /n/emeliedump/2000/1205/sys/src/9/bitsy/dat.h /n/emeliedump/2001/0529/sys/src/9/bitsy/dat.h
363c
	char	*type;	/* card type, mallocated */
.
267a
#endif
.
191a
#ifdef NDEF
.
## diffname bitsy/dat.h 2001/0616
## diff -e /n/emeliedump/2001/0529/sys/src/9/bitsy/dat.h /n/emeliedump/2001/0616/sys/src/9/bitsy/dat.h
365c
	char		*type;	/* card type, mallocated */
.
362,363c
	int		size;		/* access size */
	int		itype;	/* type of interrupt */
.
360c
	ulong	mem;	/* mapped memory address */
.
194,271d
192d
## diffname bitsy/dat.h 2001/0619
## diff -e /n/emeliedump/2001/0616/sys/src/9/bitsy/dat.h /n/emeliedump/2001/0619/sys/src/9/bitsy/dat.h
267,269d
230,240d
## diffname bitsy/dat.h 2001/0731
## diff -e /n/emeliedump/2001/0619/sys/src/9/bitsy/dat.h /n/emeliedump/2001/0731/sys/src/9/bitsy/dat.h
26a
#define MAXSYSARG	5	/* for mount(fd, mpt, flag, arg, srv) */

.
## diffname bitsy/dat.h 2002/0222
## diff -e /n/emeliedump/2001/0731/sys/src/9/bitsy/dat.h /n/emeliedump/2002/0222/sys/src/9/bitsy/dat.h
146c
	vlong	cpuhz;			/* ... */
.
## diffname bitsy/dat.h 2002/0405
## diff -e /n/emeliedump/2002/0222/sys/src/9/bitsy/dat.h /n/emeliedump/2002/0405/sys/src/9/bitsy/dat.h
274a
};

/*
 * Timer interrupts
 */
struct Timer
{
	vlong	when;			/* fastticks when f should be called */
	vlong	period;			/* non-zero for recurring periodic timers */
	void		(*f)(Ureg*, Timer*);	/* function to call */
	void		*a;				/* User parameter */
	Timer	*next;
.
158,168d
19a
typedef struct Timer		Timer;
.
3d
## diffname bitsy/dat.h 2002/0406
## diff -e /n/emeliedump/2002/0405/sys/src/9/bitsy/dat.h /n/emeliedump/2002/0406/sys/src/9/bitsy/dat.h
271,272c
	uvlong	when;			/* fastticks when f should be called */
	ulong	period;			/* non-zero for recurring periodic timers */
.
## diffname bitsy/dat.h 2002/0410
## diff -e /n/emeliedump/2002/0406/sys/src/9/bitsy/dat.h /n/emeliedump/2002/0410/sys/src/9/bitsy/dat.h
264,275d
19d
## diffname bitsy/dat.h 2002/0420
## diff -e /n/emeliedump/2002/0410/sys/src/9/bitsy/dat.h /n/emeliedump/2002/0420/sys/src/9/bitsy/dat.h
138a
	int		ilockdepth;
.
## diffname bitsy/dat.h 2002/0613
## diff -e /n/emeliedump/2002/0420/sys/src/9/bitsy/dat.h /n/emeliedump/2002/0613/sys/src/9/bitsy/dat.h
257a
	RWlock;			/* write: configure/unconfigure/suspend; read: normal access */
.
## diffname bitsy/dat.h 2002/0615
## diff -e /n/emeliedump/2002/0613/sys/src/9/bitsy/dat.h /n/emeliedump/2002/0615/sys/src/9/bitsy/dat.h
263c
	ulong	intnum;	/* interrupt number */
.
## diffname bitsy/dat.h 2002/0618
## diff -e /n/emeliedump/2002/0615/sys/src/9/bitsy/dat.h /n/emeliedump/2002/0618/sys/src/9/bitsy/dat.h
238a
	Dev		*dev;	/* set in ctlwrite `configure' */

.
## diffname bitsy/dat.h 2002/0703
## diff -e /n/emeliedump/2002/0618/sys/src/9/bitsy/dat.h /n/emeliedump/2002/0703/sys/src/9/bitsy/dat.h
265c
	ulong	irq;		/* interrupt number */
.
## diffname bitsy/dat.h 2002/0821
## diff -e /n/emeliedump/2002/0703/sys/src/9/bitsy/dat.h /n/emeliedump/2002/0821/sys/src/9/bitsy/dat.h
139c
	int	ilockdepth;
	ulong	inidle;			/* fastticks in idlehands() since last slowtick */
	ulong	avginidle;		/* avg fastticks in idlehands() per slowtick */
.
136a
	uvlong	inidle;			/* time spent in idlehands() */
.
## diffname bitsy/dat.h 2002/0822
## diff -e /n/emeliedump/2002/0821/sys/src/9/bitsy/dat.h /n/emeliedump/2002/0822/sys/src/9/bitsy/dat.h
141,142c
	Perf	perf;			/* performance counters */
.
136d
## diffname bitsy/dat.h 2002/1112
## diff -e /n/emeliedump/2002/0822/sys/src/9/bitsy/dat.h /n/emeliedump/2002/1112/sys/src/9/bitsy/dat.h
268a

.
262,267c
	ulong	mem;		/* mapped memory address */
	port_t	*ports;		/* ports[0]: mapped i/o regs, access size */
	int	nports;		/* always 1 for the bitsy */
	int	itype;		/* type of interrupt */
	ulong	intnum;		/* interrupt number */
	char	*type;		/* card type, mallocated */
.
258a
typedef struct {
	ulong	port;	
	int	size;
} port_t;

.
238a
	uchar	inserted;	/* card just inserted */
.

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].