blob: 7904b4e94b06429c072d152d76a0e59e41a0daf7 [file] [log] [blame]
Tom Warren64982c502014-01-23 13:37:50 -07001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright 2014 Google 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; 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 <console/console.h>
Julius Wernerf0d21ff32014-10-20 13:24:14 -070021#include <soc/sdram.h>
22
Tom Warren64982c502014-01-23 13:37:50 -070023#include "sdram_configs.h"
24
Tom Warren64982c502014-01-23 13:37:50 -070025static struct sdram_params sdram_configs[] = {
Tom Warren96ef1882014-06-10 13:46:48 -070026#include "bct/sdram-unused.inc" /* ram_code = 0000 */
27#include "bct/sdram-hynix-2GB-792.inc" /* ram_code = 0001 */
28#include "bct/sdram-unused.inc" /* ram_code = 0010 */
29#include "bct/sdram-unused.inc" /* ram_code = 0011 */
30#include "bct/sdram-hynix-4GB-792.inc" /* ram_code = 0100 */
31#include "bct/sdram-unused.inc" /* ram_code = 0101 */
32#include "bct/sdram-kingston-2GB-792.inc" /* ram_code = 0110 */
33#include "bct/sdram-unused.inc" /* ram_code = 0111 */
34#include "bct/sdram-unused.inc" /* ram_code = 1000 */
35#include "bct/sdram-unused.inc" /* ram_code = 1001 */
36#include "bct/sdram-unused.inc" /* ram_code = 1010 */
37#include "bct/sdram-unused.inc" /* ram_code = 1011 */
38#include "bct/sdram-unused.inc" /* ram_code = 1100 */
39#include "bct/sdram-unused.inc" /* ram_code = 1101 */
40#include "bct/sdram-unused.inc" /* ram_code = 1110 */
41#include "bct/sdram-unused.inc" /* ram_code = 1111 */
Tom Warren64982c502014-01-23 13:37:50 -070042};
43
44const struct sdram_params *get_sdram_config()
45{
46 uint32_t ramcode = sdram_get_ram_code();
47 /*
48 * If we need to apply some special hacks to RAMCODE mapping (ex, by
49 * board_id), do that now.
50 */
51
52 printk(BIOS_SPEW, "%s: RAMCODE=%d\n", __func__, ramcode);
53 if (ramcode >= sizeof(sdram_configs) / sizeof(sdram_configs[0]) ||
54 sdram_configs[ramcode].MemoryType == NvBootMemoryType_Unused) {
55 die("Invalid RAMCODE.");
56 }
57
58 return &sdram_configs[ramcode];
59}