1 /* SPDX-License-Identifier: GPL-2.0-only */
5 #include <console/console.h>
6 #include <cpu/x86/smm.h>
9 void *backup_default_smm_area(void)
12 const void *default_smm
= (void *)SMM_DEFAULT_BASE
;
14 if (!CONFIG(HAVE_ACPI_RESUME
))
18 * The buffer needs to be preallocated regardless. In the non-resume
19 * path it will be allocated for handling resume. Note that cbmem_add()
20 * does a find before the addition.
22 save_area
= cbmem_add(CBMEM_ID_SMM_SAVE_SPACE
, SMM_DEFAULT_SIZE
);
24 if (save_area
== NULL
) {
25 printk(BIOS_DEBUG
, "SMM save area not added.\n");
29 /* Only back up the area on S3 resume. */
30 if (acpi_is_wakeup_s3()) {
31 memcpy(save_area
, default_smm
, SMM_DEFAULT_SIZE
);
36 * Not the S3 resume path. No need to restore memory contents after
42 void restore_default_smm_area(void *smm_save_area
)
44 void *default_smm
= (void *)SMM_DEFAULT_BASE
;
46 if (smm_save_area
== NULL
)
49 memcpy(default_smm
, smm_save_area
, SMM_DEFAULT_SIZE
);