From e6b4597fefae3e4fd30e66c522e0e57753b03813 Mon Sep 17 00:00:00 2001 From: Grzegorz Bernacki Date: Tue, 25 Apr 2023 15:33:34 +0000 Subject: device/pci_rom: Add simple pci_rom_free() It adds simple function, which frees the memory which could be allocated by pci_rom_probe(). In the next step it will be modified to free only memory, which was mapped from CBFS. BUG=b:278264488 TEST=Build and run with additional debug prints added to confirm that data are correctly unmapped Change-Id: Ibc9aad34b6bf101a3a0c06b92ed2dc6f2d7b9b33 Signed-off-by: Grzegorz Bernacki Reviewed-on: https://review.coreboot.org/c/coreboot/+/74778 Reviewed-by: Karthik Ramasubramanian Reviewed-by: Felix Singer Reviewed-by: Himanshu Sahdev Tested-by: build bot (Jenkins) --- src/include/device/pci_rom.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/include/device/pci_rom.h b/src/include/device/pci_rom.h index 83015a12b4..19728f2225 100644 --- a/src/include/device/pci_rom.h +++ b/src/include/device/pci_rom.h @@ -5,6 +5,7 @@ #include #include +#include #include #define PCI_ROM_HDR 0xAA55 @@ -42,6 +43,11 @@ struct rom_header *pci_rom_probe(const struct device *dev); struct rom_header *pci_rom_load(struct device *dev, struct rom_header *rom_header); +static inline void pci_rom_free(struct rom_header *rom_header) +{ + cbfs_unmap(rom_header); +} + unsigned long pci_rom_write_acpi_tables(const struct device *device, unsigned long current, -- cgit v1.2.3