blob: 633a0bf7db8ae53c14b046737192df01097e76ed [file] [log] [blame]
Yen Lin727ba2d2015-06-17 17:06:23 -07001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright 2014 Google Inc.
5 * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
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
17#include <console/console.h>
18#include <soc/sdram_configs.h>
19
20static struct sdram_params sdram_configs[] = {
21#include "bct/sdram-samsung-3GB-204.inc" /* ram_code = 0000 */
22#include "bct/sdram-unused.inc" /* ram_code = 0001 */
23#include "bct/sdram-unused.inc" /* ram_code = 0010 */
24#include "bct/sdram-unused.inc" /* ram_code = 0011 */
25};
26
27const struct sdram_params *get_sdram_config()
28{
29 uint32_t ramcode = sdram_get_ram_code();
30 /*
31 * If we need to apply some special hacks to RAMCODE mapping (ex, by
32 * board_id), do that now.
33 */
34
35 printk(BIOS_SPEW, "%s: RAMCODE=%d\n", __func__, ramcode);
36 if (ramcode >= sizeof(sdram_configs) / sizeof(sdram_configs[0]) ||
37 sdram_configs[ramcode].MemoryType == NvBootMemoryType_Unused) {
38 die("Invalid RAMCODE.");
39 }
40
41 return &sdram_configs[ramcode];
42}