diff options
author | Julius Werner <jwerner@chromium.org> | 2022-01-21 17:06:20 -0800 |
---|---|---|
committer | Julius Werner <jwerner@chromium.org> | 2022-02-07 23:29:09 +0000 |
commit | e9665959edeba6ae2d5364c4f7339704b6b6fd42 (patch) | |
tree | e3cd9e0e6e91c9b6bd5c6f586a9abee1d654b5dd /src/lib | |
parent | 266041f0e62296737617cc2fcfa97f31e2b43aea (diff) |
treewide: Remove "ERROR: "/"WARN: " prefixes from log messages
Now that the console system itself will clearly differentiate loglevels,
it is no longer necessary to explicitly add "ERROR: " in front of every
BIOS_ERR message to help it stand out more (and allow automated tooling
to grep for it). Removing all these extra .rodata characters should save
us a nice little amount of binary size.
This patch was created by running
find src/ -type f -exec perl -0777 -pi -e 's/printk\(\s*BIOS_ERR,\s*"ERROR: /printk\(BIOS_ERR, "/gi' '{}' ';'
and doing some cursory review/cleanup on the result. Then doing the same
thing for BIOS_WARN with
's/printk\(\s*BIOS_WARNING,\s*"WARN(ING)?: /printk\(BIOS_WARNING, "/gi'
Signed-off-by: Julius Werner <jwerner@chromium.org>
Change-Id: I3d0573acb23d2df53db6813cb1a5fc31b5357db8
Reviewed-on: https://review.coreboot.org/c/coreboot/+/61309
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: HAOUAS Elyes <ehaouas@noos.fr>
Reviewed-by: Lance Zhao
Reviewed-by: Jason Glenesk <jason.glenesk@gmail.com>
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/bootmem.c | 2 | ||||
-rw-r--r-- | src/lib/cbfs.c | 2 | ||||
-rw-r--r-- | src/lib/cbmem_stage_cache.c | 10 | ||||
-rw-r--r-- | src/lib/edid.c | 2 | ||||
-rw-r--r-- | src/lib/fit.c | 21 | ||||
-rw-r--r-- | src/lib/fit_payload.c | 18 | ||||
-rw-r--r-- | src/lib/fmap.c | 6 | ||||
-rw-r--r-- | src/lib/thread.c | 10 | ||||
-rw-r--r-- | src/lib/timestamp.c | 12 |
9 files changed, 38 insertions, 45 deletions
diff --git a/src/lib/bootmem.c b/src/lib/bootmem.c index 1fe23c2828..e9d4287d21 100644 --- a/src/lib/bootmem.c +++ b/src/lib/bootmem.c @@ -51,7 +51,7 @@ static uint32_t bootmem_to_lb_tag(const enum bootmem_type tag) case BM_MEM_TABLE: return LB_MEM_TABLE; default: - printk(BIOS_ERR, "ERROR: Unsupported tag %u\n", tag); + printk(BIOS_ERR, "Unsupported tag %u\n", tag); return LB_MEM_RESERVED; } } diff --git a/src/lib/cbfs.c b/src/lib/cbfs.c index 5bbbe6a2ad..2d98c44a79 100644 --- a/src/lib/cbfs.c +++ b/src/lib/cbfs.c @@ -681,7 +681,7 @@ static void mcache_to_cbmem(const struct cbfs_boot_device *cbd, u32 cbmem_id) size_t real_size = cbfs_mcache_real_size(cbd->mcache, cbd->mcache_size); void *cbmem_mcache = cbmem_add(cbmem_id, real_size); if (!cbmem_mcache) { - printk(BIOS_ERR, "ERROR: Cannot allocate CBMEM mcache %#x (%#zx bytes)!\n", + printk(BIOS_ERR, "Cannot allocate CBMEM mcache %#x (%#zx bytes)!\n", cbmem_id, real_size); return; } diff --git a/src/lib/cbmem_stage_cache.c b/src/lib/cbmem_stage_cache.c index 28cc242f1c..b45c9505f8 100644 --- a/src/lib/cbmem_stage_cache.c +++ b/src/lib/cbmem_stage_cache.c @@ -13,7 +13,7 @@ void stage_cache_add(int stage_id, const struct prog *stage) meta = cbmem_add(CBMEM_ID_STAGEx_META + stage_id, sizeof(*meta)); if (meta == NULL) { - printk(BIOS_ERR, "Error: Can't add %x metadata to cbmem\n", + printk(BIOS_ERR, "Can't add %x metadata to cbmem\n", CBMEM_ID_STAGEx_META + stage_id); return; } @@ -23,7 +23,7 @@ void stage_cache_add(int stage_id, const struct prog *stage) c = cbmem_add(CBMEM_ID_STAGEx_CACHE + stage_id, prog_size(stage)); if (c == NULL) { - printk(BIOS_ERR, "Error: Can't add stage_cache %x to cbmem\n", + printk(BIOS_ERR, "Can't add stage_cache %x to cbmem\n", CBMEM_ID_STAGEx_CACHE + stage_id); return; } @@ -51,7 +51,7 @@ void stage_cache_get_raw(int stage_id, void **base, size_t *size) e = cbmem_entry_find(CBMEM_ID_STAGEx_RAW + stage_id); if (e == NULL) { - printk(BIOS_ERR, "Error: Can't find raw %x data in cbmem\n", + printk(BIOS_ERR, "Can't find raw %x data in cbmem\n", CBMEM_ID_STAGEx_RAW + stage_id); return; } @@ -72,7 +72,7 @@ void stage_cache_load_stage(int stage_id, struct prog *stage) meta = cbmem_find(CBMEM_ID_STAGEx_META + stage_id); if (meta == NULL) { - printk(BIOS_ERR, "Error: Can't find %x metadata in cbmem\n", + printk(BIOS_ERR, "Can't find %x metadata in cbmem\n", CBMEM_ID_STAGEx_META + stage_id); return; } @@ -80,7 +80,7 @@ void stage_cache_load_stage(int stage_id, struct prog *stage) e = cbmem_entry_find(CBMEM_ID_STAGEx_CACHE + stage_id); if (e == NULL) { - printk(BIOS_ERR, "Error: Can't find stage_cache %x in cbmem\n", + printk(BIOS_ERR, "Can't find stage_cache %x in cbmem\n", CBMEM_ID_STAGEx_CACHE + stage_id); return; } diff --git a/src/lib/edid.c b/src/lib/edid.c index 55876e8a7c..41b8031534 100644 --- a/src/lib/edid.c +++ b/src/lib/edid.c @@ -1507,7 +1507,7 @@ int decode_edid(unsigned char *edid, int size, struct edid *out) printk(BIOS_ERR, "EDID block does NOT conform to EDID 1.3!\n"); else if (!c.has_name_descriptor || !c.has_range_descriptor) - printk(BIOS_WARNING, "WARNING: EDID block does NOT " + printk(BIOS_WARNING, "EDID block does NOT " "fully conform to EDID 1.3.\n"); if (c.nonconformant_digital_display) diff --git a/src/lib/fit.c b/src/lib/fit.c index 23ee52fd5b..08fd0455b3 100644 --- a/src/lib/fit.c +++ b/src/lib/fit.c @@ -78,7 +78,7 @@ static struct fit_image_node *find_image(const char *name) if (!strcmp(image->name, name)) return image; } - printk(BIOS_ERR, "ERROR: Cannot find image node %s!\n", name); + printk(BIOS_ERR, "Cannot find image node %s!\n", name); return NULL; } @@ -413,8 +413,7 @@ static int fit_update_compat(struct fit_config_node *config) uint32_t fdt_offset = be32_to_cpu(fdt_header->structure_offset); if (config->fdt->compression != CBFS_COMPRESS_NONE) { - printk(BIOS_ERR, - "ERROR: config %s has a compressed FDT without " + printk(BIOS_ERR, "config %s has a compressed FDT without " "external compatible property, skipping.\n", config->name); return -1; @@ -422,15 +421,13 @@ static int fit_update_compat(struct fit_config_node *config) /* FDT overlays are not supported in legacy FIT images. */ if (config->overlays.next) { - printk(BIOS_ERR, - "ERROR: config %s has overlay but no compat!\n", + printk(BIOS_ERR, "config %s has overlay but no compat!\n", config->name); return -1; } if (fdt_find_compat(fdt_blob, fdt_offset, &config->compat)) { - printk(BIOS_ERR, - "ERROR: Can't find compat string in FDT %s " + printk(BIOS_ERR, "Can't find compat string in FDT %s " "for config %s, skipping.\n", config->fdt->name, config->name); return -1; @@ -467,7 +464,7 @@ struct fit_config_node *fit_load(void *fit) struct device_tree *tree = fdt_unflatten(fit); if (!tree) { - printk(BIOS_ERR, "ERROR: Failed to unflatten FIT image!\n"); + printk(BIOS_ERR, "Failed to unflatten FIT image!\n"); return NULL; } @@ -494,21 +491,19 @@ struct fit_config_node *fit_load(void *fit) /* Process and list the configs. */ list_for_each(config, config_nodes, list_node) { if (!config->kernel) { - printk(BIOS_ERR, - "ERROR: config %s has no kernel, skipping.\n", + printk(BIOS_ERR, "config %s has no kernel, skipping.\n", config->name); continue; } if (!config->fdt) { - printk(BIOS_ERR, - "ERROR: config %s has no FDT, skipping.\n", + printk(BIOS_ERR, "config %s has no FDT, skipping.\n", config->name); continue; } if (config->ramdisk && config->ramdisk->compression < 0) { - printk(BIOS_WARNING, "WARN: Ramdisk is compressed with " + printk(BIOS_WARNING, "Ramdisk is compressed with " "an unsupported algorithm, discarding config %s." "\n", config->name); continue; diff --git a/src/lib/fit_payload.c b/src/lib/fit_payload.c index 97f9af04ae..d61bfd5c4e 100644 --- a/src/lib/fit_payload.c +++ b/src/lib/fit_payload.c @@ -35,7 +35,7 @@ static bool extract(struct region *region, struct fit_image_node *node) size_t true_size = 0; if (node->size == 0) { - printk(BIOS_ERR, "ERROR: The %s size is 0\n", node->name); + printk(BIOS_ERR, "The %s size is 0\n", node->name); return true; } @@ -50,7 +50,7 @@ static bool extract(struct region *region, struct fit_image_node *node) comp_name = "Decompressing LZ4"; break; default: - printk(BIOS_ERR, "ERROR: Unsupported compression\n"); + printk(BIOS_ERR, "Unsupported compression\n"); return true; } @@ -76,7 +76,7 @@ static bool extract(struct region *region, struct fit_image_node *node) } if (!true_size) { - printk(BIOS_ERR, "ERROR: %s decompression failed!\n", + printk(BIOS_ERR, "%s decompression failed!\n", comp_name); return true; } @@ -176,13 +176,13 @@ void fit_payload(struct prog *payload, void *data) struct fit_config_node *config = fit_load(data); if (!config) { - printk(BIOS_ERR, "ERROR: Could not load FIT\n"); + printk(BIOS_ERR, "Could not load FIT\n"); return; } dt = unpack_fdt(config->fdt); if (!dt) { - printk(BIOS_ERR, "ERROR: Failed to unflatten the FDT.\n"); + printk(BIOS_ERR, "Failed to unflatten the FDT.\n"); return; } @@ -190,7 +190,7 @@ void fit_payload(struct prog *payload, void *data) list_for_each(chain, config->overlays, list_node) { struct device_tree *overlay = unpack_fdt(chain->overlay); if (!overlay || dt_apply_overlay(dt, overlay)) { - printk(BIOS_ERR, "ERROR: Failed to apply overlay %s!\n", + printk(BIOS_ERR, "Failed to apply overlay %s!\n", chain->overlay->name); } } @@ -213,7 +213,7 @@ void fit_payload(struct prog *payload, void *data) /* Invoke arch specific payload placement and fixups */ if (!fit_payload_arch(payload, config, &kernel, &fdt, &initrd)) { - printk(BIOS_ERR, "ERROR: Failed to find free memory region\n"); + printk(BIOS_ERR, "Failed to find free memory region\n"); bootmem_dump_ranges(); return; } @@ -227,7 +227,7 @@ void fit_payload(struct prog *payload, void *data) if (config->ramdisk && extract(&initrd, config->ramdisk)) { - printk(BIOS_ERR, "ERROR: Failed to extract initrd\n"); + printk(BIOS_ERR, "Failed to extract initrd\n"); prog_set_entry(payload, NULL, NULL); return; } @@ -235,7 +235,7 @@ void fit_payload(struct prog *payload, void *data) timestamp_add_now(TS_KERNEL_DECOMPRESSION); if (extract(&kernel, config->kernel)) { - printk(BIOS_ERR, "ERROR: Failed to extract kernel\n"); + printk(BIOS_ERR, "Failed to extract kernel\n"); prog_set_entry(payload, NULL, NULL); return; } diff --git a/src/lib/fmap.c b/src/lib/fmap.c index 6ff8431b04..251125522e 100644 --- a/src/lib/fmap.c +++ b/src/lib/fmap.c @@ -80,7 +80,7 @@ static void setup_preram_cache(struct region_device *cache_rdev) if (!verify_fmap(fmap)) goto register_cache; - printk(BIOS_ERR, "ERROR: FMAP cache corrupted?!\n"); + printk(BIOS_ERR, "FMAP cache corrupted?!\n"); if (CONFIG(TOCTOU_SAFETY)) die("TOCTOU safety relies on FMAP cache"); } @@ -301,13 +301,13 @@ static void fmap_setup_cbmem_cache(int unused) const size_t s = region_device_sz(&fmrd); struct fmap *fmap = cbmem_add(CBMEM_ID_FMAP, s); if (!fmap) { - printk(BIOS_ERR, "ERROR: Failed to allocate CBMEM\n"); + printk(BIOS_ERR, "Failed to allocate CBMEM\n"); return; } const ssize_t ret = rdev_readat(&fmrd, fmap, 0, s); if (ret != s) { - printk(BIOS_ERR, "ERROR: Failed to read FMAP into CBMEM\n"); + printk(BIOS_ERR, "Failed to read FMAP into CBMEM\n"); cbmem_entry_remove(cbmem_entry_find(CBMEM_ID_FMAP)); return; } diff --git a/src/lib/thread.c b/src/lib/thread.c index a1c84dce59..adfc298a71 100644 --- a/src/lib/thread.c +++ b/src/lib/thread.c @@ -282,15 +282,14 @@ int thread_run(struct thread_handle *handle, enum cb_err (*func)(void *), void * current = current_thread(); if (!thread_can_yield(current)) { - printk(BIOS_ERR, - "ERROR: %s() called from non-yielding context!\n", __func__); + printk(BIOS_ERR, "%s() called from non-yielding context!\n", __func__); return -1; } t = get_free_thread(); if (t == NULL) { - printk(BIOS_ERR, "ERROR: %s: No more threads!\n", __func__); + printk(BIOS_ERR, "%s: No more threads!\n", __func__); return -1; } @@ -317,15 +316,14 @@ int thread_run_until(struct thread_handle *handle, enum cb_err (*func)(void *), current = current_thread(); if (!thread_can_yield(current)) { - printk(BIOS_ERR, - "ERROR: %s() called from non-yielding context!\n", __func__); + printk(BIOS_ERR, "%s() called from non-yielding context!\n", __func__); return -1; } t = get_free_thread(); if (t == NULL) { - printk(BIOS_ERR, "ERROR: %s: No more threads!\n", __func__); + printk(BIOS_ERR, "%s: No more threads!\n", __func__); return -1; } diff --git a/src/lib/timestamp.c b/src/lib/timestamp.c index f8e4ab840a..b92975fb13 100644 --- a/src/lib/timestamp.c +++ b/src/lib/timestamp.c @@ -114,7 +114,7 @@ static void timestamp_add_table_entry(struct timestamp_table *ts_table, tse->entry_stamp = ts_time; if (ts_table->num_entries == ts_table->max_entries) - printk(BIOS_ERR, "ERROR: Timestamp table full\n"); + printk(BIOS_ERR, "Timestamp table full\n"); } void timestamp_add(enum timestamp_id id, int64_t ts_time) @@ -127,7 +127,7 @@ void timestamp_add(enum timestamp_id id, int64_t ts_time) ts_table = timestamp_table_get(); if (!ts_table) { - printk(BIOS_ERR, "ERROR: No timestamp table found\n"); + printk(BIOS_ERR, "No timestamp table found\n"); return; } @@ -155,7 +155,7 @@ void timestamp_init(uint64_t base) ts_cache = timestamp_cache_get(); if (!ts_cache) { - printk(BIOS_ERR, "ERROR: No timestamp cache to init\n"); + printk(BIOS_ERR, "No timestamp cache to init\n"); return; } @@ -170,7 +170,7 @@ static void timestamp_sync_cache_to_cbmem(struct timestamp_table *ts_cbmem_table ts_cache_table = timestamp_table_get(); if (!ts_cache_table) { - printk(BIOS_ERR, "ERROR: No timestamp cache found\n"); + printk(BIOS_ERR, "No timestamp cache found\n"); return; } @@ -223,7 +223,7 @@ static void timestamp_reinit(int is_recovery) } if (ts_cbmem_table == NULL) { - printk(BIOS_ERR, "ERROR: No timestamp table allocated\n"); + printk(BIOS_ERR, "No timestamp table allocated\n"); timestamp_table_set(NULL); return; } @@ -253,7 +253,7 @@ void timestamp_rescale_table(uint16_t N, uint16_t M) /* No timestamp table found */ if (ts_table == NULL) { - printk(BIOS_ERR, "ERROR: No timestamp table found\n"); + printk(BIOS_ERR, "No timestamp table found\n"); return; } |