2 * This file is part of the LinuxBIOS project.
4 * Copyright (C) 2007 Advanced Micro Devices, Inc.
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.
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.
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
23 #include <cpu/amd/vr.h>
24 #include <console/console.h>
28 * This function mirrors the Graphics_Init routine in GeodeROM.
30 void graphics_init(void)
32 uint16_t wClassIndex, wData, res;
34 /* SoftVG initialization */
35 printk_debug("Graphics init...\n");
37 /* Call SoftVG with the main configuration parameters. */
38 /* NOTE: SoftVG expects the memory size to be given in 2MB blocks */
40 wClassIndex = (VRC_VG << 8) + VG_CONFIG;
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
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
57 wData = VG_CFG_DRIVER | VG_CFG_PRIORITY | VG_CFG_DSCRT | (CONFIG_VIDEO_MB & VG_MEM_MASK);
58 vrWrite(wClassIndex, wData);
60 res = vrRead(wClassIndex);
61 printk_debug("VRC_VG value: 0x%04x\n", res);