2 * This file is part of the coreboot project.
4 * Copyright (C) 2013 Google, Inc.
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.
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.
15 #include <console/console.h>
17 #include <bootstate.h>
20 #if IS_ENABLED(CONFIG_ARCH_X86) && !IS_ENABLED(CONFIG_EARLY_CBMEM_INIT)
21 #include <arch/acpi.h>
24 void cbmem_run_init_hooks(int is_recovery
)
26 cbmem_init_hook_t
*init_hook_ptr
=
27 (cbmem_init_hook_t
*)&_cbmem_init_hooks
;
28 cbmem_init_hook_t
*einit_hook_ptr
=
29 (cbmem_init_hook_t
*)&_ecbmem_init_hooks
;
31 if (_cbmem_init_hooks_size
== 0)
34 while (init_hook_ptr
!= einit_hook_ptr
) {
35 (*init_hook_ptr
)(is_recovery
);
40 void __attribute__((weak
)) cbmem_fail_resume(void)
44 #if ENV_RAMSTAGE && !IS_ENABLED(CONFIG_EARLY_CBMEM_INIT)
45 static void init_cbmem_post_device(void *unused
)
50 cbmem_initialize_empty();
53 BOOT_STATE_INIT_ENTRY(BS_POST_DEVICE
, BS_ON_ENTRY
,
54 init_cbmem_post_device
, NULL
);