summaryrefslogblamecommitdiffstats
path: root/private/ntos/nthals/halsni4x/mips/xxinithl.c
blob: 8e05dea91d2d7c319482c2198ef5c338f488b620 (plain) (tree)
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
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746









































































































































































































































































































































































































































































































































































































































































































































































                                                                                                                                       
#pragma comment(exestr, "$Header: /usr4/winnt/SOURCES/ddk351/src/hal/halsni4x/mips/RCS/xxinithl.c,v 1.4 1995/10/06 09:40:49 flo Exp $")
/*--

Copyright (c) 1991  Microsoft Corporation

Module Name:

    xxinithl.c

Abstract:


    This module implements the initialization of the system dependent
    functions that define the Hardware Architecture Layer (HAL) for a
    MIPS R3000 or R4000 system.

Environment:

    Kernel mode only.


--*/

#include "halp.h"
#include "eisa.h"
#include "string.h"
#include "mpagent.h"


#if DBG
UCHAR HalpBuffer[128];
#endif

VOID	HalpNetTowerInit(IN PLOADER_PARAMETER_BLOCK LoaderBlock);
    
typedef struct _HALP_NET_CONFIG {
	UCHAR Reserved[2];
	UCHAR SysBus;		 // 54
	UCHAR Reserved1[5];
	ULONG PISCP;	// adress ISCP
	UCHAR Busy;
	UCHAR Reserved2[3];
	ULONG PSCB;		// adress SCB
	USHORT Status;
	USHORT Command;
	ULONG Reseved3[9];
}  HALP_NET_CONFIG, *PHALP_NET_CONFIG;

ULONG HalpNetReserved[18];

ULONG            HalpLedRegister;
PUCHAR           HalpLedAddress		= (PUCHAR)RM400_LED_ADDR;
ULONG            HalpBusType		= MACHINE_TYPE_ISA;
//ULONG            HalpBusType		= MACHINE_TYPE_EISA;
ULONG            HalpMapBufferSize;
PHYSICAL_ADDRESS HalpMapBufferPhysicalAddress;
PHALP_NET_CONFIG HalpNetStructureAddress;
BOOLEAN          LessThan16Mb;
BOOLEAN          HalpEisaDma;
BOOLEAN 	 	 HalpProcPc		    = TRUE; // kind of CPU module (without second. cache)
BOOLEAN          HalpEisaExtensionInstalled = FALSE;
BOOLEAN          HalpIsRM200		    = FALSE;
MotherBoardType	 HalpMainBoard		    = M8042; // default is RM400 Minitower


BOOLEAN		HalpIsMulti		    = FALSE; // MultiProcessor machine has a MpAgent per processor
BOOLEAN		HalpCountCompareInterrupt   = FALSE;
KAFFINITY	HalpActiveProcessors;
LONG 		HalpNetProcessor = 0;

//
// Define global spin locks used to synchronize various HAL operations.
//

KSPIN_LOCK HalpBeepLock;
KSPIN_LOCK HalpDisplayAdapterLock;
KSPIN_LOCK HalpSystemInterruptLock;

//
// Put all code for HAL initialization in the INIT section. It will be
// deallocated by memory management when phase 1 initialization is
// completed.
//

#if defined(ALLOC_PRAGMA)

#pragma alloc_text(INIT, HalInitSystem)
#pragma alloc_text(INIT, HalInitializeProcessor)
#pragma alloc_text(INIT, HalStartNextProcessor)
#pragma alloc_text(INIT, HalpDisplayCopyRight)

#endif


BOOLEAN
HalInitSystem (
    IN ULONG Phase,
    IN PLOADER_PARAMETER_BLOCK LoaderBlock
    )

/*++

Routine Description:

    This function initializes the Hardware Architecture Layer (HAL) for a
    MIPS R3000 or R4000 system.

Arguments:

    Phase - Supplies the initialization phase (zero or one).

    LoaderBlock - Supplies a pointer to a loader parameter block.

Return Value:

    A value of TRUE is returned is the initialization was successfully
    complete. Otherwise a value of FALSE is returend.

--*/

{
    PMEMORY_ALLOCATION_DESCRIPTOR Descriptor;
    PLIST_ENTRY NextMd;
    PKPRCB Prcb;
    ULONG  BuildType = 0;
    UCHAR  Byte;
    PRESTART_BLOCK NextRestartBlock;

    Prcb = PCR->Prcb;

    if ((Phase == 0) || (Prcb->Number != 0)) {


        //
        // Phase 0 initialization.
        //
        // N.B. Phase 0 initialization is executed on all processors.
        //
        // Verify that the processor block major version number conform
        // to the system that is being loaded.
        //

        if (Prcb->MajorVersion != PRCB_MAJOR_VERSION) {
            KeBugCheck(MISMATCHED_HAL);
        }
       
        if ( (LoaderBlock->u.Mips.SecondLevelDcacheSize) == 0 )
           HalpProcPc = TRUE;
        else
           HalpProcPc = FALSE;

        //
        // Processor 0 specific
        //

	if(Prcb->Number == 0) {

            //
            // Set the number of process id's and TB entries.
            //

            **((PULONG *)(&KeNumberProcessIds)) = 256;
            **((PULONG *)(&KeNumberTbEntries)) = 48;

            //
            // Set the interval clock increment value.
            //

            HalpCurrentTimeIncrement = MAXIMUM_INCREMENT;
            HalpNextTimeIncrement    = MAXIMUM_INCREMENT;
            HalpNewTimeIncrement     = 0;
            KeSetTimeIncrement(MAXIMUM_INCREMENT, MINIMUM_INCREMENT);


            //
            // Initialize all spin locks.
            //

            KeInitializeSpinLock(&HalpBeepLock);
            KeInitializeSpinLock(&HalpDisplayAdapterLock);
            KeInitializeSpinLock(&HalpSystemInterruptLock);

            //
            // Set address of cache error routine.
            //

            KeSetCacheErrorRoutine(HalpCacheErrorRoutine);

            //
            // try to identify the Kind of Mainboard
            //

            HalpMainBoard = (MotherBoardType) READ_REGISTER_UCHAR(0xbff0002a);

            if (HalpMainBoard == M8036) {

                // 
                // this is the "nice" Desktop Model RM200
                //
                HalpIsRM200 = TRUE;

                // 
                // test, if the EISA Extension board is installed in the desktop
                //

                Byte = READ_REGISTER_UCHAR(RM200_INTERRUPT_SOURCE_REGISTER);

                // this bit is low active

                if ((Byte & 0x80) == 0)
                     HalpEisaExtensionInstalled = TRUE;

                //
                // enable all Interrupts by resetting there bits in the interrupt mask register
                // except Timeout interrupts, which we don't like at this moment
                //

        //       WRITE_REGISTER_UCHAR(RM200_INTERRUPT_MASK_REGISTER, (UCHAR)(RM200_TIMEOUT_MASK));
                WRITE_REGISTER_UCHAR(RM200_INTERRUPT_MASK_REGISTER, (UCHAR)(0x00));

            }


            HalpLedRegister = 0;
            HalpLedAddress = (HalpIsRM200) ? (PUCHAR)RM200_LED_ADDR : (PUCHAR)RM400_LED_ADDR;

            //
            // for Isa/Eisa access during phase 0 we use KSEG1 addresses
            // N.B. HalpEisaExtensionInstalled can only be TRUE on an RM200 (Desktop)
            //

            if (HalpEisaExtensionInstalled )
                HalpOnboardControlBase = (PVOID) (RM200_ONBOARD_CONTROL_PHYSICAL_BASE | KSEG1_BASE); 

            else

                HalpOnboardControlBase = (PVOID) (EISA_CONTROL_PHYSICAL_BASE | KSEG1_BASE); 

            HalpEisaControlBase    = (PVOID) (EISA_CONTROL_PHYSICAL_BASE | KSEG1_BASE); 
 
            //
            // Initialize the display adapter.
            //

            HalpInitializeDisplay0(LoaderBlock); 

            //
            // Determine if there is physical memory above 16 MB.
            //

            LessThan16Mb = TRUE;

            NextMd = LoaderBlock->MemoryDescriptorListHead.Flink;

            while (NextMd != &LoaderBlock->MemoryDescriptorListHead) {

                Descriptor = CONTAINING_RECORD( NextMd,
                                            MEMORY_ALLOCATION_DESCRIPTOR,
                                            ListEntry );

                if (Descriptor->BasePage + Descriptor->PageCount > 0x1000) {
                    LessThan16Mb = FALSE;
                }

                NextMd = Descriptor->ListEntry.Flink;
            }

            //
            // Determine the size need for map buffers.  If this system has
            // memory with a physical address of greater than
            // MAXIMUM_PHYSICAL_ADDRESS, then allocate a large chunk; otherwise,
            // allocate a small chunk.
            //

            if (LessThan16Mb) {

                //
                // Allocate a small set of map buffers.  They are only needed for
                // slave DMA devices.
                //

                HalpMapBufferSize = INITIAL_MAP_BUFFER_SMALL_SIZE;

            } else {

                //
                // Allocate a larger set of map buffers.  These are used for
                // slave DMA controllers and Isa cards.
                //

                HalpMapBufferSize = INITIAL_MAP_BUFFER_LARGE_SIZE;

            }

            //
            // Allocate map buffers for the adapter objects
            //

            HalpMapBufferPhysicalAddress.LowPart =
                HalpAllocPhysicalMemory (LoaderBlock, MAXIMUM_PHYSICAL_ADDRESS,
                    HalpMapBufferSize >> PAGE_SHIFT, TRUE);
            HalpMapBufferPhysicalAddress.HighPart = 0;

            if (!HalpMapBufferPhysicalAddress.LowPart) {

                //
                // There was not a satisfactory block.  Clear the allocation.
                //
    
                HalpMapBufferSize = 0;
            }

            //
	    // Is this machine a multi-processor one ?
	    //
            // If the address of the first restart parameter block is NULL, then
            // the host system is a uniprocessor system running with old firmware.
            // Otherwise, the host system may be a multiprocessor system if more
            // than one restart block is present.


	    NextRestartBlock = SYSTEM_BLOCK->RestartBlock;
	    if ((NextRestartBlock != NULL) && (NextRestartBlock->NextRestartBlock != NULL)) {

#if DBG
	        HalDisplayString("Multiprocessor machine detected by RestartBlock\n");
#endif

                //
                // There is more than one processor
                // be sure, the boot (this one) is set to running and started
                //

		HalpIsMulti = TRUE; 
                NextRestartBlock->BootStatus.ProcessorStart = 1;
                NextRestartBlock->BootStatus.ProcessorReady = 1;

                //
                // set up Interrupt routing, Cache replace Address etc.
                //

    	 	PCR->InterruptRoutine[OUR_IPI_LEVEL] = HalpIpiInterrupt;

    	    } else {
#if DBG
	        HalDisplayString("UniProcessor machine detected\n");
#endif
		HalpIsMulti = FALSE; 
	    }

            // Initialize the MP Agent

    	    if (HalpProcessorId == MPAGENT) {
		HalpInitMPAgent(0); 
                HalpActiveProcessors = 0x01;
	    }	

            //
            // For the moment, we say all Eisa/ Isa(Onboard) Interrupts should go to processor 0
            //

            HalpCreateEisaStructures(Isa);       // Initialize Onboard Interrupts and Controller

            //
            // The RM200 is in Fact a real Uni Processor machine
            //

            if(HalpEisaExtensionInstalled) {
                HalpCreateEisaStructures(Eisa);  // Initialize Eisa Extension board Interrupts
                                                 // and Controller for the RM200
            }

	    // Correction pb Tower with memory > 128 mb + minitower with adaptec

	    if ((HalpMainBoard == M8032) || (HalpMainBoard == M8042))
						HalpNetTowerInit(LoaderBlock);

            //
            // Initialize SNI specific interrupts
            // (only once needed)
            //

            if (HalpProcessorId == MPAGENT) HalpCreateIntMultiStructures(); else HalpCreateIntStructures();         

	} else {

#if DBG
//            sprintf(HalpBuffer,"HalInitSystem:          running on %d\n", HalpGetMyAgent());
//            HalDisplayString(HalpBuffer);
#endif
            //
            // Place something special only to Slave Processors here ...
            //

            HalpInitMPAgent(Prcb->Number); // enables IPI, init cache replace address	
            PCR->InterruptRoutine[OUR_IPI_LEVEL] = HalpIpiInterrupt;
        }

    
        // 
        // PCR tables and System Timer Initialisation
        // 

        HalpInitializeInterrupts();        

        return (TRUE);             

    } else {

        extern BOOLEAN HalpX86BiosInitialized;

        //
        // Phase 1 initialization.
        //
        // N.B. Phase 1 initialization is only executed on processor 0.

        //
        // Complete initialization of the display adapter.
        //

        if (HalpInitializeDisplay1(LoaderBlock) == FALSE) {
            return FALSE;
        }

        //
        // Mapping of the EISA Control Space via MmMapIoSpace()
        //

        HalpMapIoSpace();                    

        HalpCalibrateStall();

        //
        // Initialisation of the x86 Bios Emulator ...
        //

        x86BiosInitializeBios(HalpEisaControlBase, HalpEisaMemoryBase);
        HalpX86BiosInitialized = TRUE;

        //
        // Be sure, that the NET_LEVEL is not in the reserved vector .
        // (NET_DEFAULT_VECTOR == IPI_LEVEL = 7) => only used for
	// machine != RM200 (mainboard 8036) and processor without
	// secondary cache
        //

        if ((HalpProcPc) || ((HalpProcessorId == ORIONSC) && (HalpMainBoard != M8036))) 
		PCR->ReservedVectors &= ~(1 << NET_DEFAULT_VECTOR);

        HalpDisplayCopyRight();

        return TRUE;
    }
}


VOID
HalInitializeProcessor (
    IN ULONG Number
    )

/*++

Routine Description:

    This function is called early in the initialization of the kernel
    to perform platform dependent initialization for each processor
    before the HAL Is fully functional.

    N.B. When this routine is called, the PCR is present but is not
         fully initialized.

Arguments:

    Number - Supplies the number of the processor to initialize.

Return Value:

    None.

--*/

{

//
// The boot processor is already initialized
//

if (Number == 0)
    return;

#if DBG
//    sprintf(HalpBuffer,"HalInitializeProcessor %d\n",Number);
//    HalDisplayString(HalpBuffer);
#endif

return;

}

BOOLEAN
HalStartNextProcessor (
    IN PLOADER_PARAMETER_BLOCK LoaderBlock,
    IN PKPROCESSOR_STATE ProcessorState
    )

/*++

Routine Description:

    This function is called to start the next processor.

Arguments:

    LoaderBlock - Supplies a pointer to the loader parameter block.

    ProcessorState - Supplies a pointer to the processor state to be
        used to start the processor.

Return Value:

    If a processor is successfully started, then a value of TRUE is
    returned. Otherwise a value of FALSE is returned. If a value of
    TRUE is returned, then the logical processor number is stored
    in the processor control block specified by the loader block.

--*/

{

    PRESTART_BLOCK NextRestartBlock;
    ULONG Number;
    PKPRCB Prcb;

    if(!HalpIsMulti) {
        return FALSE;
    }

#if DBG
//    sprintf(HalpBuffer,"HalStartNextProcessor   running on %d\n", HalpGetMyAgent());
//    HalDisplayString(HalpBuffer);
#endif

    //
    // If the address of the first restart parameter block is NULL, then
    // the host system is a uniprocessor system running with old firmware.
    // Otherwise, the host system may be a multiprocessor system if more
    // than one restart block is present.
    //
    // N.B. The first restart parameter block must be for the boot master
    //      and must represent logical processor 0.
    //


    NextRestartBlock = SYSTEM_BLOCK->RestartBlock;
    if (NextRestartBlock == NULL) {
        return FALSE;
    }

    //
    // Scan the restart parameter blocks for a processor that is ready,
    // but not running. If a processor is found, then fill in the restart
    // processor state, set the logical processor number, and set start
    // in the boot status.
    //

    Number = 0;
    do {
        if ((NextRestartBlock->BootStatus.ProcessorReady != FALSE) &&
            (NextRestartBlock->BootStatus.ProcessorStart == FALSE)) {

            RtlZeroMemory(&NextRestartBlock->u.Mips, sizeof(MIPS_RESTART_STATE));
            NextRestartBlock->u.Mips.IntA0 = ProcessorState->ContextFrame.IntA0;
            NextRestartBlock->u.Mips.Fir = ProcessorState->ContextFrame.Fir;
            Prcb = (PKPRCB)(LoaderBlock->Prcb);
            Prcb->Number = (CCHAR)Number;
            Prcb->RestartBlock = NextRestartBlock;
            NextRestartBlock->BootStatus.ProcessorStart = 1;
//
// start it by sending him a special IPI message (SNI special to avoid traffic on 
// the MP bus during boot)
//
            HalpActiveProcessors |= (1 << (NextRestartBlock->ProcessorId));
	    HalpSendIpi(1 << (NextRestartBlock->ProcessorId),  MPA_BOOT_MESSAGE );
	    HalpNetProcessor = 1; // If proc 1 started, net interrupts will be connected to it 
            return TRUE;
        }

        Number += 1;
        NextRestartBlock = NextRestartBlock->NextRestartBlock;
    } while (NextRestartBlock != NULL);

    return FALSE;
}

VOID
HalpVerifyPrcbVersion(
    VOID
    )

/*++

Routine Description:

    This function ?

Arguments:

    None.


Return Value:

    None.

--*/

{

    return;
}

VOID
HalpDisplayCopyRight(
    VOID
    )
/*++

Routine Description:

    This function displays the CopyRight Information in the correct SNI Style

Arguments:

    None.


Return Value:

    None.

--*/
{

//
// Define Identification Strings.
//
    HalDisplayString("ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»\n");
    HalDisplayString("ºMicrosoft(R) Windows NT(TM) 3.51 Hardware Abstraction Layer º\n");
    HalDisplayString("ºfor Siemens Nixdorf  RM200/RM400         Release 2.0 B0006  º\n");
    HalDisplayString("ºCopyright(c) Siemens Nixdorf Informationssysteme AG 1995    º\n");
    HalDisplayString("ºCopyright(c) Microsoft Corporation 1985-1995                º\n");
    HalDisplayString("ºAll Rights Reserved                                         º\n");
    HalDisplayString("ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ\n");

    //
    // this does not seem to work correct on NT 3.51 builds (872) at least 
    // on our MultiPro machine
    //
    if(!HalpCountCompareInterrupt) {

    HalDisplayString("ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»\n");
    HalDisplayString("ºWARNING:     CountCompare Interrupt is not enabled          º\n");
    HalDisplayString("ºWARNING:     please contact your local Siemens Nixdorf      º\n");
    HalDisplayString("ºWARNING:     Service Center.                                º\n");
    HalDisplayString("ºWARNING:                                                    º\n");
    HalDisplayString("ºWARNING:     Your System will come up - but some            º\n");
    HalDisplayString("ºWARNING:     performance measurement issues                 º\n");
    HalDisplayString("ºWARNING:     WILL NOT FUNCTION PROPERLY                     º\n");
    HalDisplayString("ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ\n");

    }


}



VOID
HalpNetTowerInit(
    IN PLOADER_PARAMETER_BLOCK LoaderBlock
    )
/*++

Routine Description:

    This function is only used on Tower machines. It initialises the net chip.
    It is used because of a hardware problem when the machine has
    more than 128 Mb memory : net interrupts may happen with no
    installed network. 

Arguments:

    None.


Return Value:

    None.

--*/
{
ULONG Cmd;
PUSHORT Port = (PUSHORT)0xb8000000;
PULONG ChannelAttention = (PULONG)0xb8010000;   
ULONG Time;
USHORT Status;

        HalpNetStructureAddress = 
             (PHALP_NET_CONFIG) (((ULONG)((PUCHAR)HalpNetReserved + 0xf)) & 0xfffffff0);  // aligned on 16 
        HalpNetStructureAddress	= (PHALP_NET_CONFIG) ((ULONG)HalpNetStructureAddress | 0xa0000000);
		HalSweepDcache();	// because we are going to use non cached addresses
        HalpNetStructureAddress->SysBus = 0x54;
		HalpNetStructureAddress->Busy = 0xff;
		HalpNetStructureAddress->PISCP = (ULONG)(((PULONG)HalpNetStructureAddress) + 3) & 0x5fffffff;
		HalpNetStructureAddress->PSCB = (ULONG)(((PULONG)HalpNetStructureAddress) + 5) & 0x5fffffff;

		Cmd = 0;
		WRITE_REGISTER_USHORT(Port, (USHORT)Cmd);
		WRITE_REGISTER_USHORT(Port, (USHORT)Cmd);
		KeStallExecutionProcessor(50000);

        Cmd = (((ULONG)HalpNetStructureAddress) & 0x5fffffff) | 0x02;
		WRITE_REGISTER_USHORT(Port, (USHORT)Cmd);
		WRITE_REGISTER_USHORT(Port, (USHORT)(Cmd >> 16));

		Cmd = 0;
		WRITE_REGISTER_ULONG(ChannelAttention,Cmd);

	    Time = 20;
		while (Time > 0) {   
        	if (!(HalpNetStructureAddress->Busy !=0)) { 
            	break;  
        	}     
        	KeStallExecutionProcessor(10000);  
        	Time--; 
    	} 
		
		Status = HalpNetStructureAddress->Status;
		Status = Status & 0xf000;
		HalpNetStructureAddress->Command = Status;
		KeFlushWriteBuffer();

		Cmd = 0;
		WRITE_REGISTER_ULONG(ChannelAttention,Cmd);
}