| 1 |
|
| 2 |
|
| 3 |
#include <arch/io.h> |
| 4 |
#include <console/console.h> |
| 5 |
#include <cpu/x86/smm.h> |
| 6 |
#include <ec/acpi/ec.h> |
| 7 |
#include <ec/lenovo/h8/h8.h> |
| 8 |
#include <southbridge/intel/bd82x6x/pch.h> |
| 9 |
#include <southbridge/intel/common/pmutil.h> |
| 10 |
|
| 11 |
#define GPE_EC_SCI 1 |
| 12 |
#define GPE_EC_WAKE 13 |
| 13 |
|
| 14 |
static void mainboard_smi_handle_ec_sci(void) |
| 15 |
{ |
| 16 |
u8 status = inb(EC_SC); |
| 17 |
u8 event; |
| 18 |
|
| 19 |
if (!(status & EC_SCI_EVT)) |
| 20 |
return; |
| 21 |
|
| 22 |
event = ec_query(); |
| 23 |
printk(BIOS_DEBUG, "EC event %#02x\n", event); |
| 24 |
} |
| 25 |
|
| 26 |
void mainboard_smi_gpi(u32 gpi_sts) |
| 27 |
{ |
| 28 |
if (gpi_sts & (1 << GPE_EC_SCI)) |
| 29 |
mainboard_smi_handle_ec_sci(); |
| 30 |
} |
| 31 |
|
| 32 |
int mainboard_smi_apmc(u8 data) |
| 33 |
{ |
| 34 |
switch (data) { |
| 35 |
case APM_CNT_ACPI_ENABLE: |
| 36 |
|
| 37 |
ec_set_ports(0x1604, 0x1600); |
| 38 |
|
| 39 |
gpi_route_interrupt(GPE_EC_SCI, GPI_IS_SCI); |
| 40 |
|
| 41 |
ec_write(0x80, 0x01); |
| 42 |
break; |
| 43 |
case APM_CNT_ACPI_DISABLE: |
| 44 |
|
| 45 |
|
| 46 |
ec_set_ports(0x66, 0x62); |
| 47 |
|
| 48 |
gpi_route_interrupt(GPE_EC_SCI, GPI_IS_SMI); |
| 49 |
|
| 50 |
ec_write(0x80, 0x01); |
| 51 |
break; |
| 52 |
default: |
| 53 |
break; |
| 54 |
} |
| 55 |
return 0; |
| 56 |
} |
| 57 |
|
| 58 |
void mainboard_smi_sleep(u8 slp_typ) |
| 59 |
{ |
| 60 |
if (slp_typ == 3) { |
| 61 |
u8 ec_wake = ec_read(0x32); |
| 62 |
|
| 63 |
if (ec_wake & 0x14) { |
| 64 |
|
| 65 |
gpi_route_interrupt(GPE_EC_WAKE, GPI_IS_SCI); |
| 66 |
} |
| 67 |
} |
| 68 |
} |