summaryrefslogtreecommitdiff
path: root/driver/xf86-video-mga/src/clientlx.c
blob: 306d3ed34483949d68138397122182d99391ccc1 (plain)
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
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
/******************************************************************************\

    clientlx.c

    Copyright © 1997, Matrox Graphics Inc.

    All Rights Reserved.

\******************************************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "xf86_OSproc.h"
#include "xf86Pci.h"
#include "client.h"
#include "mga.h"

CLIENTTABLE ClientFunctions = {
    (ULONG (DECL *)(LPVOID,ULONG,LPVOID))    ClientReadConfigSpaceByte,
    (ULONG (DECL *)(LPVOID,ULONG,LPVOID))    ClientReadConfigSpaceDword,
    (ULONG (DECL *)(LPVOID,ULONG,UCHAR))     ClientWriteConfigSpaceByte,
    (ULONG (DECL *)(LPVOID,ULONG,ULONG))     ClientWriteConfigSpaceDword,
    (ULONG (DECL *)(LPVOID,ULONG,ULONG))     ClientOpenRegisterBase,
    (ULONG (DECL *)(LPVOID))                 ClientCloseRegisterBase,
    (ULONG (DECL *)(LPVOID,ULONG,LPVOID))    ClientReadRegisterByte,
    (ULONG (DECL *)(LPVOID,ULONG,LPVOID))    ClientReadRegisterDword,
    (ULONG (DECL *)(LPVOID,ULONG,UCHAR))     ClientWriteRegisterByte,
    (ULONG (DECL *)(LPVOID,ULONG,ULONG))     ClientWriteRegisterDword,
    (ULONG (DECL *)(LPVOID,ULONG,ULONG))     ClientOpenMemoryBase,
    (ULONG (DECL *)(LPVOID))                 ClientCloseMemoryBase,
    (ULONG (DECL *)(LPVOID,ULONG,LPVOID))    ClientReadMemoryByte,
    (ULONG (DECL *)(LPVOID,ULONG,LPVOID))    ClientReadMemoryDword,
    (ULONG (DECL *)(LPVOID,ULONG,UCHAR))     ClientWriteMemoryByte,
    (ULONG (DECL *)(LPVOID,ULONG,ULONG))     ClientWriteMemoryDword,
    (ULONG (DECL *)(LPVOID,ULONG,ULONG))     ClientOpenSystemDevice,
    (ULONG (DECL *)(LPVOID))                 ClientCloseSystemDevice,
    (ULONG (DECL *)(LPVOID,ULONG,LPVOID))    ClientReadSystemDeviceByte,
    (ULONG (DECL *)(LPVOID,ULONG,LPVOID))    ClientReadSystemDeviceDword,
    (ULONG (DECL *)(LPVOID,ULONG,UCHAR))     ClientWriteSystemDeviceByte,
    (ULONG (DECL *)(LPVOID,ULONG,ULONG))     ClientWriteSystemDeviceDword,
    (ULONG (DECL *)(LPVOID,ULONG))           ClientWait,
    (ULONG (DECL *)(LPVOID,LPVOID,LPVOID))   ClientGetBiosInfo,
    (ULONG (DECL *)(LPVOID,LPVOID,ULONG))    ClientReadDDCEdid
};

/******************************************************************************\

    Function      : ClientReadConfigSpaceByte

    Description   : Read a Byte from the configuration space.

    I/O Desc.     : LPBOARDHANDLE pBoard | Handle to the board structure
                    containing all the information about a specifib board.
                    ULONG ulOffset | Offset of the Byte to be read.
                    UCHAR *pucByte | pointer to a byte that will receive
                    the data

    Return Val : ULONG

\******************************************************************************/
ULONG ClientReadConfigSpaceByte(LPBOARDHANDLE pBoard, ULONG ulOffset,
                                UCHAR *pucByte)
{
    LPCLIENTDATA pClientStruct = MGAGetClientPointer(pBoard);
    MGAPtr pMga = (MGAPtr)pClientStruct->pMga;

    ASSERT_HANDLER(pBoard);

    *pucByte = pciReadByte(pMga->PciTag,ulOffset);

    return 0;
}


/******************************************************************************\

    Function      : ClientReadConfigSpaceDword

    Description   : Read a Dword from the configuration space.

    I/O Desc.     : LPBOARDHANDLE pBoard | Handle to the board structure
                    containing all the information about a specific board.
                    ULONG ulOffset  | Offset of the Byte to be read.
                    ULONG *pulDword | Dword to receive the data

    Return Val    : ULONG

\******************************************************************************/
ULONG ClientReadConfigSpaceDword(LPBOARDHANDLE pBoard, ULONG ulOffset,
                                 ULONG *pulDword)
{
    LPCLIENTDATA pClientStruct = MGAGetClientPointer(pBoard);
    MGAPtr pMga = (MGAPtr)pClientStruct->pMga;

    ASSERT_HANDLER(pBoard);

    *pulDword = pciReadLong(pMga->PciTag,ulOffset);

    return 0;
}


/******************************************************************************\

    Function      : ClientWriteConfigSpaceByte

    Description   : Write a Byte from the configuration space.

    I/O Desc.     : LPBOARDHANDLE pBoard | Handle to the board structure
                    containing all the information about a specific board.
                    ULONG ulOffset | Offset of the Byte to be read.
                    UCHAR ucByte   | Byte to receive the data

    Return Val    : ULONG

\******************************************************************************/
ULONG ClientWriteConfigSpaceByte(LPBOARDHANDLE pBoard, ULONG ulOffset,
                                 UCHAR ucByte)
{
    LPCLIENTDATA pClientStruct = MGAGetClientPointer(pBoard);
    MGAPtr pMga = (MGAPtr)pClientStruct->pMga;

    ASSERT_HANDLER(pBoard);

    pciWriteByte(pMga->PciTag,ulOffset, ucByte);

    return 0;
}


/******************************************************************************\

    Function      : ClientWriteConfigSpaceDword

    Description   : Write a Dword from the configuration space.

    I/O Desc.     : LPBOARDHANDLE pBoard     | Handle to the board structure
                    containing all the information about a specific board.
                    ULONG ulOffset | Offset of the Byte to be read.
                    ULONG ulDword  | Dword containing the data to  be written

    Return Val    : ULONG

\******************************************************************************/
ULONG ClientWriteConfigSpaceDword(LPBOARDHANDLE pBoard, ULONG ulOffset,
                                  ULONG ulDword)
{
    LPCLIENTDATA pClientStruct = MGAGetClientPointer(pBoard);
    MGAPtr pMga = (MGAPtr)pClientStruct->pMga;

    ASSERT_HANDLER(pBoard);

    pciWriteLong(pMga->PciTag,ulOffset, ulDword);

    return 0;
}


/******************************************************************************\

    Function      : ClientOpenRegisterBase

    Description   : Map the register base for future call to ClientReadRegisterX
                    and ClientWriteRegisterX.

    I/O Desc.     : LPBOARDHANDLE pBoard | Handle to the board structure
                    containing all the information about a specific board.
                    ULONG ulAddress | Physical address of the Register aperture
                    ULONG ulSize    | Size in Byte of the Register Aperture

    Return Val : ULONG

\******************************************************************************/
ULONG ClientOpenRegisterBase(LPBOARDHANDLE pBoard, ULONG ulAddress, ULONG ulSize)
{
    LPCLIENTDATA pClientStruct = MGAGetClientPointer(pBoard);
    MGAPtr pMga = (MGAPtr)pClientStruct->pMga;

    ASSERT_HANDLER(pBoard);

    pClientStruct->ulRegisterBase = (ULONG) pMga->IOBase;

    return 0;
}


/******************************************************************************\

    Function      : ClientCloseRegisterBase

    Description   : Unmap the register base address and free resources needed
                    to address it.

    I/O Desc.     : LPBOARDHANDLE pBoard | Handle to the board structure
                    containing all the information about a specific board.

    Return Val : ULONG

\******************************************************************************/
ULONG ClientCloseRegisterBase(LPBOARDHANDLE pBoard)
{
    ASSERT_HANDLER(pBoard);
    return 0;
}


/******************************************************************************\

    Function      : ClientReadRegisterByte

    Description   : Read a byte from the Register space.

    I/O Desc.     : LPBOARDHANDLE pBoard | Handle to the board structure.
                    containing all the information about a specific board.
                    ULONG ulOffset | Offset of the Byte to be read.
                    UCHAR *pucByte | pointer to the byte that will receive
                    the data.

    Return Val    : ULONG

\******************************************************************************/
ULONG ClientReadRegisterByte(LPBOARDHANDLE pBoard, ULONG ulOffset,
                             UCHAR *pucByte)
{
    LPCLIENTDATA pClientStruct = MGAGetClientPointer(pBoard);

    ASSERT_HANDLER(pBoard);

    *pucByte = *((UCHAR *)(pClientStruct->ulRegisterBase + ulOffset));

    return 0;
}


/******************************************************************************\

    Function      : ClientReadRegisterDword

    Description   : Read a Dword from the Register space.

    I/O Desc.     : LPBOARDHANDLE pBoard | Handle to the board structure
                    containing all the information about a specific board.
                    ULONG ulOffset  | Offset of the Byte to be read.
                    ULONG *pulDword | pointer to the dword that will receive
                    the data.

    Return Val : ULONG

\******************************************************************************/
ULONG ClientReadRegisterDword(LPBOARDHANDLE pBoard, ULONG ulOffset,
                              ULONG *pulDword)
{
    LPCLIENTDATA pClientStruct = MGAGetClientPointer(pBoard);

    ASSERT_HANDLER(pBoard);

    *pulDword = *((ULONG *)(pClientStruct->ulRegisterBase + ulOffset));

    return 0;
}


/******************************************************************************\

    Function      : ClientWriteRegisterByte

    Description   : Write a Byte from the Register space.

    I/O Desc.     : LPBOARDHANDLE pBoard | Handle to the board structure
                    containing all the information about a specific board.
                    ULONG ulOffset | Offset of the Byte to be read.
                    UCHAR ucByte   | CHAR to receive the data.

    Return Val : ULONG

\******************************************************************************/
ULONG ClientWriteRegisterByte(LPBOARDHANDLE pBoard, ULONG ulOffset,
                              UCHAR ucByte)
{
    LPCLIENTDATA pClientStruct = MGAGetClientPointer(pBoard);

    ASSERT_HANDLER(pBoard);

    *((UCHAR *)(pClientStruct->ulRegisterBase + ulOffset)) = ucByte;

    return 0;
}


/******************************************************************************\

    Function      : ClientWriteRegisterSpaceDword

    Description   : Write a Dword from the Register space.

    I/O Desc.     : LPBOARDHANDLE *| pBoard  | Handle to the board structure
                    containing all the information about a specific board.
                    ULONG ulOffset | Offset of the Byte to be read.
                    ULONG ulDword  | Dword to receive the data

    Return Val : ULONG

\******************************************************************************/
ULONG ClientWriteRegisterDword(LPBOARDHANDLE pBoard, ULONG ulOffset,
                               ULONG ulDword)
{
    LPCLIENTDATA pClientStruct = MGAGetClientPointer(pBoard);

    ASSERT_HANDLER(pBoard);

    *((ULONG *)(pClientStruct->ulRegisterBase + ulOffset)) = ulDword;

    return 0;
}


/******************************************************************************\

    Function      : ClientOpenMemoryBase

    Description   : Map the Memory base for future call to ClientReadMemoryX
                    and ClientWriteMemoryX.

    I/O Desc.     : LPBOARDHANDLE pBoard | Handle to the board structure
                    containing all the information about a specific board.
                    ULONG ulAddress | Physical address of the Register aperture
                    ULONG ulSize    | Size in Byte of the Register Aperture
    Return Val : ULONG

\******************************************************************************/
ULONG ClientOpenMemoryBase(LPBOARDHANDLE pBoard, ULONG ulAddress, ULONG ulSize)
{
    LPCLIENTDATA pClientStruct = MGAGetClientPointer(pBoard);
    MGAPtr pMga = (MGAPtr) pClientStruct->pMga;

    ASSERT_HANDLER(pBoard);

    pClientStruct->ulFrameBufferBase = (ULONG) pMga->FbBase;

    return 0;
}


/******************************************************************************\

    Function      : ClientCloseMemoryBase

    Description   : Unmap the Frame Buffer aperture and free resources
                    needed to address it.

    I/O Desc.     : LPBOARDHANDLE pBoard | Handle to the board structure
                    containing all the information about a specific board.

    Return Val    : ULONG

\******************************************************************************/
ULONG ClientCloseMemoryBase(LPBOARDHANDLE pBoard)
{
    ASSERT_HANDLER(pBoard);
    return 0;
}


/******************************************************************************\

    Function      : ClientReadMemoryByte

    Description   : Read a Byte from the Frame Buffer space.

    I/O Desc.     : LPBOARDHANDLE pBoard | Handle to the board structure
                    containing all the information about a specific board.
                    ULONG ulOffset | Offset of the Byte to be read.
                    UCHAR *ucByte  | CHAR to receive the data

    Return Val : ULONG
\******************************************************************************/
ULONG ClientReadMemoryByte(LPBOARDHANDLE pBoard, ULONG ulOffset, UCHAR *pucByte)
{
    LPCLIENTDATA pClientStruct = MGAGetClientPointer(pBoard);

    ASSERT_HANDLER(pBoard);

    *pucByte = *((UCHAR *)(pClientStruct->ulFrameBufferBase + ulOffset));

    return 0;
}


/******************************************************************************\

    Function      : ClientReadMemoryDword

    Description   : Read a Dword from the Frame Buffer Space.

    I/O Desc.     : LPBOARDHANDLE pBoard | Handle to the board structure
                    containing all the information about a specific board.
                    ULONG ulOffset | Offset of the Byte to be read.
                    ULONG *uDword  | Dword to receive the data

    Return Val    : ULONG

\******************************************************************************/
ULONG ClientReadMemoryDword(LPBOARDHANDLE pBoard, ULONG ulOffset,
                            ULONG *pulDword)
{
    LPCLIENTDATA pClientStruct = MGAGetClientPointer(pBoard);

    ASSERT_HANDLER(pBoard);

    *pulDword = *((ULONG *)(pClientStruct->ulFrameBufferBase + ulOffset));

    return 0;
}


/******************************************************************************\

   Function      : ClientWriteMemoryByte

   Description   : Write a Byte from the Frame Buffer space.

   I/O Desc.     : LPBOARDHANDLE pBoard     | Handle to the board structure
                   containing all the information about a specific board.
                   ULONG ulOffset | Offset of the Byte to be read.
                   UCHAR ucByte   | CHAR to receive the data

   Return Val    : ULONG

\******************************************************************************/
ULONG ClientWriteMemoryByte(LPBOARDHANDLE pBoard, ULONG ulOffset, UCHAR ucByte)
{
    LPCLIENTDATA pClientStruct = MGAGetClientPointer(pBoard);

    ASSERT_HANDLER(pBoard);

    *((UCHAR *)(pClientStruct->ulFrameBufferBase + ulOffset)) = ucByte;

    return 0;
}


/******************************************************************************\

    Function      : ClientWriteMemoryDword

    Description   : Write a Dword from the Frame Buffer space.

    I/O desc.     : LPBOARDHANDLE pBoard | Handle to the board structure
                    containing all the information about a specific board.
                    ULONG ulOffset | Offset of the Byte to be read.
                    ULONG ulDword  | Dword to receive the data

    Return Val    : ULONG

\******************************************************************************/
ULONG ClientWriteMemoryDword(LPBOARDHANDLE pBoard, ULONG ulOffset,
                            ULONG ulDword)
{
    LPCLIENTDATA pClientStruct = MGAGetClientPointer(pBoard);

    ASSERT_HANDLER(pBoard);

    *((ULONG *)(pClientStruct->ulFrameBufferBase + ulOffset)) = ulDword;

    return 0;
}


/******************************************************************************\

    Function      : ClientOpenSystemDevice

    Description   : Map a System device aperture for future call to
                    ClientReadSystemDeviceX and ClientWriteSystemDeviceX.

    I/O Desc.     : LPBOARDHANDLE pBoard | Handle to the board structure
                    containing all the information about a specific board.
                    ULONG ulAddress | Physical address of the Register aperture
                    ULONG ulSize    | Size in Byte of the Register Aperture

    Return Val    : ULONG

\******************************************************************************/
ULONG ClientOpenSystemDevice(LPBOARDHANDLE pBoard, ULONG ulAddress,
                                    ULONG ulSize)
{
    return 1;
}


/******************************************************************************\

    Function      : ClientCloseSystemDevice

    Description   : Unmap the System Device aperture address and free
                    resources needed to address it.

    I/O Desc.     : LPBOARDHANDLE pBoard | Handle to the board structure
                    containing all the information about a specific board.

    Return Val    : ULONG

\******************************************************************************/
ULONG ClientCloseSystemDevice (LPBOARDHANDLE pBoard)
{
    return 1;
}


/******************************************************************************\

    Function      : ClientReadSystemDeviceByte

    Description   : Read a Byte from the device Space.

    I/O Desc.     : LPBOARDHANDLE pBoard | Handle to the board structure
                    containing all the information about a specific board.
                    ULONG ulOffset | Offset of the Byte to be read.
                    ULONG pucByte  | Byte to read the data

    Return Val    : ULONG

\******************************************************************************/
ULONG ClientReadSystemDeviceByte(LPBOARDHANDLE pBoard, ULONG ulOffset,
                                 UCHAR *pucByte)
{
    return 1;
}


/******************************************************************************\

    Function      : ClientReadSystemDeviceDword

    Description   : Read a Dword from the Frame Buffer Space

    I/O Desc.     : LPBOARDHANDLE pBoard     | Handle to the board structure
                    containing all the information about a specific board.
                    ULONG ulOffset | Offset of the Byte to be read.
                    ULONG ulDword  | Dword to Read the data

    Return Val    : ULONG

\******************************************************************************/
ULONG ClientReadSystemDeviceDword(LPBOARDHANDLE pBoard, ULONG ulOffset,
                                  ULONG *pulDword)
{
    return 1;
}


/******************************************************************************\

    Function      : ClientWriteSystemByte

    Description   : Write a Byte from the System Device Aperture

    I/O Desc.     : LPBOARDHANDLE pBoard | Handle to the board structure
                    containing all the information about a specific board.
                    ULONG ulOffset | Offset of the Byte to be read.
                    UCHAR ucByte   | Byte to receive the data
    Return Val : ULONG

\******************************************************************************/
ULONG ClientWriteSystemDeviceByte(LPBOARDHANDLE pBoard, ULONG ulOffset,
                                  UCHAR ucByte)
{
    return 1;
}


/******************************************************************************\

    Function      : ClientWriteSystemDword

    Description   : Write a Dword from the System Device Aperture.

    I/O Desc.     : LPBOARDHANDLE pBoard     | Handle to the board structure
                    containing all the information about a specific board.
                    ULONG ulOffset | Offset of the Byte to be read.
                    ULONG uDword   | Dword to receive the data

    Return Val    : ULONG

\******************************************************************************/
ULONG ClientWriteSystemDeviceDword(LPBOARDHANDLE pBoard, ULONG ulOffset,
                                   ULONG ulDword)
{
    return 1;
}


/******************************************************************************\

    Function      : ClientWait

    Description   : Wait for ulDelayus micro-seconds.

    I/O Desc.     : LPBOARDHANDLE pBoard | Handle to the board structure
                    containing all the information about a specific board.
                    ULONG ulDelayus | Delay in uSec

    Return Val    : ULONG

\******************************************************************************/
ULONG ClientWait (LPBOARDHANDLE pBoard, ULONG ulDelayus)
{
    int i;
    ULONG ulTmp;

    ASSERT_HANDLER(pBoard);

    for(i = 0; i < ulDelayus * 3; i++)
    {
        ClientReadRegisterDword(pBoard,0x1e14,&ulTmp);
    }

    return 0;
}


/******************************************************************************\

    Function      : ClientGetBiosInfo

    Description   : This function will be call if no PINS can be found
                    in physical EEPROM.

    I/O Desc.     :  LPBOARDHANDLE pBoard | Handle to the board structure
                     containing all the information about a specific board.
                     LPUCHAR    | Buffer where we copy bios pins.
                     ULONG      | Bios version

    Return Val    : ULONG

\******************************************************************************/
ULONG ClientGetBiosInfo(LPBOARDHANDLE pBoard, LPUCHAR pucPins,LPULONG pulBIOSVersion)
{
    Bool bNotFound = TRUE;
    UCHAR ucBIOS[32768];
    UCHAR ucTmpByte;
    UCHAR ucCheckSum;
    UCHAR ucPinsIndex;
    UCHAR ucPinsSize;
    ULONG ulTmpDword;
    ULONG ulPinsOffset = 0;
    ULONG ulPCIINFOffset;

    ASSERT_HANDLER(pBoard);

    xf86ReadBIOS(0xc0000,0,ucBIOS,32768);

    if(ucBIOS[0] == 0x55)
    {
        if(ucBIOS[1] == 0xaa)
        {
            while((ulPinsOffset < 0x10000) && bNotFound)
            {
                ulTmpDword = *(ULONG *)(ucBIOS + ulPinsOffset);
                ucPinsSize = (UCHAR) (ulTmpDword >> 16);
                if(((ulTmpDword & 0x0000ffff) == 0x0000412e)
                    && ucPinsSize <= 128)
                {
                    ucCheckSum = 0;
                    for(ucPinsIndex = 0;ucPinsIndex < ucPinsSize; ucPinsIndex++)
                    {
                        pucPins[ucPinsIndex] = ucBIOS[ulPinsOffset +
                                               ucPinsIndex];
                        ucCheckSum += pucPins[ucPinsIndex];
                    }
                    if(ucCheckSum == 0)
                    {
                        bNotFound = FALSE;
                    }
                }
                ulPinsOffset++;
            }

            if(bNotFound)
            {
                return 1;
            }

            ulPCIINFOffset = *(ULONG *)(ucBIOS + 0x18);
            ulPCIINFOffset &= 0x0000ffff;
            ulTmpDword = *(ULONG *)(ucBIOS + ulPCIINFOffset);

            if(ulTmpDword == 0x52494350)  /* "PCIR" */
            {
                ulPCIINFOffset += 0x12;
                ulTmpDword = *(ULONG *)(ucBIOS + ulPCIINFOffset);
                *pulBIOSVersion = ((ULONG) ((ulTmpDword & 0xf0) >> 4) << 16) |
                                  ((ulTmpDword &0xf) << 12) | ((ulTmpDword >> 8)
                                  & 0xff);
            }
            else
            {
                return 1;
            }
        }
        else
        {
           return 1;
        }
    }
    else
    {
        return 1;
    }

    if(!*pulBIOSVersion)
    {
        ucTmpByte = ucBIOS[5];
        *pulBIOSVersion = ((ULONG) (ucTmpByte >> 4) << 16) | ((ULONG)
                          (ucTmpByte & 0x0f) << 12);
    }

    return 0;
}

/******************************************************************************\

    Function      : ClientCallBiosInt10

    Description   : Call the BIOS Int10h with specified parameters.

    I/O Desc.     : LPBOARDHANDLE pBoard | Handle to the board structure
                    containing all the information about a specific board.
                    LPBIOSREGS pBiosRegs | Pointor to the Bios register
                    structure.

    Return Val    : ULONG

\******************************************************************************/
ULONG ClientCallBiosInt10(LPBOARDHANDLE pBoard, LPBIOSREGS pBiosRegs)
{
   ASSERT_HANDLER(pBoard);

   return 1;
}


/******************************************************************************\

    Function      : ClientReadDDCEdid

    Description   : Not implemented.

    I/O Desc.     : LPBOARDHANDLE pBoard | Handle to the board structure
                    containing all the information about a specific board.
                    LPBIOSREGS pBiosRegs | Pointor to the Bios register
                    structure.

    Return Val    : ULONG

\******************************************************************************/
ULONG ClientReadDDCEdid(LPBOARDHANDLE pBoard, LPUCHAR pEdid,
                               ULONG ulMonitorIndex)
{
   ASSERT_HANDLER(pBoard);

   return 1;
}


/******************************************************************************\

    Function      : ClientCustomCall

    Description   : Not implemented.

    I/O Desc.     : LPBOARDHANDLE pBoard | Handle to the board structure
                    containing all the information about a specific board.
                    LPBIOSREGS pBiosRegs | Pointor to the Bios register
                    structure.

    Return Val    : ULONG

\******************************************************************************/
ULONG ClientCustomCall(LPBOARDHANDLE pBoard, ULONG ulServiceNumber,
                       LPVOID pInData, LPVOID pOutData)
{
   ASSERT_HANDLER(pBoard);

   return 1;
}


/******************************************************************************\

    Function      : ClientApplyEpromPatch

    Description   : Not implemented.

    I/O Desc.     : LPBOARDHANDLE pBoard | Handle to the board structure
                    containing all the information about a specific board.
                    LPBIOSREGS pBiosRegs | Pointor to the Bios register
                    structure.

    Return Val    : ULONG

\******************************************************************************/
ULONG ClientApplyEpromPatch(LPBOARDHANDLE pBoard)
{
   ASSERT_HANDLER(pBoard);

   return 1;
}


/******************************************************************************\

    Function      : ClientDetectHostInterface

    Description   : Not implemented.

    I/O Desc.     : LPBOARDHANDLE pBoard | Handle to the board structure
                    containing all the information about a specific board.
                    LPBIOSREGS pBiosRegs | Pointor to the Bios register
                    structure.

    Return Val    : ULONG

\******************************************************************************/
ULONG ClientDetectHostInterface(LPBOARDHANDLE pBoard, LPULONG pulData)
{
   ASSERT_HANDLER(pBoard);

   return 1;
}