static void pch_power_options(struct device *dev) { const char *state; /* Get the chip configuration */ int pwr_on = pmc_get_mainboard_power_failure_state_choice(); /* * Which state do we want to goto after g3 (power restored)? * 0 == S5 Soft Off * 1 == S0 Full On * 2 == Keep Previous State */ switch (pwr_on) { case MAINBOARD_POWER_STATE_OFF: state = "off"; break; case MAINBOARD_POWER_STATE_ON: state = "on"; break; case MAINBOARD_POWER_STATE_PREVIOUS: state = "state keep"; break; default: state = "undefined"; } pmc_set_afterg3(dev, pwr_on); printk(BIOS_INFO, "Set power %s after power failure.\n", state); /* Set up GPE configuration. */ pmc_gpe_init(); }
static void pch_power_options(void) { u16 reg16; const char *state; /*PMC Controller Device 0x1F, Func 02*/ device_t dev = PCH_DEV_PMC; /* Get the chip configuration */ config_t *config = dev->chip_info; int pwr_on = CONFIG_MAINBOARD_POWER_ON_AFTER_POWER_FAIL; /* * Which state do we want to goto after g3 (power restored)? * 0 == S0 Full On * 1 == S5 Soft Off * * If the option is not existent (Laptops), use Kconfig setting. */ /*TODO: cmos_layout.bin need to verify; cause wrong CMOS setup*/ //get_option(&pwr_on, "power_on_after_fail"); pwr_on = MAINBOARD_POWER_ON; reg16 = pci_read_config16(dev, GEN_PMCON_B); reg16 &= 0xfffe; switch (pwr_on) { case MAINBOARD_POWER_OFF: reg16 |= 1; state = "off"; break; case MAINBOARD_POWER_ON: reg16 &= ~1; state = "on"; break; case MAINBOARD_POWER_KEEP: reg16 &= ~1; state = "state keep"; break; default: state = "undefined"; } pci_write_config16(dev, GEN_PMCON_B, reg16); printk(BIOS_INFO, "Set power %s after power failure.\n", state); /* Set up GPE configuration. */ pmc_gpe_init(config); }