summaryrefslogtreecommitdiffstats
path: root/private/ntos/nthals/halfire/ppc/phsystem.h
blob: 03b211f4021ce6aaf140e5730765a1030f05d75a (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
/*
 * Copyright (c) 1995 Firepower Systems, Inc.
 * DO NOT DISTRIBUTE without permission
 *
 * $RCSfile: phsystem.h $
 * $Revision: 1.28 $
 * $Date: 1996/05/14 02:33:25 $
 * $Locker:  $
 */

#ifndef PHSYSTEM_H
#define PHSYSTEM_H

//
// (sfk 11/3/94)
// Should this be placed here or directly included?
//
#include "fpreg.h"
#include "stdio.h"
#include "ntverp.h"

// defined 'special' address space for system memory [rdl:01.04.95]
#define MEMORY_ADDRESS_SPACE 0
#define IO_ADDRESS_SPACE     1
#define SYSTEM_ADDRESS_SPACE 2

BOOLEAN	HalpInitializeDisplay1(PLOADER_PARAMETER_BLOCK);
ULONG	HalpInitInts( ULONG CpuNumber );
VOID    HalpInitPciBusEarly( PLOADER_PARAMETER_BLOCK );
int 	PHalTriggerEvent( ULONG returndata );
int 	PHalSetupGpio( ULONG LEDFLAGS );
VOID	PHalBlinkLeds( UCHAR LEDS, ULONG Rate, ULONG LEDFLAGS );
int 	PHalpInterruptSetup( VOID );
BOOLEAN PHalpHandleIpi(	PKINTERRUPT , PVOID , PVOID );
VOID	PHalpDumpLoaderBlock ( PLOADER_PARAMETER_BLOCK );
VOID	PHalpDumpConfigData ( PCONFIGURATION_COMPONENT_DATA, PULONG );
VOID	PHalDumpTree ( PCONFIGURATION_COMPONENT_DATA );
BOOLEAN PHalpEisaDispatch( PKINTERRUPT , PVOID , PVOID );
int 	PH_HalVersion( VOID );
ULONG	HalpCheckString( PCHAR , PCHAR );
ULONG	HalpSetPixelColorMap( ULONG , ULONG );
BOOLEAN	HalpInitIntelAIP ( VOID );
VOID 	PH_HalVersionInternal( VOID );
VOID 	PH_HalVersionExternal( VOID );
VOID	HalpResetByKeyboard(VOID);
VOID	HalpSetupDCC(ULONG, ULONG);

BOOLEAN HalpMemoryHandler(
    IN PKINTERRUPT Interrupt,
    IN PVOID ServiceContext,
    IN PVOID TrapFrame);

BOOLEAN HalpHandleExternalInterrupt(	IN PKINTERRUPT Interrupt,
					IN PVOID ServiceContext,
					IN PVOID TrapFrame
				    );
ULONG	HalpGetProcessorRev( VOID);

// define the start address for system register space, apart
//	from eisa/pci specific registers
//
// PVOID	HalpSysBase =	(PVOID) 0xff000000;
// PVOID	HalpSysBase =	(PVOID) 0x8000ff00;

extern	PVOID	HalpSystemSpace;
extern	PVOID	HalpIoControl;
extern	PVOID	HalpVideMemoryBase;
extern	PVOID	HalpSystemControlBase;
extern  BOOLEAN HalpInitializeRegistry (IN PLOADER_PARAMETER_BLOCK LoaderBlock);
extern	ULONG	HalpGetCycleTime(VOID);
extern	ULONG	HalpProcessorCount(VOID);
extern	ULONG	HalpGetCycleTime(VOID);

#define LED_0		0x01    // led 0
#define LED_1		0x02    // led 1
#define LED_2		0x04    // led 2
#define LED_3		0x08    // led 3
#define LED_EMIT	0xf0	// led direction bits in gpio register

#define LED_ON	0xffffffff
#define LED_OFF 0x00000000
//#define DCC_INDX        0x840
//#define DCC_DATA        0x841
#define GPIOA   0x2
// #define WAIT_TIME       0xf000000
#define WAIT_TIME       0x800000

typedef struct _DCC_CONTROL {
	UCHAR space[0x840];
	UCHAR DccIndxReg; // this should show up at address base + 840
	UCHAR DccDataReg; // this should show up at address base + 841
	UCHAR DccTestAddr; // this is for test purposes....
} DCC_CONTROL, *P_DCC_CONTROL;

typedef struct _Address_Map {
	ULONG System;
	ULONG IO;
	ULONG General;
} Address_Map, *PAddress_Map;


typedef struct {
	ULONG	EntryCounter;
	ULONG	ExitCounter;
	ULONG	Flags;		// keep track of where in the routine you are..
	ULONG	Isr;
	ULONG	TmpMask;
	ULONG	MasksDifferFlag;
	ULONG	SysInterruptVector;
	ULONG	Intbucket;	// bit map each int type seen
	ULONG	CompareMask;
	ULONG	BusyCount;
	ULONG	Bloob;
	ULONG	LastCount;
} HalState, *PHalState;

//
// System Descriptions:
//		Hold a description of the system for the hal to use
//		to determine what form it should take.

//
// Declare an enumerated type for asking which processor the
// system is currently running on.
//
typedef struct {
    ULONG Flags;
    ULONG HashSize;
    PCHAR ProcessorName;
	PCHAR ProductNumber;
} PROCESSOR_DESCRIPTION;

//
// Flags for defining the capabilities of the cpu,
//		and the enumerated labels for marking what
//		cpu we're on.
//
#define PROC_NOSUPP     0x00000000
#define PROC_SUPP       0x00000001
#define PROC_HASHTABLE  0x00000002
#define PROC_MPCAPABLE  0x00000004

typedef enum {
	PPC_UNKNOWN = 0,
	PPC_601 = 1,
	PPC_602 = 2,
	PPC_603 = 3,
	PPC_604 = 4,
	PPC_605 = 5,
	PPC_606 = 6,
	PPC_607 = 7,
	PPC_608 = 8,
	PPC_609 = 9,
    nPROCESSOR_TYPE
} PROCESSOR_TYPE;

extern PROCESSOR_DESCRIPTION ProcessorDescription[];
extern PROCESSOR_TYPE ProcessorType;

//
// System IDENT Values:
//
#define ESCC_IDENT	0x60730000	// chip only in pro
#define TSC_IDENT	0x60370000	// chip only in top ( currently )


//
// Flags to label the capabilities of the system as a whole:
//
#define SYS_NOSUPP		0x00000000	// system is not supported by this hal.
#define SYS_SUPP		0x00000001	// system is supported by this hal.
#define SYS_MPCAPABLE	0x00000002	// system is able to support more than one cpu.
#define SYS_MPFOREAL    0x00000004	// system is able to have more than one cpu.

typedef enum {
	SYS_UNKNOWN  = 0,
	SYS_POWERPRO = 1, // 0x60730000
	SYS_POWERTOP = 2, // 0x60370000
	SYS_POWERSERVE = 3, // 0x60370000 ???? don't know yet
        SYS_POWERSLICE = 4, 
    nSYSTEM_TYPE
} SYSTEM_TYPE ;

typedef struct {
    ULONG Flags;
    PCHAR SystemName;
} SYSTEM_DESCRIPTION, PSYSTEM_DESCRIPTION;

typedef struct _HW_DESCRIPTION {
	ULONG HwFlags;
	ULONG Spare;
}HARDWARE_DESCRIPTION;
extern SYSTEM_DESCRIPTION SystemDescription[];
extern SYSTEM_TYPE SystemType;
extern VOID HalpInitIoBuses ( VOID );

#define	IRQ0	1

extern ULONG PciDeviceIDs[4][256];
extern ULONG PciClassInfo[4][256];


//
// these values show up in the lower byte of the interrupt word read out of
// the system register...
//
#define	VEC_Timer		0x0001
#define	VEC_Keyboard	0x0002
#define	VEC_Cascade		0x0004
#define	VEC_Serial2		0x0008
#define	VEC_Serial1		0x0010
#define	VEC_Display		0x0020
#define	VEC_Floppy		0x0040
#define	VEC_Parallel1	0x0080
//
// these values show up in the secondary next byte
// of the SIO
//
#define	VEC_RTC			0x0100
#define	VEC_Open9		0x0200
#define	VEC_Audio		0x0400
#define	VEC_PCI			0x0800
#define	VEC_Mouse		0x1000
#define	VEC_Scsi		0x2000
#define VEC_Enet		0x4000
#define	VEC_Open15		0x8000

#define HalPrint  HalpDebugPrint
#define HalpPrint HalpDebugPrint

#define HalBreak(x)
#define SEE_DEFINES A_DEFINES
#define SET_STRING(x)	#x

//
//Declare The BAT Support Routines [ged]
//
ULONG HalpGetUpperIBAT(ULONG);
ULONG HalpGetLowerIBAT(ULONG);
ULONG HalpGetUpperDBAT(ULONG);
ULONG HalpGetLowerDBAT(ULONG);
VOID  HalpSetLowerDBAT1(ULONG);
VOID  HalpSetUpperDBAT1(ULONG);
// Add more BAT Support Routines [rdl:01.03.95]
VOID  HalpSetUpperDBAT(ULONG,ULONG);
VOID  HalpSetLowerDBAT(ULONG,ULONG);

//
// Memory parity error variables
//

#define MemoryParityErrorsVarName "MEMORY_PARITY_ERRORS"
extern ULONG MemoryParityErrorsThisBoot;
extern ULONG MemoryParityErrorsForever;

//
// 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 -> "


#define NOTE(x) message(REVIEW IQUOTE(x) )

#define PAUSE for(;;) { \
		}


#endif // PHSYSTEM_H