xref: /inferno-os/os/boot/puma/dat.h (revision 74a4d8c26dd3c1e9febcb717cfd6cb6512991a7a)
1 typedef struct Block Block;
2 typedef struct Queue Queue;
3 
4 typedef struct List {
5 	void	*next;
6 } List;
7 
8 typedef struct {
9 	int	fake;
10 	int	pri;
11 } Lock;
12 #define	lock(x)
13 #define	unlock(x)
14 
15 typedef struct Alarm {
16 	List;
17 	int	busy;
18 	long	dt;
19 	void	(*f)(void*);
20 	void	*arg;
21 } Alarm;
22 
23 enum {
24 	Eaddrlen	= 6,
25 	ETHERMINTU	= 60,		/* minimum transmit size */
26 	ETHERMAXTU	= 1514,		/* maximum transmit size */
27 	ETHERHDRSIZE	= 14,		/* size of an ethernet header */
28 
29 	MaxEther	= 2,
30 };
31 
32 typedef struct {
33 	uchar	d[Eaddrlen];
34 	uchar	s[Eaddrlen];
35 	uchar	type[2];
36 	uchar	data[1500];
37 	uchar	crc[4];
38 } Etherpkt;
39 
40 extern uchar broadcast[Eaddrlen];
41 
42 enum {
43 	Npart		= 20+2,		/* 8 sub partitions, disk, and partition */
44 	Maxxfer		= 16*1024,	/* maximum transfer size/cmd */
45 };
46 
47 typedef struct {
48 	ulong	start;
49 	ulong	end;
50 	char	name[NAMELEN+1];
51 } Partition;
52 
53 typedef struct {
54 	int	online;
55 	int	npart;		/* number of real partitions */
56 	Partition p[Npart];
57 	ulong	offset;
58 	Partition *current;	/* current partition */
59 
60 	ulong	cap;		/* total bytes */
61 	int	bytes;		/* bytes/sector */
62 	int	sectors;		/* sectors/track */
63 	int	heads;		/* heads/cyl */
64 	long	cyl;			/* cylinders/drive */
65 
66 	char	lba;			/* true if drive has logical block addressing */
67 	char	multi;		/* non-zero if drive does multiple block xfers */
68 } Disc;
69 
70 enum {
71 	ScsiTestunit	= 0x00,
72 	ScsiExtsens	= 0x03,
73 	ScsiInquiry	= 0x12,
74 	ScsiModesense	= 0x1a,
75 	ScsiStartunit	= 0x1B,
76 	ScsiStopunit	= 0x1B,
77 	ScsiGetcap	= 0x25,
78 	ScsiRead	= 0x08,
79 	ScsiWrite	= 0x0a,
80 	ScsiExtread	= 0x28,
81 	ScsiExtwrite	= 0x2a,
82 
83 	/* data direction */
84 	ScsiIn		= 1,
85 	ScsiOut		= 0,
86 };
87 
88 typedef struct Scsibuf Scsibuf;
89 typedef struct Scsibuf {
90 	void*		virt;
91 	void*		phys;
92 	Scsibuf*	next;
93 };
94 
95 typedef struct Scsidata {
96 	uchar*		base;
97 	uchar*		lim;
98 	uchar*		ptr;
99 } Scsidata;
100 
101 typedef struct Ureg Ureg;
102 
103 typedef struct Scsi {
104 	ulong		pid;
105 	ushort		target;
106 	ushort		lun;
107 	ushort		rflag;
108 	ushort		status;
109 	Scsidata 	cmd;
110 	Scsidata 	data;
111 	Scsibuf*	b;
112 	uchar*		save;
113 	uchar		cmdblk[16];
114 } Scsi;
115 
116 typedef struct Segdesc {
117 	ulong	d0;
118 	ulong	d1;
119 } Segdesc;
120 
121 typedef struct Mach {
122 	ulong	ticks;		/* of the clock since boot time */
123 	ulong	delayloop;
124 	int		speed;		/* general system clock in MHz */
125 	int		oscclk;		/* oscillator frequency in MHz */
126 	void*	alarm;		/* alarms bound to this clock */
127 } Mach;
128 
129 extern Mach *m;
130 
131 #define E_MAGIC		((((4*20)+0)*20)+7)
132 
133 typedef struct Exec Exec;
134 struct	Exec
135 {
136 	uchar	magic[4];		/* magic number */
137 	uchar	text[4];	 	/* size of text segment */
138 	uchar	data[4];	 	/* size of initialized data */
139 	uchar	bss[4];	  		/* size of uninitialized data */
140 	uchar	syms[4];	 	/* size of symbol table */
141 	uchar	entry[4];	 	/* entry point */
142 	uchar	spsz[4];		/* size of sp/pc offset table */
143 	uchar	pcsz[4];		/* size of pc/line number table */
144 };
145 
146 /*
147  *  bootline passed by boot program
148  */
149 #define BOOTLINE ((char *)0x18000-150)
150 
151 /*
152  * Where we leave configuration info.
153  */
154 #define BOOTARGS	((char*)(0x18000))
155 #define	BOOTARGSLEN	1024
156 #define	MAXCONF		32
157 
158 /*
159  *  a parsed plan9.ini line
160  */
161 #define ISAOPTLEN	16
162 #define NISAOPT		8
163 
164 typedef struct  ISAConf {
165 	char	type[NAMELEN];
166 	ulong	port;
167 	ulong	irq;
168 	ulong	mem;
169 	ulong	size;
170 	uchar	ea[6];
171 
172 	int	nopt;
173 	char	opt[NISAOPT][ISAOPTLEN];
174 } ISAConf;
175 
176 typedef struct {
177 	int	size;
178 	ulong	addr;
179 } Map;
180 
181 typedef struct {
182 	char*	name;
183 	Map*	map;
184 	Map*	mapend;
185 
186 	Lock;
187 } RMap;
188 
189 typedef struct PCIcfg PCIcfg;
190 
191 extern	uchar*	vgamem;
192 
193 struct Block {
194 	uchar	*rp;
195 	uchar	*wp;
196 	uchar	*lim;
197 	uchar	*data;
198 	Block*	next;
199 	ulong	magic;
200 };
201 #define	BLEN(b)	((b)->wp-(b)->rp)
202 
203 typedef struct QLock {
204 	int	dummy;
205 } QLock;
206