Kyösti Mälkki | 191d221 | 2014-06-15 12:06:12 +0300 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2013 Vladimir Serbinenko. |
| 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. |
Kyösti Mälkki | 191d221 | 2014-06-15 12:06:12 +0300 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | #define __SIMPLE_DEVICE__ |
| 17 | |
| 18 | #include <arch/io.h> |
| 19 | #include <cbmem.h> |
| 20 | #include "nehalem.h" |
| 21 | |
Kyösti Mälkki | f1e3c76 | 2014-12-22 12:28:07 +0200 | [diff] [blame] | 22 | static uintptr_t smm_region_start(void) |
Kyösti Mälkki | 191d221 | 2014-06-15 12:06:12 +0300 | [diff] [blame] | 23 | { |
| 24 | /* Base of TSEG is top of usable DRAM */ |
Kyösti Mälkki | f1e3c76 | 2014-12-22 12:28:07 +0200 | [diff] [blame] | 25 | uintptr_t tom = pci_read_config32(PCI_DEV(0,0,0), TSEG); |
| 26 | return tom; |
| 27 | } |
| 28 | |
| 29 | void *cbmem_top(void) |
| 30 | { |
| 31 | return (void *) smm_region_start(); |
Kyösti Mälkki | 191d221 | 2014-06-15 12:06:12 +0300 | [diff] [blame] | 32 | } |