diff options
Diffstat (limited to 'src/vendorcode/google/chromeos/ramoops.c')
-rw-r--r-- | src/vendorcode/google/chromeos/ramoops.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/vendorcode/google/chromeos/ramoops.c b/src/vendorcode/google/chromeos/ramoops.c index f7177e5397..07649c975c 100644 --- a/src/vendorcode/google/chromeos/ramoops.c +++ b/src/vendorcode/google/chromeos/ramoops.c @@ -20,6 +20,7 @@ #include <stddef.h> #include <stdint.h> +#include <boot/coreboot_tables.h> #include <bootstate.h> #include <console/console.h> #include <cbmem.h> @@ -99,4 +100,34 @@ void chromeos_ram_oops_init(chromeos_acpi_t *chromeos) reserve_ram_oops_dynamic(chromeos); } -#endif /* CONFIG_HAVE_ACPI_TABLES */ +#elif IS_ENABLED(CONFIG_CHROMEOS_RAMOOPS_NON_ACPI) + +static void ramoops_alloc(void *arg) +{ + const size_t size = CONFIG_CHROMEOS_RAMOOPS_RAM_SIZE; + + if (size == 0) + return; + + if (cbmem_add(CBMEM_ID_RAM_OOPS, size) == NULL) + printk(BIOS_ERR, "Could not allocate RAMOOPS buffer\n"); +} + +BOOT_STATE_INIT_ENTRY(BS_WRITE_TABLES, BS_ON_ENTRY, ramoops_alloc, NULL); + +#endif + +void lb_ramoops(struct lb_header *header) +{ + void *buffer = cbmem_find(CBMEM_ID_RAM_OOPS); + + if (buffer == NULL) + return; + + struct lb_range *ramoops; + ramoops = (struct lb_range *)lb_new_record(header); + ramoops->tag = LB_TAG_RAM_OOPS; + ramoops->size = sizeof(*ramoops); + ramoops->range_start = (uintptr_t)buffer; + ramoops->range_size = CONFIG_CHROMEOS_RAMOOPS_RAM_SIZE; +} |