mb/asus/p5gc-mx: Add mainboard
[coreboot.git] / src / mainboard / google / rikku / smihandler.c
blob4331a1fe688f1f4ad41673d8cfe731e0d2552008
1 /*
2 * This file is part of the coreboot project.
4 * Copyright (C) 2008-2009 coresystems GmbH
5 * Copyright 2014 Google Inc.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
17 #include <arch/acpi.h>
18 #include <arch/io.h>
19 #include <console/console.h>
20 #include <cpu/x86/smm.h>
21 #include <soc/pm.h>
22 #include <soc/smm.h>
23 #include <elog.h>
24 #include <ec/google/chromeec/ec.h>
25 #include <soc/gpio.h>
26 #include <soc/iomap.h>
27 #include <soc/nvs.h>
28 #include <soc/pm.h>
29 #include <soc/smm.h>
30 #include <superio/ite/it8772f/it8772f.h>
31 #include "onboard.h"
33 int mainboard_io_trap_handler(int smif)
35 switch (smif) {
36 case 0x99:
37 printk(BIOS_DEBUG, "Sample\n");
38 smm_get_gnvs()->smif = 0;
39 break;
40 default:
41 return 0;
44 /* On success, the IO Trap Handler returns 0
45 * On failure, the IO Trap Handler returns a value != 0
47 * For now, we force the return value to 0 and log all traps to
48 * see what's going on.
50 return 1;
53 /* gpi_sts is GPIO 47:32 */
54 void mainboard_smi_gpi(u32 gpi_sts)
58 void mainboard_smi_sleep(u8 slp_typ)
60 /* Disable USB charging if required */
61 switch (slp_typ) {
62 case ACPI_S3:
63 it8772f_gpio_led(IT8772F_GPIO_DEV, 1 /* set */, 0x01 /* select */,
64 0x01 /* polarity */, 0x01 /* 1=pullup */,
65 0x01 /* output */, 0x00, /* 0=Alternate function */
66 SIO_GPIO_BLINK_GPIO10, IT8772F_GPIO_BLINK_FREQUENCY_1_HZ);
67 break;
68 case ACPI_S5:
69 it8772f_gpio_led(IT8772F_GPIO_DEV, 1 /* set */, 0x01 /* select */,
70 0x00 /* polarity: non-inverting */, 0x00 /* 0=pulldown */,
71 0x01 /* output */, 0x01 /* 1=Simple IO function */,
72 SIO_GPIO_BLINK_GPIO10, IT8772F_GPIO_BLINK_FREQUENCY_1_HZ);
73 break;
74 default:
75 break;
77 return;
80 int mainboard_smi_apmc(u8 apmc)
82 switch (apmc) {
83 case APM_CNT_ACPI_ENABLE:
84 break;
85 case APM_CNT_ACPI_DISABLE:
86 break;
88 return 0;