summaryrefslogtreecommitdiffstats
path: root/private/ntos/nthals/halr94a/mips/halp.h
blob: 1bd34fd72e1cef09971083170a0ba09e94ef06ec (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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
// #pragma comment(exestr, "@(#) halp.h 1.1 95/09/28 15:33:24 nec")
/*++ BUILD Version: 0003    // Increment this if a change has global effects

Copyright (c) 1991-1993  Microsoft Corporation

Module Name:

    halp.h

Abstract:

    This header file defines the private Hardware Architecture Layer (HAL)
    interfaces.

Author:

    David N. Cutler (davec) 25-Apr-1991


Revision History:

    L0001	1994.9.20	kbnes!kuriyama(A)
                -Modify for R94A	original halfxs\mips\halp.h
		-add #include"r94axxx.h "
    L0002	Thu Oct 13 18:09:33 JST 1994	kbnes!kuriyama(A)
	        - Del HalpDisplayLED
		- Del HalpLEDDisplayLock
		- Del HalpLEDControlBase
		- Add READ_REGISTER_DWORD
    ADD001	ataka@oa2.kb.nec.co.jp Mon Oct 17 20:31:21 JST 1994
                - add data definitions for HalReportResourceUsage
    CMP001      ataka@oa2.kb.nec.co.jp Tue Oct 18 15:15:11 JST 1994
                - resolve compile error
    ADD002	kisimoto@oa2.kb.nec.co.jp Fri Nov 25 15:46:03 1994
		add HalpGetStatusRegister() definition
    S0003	kuriyama@oa2.kb.nec.co.jp Fri Mar 31 16:51:00 JST 1995
                add _IPI_LIMIT_ support
    H0004	kisimoto@oa2.kb.nec.co.jp Sun Jun 25 14:39:38 1995
		- Merge build 1057
    H0005	kisimoto@oa2.kb.nec.co.jp Thu Jul 20 20:03:30 1995
		- Merge code for ESM from J94C
    H0006	kisimoto@oa2.kb.nec.co.jp Sat Aug 12 19:23:03 1995
                - Removed _J94C_ definitions.
                _J94C_ definition indicates that the status of
                the dump switch can acknowledge from Self-test
                register.
    S0007       kuriyama@oa2.kb.nec.co.jp Wed Aug 23 20:18:18 JST 1995
                - change  for x86bios support
    H0008	kisimoto@oa2.kb.nec.co.jp Wed Aug 30 12:23:36 1995
                - add spinlock to support PCI Fast Back-to-back transfer.

--*/

#ifndef _HALP_
#define _HALP_

#if defined(NT_UP)

#undef NT_UP

#endif

#include "nthal.h"
#include "hal.h" // H0004

#ifndef _HALI_ // H0004
#include "..\inc\hali.h"
#endif

#if defined(_DUO_)

#if defined(_R94A_)

#include "r94adma.h"
#include "r94adef.h"
#include "r94aint.h"

#else // _R94A_

#include "duodma.h"
#include "duodef.h"
#include "duoint.h"

#endif // _R94A_

#endif

#if defined(_JAZZ_)

#include "jazzdma.h"
#include "jazzdef.h"
#include "jazzint.h"

#endif

#include "jxhalp.h"

#if defined(USE_BIOS_EMULATOR) // H0004

#include "xm86.h"
#include "x86new.h"

#endif


//
// Define function prototypes.
//

PADAPTER_OBJECT
HalpAllocateAdapter(
    IN ULONG MapRegistersPerChannel,
    IN PVOID AdapterBaseVa,
    IN PVOID MapRegisterBase
    );

ULONG
HalpAllocateTbEntry (
    VOID
    );

VOID
HalpFreeTbEntry (
    VOID
    );

VOID
HalpCacheErrorRoutine (
    VOID
    );

BOOLEAN
HalpCalibrateStall (
    VOID
    );

VOID
HalpClockInterrupt0 (
    VOID
    );

VOID
HalpClockInterrupt1 (
    VOID
    );

BOOLEAN
HalpCreateDmaStructures (
    VOID
    );

BOOLEAN
HalpDmaDispatch(
    IN PKINTERRUPT Interrupt,
    IN PVOID ServiceContext
    );

BOOLEAN
HalpInitializeDisplay0 (
    IN PLOADER_PARAMETER_BLOCK LoaderBlock
    );

BOOLEAN
HalpInitializeDisplay1 (
    IN PLOADER_PARAMETER_BLOCK LoaderBlock
    );

BOOLEAN
HalpInitializeInterrupts (
    VOID
    );

VOID
HalpIpiInterrupt (
    VOID
    );

BOOLEAN
HalpMapFixedTbEntries (
    VOID
    );

BOOLEAN
HalpMapIoSpace (
    VOID
    );

VOID
HalpProfileInterrupt (
    VOID
    );

#if defined(R4000)

ULONG
HalpReadCountRegister (
    VOID
    );

ULONG
HalpWriteCompareRegisterAndClear (
    IN ULONG Value
    );

#endif

VOID
HalpStallInterrupt (
    VOID
    );

// S0007
// change prototype HalpInitializeX86DisplayAdapter()

BOOLEAN
HalpInitializeX86DisplayAdapter(
    VOID
    );

VOID
HalpResetX86DisplayAdapter(
    VOID
    );

#if defined(_R94A_)
VOID
READ_REGISTER_DWORD(
    PLARGE_INTEGER,
    PVOID
    );

VOID
WRITE_REGISTER_DWORD(
    PLARGE_INTEGER,
    PVOID
    );

VOID
HalpGetStatusRegister (
   IN PULONG Variable
   );

BOOLEAN
HalNvramWrite(
    ULONG   Offset,
    ULONG   Count,
    PVOID   Buffer
);

BOOLEAN
HalNvramRead(
    ULONG   Offset,
    ULONG   Count,
    PVOID   Buffer
);

BOOLEAN
HalpNvramReadWrite(
    ULONG   Offset,
    ULONG   Count,
    PVOID   Buffer,
    ULONG   Write
);
#endif

//
// Define external references.
//

extern KSPIN_LOCK HalpBeepLock;
extern USHORT HalpBuiltinInterruptEnable;
extern ULONG HalpCurrentTimeIncrement;
extern KSPIN_LOCK HalpDisplayAdapterLock;
extern KAFFINITY HalpEisaBusAffinity;
extern ULONG HalpNextIntervalCount;
extern ULONG HalpNextTimeIncrement;
extern ULONG HalpNewTimeIncrement;
extern ULONG HalpProfileCountRate;
extern ULONG HalpStallScaleFactor;
extern KSPIN_LOCK HalpSystemInterruptLock;
extern KSPIN_LOCK HalpIpiRequestLock;
extern KSPIN_LOCK Ecc1bitDisableLock;// H005
extern KSPIN_LOCK Ecc1bitRoutineLock;// H005
extern KSPIN_LOCK HalpPCIBackToBackLock; // H008


// ADD001
//
// Resource usage information
//

#if !defined (_R94A_)
#pragma pack(1)
#endif
typedef struct {
    UCHAR   Flags;
    KIRQL   Irql;
    UCHAR   BusReleativeVector;
} IDTUsage;

typedef struct _HalAddressUsage{
    struct _HalAddressUsage *Next;
    CM_RESOURCE_TYPE        Type;       // Port or Memory
    UCHAR                   Flags;      // same as IDTUsage.Flags
    struct {
        ULONG   Start;
        USHORT  Length;
    }                       Element[];
} ADDRESS_USAGE;
#if !defined (_R94A_)
#pragma pack()
#endif

#define IDTOwned            0x01        // IDT is not available for others
#define InterruptLatched    0x02        // Level or Latched
#define InternalUsage       0x11        // Report usage on internal bus
#define DeviceUsage         0x21        // Report usage on device bus

extern IDTUsage         HalpIDTUsage[];
extern ADDRESS_USAGE   *HalpAddressUsageList;
// CMP001
extern ADDRESS_USAGE HalpDefaultPcIoSpace;
extern ADDRESS_USAGE HalpEisaIoSpace;
extern ADDRESS_USAGE HalpMapRegisterMemorySpace;

#define HalpRegisterAddressUsage(a) \
    (a)->Next = HalpAddressUsageList, HalpAddressUsageList = (a);

// CMP001
#define  IRQ_PREFERRED  0x02
#define  IRQ_VALID      0x01

// CMP001
VOID
HalpReportResourceUsage (
    IN PUNICODE_STRING  HalName,
    IN INTERFACE_TYPE   DeviceInterfaceToUse
);

//
// H0004: from halx86/i386/halp.h
// Temp definitions to thunk into supporting new bus extension format
//

VOID
HalpRegisterInternalBusHandlers (
    VOID
    );

PBUS_HANDLER
HalpAllocateBusHandler (
    IN INTERFACE_TYPE   InterfaceType,
    IN BUS_DATA_TYPE    BusDataType,
    IN ULONG            BusNumber,
    IN INTERFACE_TYPE   ParentBusDataType,
    IN ULONG            ParentBusNumber,
    IN ULONG            BusSpecificData
    );

#define HalpHandlerForBus   HaliHandlerForBus
#define HalpSetBusHandlerParent(c,p)    (c)->ParentHandler = p;

#if DBG
   int printNvramData(void);
#endif // DBG

#endif // _HALP_