soc/amd/stoneyridge: use new ACPI helper functions from common
Transition the current call sequence to using the newly added common ACPI helper functions. Semantically, the expectations are that this sequence is the equivalent of previous acpi_clear_pm1_status(). BUG=b:159947207 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Change-Id: Id3ae19013c68d2c97b084046f600596ecc462374 Reviewed-on: https://review.coreboot.org/c/coreboot/+/44483 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
parent
a244eb3dad
commit
5a5e4d05eb
|
@ -501,59 +501,36 @@ static void sb_init_acpi_ports(void)
|
||||||
PM_ACPI_TIMER_EN_EN);
|
PM_ACPI_TIMER_EN_EN);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_index_bit(uint32_t value, uint16_t limit)
|
|
||||||
{
|
|
||||||
uint16_t i;
|
|
||||||
uint32_t t;
|
|
||||||
|
|
||||||
if (limit >= TOTAL_BITS(uint32_t))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
/* get a mask of valid bits. Ex limit = 3, set bits 0-2 */
|
|
||||||
t = (1 << limit) - 1;
|
|
||||||
if ((value & t) == 0)
|
|
||||||
return -1;
|
|
||||||
t = 1;
|
|
||||||
for (i = 0; i < limit; i++) {
|
|
||||||
if (value & t)
|
|
||||||
break;
|
|
||||||
t <<= 1;
|
|
||||||
}
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void set_nvs_sws(void *unused)
|
static void set_nvs_sws(void *unused)
|
||||||
{
|
{
|
||||||
struct soc_power_reg *sws;
|
struct acpi_pm_gpe_state *state;
|
||||||
struct global_nvs *gnvs;
|
struct global_nvs *gnvs;
|
||||||
int index;
|
|
||||||
|
|
||||||
sws = cbmem_find(CBMEM_ID_POWER_STATE);
|
state = cbmem_find(CBMEM_ID_POWER_STATE);
|
||||||
if (sws == NULL)
|
if (state == NULL)
|
||||||
return;
|
return;
|
||||||
gnvs = acpi_get_gnvs();
|
gnvs = acpi_get_gnvs();
|
||||||
if (gnvs == NULL)
|
if (gnvs == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
index = get_index_bit(sws->pm1_sts & sws->pm1_en, PM1_LIMIT);
|
acpi_fill_gnvs(gnvs, state);
|
||||||
if (index < 0)
|
|
||||||
gnvs->pm1i = ~0ULL;
|
|
||||||
else
|
|
||||||
gnvs->pm1i = index;
|
|
||||||
|
|
||||||
index = get_index_bit(sws->gpe0_sts & sws->gpe0_en, GPE0_LIMIT);
|
|
||||||
if (index < 0)
|
|
||||||
gnvs->gpei = ~0ULL;
|
|
||||||
else
|
|
||||||
gnvs->gpei = index;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOT_STATE_INIT_ENTRY(BS_OS_RESUME, BS_ON_ENTRY, set_nvs_sws, NULL);
|
BOOT_STATE_INIT_ENTRY(BS_OS_RESUME, BS_ON_ENTRY, set_nvs_sws, NULL);
|
||||||
|
|
||||||
void southbridge_init(void *chip_info)
|
void southbridge_init(void *chip_info)
|
||||||
{
|
{
|
||||||
|
struct acpi_pm_gpe_state *state;
|
||||||
|
|
||||||
sb_init_acpi_ports();
|
sb_init_acpi_ports();
|
||||||
acpi_clear_pm1_status();
|
|
||||||
|
state = cbmem_add(CBMEM_ID_POWER_STATE, sizeof(*state));
|
||||||
|
if (state) {
|
||||||
|
acpi_fill_pm_gpe_state(state);
|
||||||
|
acpi_pm_gpe_add_events_print_events(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
acpi_clear_pm_gpe_status();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_sb_final_nvs(void)
|
static void set_sb_final_nvs(void)
|
||||||
|
|
Loading…
Reference in New Issue