blob: e6e6247cade75a3e57c12246bd64052c8f2edff3 [file] [log] [blame]
Stefan Reinauer9839cbd2010-04-21 20:06:10 +00001/*
2 * This file is part of the coreboot project.
Stefan Reinauer14e22772010-04-27 06:56:47 +00003 *
Stefan Reinauer9839cbd2010-04-21 20:06:10 +00004 * 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.
Stefan Reinauer9839cbd2010-04-21 20:06:10 +000014 */
15
Stefan Reinauer4e169f92010-04-22 00:52:42 +000016#include <stdlib.h>
Edwin Beasantf333ba02010-06-10 15:24:57 +000017#include "cpu/x86/msr.h"
Stefan Reinauer4e169f92010-04-22 00:52:42 +000018
Edwin Beasantf333ba02010-06-10 15:24:57 +000019static const msrinit_t msr_table[] =
Stefan Reinauer9839cbd2010-04-21 20:06:10 +000020{
Nils Jacobseb84f6a2012-01-09 20:27:07 +010021 {CPU_RCONF_DEFAULT, {.hi = 0x24fffc00,.lo = 0x0000A000}}, /* Setup access to cache under 1MB.
Stefan Reinauer9839cbd2010-04-21 20:06:10 +000022 * Rom Properties: Write Serialize, WriteProtect.
23 * RomBase: 0xFFFC0
Nils Jacobseb84f6a2012-01-09 20:27:07 +010024 * SysTop to RomBase Properties: Write Back.
Stefan Reinauer9839cbd2010-04-21 20:06:10 +000025 * SysTop: 0x000A0
26 * System Memory Properties: (Write Back) */
27 {CPU_RCONF_A0_BF, {.hi = 0x00000000,.lo = 0x00000000}}, /* 0xA0000-0xBFFFF : (Write Back) */
28 {CPU_RCONF_C0_DF, {.hi = 0x00000000,.lo = 0x00000000}}, /* 0xC0000-0xDFFFF : (Write Back) */
29 {CPU_RCONF_E0_FF, {.hi = 0x00000000,.lo = 0x00000000}}, /* 0xE0000-0xFFFFF : (Write Back) */
Stefan Reinauer14e22772010-04-27 06:56:47 +000030
Stefan Reinauer9839cbd2010-04-21 20:06:10 +000031 /* Setup access to memory under 1MB. Note: VGA hole at 0xA0000-0xBFFFF */
32 {MSR_GLIU0_BASE1, {.hi = 0x20000000,.lo = 0x000fff80}}, // 0x00000-0x7FFFF
33 {MSR_GLIU0_BASE2, {.hi = 0x20000000,.lo = 0x080fffe0}}, // 0x80000-0x9FFFF
34 {MSR_GLIU0_SHADOW, {.hi = 0x2000FFFF,.lo = 0xFFFF0003}}, // 0xC0000-0xFFFFF
35 {MSR_GLIU1_BASE1, {.hi = 0x20000000,.lo = 0x000fff80}}, // 0x00000-0x7FFFF
36 {MSR_GLIU1_BASE2, {.hi = 0x20000000,.lo = 0x080fffe0}}, // 0x80000-0x9FFFF
37 {MSR_GLIU1_SHADOW, {.hi = 0x2000FFFF,.lo = 0xFFFF0003}}, // 0xC0000-0xFFFFF
Aurelien Guillaume34697d62010-09-07 07:43:10 +000038
39 /* Pre-setup access to memory above 1Mb. Here we set up about 500Mb of memory.
40 * It doesn't really matter in fact how much, however, because the only usage
Furquan Shaikh20f25dd2014-04-22 10:41:05 -070041 * of this extended memory will be to host the ramstage stage at RAMBASE,
Aurelien Guillaume34697d62010-09-07 07:43:10 +000042 * currently 1Mb.
43 * These registers will be set to their correct value by the Northbridge init code.
Stefan Reinauer5ff7c132011-10-31 12:56:45 -070044 *
Furquan Shaikh20f25dd2014-04-22 10:41:05 -070045 * WARNING: if ramstage could not be loaded, these registers are probably
Aurelien Guillaume34697d62010-09-07 07:43:10 +000046 * incorrectly set here. You may comment the following two lines and set RAMBASE
47 * to 0x4000 to revert to the previous behavior for LX-boards.
48 */
49 {MSR_GLIU0_SYSMEM, {.hi = 0x2000001F,.lo = 0x6BF00100}}, // 0x100000-0x1F6BF000
50 {MSR_GLIU1_SYSMEM, {.hi = 0x2000001F,.lo = 0x6BF00100}}, // 0x100000-0x1F6BF000
Stefan Reinauer9839cbd2010-04-21 20:06:10 +000051};
52
53static void msr_init(void)
54{
55 int i;
56 for (i = 0; i < ARRAY_SIZE(msr_table); i++)
Edwin Beasantf333ba02010-06-10 15:24:57 +000057 wrmsr(msr_table[i].index, msr_table[i].msr);
Stefan Reinauer9839cbd2010-04-21 20:06:10 +000058}