void ec_mem_write(u8 addr, u8 data) { ec_write_cmd(EC_CMD_WRITE_RAM); ec_write_ib(addr); ec_write_ib(data); return; }
void mainboard_suspend_resume(void) { /* Call SMM finalize() handlers before resume */ outb(0xcb, 0xb2); /* Stout EC needs to be put back in ACPI mode */ ec_write_cmd(EC_CMD_NOTIFY_ACPI_ENTER); }
int mainboard_smi_apmc(u8 apmc) { printk(BIOS_DEBUG, "mainboard_smi_apmc: %x\n", apmc); switch (apmc) { case APMC_ACPI_EN: printk(BIOS_DEBUG, "APMC: ACPI_EN\n"); /* Clear all pending events and enable SCI */ ec_write_cmd(EC_CMD_ENABLE_ACPI_MODE); break; case APMC_ACPI_DIS: printk(BIOS_DEBUG, "APMC: ACPI_DIS\n"); /* Clear all pending events and tell the EC that ACPI is disabled */ ec_write_cmd(EC_CMD_DISABLE_ACPI_MODE); break; } return 0; }
u8 ec_it8518_get_event(void) { u8 cmd = 0; u8 status = inb(EC_SC); if (status & SCI_EVT) { ec_write_cmd(QR_EC); cmd = ec_read_ob(); } else if ( status & SMI_EVT) { ec_kbc_write_cmd(EC_KBD_SMI_EVENT); cmd = ec_kbc_read_ob(); } return cmd; }
/* * The Stout EC needs to be reset to RW mode. It is important that * the RTC_PWR_STS is not set until ramstage EC init. */ static void early_ec_init(void) { u8 ec_status = ec_read(EC_STATUS_REG); int rec_mode = get_recovery_mode_switch(); if (((ec_status & 0x3) == EC_IN_RO_MODE) || ((ec_status & 0x3) == EC_IN_RECOVERY_MODE)) { printk(BIOS_DEBUG, "EC Cold Boot Detected\n"); if (!rec_mode) { /* * Tell EC to exit RO mode */ printk(BIOS_DEBUG, "EC will exit RO mode and boot normally\n"); ec_write_cmd(EC_CMD_EXIT_BOOT_BLOCK); die("wait for ec to reset"); } } else { printk(BIOS_DEBUG, "EC Warm Boot Detected\n"); ec_write_cmd(EC_CMD_WARM_RESET); } }
void ec_write(u16 addr, u8 data) { ec_write_cmd(WR_EC); ec_write_ib(addr); ec_write_ib(data); }
u8 ec_read(u16 addr) { ec_write_cmd(RD_EC); ec_write_ib(addr); return ec_read_ob(); }
/* * These functions are for accessing the ENE932 device RAM space */ u8 ec_mem_read(u8 addr) { ec_write_cmd(EC_CMD_READ_RAM); ec_write_ib(addr); return ec_read_ob(); }
void mainboard_suspend_resume(void) { /* Stout EC needs to be put back in ACPI mode */ ec_write_cmd(EC_CMD_NOTIFY_ACPI_ENTER); }