summaryrefslogtreecommitdiffstats
path: root/private/ntos/boot/veneer/veneer.h
blob: aae1b1d1cb4cbf76e13907ce85231705df5987d6 (plain) (blame)
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
/*++
 *
 * Copyright (c) 1994,1996 FirePower Systems, Inc.
 * Copyright (c) 1994 FirmWorks, Mountain View CA USA. All rights reserved.
 *
 * $RCSfile: veneer.h $
 * $Revision: 1.20 $
 * $Date: 1996/06/19 23:13:15 $
 * $Locker:  $
 *
 *


Module Name:

	veneer.h

Abstract:

	This module contains the private data structures and procedure
	prototypes for the veneer for the PowerPC NT.

	This module is specifically tailored for the PowerPro and PowerTop
	systems.

Author:

	A. Benjamin 9-May-1994

Revision History:
	20-Jul-94  Shin Iwamoto at FirePower Systems Inc.
		   Added VRDBG_LOAD.
	13-Jul-94  Shin Iwamoto at FirePower Systems Inc.
		   Added ReadAheadCount and ReadAheadBuffer[2] in FileTable.
	12-Jul-94  Shin Iwamoto at FirePower Systems Inc.
		   Added Delete and NetworkDevice flags in FILE_FLAGS.


--*/


#ifndef _VENEER
#define _VENEER

//----------------------------------------------------------------
//
// Headers
//

#include <windef.h>
#include "vrheader.h"
#include <arc.h>
#include <arccodes.h>
#include <stdarg.h>

#ifdef  putchar
# undef putchar
#endif
#ifdef  puts
# undef puts
#endif

//----------------------------------------------------------------
//
// Define common macros....
//

//----------------------------------------------------------------
//
// IEEE 1275-1994 definitions
//

typedef long phandle;
typedef long ihandle;

typedef struct {
	long hi, lo;
	long size;
} reg;

//----------------------------------------------------------------
//
// Global definitions and macros
//

#define MAX_IDE_DEVICE 4

#ifdef  BAT_MMU
#define	CLAIM(BaseAddr, SizeOfImage)			\
					claim(BaseAddr, SizeOfImage)
#else
#define	CLAIM(BaseAddr, SizeOfImage)						\
									claimreal(BaseAddr, SizeOfImage)
#endif


typedef enum {
	NOALLOC,
	ALLOC
} allocflag;

#define new(t)  (t *)zalloc(sizeof(t));

#ifdef  islower
# undef islower
#endif
#define islower(c)  (((c) >= 'a') && ((c) <= 'z'))

#ifdef  toupper
# undef toupper
#endif
#define toupper(c)  (((c) - 'a') + 'A')

//
// Current version and revision numbers.
// These values are in OSLoader specifications (3-49).
//
#define ARC_VERSION     2
#define ARC_REVISION    0

//
// CPU type
//

typedef enum {
	PPC_UNKNOWN = 0,
	PPC_601 = 1,
	PPC_603 = 3,
	PPC_604 = 4,
	PPC_603E = 6,
	PPC_604E = 9,
    nPROCESSOR_TYPE
} PROCESSOR_TYPE;


//
// Definitions associated with ARC.
//
#define SYSTEM_BLOCK_SIGNATURE  0x53435241
#define RSTB_SIGNATURE          0x42545352

//
// The current (1/95) PowerPC port requires a "MIPS kseg0"-like
// mapping which aliases 0x80000000 to 0x00000000. This macro,
// used by claim(), undoes the mapping.
//
#define MAP(x)          ((ULONG)(x) & ~0x80000000)
#define UNMAP(x)        ((ULONG)(x) |  0x80000000)


//----------------------------------------------------------------
//
// Veneer data structures and declarations
//

/*
 * This data structure is intended to link the components of the ARC
 * tree with the nodes of the OF tree.
 */
typedef struct _CONFIGURATION_NODE {
	phandle OfPhandle;
	CONFIGURATION_COMPONENT Component;
	CM_PARTIAL_RESOURCE_LIST *ConfigurationData;
	struct _CONFIGURATION_NODE *Peer, *Child, *Parent;
	char *ComponentName;
	int Wildcard;
	char *WildcardAddrPath;
} CONFIGURATION_NODE, *PCONFIGURATION_NODE;


//
// Define the vendor specific entry point numbers.
//
typedef enum _VENDOR_ENTRY {
    MaximumVendorRoutine
    } VENDOR_ENTRY;

//
// Define file table structure.
//
#define FILE_TABLE_SIZE 32

typedef struct _FILE_FLAGS {
    ULONG Open : 1;
    ULONG Read : 1;
    ULONG Write : 1;
    ULONG Delete : 1;
    ULONG Device : 1;
    ULONG Partition : 1;
    ULONG DisplayDevice : 1;
    ULONG RemovableDevice : 1;
    ULONG NetworkDevice : 1;
} FILE_FLAGS, *PFILE_FLAGS;

#define MAX_PATH_NAME_SIZE 128

typedef struct _FILE_TABLE_ENTRY {
    ihandle IHandle;
    FILE_FLAGS Flags;
    LARGE_INTEGER Position;
    PCHAR PathName;
    LONG ReadAheadCount;
    CHAR ReadAheadBuffer[2];
} FILE_TABLE_ENTRY, *PFILE_TABLE_ENTRY;
extern FILE_TABLE_ENTRY FileTable[];

//
// Define the keyboard and mouse id strings.
//
#define KBD_IDENTIFIER          "PCAT_ENHANCED"
#define MOUSE_IDENTIFIER        "PS2 MOUSE"


//----------------------------------------------------------------
//
// External/Global variable declarations
//

extern int VrDebug;
extern CONFIGURATION_NODE *RootNode;
extern ihandle ConsoleIn, ConsoleOut;
extern BOOLEAN use_bat_mapping;

//----------------------------------------------------------------
//
// Function prototypes
//

//
// Useful macros for pragma message, ie. #pragma message(REVIEW "some text")
//
#define QUOTE(x) #x
#define IQUOTE(x) QUOTE(x)
#define REVIEW __FILE__ "(" IQUOTE(__LINE__) ") : REVIEW -> "

//----------------------------------------------------------------
//
// Debugging definitions and macros
//

#define STATIC static

#define VRDBG_VR		0x00000001	// printout "ARC" interface activity.
#define VRDBG_OF		0x00000002
#define VRDBG_TEST		0x00000004
#define VRDBG_TREE		0x00000008
#define VRDBG_MEM		0x00000010
#define VRDBG_MAIN		0x00000020
#define VRDBG_ENTRY		0x00000040
#define VRDBG_PE		0x00000080
#define VRDBG_CONF		0x00000100
#define VRDBG_OPEN		0x00000200
#define VRDBG_CONFIG	0x00000400
#define VRDBG_LOAD		0x00000800
#define VRDBG_RDWR		0x00001000
#define VRDBG_ARGV		0x00002000
#define VRDBG_ENV		0x00004000	// printout environment values and variables
#define VRDBG_DUMP		0x00008000
#define VRDBG_HOLDIT	0x00010000
#define SANDALFOOT		0x00020000
//#define CDROMHACK		0x00040000
#define VRDBG_TMP		0x00080000
#define VRDBG_ARCDATA	0x00100000
#define	VRDBG_SCSI		0x00200000	// print out scsi node activity
#define VRDBG_IDE		0x00400000	// print out ide node activity
#define VRDBG_TIME      0x00800000
#define VRDBG_ALL		0xffffffff

#define VRASSERT(_exp)				\
				if (!(_exp)) {	\
					warn("Assertion Failure: line %d, File %s\n",\
						__LINE__, __FILE__);	\
					warn("Veneer Assertion Failure:" #_exp "\n"); \
					ArcHalt();\
				}

#define DBGSET(_value) ((_value)&(VrDebug))
#define VRDBG(_value, _str)		\
	{				\
		if (DBGSET(_value)) {	\
			_str;		\
		}			\
	}

#include "proto.h"

#endif // _VENEER