summaryrefslogtreecommitdiff
path: root/os/cerf250/dat.h
blob: 553c0cb0f4656999c075f97d98ee473e13b9ec81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
typedef struct Conf	Conf;
typedef struct Dma	Dma;
typedef struct FPU	FPU;
typedef struct FPenv	FPenv;
typedef struct Label	Label;
typedef struct Lock	Lock;
typedef struct Mach	Mach;
typedef struct Ureg	Ureg;
typedef struct ISAConf	ISAConf;
typedef struct PCMmap	PCMmap;
typedef struct PCMslot	PCMslot;

typedef ulong Instr;

struct Conf
{
	ulong	nmach;			/* processors */
	ulong	nproc;			/* processes */
	ulong	npage0;			/* total physical pages of memory */
	ulong	npage1;			/* total physical pages of memory */
	ulong	topofmem;		/* highest physical address + 1 */
	ulong	npage;			/* total physical pages of memory */
	ulong	base0;			/* base of bank 0 */
	ulong	base1;			/* base of bank 1 */
	ulong	ialloc;			/* max interrupt time allocation in bytes */

	int		useminicache;		/* use mini cache: screen.c/lcd.c */
	int		textwrite;			/* writeable text segment, for debug */
	int		portrait;	/* display orientation */
};

#define NISAOPT 8
struct ISAConf {
	char	type[KNAMELEN];
	ulong	port;
	ulong	irq;
	int	itype;
	ulong	dma;
	ulong	mem;
	ulong	size;
	ulong	freq;

	int	nopt;
	char	*opt[NISAOPT];
};

/*
 * FPenv.status
 */
enum
{
	FPINIT,
	FPACTIVE,
	FPINACTIVE,
};

struct	FPenv
{
	ulong	status;
	ulong	control;
	ushort	fpistate;	/* emulated fp */
	ulong	regs[8][3];	/* emulated fp */	
};

/*
 * This structure must agree with fpsave and fprestore asm routines
 */
struct	FPU
{
	FPenv	env;
};

struct Label
{
	ulong	sp;
	ulong	pc;
};

struct Lock
{
	ulong	key;
	ulong	sr;
	ulong	pc;
	int	pri;
};

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

/*
 *  machine dependent definitions not used by ../port/portdat.h
 */
struct Mach
{
	/* OFFSETS OF THE FOLLOWING KNOWN BY l.s */
	ulong	splpc;		/* pc of last caller to splhi */

	/* ordering from here on irrelevant */

	int	machno;		/* physical id of processor */
	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 */
	ulong	cpuhz;

	/* stacks for exceptions */
	ulong	fiqstack[4];
	ulong	irqstack[4];
	ulong	abtstack[4];
	ulong	undstack[4];

	int	stack[1];
};

#define	MACHP(n)	(n == 0 ? (Mach*)(MACHADDR) : (Mach*)0)

extern Mach *m;
extern Proc *up;

typedef struct MemBank {
	uint	pbase;
	uint	plimit;
	uint	vbase;
	uint	vlimit;
} MemBank;

/*
 * Layout at virtual address 0.
 */
typedef struct Vectorpage {
	void	(*vectors[8])(void);
	uint	vtable[8];
} Vectorpage;
extern Vectorpage *page0;