1/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_init.c,v 1.1 2002/12/10 15:12:25 alanh Exp $ */ 2/* 3 * $Workfile: gfx_init.c $ 4 * 5 * This file contains routines typically used in driver initialization. 6 * 7 * Routines: 8 * 9 * gfx_pci_config_read 10 * gfx_cpu_config_read 11 * gfx_detect_cpu 12 * gfx_detect_video 13 * gfx_get_cpu_register_base 14 * gfx_get_frame_buffer_base 15 * gfx_get_frame_buffer_size 16 * gfx_get_vid_register_base 17 * gfx_get_vip_register_base 18 * 19 * NSC_LIC_ALTERNATIVE_PREAMBLE 20 * 21 * Revision 1.0 22 * 23 * National Semiconductor Alternative GPL-BSD License 24 * 25 * National Semiconductor Corporation licenses this software 26 * ("Software"): 27 * 28 * Durango 29 * 30 * under one of the two following licenses, depending on how the 31 * Software is received by the Licensee. 32 * 33 * If this Software is received as part of the Linux Framebuffer or 34 * other GPL licensed software, then the GPL license designated 35 * NSC_LIC_GPL applies to this Software; in all other circumstances 36 * then the BSD-style license designated NSC_LIC_BSD shall apply. 37 * 38 * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ 39 40/* NSC_LIC_BSD 41 * 42 * National Semiconductor Corporation Open Source License for Durango 43 * 44 * (BSD License with Export Notice) 45 * 46 * Copyright (c) 1999-2001 47 * National Semiconductor Corporation. 48 * All rights reserved. 49 * 50 * Redistribution and use in source and binary forms, with or without 51 * modification, are permitted provided that the following conditions 52 * are met: 53 * 54 * * Redistributions of source code must retain the above copyright 55 * notice, this list of conditions and the following disclaimer. 56 * 57 * * Redistributions in binary form must reproduce the above 58 * copyright notice, this list of conditions and the following 59 * disclaimer in the documentation and/or other materials provided 60 * with the distribution. 61 * 62 * * Neither the name of the National Semiconductor Corporation nor 63 * the names of its contributors may be used to endorse or promote 64 * products derived from this software without specific prior 65 * written permission. 66 * 67 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 68 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 69 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 70 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 71 * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY 72 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 73 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 74 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 75 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 76 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, 77 * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY 78 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 79 * OF SUCH DAMAGE. 80 * 81 * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF 82 * YOUR JURISDICTION. It is licensee's responsibility to comply with 83 * any export regulations applicable in licensee's jurisdiction. Under 84 * CURRENT (2001) U.S. export regulations this software 85 * is eligible for export from the U.S. and can be downloaded by or 86 * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed 87 * destinations which include Cuba, Iraq, Libya, North Korea, Iran, 88 * Syria, Sudan, Afghanistan and any other country to which the U.S. 89 * has embargoed goods and services. 90 * 91 * END_NSC_LIC_BSD */ 92 93/* NSC_LIC_GPL 94 * 95 * National Semiconductor Corporation Gnu General Public License for Durango 96 * 97 * (GPL License with Export Notice) 98 * 99 * Copyright (c) 1999-2001 100 * National Semiconductor Corporation. 101 * All rights reserved. 102 * 103 * Redistribution and use in source and binary forms, with or without 104 * modification, are permitted under the terms of the GNU General 105 * Public License as published by the Free Software Foundation; either 106 * version 2 of the License, or (at your option) any later version 107 * 108 * In addition to the terms of the GNU General Public License, neither 109 * the name of the National Semiconductor Corporation nor the names of 110 * its contributors may be used to endorse or promote products derived 111 * from this software without specific prior written permission. 112 * 113 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 114 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 115 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 116 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 117 * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY 118 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 119 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 120 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 121 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 122 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, 123 * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY 124 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 125 * OF SUCH DAMAGE. See the GNU General Public License for more details. 126 * 127 * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF 128 * YOUR JURISDICTION. It is licensee's responsibility to comply with 129 * any export regulations applicable in licensee's jurisdiction. Under 130 * CURRENT (2001) U.S. export regulations this software 131 * is eligible for export from the U.S. and can be downloaded by or 132 * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed 133 * destinations which include Cuba, Iraq, Libya, North Korea, Iran, 134 * Syria, Sudan, Afghanistan and any other country to which the U.S. 135 * has embargoed goods and services. 136 * 137 * You should have received a copy of the GNU General Public License 138 * along with this file; if not, write to the Free Software Foundation, 139 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 140 * 141 * END_NSC_LIC_GPL */ 142 143/* CONSTANTS USED BY THE INITIALIZATION CODE */ 144 145#define PCI_CONFIG_ADDR 0x0CF8 146#define PCI_CONFIG_DATA 0x0CFC 147#define PCI_VENDOR_DEVICE_GXM 0x00011078 148#define PCI_VENDOR_DEVICE_REDCLOUD 0x0028100B 149#define REDCLOUD_VIDEO_PCI_VENDOR_DEVICE 0x0030100B 150 151#define GXM_CONFIG_GCR 0xB8 152#define GXM_CONFIG_CCR3 0xC3 153#define GXM_CONFIG_DIR0 0xFE 154#define GXM_CONFIG_DIR1 0xFF 155 156/* STATIC VARIABLES FOR THIS FILE */ 157 158unsigned long gfx_cpu_version = 0; 159unsigned long gfx_cpu_frequency = 0; 160unsigned long gfx_vid_version = 0; 161unsigned long gfx_gx1_scratch_base = 0; 162unsigned long gfx_gx2_scratch_base = 0x7FC000; 163ChipType gfx_chip_revision = CHIP_NOT_DETECTED; 164 165/* INCLUDE SUPPORT FOR FIRST GENERATION, IF SPECIFIED. */ 166 167ChipType gfx_detect_chip(void); 168 169#if GFX_INIT_GU1 170#include "init_gu1.c" 171#endif 172 173/* INCLUDE SUPPORT FOR SECOND GENERATION, IF SPECIFIED. */ 174 175#if GFX_INIT_GU2 176#include "init_gu2.c" 177#endif 178 179/* THE FOLLOWING ROUTINES ARE NEVER DYNAMIC */ 180/* They are used to set the variables for future dynamic */ 181/* function calls. */ 182 183/*----------------------------------------------------------------------------- 184 * gfx_detect_chip 185 * 186 * This routine returns the name and revision of the chip. This function is only 187 * relevant to the SC1200. 188 *----------------------------------------------------------------------------- 189 */ 190ChipType 191gfx_detect_chip(void) 192{ 193 unsigned char pid = INB(SC1200_CB_BASE_ADDR + SC1200_CB_PID); 194 unsigned char rev = INB(SC1200_CB_BASE_ADDR + SC1200_CB_REV); 195 196 gfx_chip_revision = CHIP_NOT_DETECTED; 197 198 if (pid == 0x4) { 199 switch (rev) { 200 case 0: 201 gfx_chip_revision = SC1200_REV_A; 202 break; 203 case 1: 204 gfx_chip_revision = SC1200_REV_B1_B2; 205 break; 206 case 2: 207 gfx_chip_revision = SC1200_REV_B3; 208 break; 209 case 3: 210 gfx_chip_revision = SC1200_REV_C1; 211 break; 212 case 4: 213 gfx_chip_revision = SC1200_REV_D1; 214 break; 215 case 5: 216 gfx_chip_revision = SC1200_REV_D1_1; 217 break; 218 case 6: 219 gfx_chip_revision = SC1200_REV_D2_MVD; 220 break; 221 } 222 if (rev > 0x6) 223 gfx_chip_revision = SC1200_FUTURE_REV; 224 } else if (pid == 0x5) { 225 if (rev == 0x6) 226 gfx_chip_revision = SC1200_REV_D2_MVE; 227 else if (rev > 0x6) 228 gfx_chip_revision = SC1200_FUTURE_REV; 229 } 230 return (gfx_chip_revision); 231} 232 233/*----------------------------------------------------------------------------- 234 * gfx_detect_cpu 235 * 236 * This routine returns the type and revison of the CPU. If a Geode 237 * processor is not present, the routine returns zero. 238 * 239 * The return value is as follows: 240 * bits[24:16] = minor version 241 * bits[15:8] = major version 242 * bits[7:0] = type (1 = GXm, 2 = SC1200, 3 = Redcloud) 243 * 244 * A return value of 0x00020501, for example, indicates GXm version 5.2. 245 *----------------------------------------------------------------------------- 246 */ 247unsigned long 248gfx_detect_cpu(void) 249{ 250 251 unsigned long value = 0; 252 unsigned long version = 0; 253 254 /* initialize core freq. to 0 */ 255 gfx_cpu_frequency = 0; 256 257#if GFX_INIT_GU1 258 259 value = gfx_pci_config_read(0x80000000); 260 261 if (value == PCI_VENDOR_DEVICE_GXM) { 262 unsigned char dir0 = gfx_gxm_config_read(GXM_CONFIG_DIR0) & 0xF0; 263 unsigned char dir1 = gfx_gxm_config_read(GXM_CONFIG_DIR1); 264 265 if (dir0 == 0x40) { 266 /* CHECK FOR GXLV (and GXm) (DIR1 = 0x30 THROUGH 0x82) */ 267 268 if ((dir1 >= 0x30) && (dir1 <= 0x82)) { 269 /* Major version is one less than what appears in DIR1 */ 270 if ((dir1 & 0xF0) < 0x70) { 271 272 version = GFX_CPU_GXLV | (((((unsigned long)dir1 >> 4) - 1) << 8)) | /* major - 1 */ 273 ((((unsigned long)dir1 & 0x0F)) << 16); /* minor */ 274 } else { 275 version = GFX_CPU_GXLV | ((((unsigned long)dir1 >> 4)) << 8) | /* major */ 276 ((((unsigned long)dir1 & 0x0F)) << 16); /* minor */ 277 278 } 279 /* Currently always CS5530 for video overlay. */ 280 281# if GFX_VIDEO_DYNAMIC 282 gfx_video_type = GFX_VIDEO_TYPE_CS5530; 283# endif 284 285 /* Currently always CS5530 GPIOs for I2C access. */ 286 287# if GFX_I2C_DYNAMIC 288 gfx_i2c_type = GFX_I2C_TYPE_GPIO; 289# endif 290 291# if GFX_TV_DYNAMIC 292 gfx_tv_type = GFX_TV_TYPE_FS451; 293# endif 294 } 295 } else if (dir0 == 0xB0) { 296 /* CHECK FOR SC1200 */ 297 298 if ((dir1 == 0x70) || (dir1 == 0x81)) { 299 version = GFX_CPU_SC1200 | ((((unsigned long)dir1 >> 4)) << 8) | /* major */ 300 ((((unsigned long)dir1 & 0x0F)) << 16); /* minor */ 301 302 /* Detect SC1200 revision */ 303 304 gfx_detect_chip(); 305 306 /* SC1200 for video overlay and VIP. */ 307 308# if GFX_VIDEO_DYNAMIC 309 gfx_video_type = GFX_VIDEO_TYPE_SC1200; 310# endif 311 312# if GFX_VIP_DYNAMIC 313 gfx_vip_type = GFX_VIP_TYPE_SC1200; 314# endif 315 316 /* Currently always SAA7114 decoder. */ 317 318# if GFX_DECODER_DYNAMIC 319 gfx_decoder_type = GFX_DECODER_TYPE_SAA7114; 320# endif 321 322 /* SC1200 for TV encoder */ 323 324# if GFX_TV_DYNAMIC 325 gfx_tv_type = GFX_TV_TYPE_SC1200; 326# endif 327 328 /* Currently always ACCESS.bus for I2C access. */ 329 330# if GFX_I2C_DYNAMIC 331 gfx_i2c_type = GFX_I2C_TYPE_ACCESS; 332# endif 333 } 334 } 335 336 if (version) { 337 /* ALWAYS FIRST GENERATION GRAPHICS UNIT */ 338 339# if GFX_DISPLAY_DYNAMIC 340 gfx_display_type = GFX_DISPLAY_TYPE_GU1; 341# endif 342# if GFX_2DACCEL_DYNAMIC 343 gfx_2daccel_type = GFX_2DACCEL_TYPE_GU1; 344# endif 345# if GFX_INIT_DYNAMIC 346 gfx_init_type = GFX_INIT_TYPE_GU1; 347# endif 348 349 /* READ THE CORE FREQUENCY */ 350 351 gfx_cpu_frequency = gfx_get_core_freq(); 352 } 353 } 354#endif 355 356#if GFX_INIT_GU2 357 358 value = gfx_pci_config_read(0x80000800); 359 360 if (value == PCI_VENDOR_DEVICE_REDCLOUD) { 361 Q_WORD msr_value; 362 int valid, i; 363 364 /* CHECK FOR SOFT VG */ 365 /* If SoftVG is not present, the base addresses for all devices */ 366 /* will not be allocated. Essentially, it is as if no Redcloud */ 367 /* video hardware is present. */ 368 369 value = gfx_pci_config_read(0x80000900); 370 371 if (value == REDCLOUD_VIDEO_PCI_VENDOR_DEVICE) { 372 valid = 1; 373 374 /* BAR0 - BAR3 HOLD THE PERIPHERAL BASE ADDRESSES */ 375 376 for (i = 0; i < 4; i++) { 377 value = gfx_pci_config_read(0x80000910 + (i << 2)); 378 if (value == 0x00000000 || value == 0xFFFFFFFF) { 379 valid = 0; 380 break; 381 } 382 } 383 384 if (valid) { 385 /* REDCLOUD INTEGRATED VIDEO */ 386 387# if GFX_VIDEO_DYNAMIC 388 gfx_video_type = GFX_VIDEO_TYPE_REDCLOUD; 389# endif 390 391 /* CURRENTLY, ALWAYS GPIO FOR I2C ACCESS */ 392 393# if GFX_I2C_DYNAMIC 394 gfx_i2c_type = GFX_I2C_TYPE_GPIO; 395# endif 396 397 /* SECOND-GENERATION DISPLAY CONTROLLER */ 398 399# if GFX_DISPLAY_DYNAMIC 400 gfx_display_type = GFX_DISPLAY_TYPE_GU2; 401# endif 402 403 /* SECOND-GENERATION GRAPHICS UNIT */ 404 405# if GFX_2DACCEL_DYNAMIC 406 gfx_2daccel_type = GFX_2DACCEL_TYPE_GU2; 407# endif 408 409 /* SECOND-GENERATION INITIALIZATION */ 410 411# if GFX_INIT_DYNAMIC 412 gfx_init_type = GFX_INIT_TYPE_GU2; 413# endif 414 415 /* MBUS MSR ACCESSES */ 416 417# if GFX_MSR_DYNAMIC 418 gfx_msr_type = GFX_MSR_TYPE_REDCLOUD; 419# endif 420 421 /* CS5530 GPIO I2C */ 422 423# if GFX_I2C_DYNAMIC 424 gfx_i2c_type = GFX_I2C_TYPE_GPIO; 425# endif 426 427 /* READ VERSION */ 428 429 gfx_msr_init(); 430 431 gfx_msr_read(RC_ID_MCP, MCP_RC_REVID, &msr_value); 432 433 /* SUBTRACT 1 FROM REV ID */ 434 /* REDCLOUD 1.X rev id is 1 less than the reported value */ 435 436 if ((msr_value.low & 0xF0) == 0x10) 437 msr_value.low--; 438 439 version = GFX_CPU_REDCLOUD | ((msr_value.low & 0xF0) << 4) | /* MAJOR */ 440 ((msr_value.low & 0x0F) << 16); /* MINOR */ 441 442 /* READ THE CORE FREQUENCY */ 443 444 gfx_cpu_frequency = gfx_get_core_freq(); 445 446 /* SET THE GP SCRATCH AREA */ 447 /* Color bitmap BLTs use the last 16K of frame buffer space */ 448 449 gfx_gx2_scratch_base = gfx_get_frame_buffer_size() - 0x4000; 450 } 451 } 452 } 453#endif 454 455 if (!version) { 456 /* ALWAYS SECOND GENERATION IF SIMULATING */ 457 /* For now, that is. This could change. */ 458 459# if GFX_DISPLAY_DYNAMIC 460 gfx_display_type = GFX_DISPLAY_TYPE_GU2; 461# endif 462# if GFX_2DACCEL_DYNAMIC 463 gfx_2daccel_type = GFX_2DACCEL_TYPE_GU2; 464# endif 465# if GFX_INIT_DYNAMIC 466 gfx_init_type = GFX_INIT_TYPE_GU2; 467# endif 468# if GFX_MSR_DYNAMIC 469 gfx_msr_type = GFX_MSR_TYPE_REDCLOUD; 470# endif 471# if GFX_VIDEO_DYNAMIC 472 gfx_video_type = GFX_VIDEO_TYPE_REDCLOUD; 473# endif 474# if GFX_I2C_DYNAMIC 475 gfx_i2c_type = GFX_I2C_TYPE_GPIO; 476# endif 477 } 478 gfx_cpu_version = version; 479 480 return (version); 481} 482 483/*----------------------------------------------------------------------------- 484 * gfx_detect_video 485 * 486 * This routine returns the type of the video hardware. 487 * 488 * The return value is as follows: 489 * bits[7:0] = type (1 = CS5530, 2 = SC1200, 3 = Redcloud) 490 * 491 * Currently this routine does not actually detect any hardware, and bases 492 * the video hardware entirely on the detected CPU. 493 *----------------------------------------------------------------------------- 494 */ 495unsigned long 496gfx_detect_video(void) 497{ 498 unsigned long version = 0; 499 500 if ((gfx_cpu_version & 0xFF) == GFX_CPU_GXLV) 501 version = GFX_VID_CS5530; 502 else if ((gfx_cpu_version & 0xFF) == GFX_CPU_SC1200) 503 version = GFX_VID_SC1200; 504 else if ((gfx_cpu_version & 0xFF) == GFX_CPU_REDCLOUD) 505 version = GFX_VID_REDCLOUD; 506 gfx_vid_version = version; 507 return (version); 508} 509 510/*----------------------------------------------------------------------------- 511 * gfx_pci_config_read 512 * 513 * This routine reads a 32-bit value from the specified location in PCI 514 * configuration space. 515 *----------------------------------------------------------------------------- 516 */ 517unsigned long 518gfx_pci_config_read(unsigned long address) 519{ 520 unsigned long value = 0xFFFFFFFF; 521 522 OUTD(PCI_CONFIG_ADDR, address); 523 value = IND(PCI_CONFIG_DATA); 524 return (value); 525} 526 527/*----------------------------------------------------------------------------- 528 * gfx_pci_config_write 529 * 530 * This routine writes a 32-bit value to the specified location in PCI 531 * configuration space. 532 *----------------------------------------------------------------------------- 533 */ 534void 535gfx_pci_config_write(unsigned long address, unsigned long data) 536{ 537 OUTD(PCI_CONFIG_ADDR, address); 538 OUTD(PCI_CONFIG_DATA, data); 539 return; 540} 541 542/* WRAPPERS IF DYNAMIC SELECTION */ 543/* Extra layer to call either first or second generation routines. */ 544 545#if GFX_INIT_DYNAMIC 546 547/*----------------------------------------------------------------------------- 548 * gfx_get_core_freq 549 *----------------------------------------------------------------------------- 550 */ 551unsigned long 552gfx_get_core_freq(void) 553{ 554 unsigned long freq = 0; 555 556# if GFX_INIT_GU1 557 if (gfx_init_type & GFX_INIT_TYPE_GU1) 558 freq = gu1_get_core_freq(); 559# endif 560# if GFX_INIT_GU2 561 if (gfx_init_type & GFX_INIT_TYPE_GU2) 562 freq = gu2_get_core_freq(); 563# endif 564 return freq; 565} 566 567/*----------------------------------------------------------------------------- 568 * gfx_get_cpu_register_base 569 *----------------------------------------------------------------------------- 570 */ 571unsigned long 572gfx_get_cpu_register_base(void) 573{ 574 unsigned long base = 0; 575 576# if GFX_INIT_GU1 577 if (gfx_init_type & GFX_INIT_TYPE_GU1) 578 base = gu1_get_cpu_register_base(); 579# endif 580# if GFX_INIT_GU2 581 if (gfx_init_type & GFX_INIT_TYPE_GU2) 582 base = gu2_get_cpu_register_base(); 583# endif 584 585 return (base); 586} 587 588/*----------------------------------------------------------------------------- 589 * gfx_get_graphics_register_base 590 *----------------------------------------------------------------------------- 591 */ 592unsigned long 593gfx_get_graphics_register_base(void) 594{ 595 unsigned long base = 0; 596 597# if GFX_INIT_GU2 598 if (gfx_init_type & GFX_INIT_TYPE_GU2) 599 base = gu2_get_graphics_register_base(); 600# endif 601 602 return (base); 603} 604 605/*----------------------------------------------------------------------------- 606 * gfx_get_frame_buffer_base 607 *----------------------------------------------------------------------------- 608 */ 609unsigned long 610gfx_get_frame_buffer_base(void) 611{ 612 unsigned long base = 0; 613 614# if GFX_INIT_GU1 615 if (gfx_init_type & GFX_INIT_TYPE_GU1) 616 base = gu1_get_frame_buffer_base(); 617# endif 618# if GFX_INIT_GU2 619 if (gfx_init_type & GFX_INIT_TYPE_GU2) 620 base = gu2_get_frame_buffer_base(); 621# endif 622 623 return (base); 624} 625 626/*----------------------------------------------------------------------------- 627 * gfx_get_frame_buffer_size 628 *----------------------------------------------------------------------------- 629 */ 630unsigned long 631gfx_get_frame_buffer_size(void) 632{ 633 unsigned long size = 0; 634 635# if GFX_INIT_GU1 636 if (gfx_init_type & GFX_INIT_TYPE_GU1) 637 size = gu1_get_frame_buffer_size(); 638# endif 639# if GFX_INIT_GU2 640 if (gfx_init_type & GFX_INIT_TYPE_GU2) 641 size = gu2_get_frame_buffer_size(); 642# endif 643 644 return size; 645} 646 647/*----------------------------------------------------------------------------- 648 * gfx_get_vid_register_base 649 *----------------------------------------------------------------------------- 650 */ 651unsigned long 652gfx_get_vid_register_base(void) 653{ 654 unsigned long base = 0; 655 656# if GFX_INIT_GU1 657 if (gfx_init_type & GFX_INIT_TYPE_GU1) 658 base = gu1_get_vid_register_base(); 659# endif 660# if GFX_INIT_GU2 661 if (gfx_init_type & GFX_INIT_TYPE_GU2) 662 base = gu2_get_vid_register_base(); 663# endif 664 665 return (base); 666} 667 668/*----------------------------------------------------------------------------- 669 * gfx_get_vip_register_base 670 *----------------------------------------------------------------------------- 671 */ 672unsigned long 673gfx_get_vip_register_base(void) 674{ 675 unsigned long base = 0; 676 677# if GFX_INIT_GU1 678 if (gfx_init_type & GFX_INIT_TYPE_GU1) 679 base = gu1_get_vip_register_base(); 680# endif 681 682 return (base); 683} 684 685#endif 686 687/* END OF FILE */ 688 689