CBMEM: Drop parameter from cbmem_reinit()
Function is always called with get_top_of_ram() - HIGH_MEMORY_SIZE which equals cbmem_base, thus no need to pass it as a parameter. Change-Id: If026cb567ff534716cd9200cdffa08b21ac0c162 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: http://review.coreboot.org/3564 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@google.com>
This commit is contained in:
@ -109,18 +109,9 @@ void restore_mtrr(void)
|
|||||||
|
|
||||||
inline void *backup_resume(void)
|
inline void *backup_resume(void)
|
||||||
{
|
{
|
||||||
unsigned long high_ram_base;
|
|
||||||
void *resume_backup_memory;
|
void *resume_backup_memory;
|
||||||
|
|
||||||
/* Start address of high memory tables */
|
if (!cbmem_reinit())
|
||||||
high_ram_base = (u32) get_cbmem_toc();
|
|
||||||
|
|
||||||
/*
|
|
||||||
* printk(BIOS_DEBUG, "CBMEM TOC is at: %x\n", (u32_t)high_ram_base);
|
|
||||||
* printk(BIOS_DEBUG, "CBMEM TOC 0-size:%x\n ",(u32_t)(high_ram_base + HIGH_MEMORY_SIZE + 4096));
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!cbmem_reinit((u64)high_ram_base))
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
resume_backup_memory = cbmem_find(CBMEM_ID_RESUME);
|
resume_backup_memory = cbmem_find(CBMEM_ID_RESUME);
|
||||||
|
@ -32,20 +32,13 @@ static void inline __attribute__((always_inline)) memcopy(void *dest, const voi
|
|||||||
#if CONFIG_HAVE_ACPI_RESUME
|
#if CONFIG_HAVE_ACPI_RESUME
|
||||||
|
|
||||||
static inline void *backup_resume(void) {
|
static inline void *backup_resume(void) {
|
||||||
unsigned long high_ram_base;
|
|
||||||
void *resume_backup_memory;
|
void *resume_backup_memory;
|
||||||
int suspend = acpi_is_wakeup_early();
|
int suspend = acpi_is_wakeup_early();
|
||||||
|
|
||||||
if (!suspend)
|
if (!suspend)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* Start address of high memory tables */
|
if (!cbmem_reinit())
|
||||||
high_ram_base = (u32) get_cbmem_toc();
|
|
||||||
|
|
||||||
print_debug_pcar("CBMEM TOC is at: ", (uint32_t)high_ram_base);
|
|
||||||
print_debug_pcar("CBMEM TOC 0-size: ",(uint32_t)(high_ram_base + HIGH_MEMORY_SIZE + 4096));
|
|
||||||
|
|
||||||
if (!cbmem_reinit((u64)high_ram_base))
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
resume_backup_memory = cbmem_find(CBMEM_ID_RESUME);
|
resume_backup_memory = cbmem_find(CBMEM_ID_RESUME);
|
||||||
|
@ -138,7 +138,7 @@ int cbmem_base_check(void);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void cbmem_init(u64 baseaddr, u64 size);
|
void cbmem_init(u64 baseaddr, u64 size);
|
||||||
int cbmem_reinit(u64 baseaddr);
|
int cbmem_reinit(void);
|
||||||
|
|
||||||
void get_cbmem_table(uint64_t *base, uint64_t *size);
|
void get_cbmem_table(uint64_t *base, uint64_t *size);
|
||||||
struct cbmem_entry *get_cbmem_toc(void);
|
struct cbmem_entry *get_cbmem_toc(void);
|
||||||
|
@ -47,7 +47,6 @@ uint64_t high_tables_base = 0;
|
|||||||
uint64_t high_tables_size = 0;
|
uint64_t high_tables_size = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(__PRE_RAM__)
|
|
||||||
static void cbmem_trace_location(uint64_t base, uint64_t size, const char *s)
|
static void cbmem_trace_location(uint64_t base, uint64_t size, const char *s)
|
||||||
{
|
{
|
||||||
if (base && size && s) {
|
if (base && size && s) {
|
||||||
@ -55,7 +54,6 @@ static void cbmem_trace_location(uint64_t base, uint64_t size, const char *s)
|
|||||||
base, base + size - 1, s);
|
base, base + size - 1, s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static void cbmem_locate_table(uint64_t *base, uint64_t *size)
|
static void cbmem_locate_table(uint64_t *base, uint64_t *size)
|
||||||
{
|
{
|
||||||
@ -120,13 +118,15 @@ void cbmem_init(u64 baseaddr, u64 size)
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
int cbmem_reinit(u64 baseaddr)
|
int cbmem_reinit(void)
|
||||||
{
|
{
|
||||||
|
uint64_t baseaddr, size;
|
||||||
struct cbmem_entry *cbmem_toc;
|
struct cbmem_entry *cbmem_toc;
|
||||||
cbmem_toc = (struct cbmem_entry *)(unsigned long)baseaddr;
|
|
||||||
|
|
||||||
printk(BIOS_DEBUG, "Re-Initializing CBMEM area to 0x%lx\n",
|
cbmem_locate_table(&baseaddr, &size);
|
||||||
(unsigned long)baseaddr);
|
cbmem_trace_location(baseaddr, size, __FUNCTION__);
|
||||||
|
|
||||||
|
cbmem_toc = (struct cbmem_entry *)(unsigned long)baseaddr;
|
||||||
|
|
||||||
return (cbmem_toc[0].magic == CBMEM_MAGIC);
|
return (cbmem_toc[0].magic == CBMEM_MAGIC);
|
||||||
}
|
}
|
||||||
@ -226,7 +226,7 @@ int cbmem_initialize(void)
|
|||||||
cbmem_locate_table(&base, &size);
|
cbmem_locate_table(&base, &size);
|
||||||
|
|
||||||
/* We expect the romstage to always initialize it. */
|
/* We expect the romstage to always initialize it. */
|
||||||
if (!cbmem_reinit(base)) {
|
if (!cbmem_reinit()) {
|
||||||
#if CONFIG_HAVE_ACPI_RESUME && !defined(__PRE_RAM__)
|
#if CONFIG_HAVE_ACPI_RESUME && !defined(__PRE_RAM__)
|
||||||
/* Something went wrong, our high memory area got wiped */
|
/* Something went wrong, our high memory area got wiped */
|
||||||
if (acpi_slp_type == 3 || acpi_slp_type == 2)
|
if (acpi_slp_type == 3 || acpi_slp_type == 2)
|
||||||
|
@ -358,13 +358,10 @@ void main(unsigned long bist)
|
|||||||
MCHBAR16(SSKPD) = 0xCAFE;
|
MCHBAR16(SSKPD) = 0xCAFE;
|
||||||
|
|
||||||
#if CONFIG_HAVE_ACPI_RESUME
|
#if CONFIG_HAVE_ACPI_RESUME
|
||||||
/* Start address of high memory tables */
|
|
||||||
unsigned long high_ram_base = get_top_of_ram() - HIGH_MEMORY_SIZE;
|
|
||||||
|
|
||||||
/* If there is no high memory area, we didn't boot before, so
|
/* If there is no high memory area, we didn't boot before, so
|
||||||
* this is not a resume. In that case we just create the cbmem toc.
|
* this is not a resume. In that case we just create the cbmem toc.
|
||||||
*/
|
*/
|
||||||
if ((boot_mode == 2) && cbmem_reinit((u64)high_ram_base)) {
|
if ((boot_mode == 2) && cbmem_reinit()) {
|
||||||
void *resume_backup_memory = cbmem_find(CBMEM_ID_RESUME);
|
void *resume_backup_memory = cbmem_find(CBMEM_ID_RESUME);
|
||||||
|
|
||||||
/* copy 1MB - 64K to high tables ram_base to prevent memory corruption
|
/* copy 1MB - 64K to high tables ram_base to prevent memory corruption
|
||||||
|
@ -313,8 +313,7 @@ void main(unsigned long bist)
|
|||||||
#if CONFIG_EARLY_CBMEM_INIT
|
#if CONFIG_EARLY_CBMEM_INIT
|
||||||
cbmem_was_initted = !cbmem_initialize();
|
cbmem_was_initted = !cbmem_initialize();
|
||||||
#else
|
#else
|
||||||
cbmem_was_initted = cbmem_reinit((uint64_t) (get_top_of_ram()
|
cbmem_was_initted = cbmem_reinit();
|
||||||
- HIGH_MEMORY_SIZE));
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CONFIG_HAVE_ACPI_RESUME
|
#if CONFIG_HAVE_ACPI_RESUME
|
||||||
|
@ -312,13 +312,10 @@ void main(unsigned long bist)
|
|||||||
MCHBAR16(SSKPD) = 0xCAFE;
|
MCHBAR16(SSKPD) = 0xCAFE;
|
||||||
|
|
||||||
#if CONFIG_HAVE_ACPI_RESUME
|
#if CONFIG_HAVE_ACPI_RESUME
|
||||||
/* Start address of high memory tables */
|
|
||||||
unsigned long high_ram_base = get_top_of_ram() - HIGH_MEMORY_SIZE;
|
|
||||||
|
|
||||||
/* If there is no high memory area, we didn't boot before, so
|
/* If there is no high memory area, we didn't boot before, so
|
||||||
* this is not a resume. In that case we just create the cbmem toc.
|
* this is not a resume. In that case we just create the cbmem toc.
|
||||||
*/
|
*/
|
||||||
if ((boot_mode == 2) && cbmem_reinit((u64)high_ram_base)) {
|
if ((boot_mode == 2) && cbmem_reinit()) {
|
||||||
void *resume_backup_memory = cbmem_find(CBMEM_ID_RESUME);
|
void *resume_backup_memory = cbmem_find(CBMEM_ID_RESUME);
|
||||||
|
|
||||||
/* copy 1MB - 64K to high tables ram_base to prevent memory corruption
|
/* copy 1MB - 64K to high tables ram_base to prevent memory corruption
|
||||||
|
@ -270,13 +270,10 @@ void main(unsigned long bist)
|
|||||||
MCHBAR16(SSKPD) = 0xCAFE;
|
MCHBAR16(SSKPD) = 0xCAFE;
|
||||||
|
|
||||||
#if CONFIG_HAVE_ACPI_RESUME
|
#if CONFIG_HAVE_ACPI_RESUME
|
||||||
/* Start address of high memory tables */
|
|
||||||
unsigned long high_ram_base = get_top_of_ram() - HIGH_MEMORY_SIZE;
|
|
||||||
|
|
||||||
/* If there is no high memory area, we didn't boot before, so
|
/* If there is no high memory area, we didn't boot before, so
|
||||||
* this is not a resume. In that case we just create the cbmem toc.
|
* this is not a resume. In that case we just create the cbmem toc.
|
||||||
*/
|
*/
|
||||||
if ((boot_mode == 2) && cbmem_reinit((u64)high_ram_base)) {
|
if ((boot_mode == 2) && cbmem_reinit()) {
|
||||||
void *resume_backup_memory = cbmem_find(CBMEM_ID_RESUME);
|
void *resume_backup_memory = cbmem_find(CBMEM_ID_RESUME);
|
||||||
|
|
||||||
/* copy 1MB - 64K to high tables ram_base to prevent memory corruption
|
/* copy 1MB - 64K to high tables ram_base to prevent memory corruption
|
||||||
|
@ -411,13 +411,10 @@ void main(unsigned long bist)
|
|||||||
MCHBAR16(SSKPD) = 0xCAFE;
|
MCHBAR16(SSKPD) = 0xCAFE;
|
||||||
|
|
||||||
#if CONFIG_HAVE_ACPI_RESUME
|
#if CONFIG_HAVE_ACPI_RESUME
|
||||||
/* Start address of high memory tables */
|
|
||||||
unsigned long high_ram_base = get_top_of_ram() - HIGH_MEMORY_SIZE;
|
|
||||||
|
|
||||||
/* If there is no high memory area, we didn't boot before, so
|
/* If there is no high memory area, we didn't boot before, so
|
||||||
* this is not a resume. In that case we just create the cbmem toc.
|
* this is not a resume. In that case we just create the cbmem toc.
|
||||||
*/
|
*/
|
||||||
if ((boot_mode == 2) && cbmem_reinit((u64)high_ram_base)) {
|
if ((boot_mode == 2) && cbmem_reinit()) {
|
||||||
void *resume_backup_memory = cbmem_find(CBMEM_ID_RESUME);
|
void *resume_backup_memory = cbmem_find(CBMEM_ID_RESUME);
|
||||||
|
|
||||||
/* copy 1MB - 64K to high tables ram_base to prevent memory corruption
|
/* copy 1MB - 64K to high tables ram_base to prevent memory corruption
|
||||||
|
@ -347,13 +347,10 @@ void main(unsigned long bist)
|
|||||||
MCHBAR16(SSKPD) = 0xCAFE;
|
MCHBAR16(SSKPD) = 0xCAFE;
|
||||||
|
|
||||||
#if CONFIG_HAVE_ACPI_RESUME
|
#if CONFIG_HAVE_ACPI_RESUME
|
||||||
/* Start address of high memory tables */
|
|
||||||
unsigned long high_ram_base = get_top_of_ram() - HIGH_MEMORY_SIZE;
|
|
||||||
|
|
||||||
/* If there is no high memory area, we didn't boot before, so
|
/* If there is no high memory area, we didn't boot before, so
|
||||||
* this is not a resume. In that case we just create the cbmem toc.
|
* this is not a resume. In that case we just create the cbmem toc.
|
||||||
*/
|
*/
|
||||||
if ((boot_mode == 2) && cbmem_reinit((u64)high_ram_base)) {
|
if ((boot_mode == 2) && cbmem_reinit()) {
|
||||||
void *resume_backup_memory = cbmem_find(CBMEM_ID_RESUME);
|
void *resume_backup_memory = cbmem_find(CBMEM_ID_RESUME);
|
||||||
|
|
||||||
/* copy 1MB - 64K to high tables ram_base to prevent memory corruption
|
/* copy 1MB - 64K to high tables ram_base to prevent memory corruption
|
||||||
|
@ -184,13 +184,10 @@ void main(unsigned long bist)
|
|||||||
init_iommu();
|
init_iommu();
|
||||||
|
|
||||||
#if CONFIG_HAVE_ACPI_RESUME
|
#if CONFIG_HAVE_ACPI_RESUME
|
||||||
/* Start address of high memory tables */
|
|
||||||
unsigned long high_ram_base = get_top_of_ram() - HIGH_MEMORY_SIZE;
|
|
||||||
|
|
||||||
/* If there is no high memory area, we didn't boot before, so
|
/* If there is no high memory area, we didn't boot before, so
|
||||||
* this is not a resume. In that case we just create the cbmem toc.
|
* this is not a resume. In that case we just create the cbmem toc.
|
||||||
*/
|
*/
|
||||||
if (s3resume && cbmem_reinit((u64)high_ram_base)) {
|
if (s3resume && cbmem_reinit() {
|
||||||
void *resume_backup_memory = cbmem_find(CBMEM_ID_RESUME);
|
void *resume_backup_memory = cbmem_find(CBMEM_ID_RESUME);
|
||||||
|
|
||||||
/* copy 1MB - 64K to high tables ram_base to prevent memory corruption
|
/* copy 1MB - 64K to high tables ram_base to prevent memory corruption
|
||||||
|
Reference in New Issue
Block a user