cbfs: Simplify load/map API names, remove type arguments
This patch renames cbfs_boot_map_with_leak() and cbfs_boot_load_file()
to cbfs_map() and cbfs_load() respectively. This is supposed to be the
start of a new, better organized CBFS API where the most common
operations have the most simple and straight-forward names. Less
commonly used variants of these operations (e.g. cbfs_ro_load() or
cbfs_region_load()) can be introduced later. It seems unnecessary to
keep carrying around "boot" in the names of most CBFS APIs if the vast
majority of accesses go to the boot CBFS (instead, more unusual
operations should have longer names that describe how they diverge from
the common ones).
cbfs_map() is paired with a new cbfs_unmap() to allow callers to cleanly
reap mappings when desired. A few new cbfs_unmap() calls are added to
generic code where it makes sense, but it seems unnecessary to introduce
this everywhere in platform or architecture specific code where the boot
medium is known to be memory-mapped anyway. In fact, even for
non-memory-mapped platforms, sometimes leaking a mapping to the CBFS
cache is a much cleaner solution than jumping through hoops to provide
some other storage for some long-lived file object, and it shouldn't be
outright forbidden when it makes sense.
Additionally, remove the type arguments from these function signatures.
The goal is to eventually remove type arguments for lookup from the
whole CBFS API. Filenames already uniquely identify CBFS files. The type
field is just informational, and there should be APIs to allow callers
to check it when desired, but it's not clear what we gain from forcing
this as a parameter into every single CBFS access when the vast majority
of the time it provides no additional value and is just clutter.
Signed-off-by: Julius Werner <jwerner@chromium.org>
Change-Id: Ib24325400815a9c3d25f66c61829a24a239bb88e
Reviewed-on: https://review.coreboot.org/c/coreboot/+/39304
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Wim Vervoorn <wvervoorn@eltan.com>
Reviewed-by: Mariusz SzafraĆski <mariuszx.szafranski@intel.com>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/src/mainboard/apple/macbookair4_2/early_init.c b/src/mainboard/apple/macbookair4_2/early_init.c
index 9da6702..a32298d 100644
--- a/src/mainboard/apple/macbookair4_2/early_init.c
+++ b/src/mainboard/apple/macbookair4_2/early_init.c
@@ -26,8 +26,7 @@
{
void *spd_file;
size_t spd_file_len = 0;
- spd_file = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD,
- &spd_file_len);
+ spd_file = cbfs_map("spd.bin", &spd_file_len);
if (spd_file && spd_file_len >= 1024) {
int i;
for (i = 0; i < 4; i++)
diff --git a/src/mainboard/dell/optiplex_9010/sch5545_ec.c b/src/mainboard/dell/optiplex_9010/sch5545_ec.c
index d11ba97..8110963 100644
--- a/src/mainboard/dell/optiplex_9010/sch5545_ec.c
+++ b/src/mainboard/dell/optiplex_9010/sch5545_ec.c
@@ -442,8 +442,7 @@
uint32_t *ec_fw_file;
size_t ec_fw_file_size;
- ec_fw_file = cbfs_boot_map_with_leak("sch5545_ecfw.bin", CBFS_TYPE_RAW,
- &ec_fw_file_size);
+ ec_fw_file = cbfs_map("sch5545_ecfw.bin", &ec_fw_file_size);
if (!ec_fw_file || ec_fw_file_size != 0x1750) {
printk(BIOS_ERR, "EC firmware file not found in CBFS!\n");
diff --git a/src/mainboard/google/asurada/sdram_configs.c b/src/mainboard/google/asurada/sdram_configs.c
index 9efcb32..e1eb527 100644
--- a/src/mainboard/google/asurada/sdram_configs.c
+++ b/src/mainboard/google/asurada/sdram_configs.c
@@ -17,8 +17,7 @@
uint32_t ramcode = ram_code();
if (ramcode >= ARRAY_SIZE(sdram_configs) ||
- cbfs_boot_load_file(sdram_configs[ramcode], ¶ms, sizeof(params),
- CBFS_TYPE_STRUCT) != sizeof(params))
+ cbfs_load(sdram_configs[ramcode], ¶ms, sizeof(params)) != sizeof(params))
die("Cannot load SDRAM parameter file for RAM code: %#x", ramcode);
return ¶ms;
diff --git a/src/mainboard/google/auron/variants/auron_paine/spd/spd.c b/src/mainboard/google/auron/variants/auron_paine/spd/spd.c
index da00ad9..12a9d7c 100644
--- a/src/mainboard/google/auron/variants/auron_paine/spd/spd.c
+++ b/src/mainboard/google/auron/variants/auron_paine/spd/spd.c
@@ -88,7 +88,7 @@
spd_bits[1], spd_gpio[1],
spd_bits[0], spd_gpio[0]);
- spd_file = cbfs_boot_map_with_leak("spd.bin", 0xab, &spd_file_len);
+ spd_file = cbfs_map("spd.bin", &spd_file_len);
if (!spd_file)
die("SPD data not found.");
diff --git a/src/mainboard/google/auron/variants/auron_yuna/spd/spd.c b/src/mainboard/google/auron/variants/auron_yuna/spd/spd.c
index da00ad9..12a9d7c 100644
--- a/src/mainboard/google/auron/variants/auron_yuna/spd/spd.c
+++ b/src/mainboard/google/auron/variants/auron_yuna/spd/spd.c
@@ -88,7 +88,7 @@
spd_bits[1], spd_gpio[1],
spd_bits[0], spd_gpio[0]);
- spd_file = cbfs_boot_map_with_leak("spd.bin", 0xab, &spd_file_len);
+ spd_file = cbfs_map("spd.bin", &spd_file_len);
if (!spd_file)
die("SPD data not found.");
diff --git a/src/mainboard/google/auron/variants/buddy/variant.c b/src/mainboard/google/auron/variants/buddy/variant.c
index 81bb828..2ffc38a 100644
--- a/src/mainboard/google/auron/variants/buddy/variant.c
+++ b/src/mainboard/google/auron/variants/buddy/variant.c
@@ -129,9 +129,7 @@
search_length = region_device_sz(&rdev);
}
} else {
- search_address = cbfs_boot_map_with_leak("vpd.bin",
- CBFS_TYPE_RAW,
- &search_length);
+ search_address = cbfs_map("vpd.bin", &search_length);
}
if (search_address == NULL)
diff --git a/src/mainboard/google/auron/variants/gandof/spd/spd.c b/src/mainboard/google/auron/variants/gandof/spd/spd.c
index da00ad9..12a9d7c 100644
--- a/src/mainboard/google/auron/variants/gandof/spd/spd.c
+++ b/src/mainboard/google/auron/variants/gandof/spd/spd.c
@@ -88,7 +88,7 @@
spd_bits[1], spd_gpio[1],
spd_bits[0], spd_gpio[0]);
- spd_file = cbfs_boot_map_with_leak("spd.bin", 0xab, &spd_file_len);
+ spd_file = cbfs_map("spd.bin", &spd_file_len);
if (!spd_file)
die("SPD data not found.");
diff --git a/src/mainboard/google/auron/variants/lulu/spd/spd.c b/src/mainboard/google/auron/variants/lulu/spd/spd.c
index 750470e..905e196 100644
--- a/src/mainboard/google/auron/variants/lulu/spd/spd.c
+++ b/src/mainboard/google/auron/variants/lulu/spd/spd.c
@@ -92,7 +92,7 @@
spd_bits[1], spd_gpio[1],
spd_bits[0], spd_gpio[0]);
- spd_file = cbfs_boot_map_with_leak("spd.bin", 0xab, &spd_file_len);
+ spd_file = cbfs_map("spd.bin", &spd_file_len);
if (!spd_file)
die("SPD data not found.");
diff --git a/src/mainboard/google/auron/variants/samus/spd/spd.c b/src/mainboard/google/auron/variants/samus/spd/spd.c
index 4684d86..4cad474 100644
--- a/src/mainboard/google/auron/variants/samus/spd/spd.c
+++ b/src/mainboard/google/auron/variants/samus/spd/spd.c
@@ -88,7 +88,7 @@
spd_bits[3], spd_gpio[3], spd_bits[2], spd_gpio[2],
spd_bits[1], spd_gpio[1], spd_bits[0], spd_gpio[0]);
- spd_file = cbfs_boot_map_with_leak("spd.bin", 0xab, &spd_file_len);
+ spd_file = cbfs_map("spd.bin", &spd_file_len);
if (!spd_file)
die("SPD data not found.");
diff --git a/src/mainboard/google/beltino/lan.c b/src/mainboard/google/beltino/lan.c
index c14a1e4..d9df5a1 100644
--- a/src/mainboard/google/beltino/lan.c
+++ b/src/mainboard/google/beltino/lan.c
@@ -110,9 +110,7 @@
search_length = region_device_sz(&rdev);
}
} else {
- search_address = cbfs_boot_map_with_leak("vpd.bin",
- CBFS_TYPE_RAW,
- &search_length);
+ search_address = cbfs_map("vpd.bin", &search_length);
}
if (search_address == NULL)
diff --git a/src/mainboard/google/butterfly/mainboard.c b/src/mainboard/google/butterfly/mainboard.c
index d2e2aa5..d9cf1b9 100644
--- a/src/mainboard/google/butterfly/mainboard.c
+++ b/src/mainboard/google/butterfly/mainboard.c
@@ -180,8 +180,7 @@
}
}
} else {
- vpd_file = cbfs_boot_map_with_leak("vpd.bin", CBFS_TYPE_RAW,
- &search_length);
+ vpd_file = cbfs_map("vpd.bin", &search_length);
if (vpd_file) {
search_address = (unsigned long)vpd_file;
} else {
diff --git a/src/mainboard/google/cyan/spd/spd.c b/src/mainboard/google/cyan/spd/spd.c
index 1c08d90..21a298e 100644
--- a/src/mainboard/google/cyan/spd/spd.c
+++ b/src/mainboard/google/cyan/spd/spd.c
@@ -35,8 +35,7 @@
int spd_index = 0;
/* Find the SPD data in CBFS. */
- spd_file = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD,
- &spd_file_len);
+ spd_file = cbfs_map("spd.bin", &spd_file_len);
if (!spd_file)
die("SPD data not found.");
diff --git a/src/mainboard/google/eve/spd/spd.c b/src/mainboard/google/eve/spd/spd.c
index 330ea52..e9405f0 100644
--- a/src/mainboard/google/eve/spd/spd.c
+++ b/src/mainboard/google/eve/spd/spd.c
@@ -82,8 +82,7 @@
printk(BIOS_INFO, "SPD index %d\n", spd_index);
/* Load SPD data from CBFS */
- spd_file = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD,
- &spd_file_len);
+ spd_file = cbfs_map("spd.bin", &spd_file_len);
if (!spd_file)
die("SPD data not found.");
diff --git a/src/mainboard/google/glados/spd/spd.c b/src/mainboard/google/glados/spd/spd.c
index 627dc3f..9bfb202 100644
--- a/src/mainboard/google/glados/spd/spd.c
+++ b/src/mainboard/google/glados/spd/spd.c
@@ -79,8 +79,7 @@
printk(BIOS_INFO, "SPD index %d\n", spd_index);
/* Load SPD data from CBFS */
- spd_file = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD,
- &spd_file_len);
+ spd_file = cbfs_map("spd.bin", &spd_file_len);
if (!spd_file)
die("SPD data not found.");
diff --git a/src/mainboard/google/gru/sdram_configs.c b/src/mainboard/google/gru/sdram_configs.c
index 87a5009..2aceb9f 100644
--- a/src/mainboard/google/gru/sdram_configs.c
+++ b/src/mainboard/google/gru/sdram_configs.c
@@ -53,8 +53,7 @@
if (ramcode >= ARRAY_SIZE(sdram_configs) ||
!snprintf(config_file, sizeof(config_file), "%s-%d",
sdram_configs[ramcode], get_sdram_target_mhz()) ||
- (cbfs_boot_load_file(config_file, ¶ms, sizeof(params),
- CBFS_TYPE_STRUCT) != sizeof(params)))
+ (cbfs_load(config_file, ¶ms, sizeof(params)) != sizeof(params)))
die("Cannot load SDRAM parameter file!");
return ¶ms;
diff --git a/src/mainboard/google/jecht/lan.c b/src/mainboard/google/jecht/lan.c
index 3d19f99..4dedb56 100644
--- a/src/mainboard/google/jecht/lan.c
+++ b/src/mainboard/google/jecht/lan.c
@@ -110,9 +110,7 @@
search_length = region_device_sz(&rdev);
}
} else {
- search_address = cbfs_boot_map_with_leak("vpd.bin",
- CBFS_TYPE_RAW,
- &search_length);
+ search_address = cbfs_map("vpd.bin", &search_length);
}
if (search_address == NULL)
diff --git a/src/mainboard/google/kahlee/variants/baseboard/mainboard.c b/src/mainboard/google/kahlee/variants/baseboard/mainboard.c
index 95f0a8d..860190a 100644
--- a/src/mainboard/google/kahlee/variants/baseboard/mainboard.c
+++ b/src/mainboard/google/kahlee/variants/baseboard/mainboard.c
@@ -89,9 +89,7 @@
if (manuf)
return manuf;
- if (cbfs_boot_load_file("oem.bin", oem_bin_data,
- sizeof(oem_bin_data) - 1,
- CBFS_TYPE_RAW))
+ if (cbfs_load("oem.bin", oem_bin_data, sizeof(oem_bin_data) - 1))
manuf = &oem_bin_data[0];
else
manuf = CONFIG_MAINBOARD_SMBIOS_MANUFACTURER;
diff --git a/src/mainboard/google/kahlee/variants/nuwani/mainboard.c b/src/mainboard/google/kahlee/variants/nuwani/mainboard.c
index df31c6f..ce98d62 100644
--- a/src/mainboard/google/kahlee/variants/nuwani/mainboard.c
+++ b/src/mainboard/google/kahlee/variants/nuwani/mainboard.c
@@ -101,9 +101,7 @@
if (manuf)
return manuf;
- if (cbfs_boot_load_file("oem.bin", oem_bin_data,
- sizeof(oem_bin_data) - 1,
- CBFS_TYPE_RAW))
+ if (cbfs_load("oem.bin", oem_bin_data, sizeof(oem_bin_data) - 1))
manuf = &oem_bin_data[0];
else
manuf = CONFIG_MAINBOARD_SMBIOS_MANUFACTURER;
diff --git a/src/mainboard/google/kahlee/variants/treeya/mainboard.c b/src/mainboard/google/kahlee/variants/treeya/mainboard.c
index df31c6f..ce98d62 100644
--- a/src/mainboard/google/kahlee/variants/treeya/mainboard.c
+++ b/src/mainboard/google/kahlee/variants/treeya/mainboard.c
@@ -101,9 +101,7 @@
if (manuf)
return manuf;
- if (cbfs_boot_load_file("oem.bin", oem_bin_data,
- sizeof(oem_bin_data) - 1,
- CBFS_TYPE_RAW))
+ if (cbfs_load("oem.bin", oem_bin_data, sizeof(oem_bin_data) - 1))
manuf = &oem_bin_data[0];
else
manuf = CONFIG_MAINBOARD_SMBIOS_MANUFACTURER;
diff --git a/src/mainboard/google/kukui/mainboard.c b/src/mainboard/google/kukui/mainboard.c
index cbcb5da..4220810d 100644
--- a/src/mainboard/google/kukui/mainboard.c
+++ b/src/mainboard/google/kukui/mainboard.c
@@ -112,8 +112,7 @@
return NULL;
snprintf(cbfs_name, sizeof(cbfs_name), "panel-%s", desc->name);
- if (cbfs_boot_load_file(cbfs_name, buffer.raw, sizeof(buffer),
- CBFS_TYPE_STRUCT))
+ if (cbfs_load(cbfs_name, buffer.raw, sizeof(buffer)))
desc->s = &buffer.s;
else
printk(BIOS_ERR, "Missing %s in CBFS.\n", cbfs_name);
diff --git a/src/mainboard/google/kukui/sdram_configs.c b/src/mainboard/google/kukui/sdram_configs.c
index 5239587..57f5e6e 100644
--- a/src/mainboard/google/kukui/sdram_configs.c
+++ b/src/mainboard/google/kukui/sdram_configs.c
@@ -43,8 +43,7 @@
if (ramcode < ARRAY_SIZE(sdram_configs))
name = sdram_configs[ramcode];
- if (!name || cbfs_boot_load_file(name, ¶ms, sizeof(params),
- CBFS_TYPE_STRUCT) != sizeof(params))
+ if (!name || cbfs_load(name, ¶ms, sizeof(params)) != sizeof(params))
die("Cannot load SDRAM parameter file for RAM code %#02x: %s!",
ramcode, name ? name : "unknown");
diff --git a/src/mainboard/google/link/early_init.c b/src/mainboard/google/link/early_init.c
index f3da77c..de8f749 100644
--- a/src/mainboard/google/link/early_init.c
+++ b/src/mainboard/google/link/early_init.c
@@ -66,8 +66,7 @@
int spd_index = get_gpios(gpio_vector);
printk(BIOS_DEBUG, "spd index %d\n", spd_index);
- spd_file = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD,
- &spd_file_len);
+ spd_file = cbfs_map("spd.bin", &spd_file_len);
if (!spd_file)
die("SPD data not found.");
diff --git a/src/mainboard/google/poppy/romstage.c b/src/mainboard/google/poppy/romstage.c
index 0c1fc02..7fd4409 100644
--- a/src/mainboard/google/poppy/romstage.c
+++ b/src/mainboard/google/poppy/romstage.c
@@ -112,8 +112,7 @@
printk(BIOS_INFO, "SPD index %d\n", spd_index);
/* Load SPD data from CBFS */
- spd_file = cbfs_boot_map_with_leak(spd_bin, CBFS_TYPE_SPD,
- &spd_file_len);
+ spd_file = cbfs_map(spd_bin, &spd_file_len);
if (!spd_file)
die("SPD data not found.");
diff --git a/src/mainboard/google/poppy/variants/nami/mainboard.c b/src/mainboard/google/poppy/variants/nami/mainboard.c
index 8d5d0c4..1387716 100644
--- a/src/mainboard/google/poppy/variants/nami/mainboard.c
+++ b/src/mainboard/google/poppy/variants/nami/mainboard.c
@@ -155,9 +155,8 @@
if (oem_id == OEM_UNKNOWN)
return CONFIG_MAINBOARD_SMBIOS_MANUFACTURER;
- oem_data_size = cbfs_boot_load_file("oem.bin", oem_bin_data,
- sizeof(oem_bin_data),
- CBFS_TYPE_RAW);
+ oem_data_size = cbfs_load("oem.bin", oem_bin_data,
+ sizeof(oem_bin_data));
while ((curr < oem_data_size) &&
((oem_data_size - curr) >= sizeof(*oem_entry))) {
diff --git a/src/mainboard/google/rambi/romstage.c b/src/mainboard/google/rambi/romstage.c
index 6487f43..28496b1 100644
--- a/src/mainboard/google/rambi/romstage.c
+++ b/src/mainboard/google/rambi/romstage.c
@@ -48,8 +48,7 @@
void *spd_file;
size_t spd_fsize;
- spd_file = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD,
- &spd_fsize);
+ spd_file = cbfs_map("spd.bin", &spd_fsize);
if (!spd_file)
die("SPD data not found.");
diff --git a/src/mainboard/google/rambi/variants/ninja/lan.c b/src/mainboard/google/rambi/variants/ninja/lan.c
index e5688df..1304071 100644
--- a/src/mainboard/google/rambi/variants/ninja/lan.c
+++ b/src/mainboard/google/rambi/variants/ninja/lan.c
@@ -109,9 +109,7 @@
search_length = region_device_sz(&rdev);
}
} else {
- search_address = cbfs_boot_map_with_leak("vpd.bin",
- CBFS_TYPE_RAW,
- &search_length);
+ search_address = cbfs_map("vpd.bin", &search_length);
}
if (search_address == NULL)
diff --git a/src/mainboard/google/rambi/variants/sumo/lan.c b/src/mainboard/google/rambi/variants/sumo/lan.c
index 53bd4fb..29bc0fe 100644
--- a/src/mainboard/google/rambi/variants/sumo/lan.c
+++ b/src/mainboard/google/rambi/variants/sumo/lan.c
@@ -109,9 +109,7 @@
search_length = region_device_sz(&rdev);
}
} else {
- search_address = cbfs_boot_map_with_leak("vpd.bin",
- CBFS_TYPE_RAW,
- &search_length);
+ search_address = cbfs_map("vpd.bin", &search_length);
}
if (search_address == NULL)
diff --git a/src/mainboard/google/slippy/variants/falco/romstage.c b/src/mainboard/google/slippy/variants/falco/romstage.c
index eba4a8b..516b26c 100644
--- a/src/mainboard/google/slippy/variants/falco/romstage.c
+++ b/src/mainboard/google/slippy/variants/falco/romstage.c
@@ -21,8 +21,7 @@
size_t spd_len = sizeof(peid->spd_data[0]);
printk(BIOS_DEBUG, "SPD index %d\n", spd_index);
- spd_file = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD,
- &spd_file_len);
+ spd_file = cbfs_map("spd.bin", &spd_file_len);
if (!spd_file)
die("SPD data not found.");
diff --git a/src/mainboard/google/slippy/variants/leon/romstage.c b/src/mainboard/google/slippy/variants/leon/romstage.c
index 2b1b5ca..e24dcb9 100644
--- a/src/mainboard/google/slippy/variants/leon/romstage.c
+++ b/src/mainboard/google/slippy/variants/leon/romstage.c
@@ -20,8 +20,7 @@
size_t spd_len = sizeof(peid->spd_data[0]);
printk(BIOS_DEBUG, "SPD index %d\n", spd_index);
- spd_file = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD,
- &spd_file_len);
+ spd_file = cbfs_map("spd.bin", &spd_file_len);
if (!spd_file)
die("SPD data not found.");
diff --git a/src/mainboard/google/slippy/variants/peppy/romstage.c b/src/mainboard/google/slippy/variants/peppy/romstage.c
index 230595e..92e1e8d 100644
--- a/src/mainboard/google/slippy/variants/peppy/romstage.c
+++ b/src/mainboard/google/slippy/variants/peppy/romstage.c
@@ -24,8 +24,7 @@
uint32_t board_version = PEPPY_BOARD_VERSION_PROTO;
printk(BIOS_DEBUG, "SPD index %d\n", spd_index);
- spd_file = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD,
- &spd_file_len);
+ spd_file = cbfs_map("spd.bin", &spd_file_len);
if (!spd_file)
die("SPD data not found.");
diff --git a/src/mainboard/google/slippy/variants/wolf/romstage.c b/src/mainboard/google/slippy/variants/wolf/romstage.c
index 405e86ace..a0b5055 100644
--- a/src/mainboard/google/slippy/variants/wolf/romstage.c
+++ b/src/mainboard/google/slippy/variants/wolf/romstage.c
@@ -21,8 +21,7 @@
size_t spd_len = sizeof(peid->spd_data[0]);
printk(BIOS_DEBUG, "SPD index %d\n", spd_index);
- spd_file = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD,
- &spd_file_len);
+ spd_file = cbfs_map("spd.bin", &spd_file_len);
if (!spd_file)
die("SPD data not found.");
diff --git a/src/mainboard/hp/snb_ivb_laptops/variants/revolve_810_g1/early_init.c b/src/mainboard/hp/snb_ivb_laptops/variants/revolve_810_g1/early_init.c
index a7c894b..65a1819 100644
--- a/src/mainboard/hp/snb_ivb_laptops/variants/revolve_810_g1/early_init.c
+++ b/src/mainboard/hp/snb_ivb_laptops/variants/revolve_810_g1/early_init.c
@@ -39,8 +39,7 @@
{
/* C1S0 is a soldered RAM with no real SPD. Use stored SPD. */
size_t spd_file_len = 0;
- void *spd_file = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD,
- &spd_file_len);
+ void *spd_file = cbfs_map("spd.bin", &spd_file_len);
if (!spd_file || spd_file_len < sizeof(spd_raw_data))
die("SPD data for C1S0 not found.");
diff --git a/src/mainboard/intel/harcuvar/spd/spd.c b/src/mainboard/intel/harcuvar/spd/spd.c
index a70bb5f..a66c10b 100644
--- a/src/mainboard/intel/harcuvar/spd/spd.c
+++ b/src/mainboard/intel/harcuvar/spd/spd.c
@@ -15,8 +15,7 @@
spd_index = 0;
- spd_file = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD,
- &spd_file_len);
+ spd_file = cbfs_map("spd.bin", &spd_file_len);
if (!spd_file)
die("SPD data not found.");
diff --git a/src/mainboard/intel/kunimitsu/spd/spd_util.c b/src/mainboard/intel/kunimitsu/spd/spd_util.c
index 71643be..8674512 100644
--- a/src/mainboard/intel/kunimitsu/spd/spd_util.c
+++ b/src/mainboard/intel/kunimitsu/spd/spd_util.c
@@ -68,8 +68,7 @@
printk(BIOS_INFO, "SPD index %d\n", spd_index);
/* Load SPD data from CBFS */
- spd_file = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD,
- &spd_file_len);
+ spd_file = cbfs_map("spd.bin", &spd_file_len);
if (!spd_file)
die("SPD data not found.");
diff --git a/src/mainboard/lenovo/s230u/early_init.c b/src/mainboard/lenovo/s230u/early_init.c
index 155b02e..434b58c 100644
--- a/src/mainboard/lenovo/s230u/early_init.c
+++ b/src/mainboard/lenovo/s230u/early_init.c
@@ -70,8 +70,7 @@
spd_index, mainboard_spd_names[spd_index]);
/* C0S0 is a soldered RAM with no real SPD. Use stored SPD. */
- spd_file = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD,
- &spd_file_len);
+ spd_file = cbfs_map("spd.bin", &spd_file_len);
if (!spd_file || spd_file_len < SPD_LEN * spd_index + SPD_LEN)
die("SPD data not found.");
diff --git a/src/mainboard/lenovo/t430s/variants/t431s/romstage.c b/src/mainboard/lenovo/t430s/variants/t431s/romstage.c
index 60a1b01..54236a1 100644
--- a/src/mainboard/lenovo/t430s/variants/t431s/romstage.c
+++ b/src/mainboard/lenovo/t430s/variants/t431s/romstage.c
@@ -28,8 +28,7 @@
{
/* C1S0 is a soldered RAM with no real SPD. Use stored SPD. */
size_t spd_file_len = 0;
- void *spd_file = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD,
- &spd_file_len);
+ void *spd_file = cbfs_map("spd.bin", &spd_file_len);
if (!spd_file || spd_file_len < sizeof(spd_raw_data))
die("SPD data for C1S0 not found.");
diff --git a/src/mainboard/lenovo/x1_carbon_gen1/early_init.c b/src/mainboard/lenovo/x1_carbon_gen1/early_init.c
index f49a59f8..6f18fee 100644
--- a/src/mainboard/lenovo/x1_carbon_gen1/early_init.c
+++ b/src/mainboard/lenovo/x1_carbon_gen1/early_init.c
@@ -32,8 +32,7 @@
size_t spd_file_len;
printk(BIOS_DEBUG, "spd index %d\n", spd_index);
- spd_file = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD,
- &spd_file_len);
+ spd_file = cbfs_map("spd.bin", &spd_file_len);
if (!spd_file)
die("SPD data not found.");
diff --git a/src/mainboard/samsung/lumpy/early_init.c b/src/mainboard/samsung/lumpy/early_init.c
index ad4ddb9..90a1764 100644
--- a/src/mainboard/samsung/lumpy/early_init.c
+++ b/src/mainboard/samsung/lumpy/early_init.c
@@ -104,8 +104,7 @@
break;
}
- spd_data = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD,
- &spd_file_len);
+ spd_data = cbfs_map("spd.bin", &spd_file_len);
if (!spd_data)
die("SPD data not found.");
if (spd_file_len < (spd_index + 1) * 256)
diff --git a/src/mainboard/sifive/hifive-unleashed/fixup_fdt.c b/src/mainboard/sifive/hifive-unleashed/fixup_fdt.c
index 38492ac..dda71b6 100644
--- a/src/mainboard/sifive/hifive-unleashed/fixup_fdt.c
+++ b/src/mainboard/sifive/hifive-unleashed/fixup_fdt.c
@@ -72,7 +72,7 @@
struct device_tree *tree;
/* load flat dt from cbfs */
- fdt_rom = cbfs_boot_map_with_leak("fallback/DTB", CBFS_TYPE_RAW, NULL);
+ fdt_rom = cbfs_map("fallback/DTB", NULL);
if (fdt_rom == NULL) {
printk(BIOS_ERR, "Unable to load fallback/DTB from CBFS\n");