Rename __attribute__((packed)) --> __packed
[coreboot.git] / src / lib / cbmem_common.c
blob166ec8701336b9e5489ab0c94e2760c2e33966fb
1 /*
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>
16 #include <cbmem.h>
17 #include <bootstate.h>
18 #include <rules.h>
19 #include <symbols.h>
20 #if IS_ENABLED(CONFIG_ARCH_X86) && !IS_ENABLED(CONFIG_EARLY_CBMEM_INIT)
21 #include <arch/acpi.h>
22 #endif
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)
32 return;
34 while (init_hook_ptr != einit_hook_ptr) {
35 (*init_hook_ptr)(is_recovery);
36 init_hook_ptr++;
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)
47 if (acpi_is_wakeup())
48 cbmem_initialize();
49 else
50 cbmem_initialize_empty();
53 BOOT_STATE_INIT_ENTRY(BS_POST_DEVICE, BS_ON_ENTRY,
54 init_cbmem_post_device, NULL);
55 #endif