summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2018-04-21 14:45:32 -0600
committerAaron Durbin <adurbin@chromium.org>2018-04-24 14:37:59 +0000
commit6403167d290da235a732bd2d6157aa2124fb403a (patch)
tree9c4805af37a31830934f91098d299e967df930c6 /src/drivers
parent38fd6685e9da61daadc96a8d537e6966dfe3b219 (diff)
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>
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/amd/agesa/romstage.c3
-rw-r--r--src/drivers/amd/agesa/state_machine.c15
-rw-r--r--src/drivers/elog/gsmi.c5
-rw-r--r--src/drivers/i2c/tpm/cr50.c3
-rw-r--r--src/drivers/intel/fsp1_1/car.c9
-rw-r--r--src/drivers/intel/fsp1_1/raminit.c7
-rw-r--r--src/drivers/intel/fsp1_1/ramstage.c9
-rw-r--r--src/drivers/intel/fsp1_1/romstage.c23
-rw-r--r--src/drivers/intel/fsp2_0/graphics.c2
-rw-r--r--src/drivers/intel/fsp2_0/hob_display.c6
-rw-r--r--src/drivers/intel/fsp2_0/memory_init.c4
-rw-r--r--src/drivers/intel/fsp2_0/notify.c3
-rw-r--r--src/drivers/intel/fsp2_0/upd_display.c5
-rw-r--r--src/drivers/intel/wifi/wifi.c2
-rw-r--r--src/drivers/spi/spi-generic.c3
-rw-r--r--src/drivers/spi/tpm/tpm.c3
16 files changed, 57 insertions, 45 deletions
diff --git a/src/drivers/amd/agesa/romstage.c b/src/drivers/amd/agesa/romstage.c
index bd502b6bad..197a007a21 100644
--- a/src/drivers/amd/agesa/romstage.c
+++ b/src/drivers/amd/agesa/romstage.c
@@ -18,6 +18,7 @@
#include <cbmem.h>
#include <cpu/amd/car.h>
#include <cpu/x86/bist.h>
+#include <compiler.h>
#include <console/console.h>
#include <halt.h>
#include <program_loading.h>
@@ -43,7 +44,7 @@ void asmlinkage early_all_cores(void)
amd_initmmio();
}
-void __attribute__((weak)) platform_once(struct sysinfo *cb)
+void __weak platform_once(struct sysinfo *cb)
{
board_BeforeAgesa(cb);
}
diff --git a/src/drivers/amd/agesa/state_machine.c b/src/drivers/amd/agesa/state_machine.c
index fdd2e6eeac..b73c1244d8 100644
--- a/src/drivers/amd/agesa/state_machine.c
+++ b/src/drivers/amd/agesa/state_machine.c
@@ -21,6 +21,7 @@
#include <bootstate.h>
#include <cbfs.h>
#include <cbmem.h>
+#include <compiler.h>
#include <northbridge/amd/agesa/state_machine.h>
#include <northbridge/amd/agesa/agesa_helper.h>
@@ -374,24 +375,24 @@ BOOT_STATE_INIT_ENTRY(BS_POST_DEVICE, BS_ON_EXIT, amd_bs_post_device,
#endif /* ENV_RAMSTAGE */
/* Empty stubs for cases board does not need to override anything. */
-void __attribute__((weak))
+void __weak
board_BeforeInitReset(struct sysinfo *cb, AMD_RESET_PARAMS *Reset) { }
-void __attribute__((weak))
+void __weak
board_BeforeInitEarly(struct sysinfo *cb, AMD_EARLY_PARAMS *Early) { }
-void __attribute__((weak))
+void __weak
board_BeforeInitPost(struct sysinfo *cb, AMD_POST_PARAMS *Post) { }
-void __attribute__((weak))
+void __weak
board_BeforeInitEnv(struct sysinfo *cb, AMD_ENV_PARAMS *Env) { }
-void __attribute__((weak))
+void __weak
board_BeforeInitMid(struct sysinfo *cb, AMD_MID_PARAMS *Mid) { }
-AGESA_STATUS __attribute__((weak))
+AGESA_STATUS __weak
fchs3earlyrestore(AMD_CONFIG_PARAMS *StdHeader)
{
return AGESA_SUCCESS;
}
-AGESA_STATUS __attribute__((weak))
+AGESA_STATUS __weak
fchs3laterestore(AMD_CONFIG_PARAMS *StdHeader)
{
return AGESA_SUCCESS;
diff --git a/src/drivers/elog/gsmi.c b/src/drivers/elog/gsmi.c
index 42bfd0f183..cced4a1293 100644
--- a/src/drivers/elog/gsmi.c
+++ b/src/drivers/elog/gsmi.c
@@ -15,6 +15,7 @@
#include <compiler.h>
#include <arch/io.h>
+#include <compiler.h>
#include <console/console.h>
#include <cpu/x86/smm.h>
#include <elog.h>
@@ -48,12 +49,12 @@ struct gsmi_clear_eventlog_param {
u32 data_type;
} __packed;
-void __attribute__((weak)) elog_gsmi_cb_platform_log_wake_source(void)
+void __weak elog_gsmi_cb_platform_log_wake_source(void)
{
/* Default weak implementation, does nothing. */
}
-void __attribute__((weak)) elog_gsmi_cb_mainboard_log_wake_source(void)
+void __weak elog_gsmi_cb_mainboard_log_wake_source(void)
{
/* Default weak implementation, does nothing. */
}
diff --git a/src/drivers/i2c/tpm/cr50.c b/src/drivers/i2c/tpm/cr50.c
index 96e00379c8..3c2f5bd198 100644
--- a/src/drivers/i2c/tpm/cr50.c
+++ b/src/drivers/i2c/tpm/cr50.c
@@ -31,6 +31,7 @@
#include <arch/early_variables.h>
#include <commonlib/endian.h>
+#include <compiler.h>
#include <stdint.h>
#include <string.h>
#include <types.h>
@@ -58,7 +59,7 @@ struct tpm_inf_dev {
static struct tpm_inf_dev g_tpm_dev CAR_GLOBAL;
-__attribute__((weak)) int tis_plat_irq_status(void)
+__weak int tis_plat_irq_status(void)
{
static int warning_displayed CAR_GLOBAL;
diff --git a/src/drivers/intel/fsp1_1/car.c b/src/drivers/intel/fsp1_1/car.c
index e1a9b9db6c..686a4c8c7e 100644
--- a/src/drivers/intel/fsp1_1/car.c
+++ b/src/drivers/intel/fsp1_1/car.c
@@ -14,6 +14,7 @@
*/
#include <arch/early_variables.h>
+#include <compiler.h>
#include <console/console.h>
#include <fsp/car.h>
#include <fsp/util.h>
@@ -100,18 +101,18 @@ asmlinkage void after_cache_as_ram(void *chipset_context)
after_cache_as_ram_stage();
}
-void __attribute__((weak)) car_mainboard_pre_console_init(void)
+void __weak car_mainboard_pre_console_init(void)
{
}
-void __attribute__((weak)) car_soc_pre_console_init(void)
+void __weak car_soc_pre_console_init(void)
{
}
-void __attribute__((weak)) car_mainboard_post_console_init(void)
+void __weak car_mainboard_post_console_init(void)
{
}
-void __attribute__((weak)) car_soc_post_console_init(void)
+void __weak car_soc_post_console_init(void)
{
}
diff --git a/src/drivers/intel/fsp1_1/raminit.c b/src/drivers/intel/fsp1_1/raminit.c
index 2bdac0a340..e5714ae140 100644
--- a/src/drivers/intel/fsp1_1/raminit.c
+++ b/src/drivers/intel/fsp1_1/raminit.c
@@ -15,6 +15,7 @@
#include <arch/acpi.h>
#include <cbmem.h>
+#include <compiler.h>
#include <console/console.h>
#include <fsp/memmap.h>
#include <fsp/romstage.h>
@@ -296,7 +297,7 @@ void raminit(struct romstage_params *params)
}
/* Initialize the UPD parameters for MemoryInit */
-__attribute__((weak)) void mainboard_memory_init_params(
+__weak void mainboard_memory_init_params(
struct romstage_params *params,
MEMORY_INIT_UPD *upd_ptr)
{
@@ -304,7 +305,7 @@ __attribute__((weak)) void mainboard_memory_init_params(
}
/* Display the UPD parameters for MemoryInit */
-__attribute__((weak)) void soc_display_memory_init_params(
+__weak void soc_display_memory_init_params(
const MEMORY_INIT_UPD *old, MEMORY_INIT_UPD *new)
{
printk(BIOS_SPEW, "UPD values for MemoryInit:\n");
@@ -312,7 +313,7 @@ __attribute__((weak)) void soc_display_memory_init_params(
}
/* Initialize the UPD parameters for MemoryInit */
-__attribute__((weak)) void soc_memory_init_params(
+__weak void soc_memory_init_params(
struct romstage_params *params,
MEMORY_INIT_UPD *upd)
{
diff --git a/src/drivers/intel/fsp1_1/ramstage.c b/src/drivers/intel/fsp1_1/ramstage.c
index 563a030220..a4609df573 100644
--- a/src/drivers/intel/fsp1_1/ramstage.c
+++ b/src/drivers/intel/fsp1_1/ramstage.c
@@ -18,6 +18,7 @@
#include <arch/acpi.h>
#include <cbmem.h>
#include <cbfs.h>
+#include <compiler.h>
#include <console/console.h>
#include <fsp/memmap.h>
#include <fsp/ramstage.h>
@@ -28,7 +29,7 @@
#include <timestamp.h>
/* SOC initialization after FSP silicon init */
-__attribute__((weak)) void soc_after_silicon_init(void)
+__weak void soc_after_silicon_init(void)
{
}
@@ -215,13 +216,13 @@ void intel_silicon_init(void)
}
/* Initialize the UPD parameters for SiliconInit */
-__attribute__((weak)) void mainboard_silicon_init_params(
+__weak void mainboard_silicon_init_params(
SILICON_INIT_UPD *params)
{
};
/* Display the UPD parameters for SiliconInit */
-__attribute__((weak)) void soc_display_silicon_init_params(
+__weak void soc_display_silicon_init_params(
const SILICON_INIT_UPD *old, SILICON_INIT_UPD *new)
{
printk(BIOS_SPEW, "UPD values for SiliconInit:\n");
@@ -229,6 +230,6 @@ __attribute__((weak)) void soc_display_silicon_init_params(
}
/* Initialize the UPD parameters for SiliconInit */
-__attribute__((weak)) void soc_silicon_init_params(SILICON_INIT_UPD *params)
+__weak void soc_silicon_init_params(SILICON_INIT_UPD *params)
{
}
diff --git a/src/drivers/intel/fsp1_1/romstage.c b/src/drivers/intel/fsp1_1/romstage.c
index 88401f0b4b..ba08cdc42b 100644
--- a/src/drivers/intel/fsp1_1/romstage.c
+++ b/src/drivers/intel/fsp1_1/romstage.c
@@ -20,6 +20,7 @@
#include <arch/cbfs.h>
#include <arch/early_variables.h>
#include <assert.h>
+#include <compiler.h>
#include <console/console.h>
#include <cbmem.h>
#include <cpu/intel/microcode.h>
@@ -185,13 +186,13 @@ void after_cache_as_ram_stage(void)
}
/* Initialize the power state */
-__attribute__((weak)) struct chipset_power_state *fill_power_state(void)
+__weak struct chipset_power_state *fill_power_state(void)
{
return NULL;
}
/* Board initialization before and after RAM is enabled */
-__attribute__((weak)) void mainboard_romstage_entry(
+__weak void mainboard_romstage_entry(
struct romstage_params *params)
{
post_code(0x31);
@@ -201,7 +202,7 @@ __attribute__((weak)) void mainboard_romstage_entry(
}
/* Save the DIMM information for SMBIOS table 17 */
-__attribute__((weak)) void mainboard_save_dimm_info(
+__weak void mainboard_save_dimm_info(
struct romstage_params *params)
{
int channel;
@@ -330,7 +331,7 @@ __attribute__((weak)) void mainboard_save_dimm_info(
}
/* Add any mainboard specific information */
-__attribute__((weak)) void mainboard_add_dimm_info(
+__weak void mainboard_add_dimm_info(
struct romstage_params *params,
struct memory_info *mem_info,
int channel, int dimm, int index)
@@ -338,44 +339,44 @@ __attribute__((weak)) void mainboard_add_dimm_info(
}
/* Get the memory configuration data */
-__attribute__((weak)) int mrc_cache_get_current(int type, uint32_t version,
+__weak int mrc_cache_get_current(int type, uint32_t version,
struct region_device *rdev)
{
return -1;
}
/* Save the memory configuration data */
-__attribute__((weak)) int mrc_cache_stash_data(int type, uint32_t version,
+__weak int mrc_cache_stash_data(int type, uint32_t version,
const void *data, size_t size)
{
return -1;
}
/* Transition RAM from off or self-refresh to active */
-__attribute__((weak)) void raminit(struct romstage_params *params)
+__weak void raminit(struct romstage_params *params)
{
post_code(0x34);
die("ERROR - No RAM initialization specified!\n");
}
/* Display the memory configuration */
-__attribute__((weak)) void report_memory_config(void)
+__weak void report_memory_config(void)
{
}
/* Choose top of stack and setup MTRRs */
-__attribute__((weak)) void *setup_stack_and_mtrrs(void)
+__weak void *setup_stack_and_mtrrs(void)
{
die("ERROR - Must specify top of stack!\n");
return NULL;
}
/* SOC initialization after RAM is enabled */
-__attribute__((weak)) void soc_after_ram_init(struct romstage_params *params)
+__weak void soc_after_ram_init(struct romstage_params *params)
{
}
/* SOC initialization before RAM is enabled */
-__attribute__((weak)) void soc_pre_ram_init(struct romstage_params *params)
+__weak void soc_pre_ram_init(struct romstage_params *params)
{
}
diff --git a/src/drivers/intel/fsp2_0/graphics.c b/src/drivers/intel/fsp2_0/graphics.c
index f1219ea15c..ae1442ee9d 100644
--- a/src/drivers/intel/fsp2_0/graphics.c
+++ b/src/drivers/intel/fsp2_0/graphics.c
@@ -124,7 +124,7 @@ int fill_lb_framebuffer(struct lb_framebuffer *framebuffer)
return 0;
}
-__attribute__((weak)) uintptr_t fsp_soc_get_igd_bar(void)
+__weak uintptr_t fsp_soc_get_igd_bar(void)
{
return 0;
}
diff --git a/src/drivers/intel/fsp2_0/hob_display.c b/src/drivers/intel/fsp2_0/hob_display.c
index d9838e9462..977facbfc6 100644
--- a/src/drivers/intel/fsp2_0/hob_display.c
+++ b/src/drivers/intel/fsp2_0/hob_display.c
@@ -157,7 +157,7 @@ const char *fsp_get_guid_name(const uint8_t *guid)
return "Unknown GUID";
}
-__attribute__((weak)) const char *soc_get_hob_type_name(
+__weak const char *soc_get_hob_type_name(
const struct hob_header *hob)
{
return NULL;
@@ -173,7 +173,7 @@ void fsp_print_guid_extension_hob(const struct hob_header *hob)
printk(BIOS_SPEW, ": %s\n", fsp_get_guid_name(res->owner_guid));
}
-__attribute__((weak)) const char *soc_get_guid_name(const uint8_t *guid)
+__weak const char *soc_get_guid_name(const uint8_t *guid)
{
return NULL;
}
@@ -212,6 +212,6 @@ void fsp_display_hobs(void)
}
}
-__attribute__((weak)) void soc_display_hob(const struct hob_header *hob)
+__weak void soc_display_hob(const struct hob_header *hob)
{
}
diff --git a/src/drivers/intel/fsp2_0/memory_init.c b/src/drivers/intel/fsp2_0/memory_init.c
index 0abe121aa6..30987ce500 100644
--- a/src/drivers/intel/fsp2_0/memory_init.c
+++ b/src/drivers/intel/fsp2_0/memory_init.c
@@ -307,13 +307,13 @@ static enum cb_err fsp_fill_common_arch_params(FSPM_ARCH_UPD *arch_upd,
return CB_SUCCESS;
}
-__attribute__((weak))
+__weak
uint8_t fsp_memory_mainboard_version(void)
{
return 0;
}
-__attribute__((weak))
+__weak
uint8_t fsp_memory_soc_version(void)
{
return 0;
diff --git a/src/drivers/intel/fsp2_0/notify.c b/src/drivers/intel/fsp2_0/notify.c
index 34a4262049..6d6d623be4 100644
--- a/src/drivers/intel/fsp2_0/notify.c
+++ b/src/drivers/intel/fsp2_0/notify.c
@@ -12,6 +12,7 @@
#include <arch/cpu.h>
#include <bootstate.h>
+#include <compiler.h>
#include <console/console.h>
#include <fsp/util.h>
#include <soc/intel/common/util.h>
@@ -87,7 +88,7 @@ BOOT_STATE_INIT_ENTRY(BS_PAYLOAD_LOAD, BS_ON_EXIT, fsp_notify_dummy,
BOOT_STATE_INIT_ENTRY(BS_OS_RESUME, BS_ON_ENTRY, fsp_notify_dummy,
(void *) READY_TO_BOOT);
-__attribute__((weak)) void platform_fsp_notify_status(
+__weak void platform_fsp_notify_status(
enum fsp_notify_phase phase)
{
}
diff --git a/src/drivers/intel/fsp2_0/upd_display.c b/src/drivers/intel/fsp2_0/upd_display.c
index 8df48659fa..415505e1dd 100644
--- a/src/drivers/intel/fsp2_0/upd_display.c
+++ b/src/drivers/intel/fsp2_0/upd_display.c
@@ -10,6 +10,7 @@
*/
#include <arch/cpu.h>
+#include <compiler.h>
#include <console/console.h>
#include <fsp/util.h>
#include <lib.h>
@@ -50,7 +51,7 @@ static void fspm_display_arch_params(const FSPM_ARCH_UPD *old,
}
/* Display the UPD parameters for MemoryInit */
-__attribute__((weak)) void soc_display_fspm_upd_params(
+__weak void soc_display_fspm_upd_params(
const FSPM_UPD *fspm_old_upd,
const FSPM_UPD *fspm_new_upd)
{
@@ -67,7 +68,7 @@ void fspm_display_upd_values(const FSPM_UPD *old,
}
/* Display the UPD parameters for SiliconInit */
-__attribute__((weak)) void soc_display_fsps_upd_params(
+__weak void soc_display_fsps_upd_params(
const FSPS_UPD *fsps_old_upd,
const FSPS_UPD *fsps_new_upd)
{
diff --git a/src/drivers/intel/wifi/wifi.c b/src/drivers/intel/wifi/wifi.c
index 57bd9b090a..1cf89cf14e 100644
--- a/src/drivers/intel/wifi/wifi.c
+++ b/src/drivers/intel/wifi/wifi.c
@@ -64,7 +64,7 @@ static int smbios_write_wifi(struct device *dev, int *handle,
}
#endif
-__attribute__((weak))
+__weak
int get_wifi_sar_limits(struct wifi_sar_limits *sar_limits)
{
return -1;
diff --git a/src/drivers/spi/spi-generic.c b/src/drivers/spi/spi-generic.c
index 6d7fcdc021..f1b11aedf7 100644
--- a/src/drivers/spi/spi-generic.c
+++ b/src/drivers/spi/spi-generic.c
@@ -15,6 +15,7 @@
*/
#include <assert.h>
+#include <compiler.h>
#include <spi-generic.h>
#include <string.h>
@@ -116,7 +117,7 @@ unsigned int spi_crop_chunk(const struct spi_slave *slave, unsigned int cmd_len,
return min(ctrlr_max, buf_len);
}
-void __attribute__((weak)) spi_init(void)
+void __weak spi_init(void)
{
/* Default weak implementation - do nothing. */
}
diff --git a/src/drivers/spi/tpm/tpm.c b/src/drivers/spi/tpm/tpm.c
index c0fee46dc7..3206ba1fa4 100644
--- a/src/drivers/spi/tpm/tpm.c
+++ b/src/drivers/spi/tpm/tpm.c
@@ -17,6 +17,7 @@
#include <arch/early_variables.h>
#include <assert.h>
+#include <compiler.h>
#include <commonlib/endian.h>
#include <console/console.h>
#include <delay.h>
@@ -64,7 +65,7 @@ void tpm2_get_info(struct tpm2_info *info)
*info = car_get_var(g_tpm_info);
}
-__attribute__((weak)) int tis_plat_irq_status(void)
+__weak int tis_plat_irq_status(void)
{
static int warning_displayed CAR_GLOBAL;