Esempio n. 1
0
/* Fill power state structure from ACPI PM registers */
struct chipset_power_state *fill_power_state(void)
{
    uint16_t tcobase;
    uint8_t *pmc;
    struct chipset_power_state *ps = car_get_var_ptr(&power_state);

    tcobase = pmc_tco_regs();

    ps->pm1_sts = inw(ACPI_BASE_ADDRESS + PM1_STS);
    ps->pm1_en = inw(ACPI_BASE_ADDRESS + PM1_EN);
    ps->pm1_cnt = inl(ACPI_BASE_ADDRESS + PM1_CNT);
    ps->tco1_sts = inw(tcobase + TCO1_STS);
    ps->tco2_sts = inw(tcobase + TCO2_STS);
    ps->gpe0_sts[0] = inl(ACPI_BASE_ADDRESS + GPE0_STS(0));
    ps->gpe0_sts[1] = inl(ACPI_BASE_ADDRESS + GPE0_STS(1));
    ps->gpe0_sts[2] = inl(ACPI_BASE_ADDRESS + GPE0_STS(2));
    ps->gpe0_sts[3] = inl(ACPI_BASE_ADDRESS + GPE0_STS(3));
    ps->gpe0_en[0] = inl(ACPI_BASE_ADDRESS + GPE0_EN(0));
    ps->gpe0_en[1] = inl(ACPI_BASE_ADDRESS + GPE0_EN(1));
    ps->gpe0_en[2] = inl(ACPI_BASE_ADDRESS + GPE0_EN(2));
    ps->gpe0_en[3] = inl(ACPI_BASE_ADDRESS + GPE0_EN(3));

    ps->gen_pmcon_a = pci_read_config32(PCH_DEV_PMC, GEN_PMCON_A);
    ps->gen_pmcon_b = pci_read_config32(PCH_DEV_PMC, GEN_PMCON_B);

    pmc = pmc_mmio_regs();
    ps->gblrst_cause[0] = read32(pmc + GBLRST_CAUSE0);
    ps->gblrst_cause[1] = read32(pmc + GBLRST_CAUSE1);

    ps->prev_sleep_state = prev_sleep_state(ps);

    dump_power_state(ps);

    return ps;
}
Esempio n. 2
0
/* Fill power state structure from ACPI PM registers */
void power_state_get(struct udevice *pch_dev, struct chipset_power_state *ps)
{
    ps->pm1_sts = inw(ACPI_BASE_ADDRESS + PM1_STS);
    ps->pm1_en = inw(ACPI_BASE_ADDRESS + PM1_EN);
    ps->pm1_cnt = inl(ACPI_BASE_ADDRESS + PM1_CNT);
    ps->tco1_sts = inw(ACPI_BASE_ADDRESS + TCO1_STS);
    ps->tco2_sts = inw(ACPI_BASE_ADDRESS + TCO2_STS);
    ps->gpe0_sts[0] = inl(ACPI_BASE_ADDRESS + GPE0_STS(0));
    ps->gpe0_sts[1] = inl(ACPI_BASE_ADDRESS + GPE0_STS(1));
    ps->gpe0_sts[2] = inl(ACPI_BASE_ADDRESS + GPE0_STS(2));
    ps->gpe0_sts[3] = inl(ACPI_BASE_ADDRESS + GPE0_STS(3));
    ps->gpe0_en[0] = inl(ACPI_BASE_ADDRESS + GPE0_EN(0));
    ps->gpe0_en[1] = inl(ACPI_BASE_ADDRESS + GPE0_EN(1));
    ps->gpe0_en[2] = inl(ACPI_BASE_ADDRESS + GPE0_EN(2));
    ps->gpe0_en[3] = inl(ACPI_BASE_ADDRESS + GPE0_EN(3));

    dm_pci_read_config16(pch_dev, GEN_PMCON_1, &ps->gen_pmcon1);
    dm_pci_read_config16(pch_dev, GEN_PMCON_2, &ps->gen_pmcon2);
    dm_pci_read_config16(pch_dev, GEN_PMCON_3, &ps->gen_pmcon3);

    ps->prev_sleep_state = prev_sleep_state(ps);

    dump_power_state(ps);
}