summaryrefslogtreecommitdiff
path: root/src/gfx/gfx_init.c
blob: 2aa93d523d69d0d17c72f0d8ed9db561f34a7703 (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
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_init.c,v 1.1 2002/12/10 15:12:25 alanh Exp $ */
/*
 * $Workfile: gfx_init.c $
 *
 * This file contains routines typically used in driver initialization.
 *
 * Routines:
 * 
 *       gfx_pci_config_read
 *       gfx_cpu_config_read
 *       gfx_detect_cpu
 *       gfx_detect_video
 *       gfx_get_cpu_register_base
 *       gfx_get_frame_buffer_base
 *       gfx_get_frame_buffer_size
 *       gfx_get_vid_register_base
 *       gfx_get_vip_register_base
 *
 * NSC_LIC_ALTERNATIVE_PREAMBLE
 *
 * Revision 1.0
 *
 * National Semiconductor Alternative GPL-BSD License
 *
 * National Semiconductor Corporation licenses this software 
 * ("Software"):
 *
 *      Durango
 *
 * under one of the two following licenses, depending on how the 
 * Software is received by the Licensee.
 * 
 * If this Software is received as part of the Linux Framebuffer or
 * other GPL licensed software, then the GPL license designated 
 * NSC_LIC_GPL applies to this Software; in all other circumstances 
 * then the BSD-style license designated NSC_LIC_BSD shall apply.
 *
 * END_NSC_LIC_ALTERNATIVE_PREAMBLE */

/* NSC_LIC_BSD
 *
 * National Semiconductor Corporation Open Source License for Durango
 *
 * (BSD License with Export Notice)
 *
 * Copyright (c) 1999-2001
 * National Semiconductor Corporation.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without 
 * modification, are permitted provided that the following conditions 
 * are met: 
 *
 *   * Redistributions of source code must retain the above copyright 
 *     notice, this list of conditions and the following disclaimer. 
 *
 *   * Redistributions in binary form must reproduce the above 
 *     copyright notice, this list of conditions and the following 
 *     disclaimer in the documentation and/or other materials provided 
 *     with the distribution. 
 *
 *   * Neither the name of the National Semiconductor Corporation nor 
 *     the names of its contributors may be used to endorse or promote 
 *     products derived from this software without specific prior 
 *     written permission. 
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY 
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 
 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE,
 * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY 
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
 * OF SUCH DAMAGE.
 *
 * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF 
 * YOUR JURISDICTION. It is licensee's responsibility to comply with 
 * any export regulations applicable in licensee's jurisdiction. Under 
 * CURRENT (2001) U.S. export regulations this software 
 * is eligible for export from the U.S. and can be downloaded by or 
 * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed 
 * destinations which include Cuba, Iraq, Libya, North Korea, Iran, 
 * Syria, Sudan, Afghanistan and any other country to which the U.S. 
 * has embargoed goods and services. 
 *
 * END_NSC_LIC_BSD */

/* NSC_LIC_GPL
 *
 * National Semiconductor Corporation Gnu General Public License for Durango
 *
 * (GPL License with Export Notice)
 *
 * Copyright (c) 1999-2001
 * National Semiconductor Corporation.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without 
 * modification, are permitted under the terms of the GNU General 
 * Public License as published by the Free Software Foundation; either 
 * version 2 of the License, or (at your option) any later version  
 *
 * In addition to the terms of the GNU General Public License, neither 
 * the name of the National Semiconductor Corporation nor the names of 
 * its contributors may be used to endorse or promote products derived 
 * from this software without specific prior written permission. 
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY 
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 
 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, 
 * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY 
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
 * OF SUCH DAMAGE. See the GNU General Public License for more details. 
 *
 * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF 
 * YOUR JURISDICTION. It is licensee's responsibility to comply with 
 * any export regulations applicable in licensee's jurisdiction. Under 
 * CURRENT (2001) U.S. export regulations this software 
 * is eligible for export from the U.S. and can be downloaded by or 
 * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed 
 * destinations which include Cuba, Iraq, Libya, North Korea, Iran, 
 * Syria, Sudan, Afghanistan and any other country to which the U.S. 
 * has embargoed goods and services. 
 *
 * You should have received a copy of the GNU General Public License 
 * along with this file; if not, write to the Free Software Foundation, 
 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
 *
 * END_NSC_LIC_GPL */

/* CONSTANTS USED BY THE INITIALIZATION CODE */

#define PCI_CONFIG_ADDR			         0x0CF8
#define PCI_CONFIG_DATA			         0x0CFC
#define PCI_VENDOR_DEVICE_GXM	         0x00011078
#define PCI_VENDOR_DEVICE_REDCLOUD       0x0028100B
#define REDCLOUD_VIDEO_PCI_VENDOR_DEVICE 0x0030100B

#define GXM_CONFIG_GCR			0xB8
#define GXM_CONFIG_CCR3			0xC3
#define GXM_CONFIG_DIR0			0xFE
#define GXM_CONFIG_DIR1			0xFF

/* STATIC VARIABLES FOR THIS FILE */

unsigned long gfx_cpu_version = 0;
unsigned long gfx_cpu_frequency = 0;
unsigned long gfx_vid_version = 0;
unsigned long gfx_gx1_scratch_base = 0;
unsigned long gfx_gx2_scratch_base = 0x7FC000;
ChipType gfx_chip_revision = CHIP_NOT_DETECTED;

/* INCLUDE SUPPORT FOR FIRST GENERATION, IF SPECIFIED. */

ChipType gfx_detect_chip(void);

#if GFX_INIT_GU1
#include "init_gu1.c"
#endif

/* INCLUDE SUPPORT FOR SECOND GENERATION, IF SPECIFIED. */

#if GFX_INIT_GU2
#include "init_gu2.c"
#endif

/* THE FOLLOWING ROUTINES ARE NEVER DYNAMIC              */
/* They are used to set the variables for future dynamic */
/* function calls.                                       */

/*-----------------------------------------------------------------------------
 * gfx_detect_chip
 *
 * This routine returns the name and revision of the chip. This function is only
 * relevant to the SC1200.
 *-----------------------------------------------------------------------------
 */
ChipType
gfx_detect_chip(void)
{
   unsigned char pid = INB(SC1200_CB_BASE_ADDR + SC1200_CB_PID);
   unsigned char rev = INB(SC1200_CB_BASE_ADDR + SC1200_CB_REV);

   gfx_chip_revision = CHIP_NOT_DETECTED;

   if (pid == 0x4) {
      switch (rev) {
      case 0:
	 gfx_chip_revision = SC1200_REV_A;
	 break;
      case 1:
	 gfx_chip_revision = SC1200_REV_B1_B2;
	 break;
      case 2:
	 gfx_chip_revision = SC1200_REV_B3;
	 break;
      case 3:
	 gfx_chip_revision = SC1200_REV_C1;
	 break;
      case 4:
	 gfx_chip_revision = SC1200_REV_D1;
	 break;
      case 5:
	 gfx_chip_revision = SC1200_REV_D1_1;
	 break;
      case 6:
	 gfx_chip_revision = SC1200_REV_D2_MVD;
	 break;
      }
      if (rev > 0x6)
	 gfx_chip_revision = SC1200_FUTURE_REV;
   } else if (pid == 0x5) {
      if (rev == 0x6)
	 gfx_chip_revision = SC1200_REV_D2_MVE;
      else if (rev > 0x6)
	 gfx_chip_revision = SC1200_FUTURE_REV;
   }
   return (gfx_chip_revision);
}

/*-----------------------------------------------------------------------------
 * gfx_detect_cpu
 * 
 * This routine returns the type and revison of the CPU.  If a Geode 
 * processor is not present, the routine returns zero.
 *
 * The return value is as follows:
 *     bits[24:16] = minor version
 *     bits[15:8] = major version 
 *     bits[7:0] = type (1 = GXm, 2 = SC1200, 3 = Redcloud)
 *
 * A return value of 0x00020501, for example, indicates GXm version 5.2.
 *-----------------------------------------------------------------------------
 */
unsigned long
gfx_detect_cpu(void)
{

   unsigned long value = 0;
   unsigned long version = 0;

   /* initialize core freq. to 0 */
   gfx_cpu_frequency = 0;

#if	GFX_INIT_GU1

   value = gfx_pci_config_read(0x80000000);

   if (value == PCI_VENDOR_DEVICE_GXM) {
      unsigned char dir0 = gfx_gxm_config_read(GXM_CONFIG_DIR0) & 0xF0;
      unsigned char dir1 = gfx_gxm_config_read(GXM_CONFIG_DIR1);

      if (dir0 == 0x40) {
	 /* CHECK FOR GXLV (and GXm) (DIR1 = 0x30 THROUGH 0x82) */

	 if ((dir1 >= 0x30) && (dir1 <= 0x82)) {
	    /* Major version is one less than what appears in DIR1 */
	    if ((dir1 & 0xF0) < 0x70) {

	       version = GFX_CPU_GXLV | (((((unsigned long)dir1 >> 4) - 1) << 8)) |	/* major - 1 */
		     ((((unsigned long)dir1 & 0x0F)) << 16);	/* minor */
	    } else {
	       version = GFX_CPU_GXLV | ((((unsigned long)dir1 >> 4)) << 8) |	/* major */
		     ((((unsigned long)dir1 & 0x0F)) << 16);	/* minor */

	    }
	    /* Currently always CS5530 for video overlay. */

#				if GFX_VIDEO_DYNAMIC
	    gfx_video_type = GFX_VIDEO_TYPE_CS5530;
#				endif

	    /* Currently always CS5530 GPIOs for I2C access. */

#				if GFX_I2C_DYNAMIC
	    gfx_i2c_type = GFX_I2C_TYPE_GPIO;
#				endif

#				if GFX_TV_DYNAMIC
	    gfx_tv_type = GFX_TV_TYPE_FS451;
#				endif
	 }
      } else if (dir0 == 0xB0) {
	 /* CHECK FOR SC1200 */

	 if ((dir1 == 0x70) || (dir1 == 0x81)) {
	    version = GFX_CPU_SC1200 | ((((unsigned long)dir1 >> 4)) << 8) |	/* major */
		  ((((unsigned long)dir1 & 0x0F)) << 16);	/* minor */

	    /* Detect SC1200 revision */

	    gfx_detect_chip();

	    /* SC1200 for video overlay and VIP. */

#				if GFX_VIDEO_DYNAMIC
	    gfx_video_type = GFX_VIDEO_TYPE_SC1200;
#				endif

#				if GFX_VIP_DYNAMIC
	    gfx_vip_type = GFX_VIP_TYPE_SC1200;
#				endif

	    /* Currently always SAA7114 decoder. */

#				if GFX_DECODER_DYNAMIC
	    gfx_decoder_type = GFX_DECODER_TYPE_SAA7114;
#				endif

	    /* SC1200 for TV encoder */

#				if GFX_TV_DYNAMIC
	    gfx_tv_type = GFX_TV_TYPE_SC1200;
#				endif

	    /* Currently always ACCESS.bus for I2C access. */

#				if GFX_I2C_DYNAMIC
	    gfx_i2c_type = GFX_I2C_TYPE_ACCESS;
#				endif
	 }
      }

      if (version) {
	 /* ALWAYS FIRST GENERATION GRAPHICS UNIT */

#			if GFX_DISPLAY_DYNAMIC
	 gfx_display_type = GFX_DISPLAY_TYPE_GU1;
#			endif
#			if GFX_2DACCEL_DYNAMIC
	 gfx_2daccel_type = GFX_2DACCEL_TYPE_GU1;
#			endif
#			if GFX_INIT_DYNAMIC
	 gfx_init_type = GFX_INIT_TYPE_GU1;
#			endif

	 /* READ THE CORE FREQUENCY  */

	 gfx_cpu_frequency = gfx_get_core_freq();
      }
   }
#endif

#if GFX_INIT_GU2

   value = gfx_pci_config_read(0x80000800);

   if (value == PCI_VENDOR_DEVICE_REDCLOUD) {
      Q_WORD msr_value;
      int valid, i;

      /* CHECK FOR SOFT VG */
      /* If SoftVG is not present, the base addresses for all devices */
      /* will not be allocated.  Essentially, it is as if no Redcloud */
      /* video hardware is present.                                   */

      value = gfx_pci_config_read(0x80000900);

      if (value == REDCLOUD_VIDEO_PCI_VENDOR_DEVICE) {
	 valid = 1;

	 /* BAR0 - BAR3 HOLD THE PERIPHERAL BASE ADDRESSES */

	 for (i = 0; i < 4; i++) {
	    value = gfx_pci_config_read(0x80000910 + (i << 2));
	    if (value == 0x00000000 || value == 0xFFFFFFFF) {
	       valid = 0;
	       break;
	    }
	 }

	 if (valid) {
	    /* REDCLOUD INTEGRATED VIDEO             */

#				if GFX_VIDEO_DYNAMIC
	    gfx_video_type = GFX_VIDEO_TYPE_REDCLOUD;
#				endif

	    /* CURRENTLY, ALWAYS GPIO FOR I2C ACCESS */

#				if GFX_I2C_DYNAMIC
	    gfx_i2c_type = GFX_I2C_TYPE_GPIO;
#				endif

	    /* SECOND-GENERATION DISPLAY CONTROLLER  */

#				if GFX_DISPLAY_DYNAMIC
	    gfx_display_type = GFX_DISPLAY_TYPE_GU2;
#				endif

	    /* SECOND-GENERATION GRAPHICS UNIT       */

#				if GFX_2DACCEL_DYNAMIC
	    gfx_2daccel_type = GFX_2DACCEL_TYPE_GU2;
#				endif

	    /* SECOND-GENERATION INITIALIZATION      */

#				if GFX_INIT_DYNAMIC
	    gfx_init_type = GFX_INIT_TYPE_GU2;
#				endif

	    /* MBUS MSR ACCESSES                     */

#				if GFX_MSR_DYNAMIC
	    gfx_msr_type = GFX_MSR_TYPE_REDCLOUD;
#				endif

	    /* CS5530 GPIO I2C */

#				if GFX_I2C_DYNAMIC
	    gfx_i2c_type = GFX_I2C_TYPE_GPIO;
#				endif

	    /* READ VERSION */

	    gfx_msr_init();

	    gfx_msr_read(RC_ID_MCP, MCP_RC_REVID, &msr_value);

	    /* SUBTRACT 1 FROM REV ID                                */
	    /* REDCLOUD 1.X rev id is 1 less than the reported value */

	    if ((msr_value.low & 0xF0) == 0x10)
	       msr_value.low--;

	    version = GFX_CPU_REDCLOUD | ((msr_value.low & 0xF0) << 4) |	/* MAJOR */
		  ((msr_value.low & 0x0F) << 16);	/* MINOR */

	    /* READ THE CORE FREQUENCY  */

	    gfx_cpu_frequency = gfx_get_core_freq();

	    /* SET THE GP SCRATCH AREA */
	    /* Color bitmap BLTs use the last 16K of frame buffer space */

	    gfx_gx2_scratch_base = gfx_get_frame_buffer_size() - 0x4000;
	 }
      }
   }
#endif

   if (!version) {
      /* ALWAYS SECOND GENERATION IF SIMULATING */
      /* For now, that is.  This could change.  */

#		if GFX_DISPLAY_DYNAMIC
      gfx_display_type = GFX_DISPLAY_TYPE_GU2;
#		endif
#		if GFX_2DACCEL_DYNAMIC
      gfx_2daccel_type = GFX_2DACCEL_TYPE_GU2;
#		endif
#		if GFX_INIT_DYNAMIC
      gfx_init_type = GFX_INIT_TYPE_GU2;
#		endif
#		if GFX_MSR_DYNAMIC
      gfx_msr_type = GFX_MSR_TYPE_REDCLOUD;
#		endif
#		if GFX_VIDEO_DYNAMIC
      gfx_video_type = GFX_VIDEO_TYPE_REDCLOUD;
#		endif
#		if GFX_I2C_DYNAMIC
      gfx_i2c_type = GFX_I2C_TYPE_GPIO;
#		endif
   }
   gfx_cpu_version = version;

   return (version);
}

/*-----------------------------------------------------------------------------
 * gfx_detect_video
 * 
 * This routine returns the type of the video hardware.
 *
 * The return value is as follows:
 *     bits[7:0] = type (1 = CS5530, 2 = SC1200, 3 = Redcloud)
 *
 * Currently this routine does not actually detect any hardware, and bases
 * the video hardware entirely on the detected CPU.
 *-----------------------------------------------------------------------------
 */
unsigned long
gfx_detect_video(void)
{
   unsigned long version = 0;

   if ((gfx_cpu_version & 0xFF) == GFX_CPU_GXLV)
      version = GFX_VID_CS5530;
   else if ((gfx_cpu_version & 0xFF) == GFX_CPU_SC1200)
      version = GFX_VID_SC1200;
   else if ((gfx_cpu_version & 0xFF) == GFX_CPU_REDCLOUD)
      version = GFX_VID_REDCLOUD;
   gfx_vid_version = version;
   return (version);
}

/*-----------------------------------------------------------------------------
 * gfx_pci_config_read
 * 
 * This routine reads a 32-bit value from the specified location in PCI
 * configuration space.
 *-----------------------------------------------------------------------------
 */
unsigned long
gfx_pci_config_read(unsigned long address)
{
   unsigned long value = 0xFFFFFFFF;

   OUTD(PCI_CONFIG_ADDR, address);
   value = IND(PCI_CONFIG_DATA);
   return (value);
}

/*-----------------------------------------------------------------------------
 * gfx_pci_config_write
 * 
 * This routine writes a 32-bit value to the specified location in PCI
 * configuration space.
 *-----------------------------------------------------------------------------
 */
void
gfx_pci_config_write(unsigned long address, unsigned long data)
{
   OUTD(PCI_CONFIG_ADDR, address);
   OUTD(PCI_CONFIG_DATA, data);
   return;
}

/* WRAPPERS IF DYNAMIC SELECTION */
/* Extra layer to call either first or second generation routines. */

#if GFX_INIT_DYNAMIC

/*-----------------------------------------------------------------------------
 * gfx_get_core_freq
 *-----------------------------------------------------------------------------
 */
unsigned long
gfx_get_core_freq(void)
{
   unsigned long freq = 0;

#	if GFX_INIT_GU1
   if (gfx_init_type & GFX_INIT_TYPE_GU1)
      freq = gu1_get_core_freq();
#	endif
#	if GFX_INIT_GU2
   if (gfx_init_type & GFX_INIT_TYPE_GU2)
      freq = gu2_get_core_freq();
#	endif
   return freq;
}

/*-----------------------------------------------------------------------------
 * gfx_get_cpu_register_base
 *-----------------------------------------------------------------------------
 */
unsigned long
gfx_get_cpu_register_base(void)
{
   unsigned long base = 0;

#	if GFX_INIT_GU1
   if (gfx_init_type & GFX_INIT_TYPE_GU1)
      base = gu1_get_cpu_register_base();
#	endif
#	if GFX_INIT_GU2
   if (gfx_init_type & GFX_INIT_TYPE_GU2)
      base = gu2_get_cpu_register_base();
#	endif

   return (base);
}

/*-----------------------------------------------------------------------------
 * gfx_get_graphics_register_base
 *-----------------------------------------------------------------------------
 */
unsigned long
gfx_get_graphics_register_base(void)
{
   unsigned long base = 0;

#	if GFX_INIT_GU2
   if (gfx_init_type & GFX_INIT_TYPE_GU2)
      base = gu2_get_graphics_register_base();
#	endif

   return (base);
}

/*-----------------------------------------------------------------------------
 * gfx_get_frame_buffer_base
 *-----------------------------------------------------------------------------
 */
unsigned long
gfx_get_frame_buffer_base(void)
{
   unsigned long base = 0;

#	if GFX_INIT_GU1
   if (gfx_init_type & GFX_INIT_TYPE_GU1)
      base = gu1_get_frame_buffer_base();
#	endif
#	if GFX_INIT_GU2
   if (gfx_init_type & GFX_INIT_TYPE_GU2)
      base = gu2_get_frame_buffer_base();
#	endif

   return (base);
}

/*-----------------------------------------------------------------------------
 * gfx_get_frame_buffer_size
 *-----------------------------------------------------------------------------
 */
unsigned long
gfx_get_frame_buffer_size(void)
{
   unsigned long size = 0;

#	if GFX_INIT_GU1
   if (gfx_init_type & GFX_INIT_TYPE_GU1)
      size = gu1_get_frame_buffer_size();
#	endif
#	if GFX_INIT_GU2
   if (gfx_init_type & GFX_INIT_TYPE_GU2)
      size = gu2_get_frame_buffer_size();
#	endif

   return size;
}

/*-----------------------------------------------------------------------------
 * gfx_get_vid_register_base
 *-----------------------------------------------------------------------------
 */
unsigned long
gfx_get_vid_register_base(void)
{
   unsigned long base = 0;

#	if GFX_INIT_GU1
   if (gfx_init_type & GFX_INIT_TYPE_GU1)
      base = gu1_get_vid_register_base();
#	endif
#	if GFX_INIT_GU2
   if (gfx_init_type & GFX_INIT_TYPE_GU2)
      base = gu2_get_vid_register_base();
#	endif

   return (base);
}

/*-----------------------------------------------------------------------------
 * gfx_get_vip_register_base
 *-----------------------------------------------------------------------------
 */
unsigned long
gfx_get_vip_register_base(void)
{
   unsigned long base = 0;

#	if GFX_INIT_GU1
   if (gfx_init_type & GFX_INIT_TYPE_GU1)
      base = gu1_get_vip_register_base();
#	endif

   return (base);
}

#endif

/* END OF FILE */