plan 9 kernel history: overview | file list | diff list

1997/0327/pc/dat.h (diff list | history)

1996/0523/sys/src/9/pc/dat.h:1,51997/0327/sys/src/9/pc/dat.h:1,7 (short | long | prev | next)
PC architecture cleanup + initial SMP support.
Structures: add Irq, Irqctl], Tss; rename PCIcfg to Pcidev; remove PCMmap.
Change MACHP to use array of Mach structures; use VM trick for m.
Remove unused entries from conf.
Add CPU-specific entries to Mach.
Add interrupt routines to PCArch.
In PMMU, rename mmutop to mmupdb.
In active: change machs and exiting from short to int.

rsc Fri Mar 4 12:44:25 2005
1991/0612    
typedef struct Conf	Conf; 
1991/0702    
typedef struct FPsave	FPsave; 
1997/0327    
typedef struct Irq	Irq; 
typedef struct Irqctl	Irqctl; 
1993/0915    
typedef struct ISAConf	ISAConf; 
1991/0612    
typedef struct Label	Label; 
typedef struct Lock	Lock; 
1996/0523/sys/src/9/pc/dat.h:7,131997/0327/sys/src/9/pc/dat.h:9,15
1991/0612    
typedef struct Mach	Mach; 
1993/1013    
typedef struct Notsave	Notsave; 
1992/0923    
typedef struct PCArch	PCArch; 
1995/0517    
typedef struct PCIcfg	PCIcfg; 
1997/0327    
typedef struct Pcidev	Pcidev; 
1995/0225    
typedef struct PCMmap	PCMmap; 
1991/0717    
typedef struct Page	Page; 
1991/0612    
typedef struct PMMU	PMMU; 
1996/0523/sys/src/9/pc/dat.h:14,241997/0327/sys/src/9/pc/dat.h:16,21
1991/0703    
typedef struct Segdesc	Segdesc; 
1991/0612    
typedef struct Ureg	Ureg; 
 
#define	MACHP(n)	(n==0? &mach0 : *(Mach**)0) 
                 
extern	Mach	mach0; 
extern  void	(*kprofp)(ulong); 
                 
/* 
 *  parameters for sysproc.c 
 */ 
1996/0523/sys/src/9/pc/dat.h:73,791997/0327/sys/src/9/pc/dat.h:70,75
1992/0807    
	ulong	monitor;	/* has monitor? */ 
1992/0625    
	ulong	npage0;		/* total physical pages of memory */ 
	ulong	npage1;		/* total physical pages of memory */ 
	ulong	topofmem;	/* highest physical address + 1 */ 
1991/0612    
	ulong	npage;		/* total physical pages of memory */ 
1992/0625    
	ulong	upages;		/* user page pool */ 
1991/0711    
	ulong	nimage;		/* number of page cache image headers */ 
1996/0523/sys/src/9/pc/dat.h:81,911997/0327/sys/src/9/pc/dat.h:77,82
1991/0711    
	ulong	base0;		/* base of bank 0 */ 
	ulong	base1;		/* base of bank 1 */ 
1991/0702    
	ulong	copymode;	/* 0 is copy on write, 1 is copy on reference */ 
1991/0809    
	ulong	nfloppy;	/* number of floppy drives */ 
	ulong	nhard;		/* number of hard drives */ 
1992/1105    
	ulong	ldepth;		/* screen depth */ 
	ulong	maxx;		/* screen width */ 
	ulong	maxy;		/* screen length */ 
1994/0322    
	ulong	ialloc;		/* max interrupt time allocation in bytes */ 
1994/0503    
	ulong	pipeqsize;	/* size in bytes of pipe queues */ 
1991/0612    
}; 
1996/0523/sys/src/9/pc/dat.h:93,1061997/0327/sys/src/9/pc/dat.h:84,95
1991/0612    
/* 
 *  MMU stuff in proc 
 */ 
1991/0717    
#define MAXMMU	4 
1991/0718    
#define MAXSMMU	1 
1993/0915    
#define NCOLOR 1 
1991/0612    
struct PMMU 
{ 
1991/1004    
	Page	*mmutop;	/* 1st level table */ 
	Page	*mmufree;	/* unused page table pages */ 
	Page	*mmuused;	/* used page table pages */ 
1997/0327    
	Page*	mmupdb;			/* page directory base */ 
	Page*	mmufree;		/* unused page table pages */ 
	Page*	mmuused;		/* used page table pages */ 
1991/0612    
}; 
 
1993/1013    
/* 
1996/0523/sys/src/9/pc/dat.h:115,1351997/0327/sys/src/9/pc/dat.h:104,163
1993/1013    
 
1991/0612    
#include "../port/portdat.h" 
 
/* 
 *  machine dependent definitions not used by ../port/dat.h 
 */ 
1997/0327    
typedef struct { 
	ulong	link;			/* link (old TSS selector) */ 
	ulong	esp0;			/* privilege level 0 stack pointer */ 
	ulong	ss0;			/* privilege level 0 stack selector */ 
	ulong	esp1;			/* privilege level 1 stack pointer */ 
	ulong	ss1;			/* privilege level 1 stack selector */ 
	ulong	esp2;			/* privilege level 2 stack pointer */ 
	ulong	ss2;			/* privilege level 2 stack selector */ 
	ulong	cr3;			/* page directory base register */ 
	ulong	eip;			/* instruction pointer */ 
	ulong	eflags;			/* flags register */ 
	ulong	eax;			/* general registers */ 
	ulong 	ecx; 
	ulong	edx; 
	ulong	ebx; 
	ulong	esp; 
	ulong	ebp; 
	ulong	esi; 
	ulong	edi; 
	ulong	es;			/* segment selectors */ 
	ulong	cs; 
	ulong	ss; 
	ulong	ds; 
	ulong	fs; 
	ulong	gs; 
	ulong	ldt;			/* selector for task's LDT */ 
	ulong	iomap;			/* I/O map base address + T-bit */ 
} Tss; 
1991/0612    
 
1997/0327    
struct Segdesc 
{ 
	ulong	d0; 
	ulong	d1; 
}; 
 
1991/0612    
struct Mach 
{ 
	int	machno;			/* physical id of processor */ 
	ulong	splpc;			/* pc of last caller to splhi */ 
	int	mmask;			/* 1<<m->machno */ 
1997/0327    
 
	void*	pdb;			/* page directory base for this processor (va) */ 
	Tss*	tss;			/* tss for this processor */ 
	Segdesc	gdt[6];			/* gdt for this processor */ 
 
	Proc*	proc;			/* current process on this processor */ 
	Proc*	externup;		/* extern register Proc *up */ 
 
	Page*	pdbpool; 
	int	pdbcnt; 
 
1991/0612    
	ulong	ticks;			/* of the clock since boot time */ 
	Proc	*proc;			/* current process on this processor */ 
	Label	sched;			/* scheduler wakeup */ 
	Lock	alarmlock;		/* access to alarm list */ 
	void	*alarm;			/* alarms bound to this clock */ 
1994/0728    
	int	nrdy; 
1997/0327    
	void*	alarm;			/* alarms bound to this clock */ 
1994/0311    
 
1991/0612    
	int	tlbfault; 
	int	tlbpurge; 
1996/0523/sys/src/9/pc/dat.h:139,1441997/0327/sys/src/9/pc/dat.h:167,180
1991/1112    
	int	load; 
1991/0612    
	int	intr; 
 
1997/0327    
	int	loopconst; 
 
	int	cpumhz; 
	int	cpuidax; 
	int	cpuiddx; 
	char	cpuidid[16]; 
	char*	cpuidtype; 
 
1991/0612    
	int	stack[1]; 
}; 
 
1996/0523/sys/src/9/pc/dat.h:150,1691997/0327/sys/src/9/pc/dat.h:186,197
1991/0718    
#define	kmap(p)		(KMap*)((p)->pa|KZERO) 
1991/0612    
#define	kunmap(k) 
 
1991/0703    
/* 
 *  segment descriptor/gate 
 */ 
struct Segdesc 
{ 
	ulong	d0; 
	ulong	d1; 
}; 
                 
1991/0612    
struct 
{ 
	Lock; 
	short	machs; 
	short	exiting; 
1997/0327    
	int	machs;			/* bitmap of active CPUs */ 
	int	exiting;		/* shutdown */ 
	int	ispanic;		/* shutdown in response to a panic */ 
1991/0612    
}active; 
 
1992/0923    
/* 
1996/0523/sys/src/9/pc/dat.h:171,1841997/0327/sys/src/9/pc/dat.h:199,214
1992/0923    
 */ 
struct PCArch 
{ 
	char	*id; 
1997/0327    
	char*	id; 
	int	(*ident)(void);		/* this should be in the model */ 
1992/0923    
	void	(*reset)(void);		/* this should be in the model */ 
	int	(*cpuspeed)(int);	/* 0 = low, 1 = high */ 
	void	(*buzz)(int, int);	/* make a noise */ 
	void	(*lights)(int);		/* turn lights or icons on/off */ 
	int	(*serialpower)(int);	/* 1 == on, 0 == off */ 
	int	(*modempower)(int);	/* 1 == on, 0 == off */ 
	int	(*extvga)(int);		/* 1 == external, 0 == internal */ 
1997/0327    
 
	void	(*intrinit)(void); 
	int	(*intrenable)(int, int, Irqctl*); 
 
	void	(*clockenable)(void); 
1992/0923    
}; 
 
1995/0223    
/* 
1996/0523/sys/src/9/pc/dat.h:191,2191997/0327/sys/src/9/pc/dat.h:221,249
1993/0915    
	char	type[NAMELEN]; 
	ulong	port; 
	ulong	irq; 
1995/0803    
	int	dma; 
1997/0327    
	ulong	dma; 
1993/0915    
	ulong	mem; 
	ulong	size; 
1994/0823    
	ulong	freq; 
1993/0915    
	uchar	ea[6]; 
1995/0920    
 
	int	nopt; 
	char	opt[NISAOPT][ISAOPTLEN]; 
1993/0915    
}; 
1995/0225    
 
1997/0327    
extern PCArch	*arch;			/* PC architecture */ 
 
1995/0225    
/* 
 *  maps between ISA memory space and PCMCIA card memory space 
1997/0327    
 * 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). 
1995/0225    
 */ 
struct PCMmap 
{ 
	ulong	ca;		/* card address */ 
	ulong	cea;		/* card end address */ 
	ulong	isa;		/* ISA address */ 
	int	len;		/* length of the ISA area */ 
	int	attr;		/* attribute memory */ 
	int	ref; 
}; 
1997/0327    
Mach* machp[MAXMACH]; 
	 
#define	MACHP(n)	(machp[n]) 
1995/0225    
 
1997/0327    
extern Mach	*m; 
#define up	(((Mach*)MACHADDR)->externup) 
1991/0801    
 
1995/0223    
/* 
 *  SCSI bus 
1996/0523/sys/src/9/pc/dat.h:234,2451997/0327/sys/src/9/pc/dat.h:264,280
1994/0908    
}; 
typedef int 	(*Scsiio)(Target*, int, uchar*, int, void*, int*); 
 
1993/0915    
#define MAXPCMCIA 8			/* maximum number of PCMCIA cards */ 
#define BOOTLINE ((char *)0x80000100)	/*  bootline passed by boot program */ 
1997/0327    
typedef struct Irq { 
	void	(*f)(Ureg*, void*);	/* handler to call */ 
	void*	a;			/* argument to call it with */ 
1991/1210    
 
1993/0915    
extern PCArch	*arch;			/* PC architecture */ 
1993/1013    
extern int	cpuflag;		/* true if this is a CPU */ 
1997/0327    
	Irq*	next;			/* link to next handler */ 
} Irq; 
1992/0918    
 
1993/0915    
extern Mach	*m; 
extern Proc	*up; 
1994/0607    
extern char	filaddr[]; 
1997/0327    
typedef struct Irqctl { 
	int	(*isr)(int);		/* get isr bit for this irq */ 
	int	(*eoi)(int);		/* eoi */ 
	int	isintr; 
 
	Irq*	irq;			/* handlers on this IRQ */ 
} Irqctl; 


source code copyright © 1990-2005 Lucent Technologies; see license
Plan 9 distribution
comments to russ cox (rsc@swtch.com)