soc/intel/apollolake: Add function to read and clear GPE status
Implement the generic acpi_get_gpe() function to read and clear the GPE status for a specific GPE. Tested by watching GPE status in a loop while generating interrupts manually from the EC console. BUG=chrome-os-partner:53336 Change-Id: I482ff52051a48441333b573f1cd0fa7f7579a6ab Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://review.coreboot.org/16671 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
parent
a673d1cd2d
commit
2e79009503
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
#define __SIMPLE_DEVICE__
|
#define __SIMPLE_DEVICE__
|
||||||
|
|
||||||
|
#include <arch/acpi.h>
|
||||||
#include <arch/io.h>
|
#include <arch/io.h>
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
#include <cbmem.h>
|
#include <cbmem.h>
|
||||||
|
@ -301,6 +302,26 @@ uint32_t clear_gpe_status(void)
|
||||||
return print_gpe_sts(reset_gpe_status());
|
return print_gpe_sts(reset_gpe_status());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Read and clear GPE status (defined in arch/acpi.h) */
|
||||||
|
int acpi_get_gpe(int gpe)
|
||||||
|
{
|
||||||
|
int bank;
|
||||||
|
uint32_t mask, sts;
|
||||||
|
|
||||||
|
if (gpe < 0 || gpe > GPE0_DW3_31)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
bank = gpe / 32;
|
||||||
|
mask = 1 << (gpe % 32);
|
||||||
|
|
||||||
|
sts = inl(ACPI_PMIO_BASE + GPE0_STS(bank));
|
||||||
|
if (sts & mask) {
|
||||||
|
outl(mask, ACPI_PMIO_BASE + GPE0_STS(bank));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void clear_pmc_status(void)
|
void clear_pmc_status(void)
|
||||||
{
|
{
|
||||||
uint32_t prsts;
|
uint32_t prsts;
|
||||||
|
|
Loading…
Reference in New Issue