Add missing licenses to several of the files.
[coreboot.git] / src / northbridge / amd / lx / grphinit.c
1 /*
2  * This file is part of the LinuxBIOS 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  /*
28  * This function mirrors the Graphics_Init routine in GeodeROM.
29  */
30 void graphics_init(void)
31 {
32         uint16_t wClassIndex, wData, res;
33         
34         /* SoftVG initialization */
35         printk_debug("Graphics init...\n");
36
37         /* Call SoftVG with the main configuration parameters. */
38         /* NOTE: SoftVG expects the memory size to be given in 2MB blocks */
39         
40         wClassIndex = (VRC_VG <<  8) + VG_CONFIG;
41         
42         /*
43          * Graphics Driver Enabled (13)                         0, NO (lets BIOS controls the GP)
44          * External Monochrome Card Support(12)         0, NO
45          * Controller Priority Select(11)                       1, Primary
46          * Display Select(10:8)                                         0x0, CRT
47          * Graphics Memory Size(7:1)                            CONFIG_VIDEO_MB >> 1,
48          *                                                                                      defined in mainboard/../Options.lb
49          * PLL Reference Clock Bypass(0)                        0, Default
50          */
51
52         /* Video RAM has to be given in 2MB chunks
53          *   the value is read @ 7:1 (value in 7:0 looks like /2)
54          *   so we can add the real value in megabytes
55          */
56          
57         wData =  VG_CFG_DRIVER | VG_CFG_PRIORITY | 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 }
63
64