x86 SMM: Replace weak prototypes with weak function stub
Change-Id: I682617cd2f4310d3e2e2ab6ffec51def28a4779c Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: http://review.coreboot.org/7961 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@google.com> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
parent
b0922f0183
commit
48b3dbc748
|
@ -199,12 +199,9 @@ void smi_handler(u32 smm_revision)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Call chipset specific SMI handlers. */
|
/* Call chipset specific SMI handlers. */
|
||||||
if (cpu_smi_handler)
|
cpu_smi_handler(node, &state_save);
|
||||||
cpu_smi_handler(node, &state_save);
|
northbridge_smi_handler(node, &state_save);
|
||||||
if (northbridge_smi_handler)
|
southbridge_smi_handler(node, &state_save);
|
||||||
northbridge_smi_handler(node, &state_save);
|
|
||||||
if (southbridge_smi_handler)
|
|
||||||
southbridge_smi_handler(node, &state_save);
|
|
||||||
|
|
||||||
smi_restore_pci_address();
|
smi_restore_pci_address();
|
||||||
|
|
||||||
|
@ -215,3 +212,15 @@ void smi_handler(u32 smm_revision)
|
||||||
/* De-assert SMI# signal to allow another SMI */
|
/* De-assert SMI# signal to allow another SMI */
|
||||||
smi_set_eos();
|
smi_set_eos();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Provide a default implementation for all weak handlers so that relocation
|
||||||
|
* entries in the modules make sense. Without default implementations the
|
||||||
|
* weak relocations w/o a symbol have a 0 address which is where the modules
|
||||||
|
* are linked at. */
|
||||||
|
int __attribute__((weak)) mainboard_io_trap_handler(int smif) { return 0; }
|
||||||
|
void __attribute__((weak)) cpu_smi_handler(unsigned int node, smm_state_save_area_t *state_save) {}
|
||||||
|
void __attribute__((weak)) northbridge_smi_handler(unsigned int node, smm_state_save_area_t *state_save) {}
|
||||||
|
void __attribute__((weak)) southbridge_smi_handler(unsigned int node, smm_state_save_area_t *state_save) {}
|
||||||
|
void __attribute__((weak)) mainboard_smi_gpi(u32 gpi_sts) {}
|
||||||
|
int __attribute__((weak)) mainboard_smi_apmc(u8 data) { return 0; }
|
||||||
|
void __attribute__((weak)) mainboard_smi_sleep(u8 slp_typ) {}
|
||||||
|
|
|
@ -467,7 +467,7 @@ void smi_handler(u32 smm_revision);
|
||||||
|
|
||||||
void io_trap_handler(int smif);
|
void io_trap_handler(int smif);
|
||||||
int southbridge_io_trap_handler(int smif);
|
int southbridge_io_trap_handler(int smif);
|
||||||
int __attribute__((weak)) mainboard_io_trap_handler(int smif);
|
int mainboard_io_trap_handler(int smif);
|
||||||
|
|
||||||
void southbridge_smi_set_eos(void);
|
void southbridge_smi_set_eos(void);
|
||||||
|
|
||||||
|
@ -475,18 +475,14 @@ void southbridge_smi_set_eos(void);
|
||||||
void cpu_smi_handler(void);
|
void cpu_smi_handler(void);
|
||||||
void northbridge_smi_handler(void);
|
void northbridge_smi_handler(void);
|
||||||
void southbridge_smi_handler(void);
|
void southbridge_smi_handler(void);
|
||||||
|
#else
|
||||||
|
void cpu_smi_handler(unsigned int node, smm_state_save_area_t *state_save);
|
||||||
|
void northbridge_smi_handler(unsigned int node, smm_state_save_area_t *state_save);
|
||||||
|
void southbridge_smi_handler(unsigned int node, smm_state_save_area_t *state_save);
|
||||||
|
#endif /* CONFIG_SMM_MODULES */
|
||||||
void mainboard_smi_gpi(u32 gpi_sts);
|
void mainboard_smi_gpi(u32 gpi_sts);
|
||||||
int mainboard_smi_apmc(u8 data);
|
int mainboard_smi_apmc(u8 data);
|
||||||
void mainboard_smi_sleep(u8 slp_typ);
|
void mainboard_smi_sleep(u8 slp_typ);
|
||||||
#else
|
|
||||||
void __attribute__((weak)) cpu_smi_handler(unsigned int node, smm_state_save_area_t *state_save);
|
|
||||||
void __attribute__((weak)) northbridge_smi_handler(unsigned int node, smm_state_save_area_t *state_save);
|
|
||||||
void __attribute__((weak)) southbridge_smi_handler(unsigned int node, smm_state_save_area_t *state_save);
|
|
||||||
|
|
||||||
void __attribute__((weak)) mainboard_smi_gpi(u32 gpi_sts);
|
|
||||||
int __attribute__((weak)) mainboard_smi_apmc(u8 data);
|
|
||||||
void __attribute__((weak)) mainboard_smi_sleep(u8 slp_typ);
|
|
||||||
#endif /* CONFIG_SMM_MODULES */
|
|
||||||
|
|
||||||
#if !CONFIG_SMM_TSEG
|
#if !CONFIG_SMM_TSEG
|
||||||
void smi_release_lock(void);
|
void smi_release_lock(void);
|
||||||
|
|
|
@ -41,8 +41,7 @@ static void hudson_apmc_smi_handler(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mainboard_smi_apmc)
|
mainboard_smi_apmc(cmd);
|
||||||
mainboard_smi_apmc(cmd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int southbridge_io_trap_handler(int smif)
|
int southbridge_io_trap_handler(int smif)
|
||||||
|
@ -66,8 +65,7 @@ static void process_gpe_smi(void)
|
||||||
/* Only Bits [23:0] indicate GEVENT SMIs. */
|
/* Only Bits [23:0] indicate GEVENT SMIs. */
|
||||||
if (status & gevent_mask) {
|
if (status & gevent_mask) {
|
||||||
/* A GEVENT SMI occurred */
|
/* A GEVENT SMI occurred */
|
||||||
if (mainboard_smi_gpi)
|
mainboard_smi_gpi(status & gevent_mask);
|
||||||
mainboard_smi_gpi(status & gevent_mask);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clear events to prevent re-entering SMI if event isn't handled */
|
/* Clear events to prevent re-entering SMI if event isn't handled */
|
||||||
|
|
|
@ -41,8 +41,7 @@ static void hudson_apmc_smi_handler(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mainboard_smi_apmc)
|
mainboard_smi_apmc(cmd);
|
||||||
mainboard_smi_apmc(cmd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int southbridge_io_trap_handler(int smif)
|
int southbridge_io_trap_handler(int smif)
|
||||||
|
@ -66,8 +65,7 @@ static void process_gpe_smi(void)
|
||||||
/* Only Bits [23:0] indicate GEVENT SMIs. */
|
/* Only Bits [23:0] indicate GEVENT SMIs. */
|
||||||
if (status & gevent_mask) {
|
if (status & gevent_mask) {
|
||||||
/* A GEVENT SMI occured */
|
/* A GEVENT SMI occured */
|
||||||
if (mainboard_smi_gpi)
|
mainboard_smi_gpi(status & gevent_mask);
|
||||||
mainboard_smi_gpi(status & gevent_mask);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clear events to prevent re-entering SMI if event isn't handled */
|
/* Clear events to prevent re-entering SMI if event isn't handled */
|
||||||
|
|
|
@ -419,8 +419,7 @@ static void southbridge_smi_sleep(unsigned int node, smm_state_save_area_t *stat
|
||||||
|
|
||||||
/* Do any mainboard sleep handling */
|
/* Do any mainboard sleep handling */
|
||||||
tseg_relocate((void **)&mainboard_sleep);
|
tseg_relocate((void **)&mainboard_sleep);
|
||||||
if (mainboard_sleep)
|
mainboard_sleep(slp_typ-2);
|
||||||
mainboard_sleep(slp_typ-2);
|
|
||||||
|
|
||||||
#if CONFIG_ELOG_GSMI
|
#if CONFIG_ELOG_GSMI
|
||||||
/* Log S3, S4, and S5 entry */
|
/* Log S3, S4, and S5 entry */
|
||||||
|
@ -607,8 +606,7 @@ static void southbridge_smi_apmc(unsigned int node, smm_state_save_area_t *state
|
||||||
}
|
}
|
||||||
|
|
||||||
tseg_relocate((void **)&mainboard_apmc);
|
tseg_relocate((void **)&mainboard_apmc);
|
||||||
if (mainboard_apmc)
|
mainboard_apmc(reg8);
|
||||||
mainboard_apmc(reg8);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void southbridge_smi_pm1(unsigned int node, smm_state_save_area_t *state_save)
|
static void southbridge_smi_pm1(unsigned int node, smm_state_save_area_t *state_save)
|
||||||
|
@ -650,12 +648,10 @@ static void southbridge_smi_gpi(unsigned int node, smm_state_save_area_t *state_
|
||||||
reg16 &= inw(pmbase + ALT_GP_SMI_EN);
|
reg16 &= inw(pmbase + ALT_GP_SMI_EN);
|
||||||
|
|
||||||
tseg_relocate((void **)&mainboard_gpi);
|
tseg_relocate((void **)&mainboard_gpi);
|
||||||
if (mainboard_gpi) {
|
mainboard_gpi(reg16);
|
||||||
mainboard_gpi(reg16);
|
|
||||||
} else {
|
if (reg16)
|
||||||
if (reg16)
|
printk(BIOS_DEBUG, "GPI (mask %04x)\n", reg16);
|
||||||
printk(BIOS_DEBUG, "GPI (mask %04x)\n", reg16);
|
|
||||||
}
|
|
||||||
|
|
||||||
outw(reg16, pmbase + ALT_GP_SMI_STS);
|
outw(reg16, pmbase + ALT_GP_SMI_STS);
|
||||||
}
|
}
|
||||||
|
|
|
@ -353,8 +353,7 @@ static void southbridge_smi_sleep(unsigned int node, smm_state_save_area_t *stat
|
||||||
|
|
||||||
/* Do any mainboard sleep handling */
|
/* Do any mainboard sleep handling */
|
||||||
tseg_relocate((void **)&mainboard_sleep);
|
tseg_relocate((void **)&mainboard_sleep);
|
||||||
if (mainboard_sleep)
|
mainboard_sleep(slp_typ-2);
|
||||||
mainboard_sleep(slp_typ-2);
|
|
||||||
|
|
||||||
#if CONFIG_ELOG_GSMI
|
#if CONFIG_ELOG_GSMI
|
||||||
/* Log S3, S4, and S5 entry */
|
/* Log S3, S4, and S5 entry */
|
||||||
|
@ -541,8 +540,7 @@ static void southbridge_smi_apmc(unsigned int node, smm_state_save_area_t *state
|
||||||
}
|
}
|
||||||
|
|
||||||
tseg_relocate((void **)&mainboard_apmc);
|
tseg_relocate((void **)&mainboard_apmc);
|
||||||
if (mainboard_apmc)
|
mainboard_apmc(reg8);
|
||||||
mainboard_apmc(reg8);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void southbridge_smi_pm1(unsigned int node, smm_state_save_area_t *state_save)
|
static void southbridge_smi_pm1(unsigned int node, smm_state_save_area_t *state_save)
|
||||||
|
@ -584,12 +582,10 @@ static void southbridge_smi_gpi(unsigned int node, smm_state_save_area_t *state_
|
||||||
reg16 &= inw(pmbase + ALT_GP_SMI_EN);
|
reg16 &= inw(pmbase + ALT_GP_SMI_EN);
|
||||||
|
|
||||||
tseg_relocate((void **)&mainboard_gpi);
|
tseg_relocate((void **)&mainboard_gpi);
|
||||||
if (mainboard_gpi) {
|
mainboard_gpi(reg16);
|
||||||
mainboard_gpi(reg16);
|
|
||||||
} else {
|
if (reg16)
|
||||||
if (reg16)
|
printk(BIOS_DEBUG, "GPI (mask %04x)\n",reg16);
|
||||||
printk(BIOS_DEBUG, "GPI (mask %04x)\n",reg16);
|
|
||||||
}
|
|
||||||
|
|
||||||
outw(reg16, pmbase + ALT_GP_SMI_STS);
|
outw(reg16, pmbase + ALT_GP_SMI_STS);
|
||||||
}
|
}
|
||||||
|
|
|
@ -441,12 +441,10 @@ static void southbridge_smi_gpi(unsigned int node, smm_state_save_area_t *state_
|
||||||
|
|
||||||
reg16 &= inw(pmbase + ALT_GP_SMI_EN);
|
reg16 &= inw(pmbase + ALT_GP_SMI_EN);
|
||||||
|
|
||||||
if (mainboard_smi_gpi) {
|
mainboard_smi_gpi(reg16);
|
||||||
mainboard_smi_gpi(reg16);
|
|
||||||
} else {
|
if (reg16)
|
||||||
if (reg16)
|
printk(BIOS_DEBUG, "GPI (mask %04x)\n",reg16);
|
||||||
printk(BIOS_DEBUG, "GPI (mask %04x)\n",reg16);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void southbridge_smi_mc(unsigned int node, smm_state_save_area_t *state_save)
|
static void southbridge_smi_mc(unsigned int node, smm_state_save_area_t *state_save)
|
||||||
|
|
|
@ -369,7 +369,7 @@ static void southbridge_smi_apmc(unsigned int node, smm_state_save_area_t *state
|
||||||
/* Emulate B2 register as the FADT / Linux expects it */
|
/* Emulate B2 register as the FADT / Linux expects it */
|
||||||
|
|
||||||
reg8 = inb(APM_CNT);
|
reg8 = inb(APM_CNT);
|
||||||
if (mainboard_smi_apmc && mainboard_smi_apmc(reg8))
|
if (mainboard_smi_apmc(reg8))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (reg8) {
|
switch (reg8) {
|
||||||
|
@ -454,12 +454,10 @@ static void southbridge_smi_gpi(unsigned int node, smm_state_save_area_t *state_
|
||||||
|
|
||||||
reg16 &= inw(pmbase + ALT_GP_SMI_EN);
|
reg16 &= inw(pmbase + ALT_GP_SMI_EN);
|
||||||
|
|
||||||
if (mainboard_smi_gpi) {
|
mainboard_smi_gpi(reg16);
|
||||||
mainboard_smi_gpi(reg16);
|
|
||||||
} else {
|
if (reg16)
|
||||||
if (reg16)
|
printk(BIOS_DEBUG, "GPI (mask %04x)\n",reg16);
|
||||||
printk(BIOS_DEBUG, "GPI (mask %04x)\n",reg16);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void southbridge_smi_mc(unsigned int node, smm_state_save_area_t *state_save)
|
static void southbridge_smi_mc(unsigned int node, smm_state_save_area_t *state_save)
|
||||||
|
|
|
@ -235,7 +235,7 @@ static void southbridge_smi_apmc(unsigned int node, smm_state_save_area_t *state
|
||||||
/* Emulate B2 register as the FADT / Linux expects it */
|
/* Emulate B2 register as the FADT / Linux expects it */
|
||||||
|
|
||||||
reg8 = inb(APM_CNT);
|
reg8 = inb(APM_CNT);
|
||||||
if (mainboard_smi_apmc && mainboard_smi_apmc(reg8))
|
if (mainboard_smi_apmc(reg8))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (reg8) {
|
switch (reg8) {
|
||||||
|
@ -322,12 +322,10 @@ static void southbridge_smi_gpi(unsigned int node, smm_state_save_area_t *state_
|
||||||
|
|
||||||
reg16 &= inw(pmbase + ALT_GP_SMI_EN);
|
reg16 &= inw(pmbase + ALT_GP_SMI_EN);
|
||||||
|
|
||||||
if (mainboard_smi_gpi) {
|
mainboard_smi_gpi(reg16);
|
||||||
mainboard_smi_gpi(reg16);
|
|
||||||
} else {
|
if (reg16)
|
||||||
if (reg16)
|
printk(BIOS_DEBUG, "GPI (mask %04x)\n",reg16);
|
||||||
printk(BIOS_DEBUG, "GPI (mask %04x)\n",reg16);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -419,8 +419,7 @@ static void southbridge_smi_sleep(unsigned int node, smm_state_save_area_t *stat
|
||||||
|
|
||||||
/* Do any mainboard sleep handling */
|
/* Do any mainboard sleep handling */
|
||||||
tseg_relocate((void **)&mainboard_sleep);
|
tseg_relocate((void **)&mainboard_sleep);
|
||||||
if (mainboard_sleep)
|
mainboard_sleep(slp_typ-2);
|
||||||
mainboard_sleep(slp_typ-2);
|
|
||||||
|
|
||||||
#if CONFIG_ELOG_GSMI
|
#if CONFIG_ELOG_GSMI
|
||||||
/* Log S3, S4, and S5 entry */
|
/* Log S3, S4, and S5 entry */
|
||||||
|
@ -607,8 +606,7 @@ static void southbridge_smi_apmc(unsigned int node, smm_state_save_area_t *state
|
||||||
}
|
}
|
||||||
|
|
||||||
tseg_relocate((void **)&mainboard_apmc);
|
tseg_relocate((void **)&mainboard_apmc);
|
||||||
if (mainboard_apmc)
|
mainboard_apmc(reg8);
|
||||||
mainboard_apmc(reg8);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void southbridge_smi_pm1(unsigned int node, smm_state_save_area_t *state_save)
|
static void southbridge_smi_pm1(unsigned int node, smm_state_save_area_t *state_save)
|
||||||
|
@ -650,12 +648,10 @@ static void southbridge_smi_gpi(unsigned int node, smm_state_save_area_t *state_
|
||||||
reg16 &= inw(pmbase + ALT_GP_SMI_EN);
|
reg16 &= inw(pmbase + ALT_GP_SMI_EN);
|
||||||
|
|
||||||
tseg_relocate((void **)&mainboard_gpi);
|
tseg_relocate((void **)&mainboard_gpi);
|
||||||
if (mainboard_gpi) {
|
mainboard_gpi(reg16);
|
||||||
mainboard_gpi(reg16);
|
|
||||||
} else {
|
if (reg16)
|
||||||
if (reg16)
|
printk(BIOS_DEBUG, "GPI (mask %04x)\n",reg16);
|
||||||
printk(BIOS_DEBUG, "GPI (mask %04x)\n",reg16);
|
|
||||||
}
|
|
||||||
|
|
||||||
outw(reg16, pmbase + ALT_GP_SMI_STS);
|
outw(reg16, pmbase + ALT_GP_SMI_STS);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue