From 6403167d290da235a732bd2d6157aa2124fb403a Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Sat, 21 Apr 2018 14:45:32 -0600 Subject: compiler.h: add __weak macro Instead of writing out '__attribute__((weak))' use a shorter form. Change-Id: If418a1d55052780077febd2d8f2089021f414b91 Signed-off-by: Aaron Durbin Reviewed-on: https://review.coreboot.org/25767 Tested-by: build bot (Jenkins) Reviewed-by: Arthur Heymans Reviewed-by: Justin TerAvest --- src/soc/intel/common/block/acpi/acpi.c | 9 +++++---- src/soc/intel/common/block/cpu/mp_init.c | 5 +++-- src/soc/intel/common/block/ebda/ebda.c | 3 ++- src/soc/intel/common/block/graphics/graphics.c | 3 ++- src/soc/intel/common/block/gspi/gspi.c | 3 ++- src/soc/intel/common/block/lpc/lpc.c | 5 +++-- src/soc/intel/common/block/pmc/pmc.c | 5 +++-- src/soc/intel/common/block/pmc/pmclib.c | 9 +++++---- src/soc/intel/common/block/rtc/rtc.c | 3 ++- src/soc/intel/common/block/smm/smihandler.c | 13 +++++++------ src/soc/intel/common/block/sram/sram.c | 3 ++- src/soc/intel/common/block/systemagent/systemagent.c | 9 +++++---- src/soc/intel/common/block/uart/uart.c | 7 ++++--- src/soc/intel/common/block/xdci/xdci.c | 3 ++- src/soc/intel/common/block/xhci/xhci.c | 3 ++- 15 files changed, 49 insertions(+), 34 deletions(-) (limited to 'src/soc/intel/common/block') diff --git a/src/soc/intel/common/block/acpi/acpi.c b/src/soc/intel/common/block/acpi/acpi.c index bf4003d575..02ab886ac0 100644 --- a/src/soc/intel/common/block/acpi/acpi.c +++ b/src/soc/intel/common/block/acpi/acpi.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -100,7 +101,7 @@ unsigned long acpi_fill_madt(unsigned long current) return acpi_madt_irq_overrides(current); } -__attribute__ ((weak)) void soc_fill_fadt(acpi_fadt_t *fadt) +__weak void soc_fill_fadt(acpi_fadt_t *fadt) { } @@ -173,7 +174,7 @@ unsigned long southbridge_write_acpi_tables(device_t device, return acpi_write_hpet(device, current, rsdp); } -__attribute__ ((weak)) +__weak uint32_t acpi_fill_soc_wake(uint32_t generic_pm1_en, const struct chipset_power_state *ps) { @@ -219,7 +220,7 @@ static int acpi_fill_wake(uint32_t *pm1, uint32_t **gpe0) return GPE0_REG_MAX; } -__attribute__ ((weak)) void acpi_create_gnvs(struct global_nvs_t *gnvs) +__weak void acpi_create_gnvs(struct global_nvs_t *gnvs) { } @@ -401,7 +402,7 @@ void generate_t_state_entries(int core, int cores_per_package) acpigen_write_TSS_package(entries, soc_tss_table); } -__attribute__ ((weak)) void soc_power_states_generation(int core_id, +__weak void soc_power_states_generation(int core_id, int cores_per_package) { } diff --git a/src/soc/intel/common/block/cpu/mp_init.c b/src/soc/intel/common/block/cpu/mp_init.c index 085a34052e..23f2fb0d47 100644 --- a/src/soc/intel/common/block/cpu/mp_init.c +++ b/src/soc/intel/common/block/cpu/mp_init.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -30,12 +31,12 @@ static const void *microcode_patch; /* SoC override function */ -__attribute__((weak)) void soc_core_init(device_t dev) +__weak void soc_core_init(device_t dev) { /* no-op */ } -__attribute__((weak)) void soc_init_cpus(struct bus *cpu_bus) +__weak void soc_init_cpus(struct bus *cpu_bus) { /* no-op */ } diff --git a/src/soc/intel/common/block/ebda/ebda.c b/src/soc/intel/common/block/ebda/ebda.c index d16ad6e4c0..41c77a8f2c 100644 --- a/src/soc/intel/common/block/ebda/ebda.c +++ b/src/soc/intel/common/block/ebda/ebda.c @@ -14,6 +14,7 @@ */ #include +#include #include #include @@ -24,7 +25,7 @@ */ /* Fill up EBDA structure inside Mainboard directory */ -__attribute__((weak)) void create_mainboard_ebda(struct ebda_config *cfg) +__weak void create_mainboard_ebda(struct ebda_config *cfg) { /* no-op */ } diff --git a/src/soc/intel/common/block/graphics/graphics.c b/src/soc/intel/common/block/graphics/graphics.c index dcf8200250..ddea99fedb 100644 --- a/src/soc/intel/common/block/graphics/graphics.c +++ b/src/soc/intel/common/block/graphics/graphics.c @@ -14,6 +14,7 @@ * GNU General Public License for more details. */ +#include #include #include #include @@ -21,7 +22,7 @@ #include /* SoC Overrides */ -__attribute__((weak)) void graphics_soc_init(struct device *dev) +__weak void graphics_soc_init(struct device *dev) { /* * User needs to implement SoC override in case wishes diff --git a/src/soc/intel/common/block/gspi/gspi.c b/src/soc/intel/common/block/gspi/gspi.c index 175fad8b24..c7e1c6af0c 100644 --- a/src/soc/intel/common/block/gspi/gspi.c +++ b/src/soc/intel/common/block/gspi/gspi.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -357,7 +358,7 @@ static int gspi_cs_change(const struct spi_slave *dev, enum cs_assert cs_assert) return 0; } -int __attribute__((weak)) gspi_get_soc_spi_cfg(unsigned int gspi_bus, +int __weak gspi_get_soc_spi_cfg(unsigned int gspi_bus, struct spi_cfg *cfg) { cfg->clk_phase = SPI_CLOCK_PHASE_FIRST; diff --git a/src/soc/intel/common/block/lpc/lpc.c b/src/soc/intel/common/block/lpc/lpc.c index 079ecde624..c462d9daa0 100644 --- a/src/soc/intel/common/block/lpc/lpc.c +++ b/src/soc/intel/common/block/lpc/lpc.c @@ -14,6 +14,7 @@ * GNU General Public License for more details. */ +#include #include #include #include @@ -24,13 +25,13 @@ /* SoC overrides */ /* Common weak definition, needs to be implemented in each soc LPC driver. */ -__attribute__((weak)) void lpc_soc_init(struct device *dev) +__weak void lpc_soc_init(struct device *dev) { /* no-op */ } /* Fill up LPC IO resource structure inside SoC directory */ -__attribute__((weak)) void pch_lpc_soc_fill_io_resources(struct device *dev) +__weak void pch_lpc_soc_fill_io_resources(struct device *dev) { /* no-op */ } diff --git a/src/soc/intel/common/block/pmc/pmc.c b/src/soc/intel/common/block/pmc/pmc.c index d3fef5567c..c8e8026171 100644 --- a/src/soc/intel/common/block/pmc/pmc.c +++ b/src/soc/intel/common/block/pmc/pmc.c @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -25,7 +26,7 @@ /* SoC overrides */ /* Fill up PMC resource structure inside SoC directory */ -__attribute__((weak)) int pmc_soc_get_resources( +__weak int pmc_soc_get_resources( struct pmc_resource_config *cfg) { /* no-op */ @@ -33,7 +34,7 @@ __attribute__((weak)) int pmc_soc_get_resources( } /* SoC override PMC initialization */ -__attribute__((weak)) void pmc_soc_init(struct device *dev) +__weak void pmc_soc_init(struct device *dev) { /* no-op */ } diff --git a/src/soc/intel/common/block/pmc/pmclib.c b/src/soc/intel/common/block/pmc/pmclib.c index cf87d05d07..38d41960ad 100644 --- a/src/soc/intel/common/block/pmc/pmclib.c +++ b/src/soc/intel/common/block/pmc/pmclib.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -75,7 +76,7 @@ static void print_num_status_bits(int num_bits, uint32_t status, } } -__attribute__ ((weak)) uint32_t soc_get_smi_status(uint32_t generic_sts) +__weak uint32_t soc_get_smi_status(uint32_t generic_sts) { return generic_sts; } @@ -84,7 +85,7 @@ __attribute__ ((weak)) uint32_t soc_get_smi_status(uint32_t generic_sts) * Set PMC register to know which state system should be after * power reapplied */ -__attribute__ ((weak)) void pmc_soc_restore_power_failure(void) +__weak void pmc_soc_restore_power_failure(void) { /* * SoC code should set PMC config register in order to set @@ -332,7 +333,7 @@ void pmc_clear_all_gpe_status(void) pmc_clear_gpi_gpe_status(); } -__attribute__ ((weak)) +__weak void soc_clear_pm_registers(uintptr_t pmc_bar) { } @@ -351,7 +352,7 @@ void pmc_clear_prsts(void) soc_clear_pm_registers(pmc_bar); } -__attribute__ ((weak)) +__weak int soc_prev_sleep_state(const struct chipset_power_state *ps, int prev_sleep_state) { diff --git a/src/soc/intel/common/block/rtc/rtc.c b/src/soc/intel/common/block/rtc/rtc.c index 9e76768e65..cb97953557 100644 --- a/src/soc/intel/common/block/rtc/rtc.c +++ b/src/soc/intel/common/block/rtc/rtc.c @@ -13,6 +13,7 @@ * GNU General Public License for more details. */ +#include #include #include #include @@ -31,7 +32,7 @@ void enable_rtc_upper_bank(void) pcr_or32(PID_RTC, PCR_RTC_CONF, PCR_RTC_CONF_UCMOS_EN); } -__attribute__((weak)) int soc_get_rtc_failed(void) +__weak int soc_get_rtc_failed(void) { return 0; } diff --git a/src/soc/intel/common/block/smm/smihandler.c b/src/soc/intel/common/block/smm/smihandler.c index d492459dc8..d8ac2f3469 100644 --- a/src/soc/intel/common/block/smm/smihandler.c +++ b/src/soc/intel/common/block/smm/smihandler.c @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -40,18 +41,18 @@ static struct global_nvs_t *gnvs; /* SoC overrides. */ /* Specific SOC SMI handler during ramstage finalize phase */ -__attribute__((weak)) void smihandler_soc_at_finalize(void) +__weak void smihandler_soc_at_finalize(void) { return; } -__attribute__((weak)) int smihandler_soc_disable_busmaster(device_t dev) +__weak int smihandler_soc_disable_busmaster(device_t dev) { return 1; } /* SMI handlers that should be serviced in SCI mode too. */ -__attribute__((weak)) uint32_t smihandler_soc_get_sci_mask(void) +__weak uint32_t smihandler_soc_get_sci_mask(void) { return 0; /* No valid SCI mask for SMI handler */ } @@ -60,7 +61,7 @@ __attribute__((weak)) uint32_t smihandler_soc_get_sci_mask(void) * Needs to implement the mechanism to know if an illegal attempt * has been made to write to the BIOS area. */ -__attribute__((weak)) void smihandler_soc_check_illegal_access( +__weak void smihandler_soc_check_illegal_access( uint32_t tco_sts) { return; @@ -68,13 +69,13 @@ __attribute__((weak)) void smihandler_soc_check_illegal_access( /* Mainboard overrides. */ -__attribute__((weak)) void mainboard_smi_gpi_handler( +__weak void mainboard_smi_gpi_handler( const struct gpi_status *sts) { return; } -__attribute__((weak)) void mainboard_smi_espi_handler(void) +__weak void mainboard_smi_espi_handler(void) { return; } diff --git a/src/soc/intel/common/block/sram/sram.c b/src/soc/intel/common/block/sram/sram.c index 49367e196b..9028952286 100644 --- a/src/soc/intel/common/block/sram/sram.c +++ b/src/soc/intel/common/block/sram/sram.c @@ -14,13 +14,14 @@ * GNU General Public License for more details. */ +#include #include #include #include #include #include -__attribute__((weak)) void soc_sram_init(struct device *dev) { /* no-op */ } +__weak void soc_sram_init(struct device *dev) { /* no-op */ } static void sram_read_resources(struct device *dev) { diff --git a/src/soc/intel/common/block/systemagent/systemagent.c b/src/soc/intel/common/block/systemagent/systemagent.c index 25b47737b1..54646c9595 100644 --- a/src/soc/intel/common/block/systemagent/systemagent.c +++ b/src/soc/intel/common/block/systemagent/systemagent.c @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -25,25 +26,25 @@ #include "systemagent_def.h" /* SoC override function */ -__attribute__((weak)) void soc_systemagent_init(struct device *dev) +__weak void soc_systemagent_init(struct device *dev) { /* no-op */ } -__attribute__((weak)) void soc_add_fixed_mmio_resources(struct device *dev, +__weak void soc_add_fixed_mmio_resources(struct device *dev, int *resource_cnt) { /* no-op */ } -__attribute__((weak)) int soc_get_uncore_prmmr_base_and_mask(uint64_t *base, +__weak int soc_get_uncore_prmmr_base_and_mask(uint64_t *base, uint64_t *mask) { /* return failure for this dummy API */ return -1; } -__attribute__((weak)) size_t soc_reserved_mmio_size(void) +__weak size_t soc_reserved_mmio_size(void) { return 0; } diff --git a/src/soc/intel/common/block/uart/uart.c b/src/soc/intel/common/block/uart/uart.c index 9f26ef1718..cdbe56b519 100644 --- a/src/soc/intel/common/block/uart/uart.c +++ b/src/soc/intel/common/block/uart/uart.c @@ -14,6 +14,7 @@ */ #include +#include #include #include #include @@ -45,7 +46,7 @@ void uart_common_init(device_t dev, uintptr_t baseaddr) uart_lpss_init(baseaddr); } -__attribute__((weak)) device_t pch_uart_get_debug_controller(void) +__weak device_t pch_uart_get_debug_controller(void) { /* * device_t can either be a pointer to struct device (e.g. ramstage) or @@ -78,12 +79,12 @@ bool uart_debug_controller_is_initialized(void) #if ENV_RAMSTAGE -__attribute__((weak)) void pch_uart_read_resources(struct device *dev) +__weak void pch_uart_read_resources(struct device *dev) { pci_dev_read_resources(dev); } -__attribute__((weak)) bool pch_uart_init_debug_controller_on_resume(void) +__weak bool pch_uart_init_debug_controller_on_resume(void) { /* By default, do not initialize controller. */ return false; diff --git a/src/soc/intel/common/block/xdci/xdci.c b/src/soc/intel/common/block/xdci/xdci.c index 07093dfb5e..cc42f2c65c 100644 --- a/src/soc/intel/common/block/xdci/xdci.c +++ b/src/soc/intel/common/block/xdci/xdci.c @@ -15,13 +15,14 @@ */ #include +#include #include #include #include #include #include -__attribute__((weak)) void soc_xdci_init(struct device *dev) { /* no-op */ } +__weak void soc_xdci_init(struct device *dev) { /* no-op */ } /* Only allow xDCI controller in developer mode if VBOOT is enabled */ int xdci_can_enable(void) diff --git a/src/soc/intel/common/block/xhci/xhci.c b/src/soc/intel/common/block/xhci/xhci.c index e5a4f9b692..737c8cfe7e 100644 --- a/src/soc/intel/common/block/xhci/xhci.c +++ b/src/soc/intel/common/block/xhci/xhci.c @@ -14,13 +14,14 @@ * GNU General Public License for more details. */ +#include #include #include #include #include #include -__attribute__((weak)) void soc_xhci_init(struct device *dev) { /* no-op */ } +__weak void soc_xhci_init(struct device *dev) { /* no-op */ } static struct device_operations usb_xhci_ops = { .read_resources = &pci_dev_read_resources, -- cgit v1.2.3