compiler.h: add __weak macro
Instead of writing out '__attribute__((weak))' use a shorter form. Change-Id: If418a1d55052780077febd2d8f2089021f414b91 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/25767 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-by: Justin TerAvest <teravest@chromium.org>
This commit is contained in:
@@ -14,8 +14,9 @@
|
||||
*/
|
||||
|
||||
#include <boot_device.h>
|
||||
#include <compiler.h>
|
||||
|
||||
void __attribute__((weak)) boot_device_init(void)
|
||||
void __weak boot_device_init(void)
|
||||
{
|
||||
/* Provide weak do-nothing init. */
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
#include <arch/exception.h>
|
||||
#include <bootblock_common.h>
|
||||
#include <compiler.h>
|
||||
#include <console/console.h>
|
||||
#include <delay.h>
|
||||
#include <pc80/mc146818rtc.h>
|
||||
@@ -25,10 +26,10 @@
|
||||
|
||||
DECLARE_OPTIONAL_REGION(timestamp);
|
||||
|
||||
__attribute__((weak)) void bootblock_mainboard_early_init(void) { /* no-op */ }
|
||||
__attribute__((weak)) void bootblock_soc_early_init(void) { /* do nothing */ }
|
||||
__attribute__((weak)) void bootblock_soc_init(void) { /* do nothing */ }
|
||||
__attribute__((weak)) void bootblock_mainboard_init(void) { /* do nothing */ }
|
||||
__weak void bootblock_mainboard_early_init(void) { /* no-op */ }
|
||||
__weak void bootblock_soc_early_init(void) { /* do nothing */ }
|
||||
__weak void bootblock_soc_init(void) { /* do nothing */ }
|
||||
__weak void bootblock_mainboard_init(void) { /* do nothing */ }
|
||||
|
||||
asmlinkage void bootblock_main_with_timestamp(uint64_t base_timestamp)
|
||||
{
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <boot_device.h>
|
||||
#include <cbfs.h>
|
||||
#include <commonlib/compression.h>
|
||||
#include <compiler.h>
|
||||
#include <endian.h>
|
||||
#include <lib.h>
|
||||
#include <symbols.h>
|
||||
@@ -308,7 +309,7 @@ static int cbfs_master_header_props(struct cbfs_props *props)
|
||||
/* This struct is marked as weak to allow a particular platform to
|
||||
* override the master header logic. This implementation should work for most
|
||||
* devices. */
|
||||
const struct cbfs_locator __attribute__((weak)) cbfs_master_header_locator = {
|
||||
const struct cbfs_locator __weak cbfs_master_header_locator = {
|
||||
.name = "Master Header Locator",
|
||||
.locate = cbfs_master_header_props,
|
||||
};
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
*/
|
||||
#include <console/console.h>
|
||||
#include <cbmem.h>
|
||||
#include <compiler.h>
|
||||
#include <bootstate.h>
|
||||
#include <rules.h>
|
||||
#include <symbols.h>
|
||||
@@ -37,7 +38,7 @@ void cbmem_run_init_hooks(int is_recovery)
|
||||
}
|
||||
}
|
||||
|
||||
void __attribute__((weak)) cbmem_fail_resume(void)
|
||||
void __weak cbmem_fail_resume(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include <arch/cbconfig.h>
|
||||
#include <compiler.h>
|
||||
#include <console/console.h>
|
||||
#include <console/uart.h>
|
||||
#include <ip_checksum.h>
|
||||
@@ -244,9 +245,9 @@ static inline void lb_vboot_handoff(struct lb_header *header) {}
|
||||
#endif /* CONFIG_VBOOT */
|
||||
#endif /* CONFIG_CHROMEOS */
|
||||
|
||||
__attribute__((weak)) uint32_t board_id(void) { return UNDEFINED_STRAPPING_ID; }
|
||||
__attribute__((weak)) uint32_t ram_code(void) { return UNDEFINED_STRAPPING_ID; }
|
||||
__attribute__((weak)) uint32_t sku_id(void) { return UNDEFINED_STRAPPING_ID; }
|
||||
__weak uint32_t board_id(void) { return UNDEFINED_STRAPPING_ID; }
|
||||
__weak uint32_t ram_code(void) { return UNDEFINED_STRAPPING_ID; }
|
||||
__weak uint32_t sku_id(void) { return UNDEFINED_STRAPPING_ID; }
|
||||
|
||||
static void lb_board_id(struct lb_header *header)
|
||||
{
|
||||
@@ -441,7 +442,7 @@ static void lb_record_version_timestamp(struct lb_header *header)
|
||||
rec->timestamp = coreboot_version_timestamp;
|
||||
}
|
||||
|
||||
void __attribute__((weak)) lb_board(struct lb_header *header) { /* NOOP */ }
|
||||
void __weak lb_board(struct lb_header *header) { /* NOOP */ }
|
||||
|
||||
/*
|
||||
* It's possible that the system is using a SPI flash as the boot device,
|
||||
@@ -449,7 +450,7 @@ void __attribute__((weak)) lb_board(struct lb_header *header) { /* NOOP */ }
|
||||
* case don't provide any information as the correct information is
|
||||
* not known.
|
||||
*/
|
||||
void __attribute__((weak)) lb_spi_flash(struct lb_header *header) { /* NOOP */ }
|
||||
void __weak lb_spi_flash(struct lb_header *header) { /* NOOP */ }
|
||||
|
||||
static struct lb_forward *lb_forward(struct lb_header *header,
|
||||
struct lb_header *next_header)
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#include <fallback.h>
|
||||
#include <compiler.h>
|
||||
#include <watchdog.h>
|
||||
|
||||
/* Implement platform specific override. */
|
||||
void __attribute__((weak)) set_boot_successful(void) { }
|
||||
void __weak set_boot_successful(void) { }
|
||||
|
||||
void boot_successful(void)
|
||||
{
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
#include <assert.h>
|
||||
#include <base3.h>
|
||||
#include <compiler.h>
|
||||
#include <console/console.h>
|
||||
#include <delay.h>
|
||||
#include <gpio.h>
|
||||
@@ -168,13 +169,13 @@ int _gpio_base3_value(const gpio_t gpio[], int num_gpio, int binary_first)
|
||||
}
|
||||
|
||||
/* Default handler for ACPI path is to return NULL */
|
||||
__attribute__((weak)) const char *gpio_acpi_path(gpio_t gpio)
|
||||
__weak const char *gpio_acpi_path(gpio_t gpio)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Default handler returns 0 because type of gpio_t is unknown */
|
||||
__attribute__((weak)) uint16_t gpio_acpi_pin(gpio_t gpio)
|
||||
__weak uint16_t gpio_acpi_pin(gpio_t gpio)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <adainit.h>
|
||||
#include <arch/exception.h>
|
||||
#include <bootstate.h>
|
||||
#include <compiler.h>
|
||||
#include <console/console.h>
|
||||
#include <console/post_codes.h>
|
||||
#include <cbmem.h>
|
||||
@@ -115,7 +116,7 @@ static struct boot_state boot_states[] = {
|
||||
BS_INIT_ENTRY(BS_PAYLOAD_BOOT, bs_payload_boot),
|
||||
};
|
||||
|
||||
void __attribute__((weak)) arch_bootstate_coreboot_exit(void) { }
|
||||
void __weak arch_bootstate_coreboot_exit(void) { }
|
||||
|
||||
static boot_state_t bs_pre_device(void *arg)
|
||||
{
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
#include <bootstate.h>
|
||||
#include <bootmem.h>
|
||||
#include <compiler.h>
|
||||
#include <console/console.h>
|
||||
#include <cbmem.h>
|
||||
#include <imd.h>
|
||||
@@ -109,7 +110,7 @@ void cbmem_initialize_empty(void)
|
||||
cbmem_initialize_empty_id_size(0, 0);
|
||||
}
|
||||
|
||||
void __attribute__((weak)) cbmem_top_init(void)
|
||||
void __weak cbmem_top_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <cbfs.h>
|
||||
#include <cbmem.h>
|
||||
#include <compiler.h>
|
||||
#include <console/console.h>
|
||||
#include <fallback.h>
|
||||
#include <halt.h>
|
||||
@@ -71,9 +72,9 @@ fail:
|
||||
halt();
|
||||
}
|
||||
|
||||
void __attribute__((weak)) stage_cache_add(int stage_id,
|
||||
void __weak stage_cache_add(int stage_id,
|
||||
const struct prog *stage) {}
|
||||
void __attribute__((weak)) stage_cache_load_stage(int stage_id,
|
||||
void __weak stage_cache_load_stage(int stage_id,
|
||||
struct prog *stage) {}
|
||||
|
||||
static void ramstage_cache_invalid(void)
|
||||
@@ -164,7 +165,7 @@ fail:
|
||||
static struct prog global_payload =
|
||||
PROG_INIT(PROG_PAYLOAD, CONFIG_CBFS_PREFIX "/payload");
|
||||
|
||||
void __attribute__((weak)) mirror_payload(struct prog *payload)
|
||||
void __weak mirror_payload(struct prog *payload)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <compiler.h>
|
||||
#include <program_loading.h>
|
||||
|
||||
/* For each segment of a program loaded this function is called*/
|
||||
@@ -23,13 +24,13 @@ void prog_segment_loaded(uintptr_t start, size_t size, int flags)
|
||||
arch_segment_loaded(start, size, flags);
|
||||
}
|
||||
|
||||
void __attribute__((weak)) platform_segment_loaded(uintptr_t start,
|
||||
void __weak platform_segment_loaded(uintptr_t start,
|
||||
size_t size, int flags)
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
void __attribute__((weak)) arch_segment_loaded(uintptr_t start, size_t size,
|
||||
void __weak arch_segment_loaded(uintptr_t start, size_t size,
|
||||
int flags)
|
||||
{
|
||||
/* do nothing */
|
||||
@@ -41,7 +42,7 @@ void prog_run(struct prog *prog)
|
||||
arch_prog_run(prog);
|
||||
}
|
||||
|
||||
void __attribute__((weak)) platform_prog_run(struct prog *prog)
|
||||
void __weak platform_prog_run(struct prog *prog)
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
*/
|
||||
|
||||
#include <arch/cache.h>
|
||||
#include <compiler.h>
|
||||
#include <console/console.h>
|
||||
#include <halt.h>
|
||||
#include <reset.h>
|
||||
@@ -27,10 +28,10 @@ __attribute__((noreturn)) static void __hard_reset(void) {
|
||||
}
|
||||
|
||||
/* Not all platforms implement all reset types. Fall back to hard_reset. */
|
||||
__attribute__((weak)) void do_global_reset(void) { __hard_reset(); }
|
||||
__attribute__((weak)) void do_soft_reset(void) { __hard_reset(); }
|
||||
__weak void do_global_reset(void) { __hard_reset(); }
|
||||
__weak void do_soft_reset(void) { __hard_reset(); }
|
||||
|
||||
__attribute__((weak)) void soc_reset_prepare(enum reset_type rt) { /* no-op */ }
|
||||
__weak void soc_reset_prepare(enum reset_type rt) { /* no-op */ }
|
||||
|
||||
void global_reset(void)
|
||||
{
|
||||
|
||||
@@ -13,12 +13,13 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <compiler.h>
|
||||
#include <console/console.h>
|
||||
#include <timer.h>
|
||||
#include <delay.h>
|
||||
#include <thread.h>
|
||||
|
||||
__attribute__((weak)) void init_timer(void) { /* do nothing */ }
|
||||
__weak void init_timer(void) { /* do nothing */ }
|
||||
|
||||
void udelay(unsigned int usec)
|
||||
{
|
||||
|
||||
@@ -361,7 +361,7 @@ ROMSTAGE_CBMEM_INIT_HOOK(timestamp_sync_cache_to_cbmem)
|
||||
RAMSTAGE_CBMEM_INIT_HOOK(timestamp_sync_cache_to_cbmem)
|
||||
|
||||
/* Provide default timestamp implementation using monotonic timer. */
|
||||
uint64_t __attribute__((weak)) timestamp_get(void)
|
||||
uint64_t __weak timestamp_get(void)
|
||||
{
|
||||
struct mono_time t1, t2;
|
||||
|
||||
@@ -375,7 +375,7 @@ uint64_t __attribute__((weak)) timestamp_get(void)
|
||||
}
|
||||
|
||||
/* Like timestamp_get() above this matches up with microsecond granularity. */
|
||||
int __attribute__((weak)) timestamp_tick_freq_mhz(void)
|
||||
int __weak timestamp_tick_freq_mhz(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -14,9 +14,10 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <compiler.h>
|
||||
#include <wrdd.h>
|
||||
|
||||
uint16_t __attribute__((weak)) wifi_regulatory_domain(void)
|
||||
uint16_t __weak wifi_regulatory_domain(void)
|
||||
{
|
||||
return WRDD_DEFAULT_REGULATORY_DOMAIN;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user