Please bear with me - another rename checkin. This qualifies as trivial, no
[coreboot.git] / src / northbridge / amd / lx / grphinit.c
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2007 Advanced Micro Devices, Inc.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
19  */
20
21 #include <arch/io.h>
22 #include <stdint.h>
23 #include <cpu/amd/vr.h>
24 #include <console/console.h>
25
26  /*
27   * This function mirrors the Graphics_Init routine in GeodeROM.
28   */
29 void graphics_init(void)
30 {
31         uint16_t wClassIndex, wData, res;
32
33         /* SoftVG initialization */
34         printk_debug("Graphics init...\n");
35
36         /* Call SoftVG with the main configuration parameters. */
37         /* NOTE: SoftVG expects the memory size to be given in 2MB blocks */
38
39         wClassIndex = (VRC_VG << 8) + VG_CONFIG;
40
41         /*
42          * Graphics Driver Enabled (13)                         0, NO (lets BIOS controls the GP)
43          * External Monochrome Card Support(12)         0, NO
44          * Controller Priority Select(11)                       1, Primary
45          * Display Select(10:8)                                         0x0, CRT
46          * Graphics Memory Size(7:1)                            CONFIG_VIDEO_MB >> 1,
47          *                                                                                      defined in mainboard/../Options.lb
48          * PLL Reference Clock Bypass(0)                        0, Default
49          */
50
51         /* Video RAM has to be given in 2MB chunks
52          *   the value is read @ 7:1 (value in 7:0 looks like /2)
53          *   so we can add the real value in megabytes
54          */
55
56         wData = VG_CFG_DRIVER | VG_CFG_PRIORITY | 
57                         VG_CFG_DSCRT | (CONFIG_VIDEO_MB & VG_MEM_MASK);
58         vrWrite(wClassIndex, wData);
59
60         res = vrRead(wClassIndex);
61         printk_debug("VRC_VG value: 0x%04x\n", res);
62 }