6569338a2f63ee7ff7885fdc5d975323e42c35ad
[coreboot.git] / src / cpu / amd / model_lx / msrinit.c
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2010 coresystems GmbH
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; version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19
20 #include <stdlib.h>
21 #include "cpu/x86/msr.h"
22
23 static const msrinit_t msr_table[] =
24 {
25         {CPU_RCONF_DEFAULT, {.hi = 0x24fffc02,.lo = 0x1000A000}}, /* Setup access to cache under 1MB.
26                                                                    * Rom Properties: Write Serialize, WriteProtect.
27                                                                    * RomBase: 0xFFFC0
28                                                                    * SysTop to RomBase Properties: Write Serialize, Cache Disable.
29                                                                    * SysTop: 0x000A0
30                                                                    * System Memory Properties:  (Write Back) */
31         {CPU_RCONF_A0_BF,   {.hi = 0x00000000,.lo = 0x00000000}}, /* 0xA0000-0xBFFFF : (Write Back) */
32         {CPU_RCONF_C0_DF,   {.hi = 0x00000000,.lo = 0x00000000}}, /* 0xC0000-0xDFFFF : (Write Back) */
33         {CPU_RCONF_E0_FF,   {.hi = 0x00000000,.lo = 0x00000000}}, /* 0xE0000-0xFFFFF : (Write Back) */
34
35         /* Setup access to memory under 1MB. Note: VGA hole at 0xA0000-0xBFFFF */
36         {MSR_GLIU0_BASE1,   {.hi = 0x20000000,.lo = 0x000fff80}}, // 0x00000-0x7FFFF
37         {MSR_GLIU0_BASE2,   {.hi = 0x20000000,.lo = 0x080fffe0}}, // 0x80000-0x9FFFF
38         {MSR_GLIU0_SHADOW,  {.hi = 0x2000FFFF,.lo = 0xFFFF0003}}, // 0xC0000-0xFFFFF
39         {MSR_GLIU1_BASE1,   {.hi = 0x20000000,.lo = 0x000fff80}}, // 0x00000-0x7FFFF
40         {MSR_GLIU1_BASE2,   {.hi = 0x20000000,.lo = 0x080fffe0}}, // 0x80000-0x9FFFF
41         {MSR_GLIU1_SHADOW,  {.hi = 0x2000FFFF,.lo = 0xFFFF0003}}, // 0xC0000-0xFFFFF
42
43         /* Pre-setup access to memory above 1Mb. Here we set up about 500Mb of memory.
44          * It doesn't really matter in fact how much, however, because the only usage
45          * of this extended memory will be to host the coreboot_ram stage at RAMBASE,
46          * currently 1Mb.
47          * These registers will be set to their correct value by the Northbridge init code.
48          * 
49          * WARNING: if coreboot_ram could not be loaded, these registers are probably
50          * incorrectly set here. You may comment the following two lines and set RAMBASE
51          * to 0x4000 to revert to the previous behavior for LX-boards.
52          */
53         {MSR_GLIU0_SYSMEM,  {.hi = 0x2000001F,.lo = 0x6BF00100}}, // 0x100000-0x1F6BF000
54         {MSR_GLIU1_SYSMEM,  {.hi = 0x2000001F,.lo = 0x6BF00100}}, // 0x100000-0x1F6BF000
55 };
56
57 static void msr_init(void)
58 {
59         int i;
60         for (i = 0; i < ARRAY_SIZE(msr_table); i++)
61                 wrmsr(msr_table[i].index, msr_table[i].msr);
62 }
63
64