blob: 82433542990fe9a3d79fb5ee7de69e6666733e69 [file] [log] [blame]
Patrick Georgi04746fc2015-06-05 18:53:43 +02001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2008-2009 coresystems GmbH
5 * Copyright 2014 Google Inc.
6 *
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.
10 *
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.
Patrick Georgi04746fc2015-06-05 18:53:43 +020015 */
16
Aaron Durbin30b0c7a2016-07-13 13:01:13 -050017#include <arch/acpi.h>
Patrick Georgi04746fc2015-06-05 18:53:43 +020018#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>
Matt DeVillier0148fcb2016-12-17 17:13:23 -060030#include "onboard.h"
Patrick Georgi04746fc2015-06-05 18:53:43 +020031
32int mainboard_io_trap_handler(int smif)
33{
34 switch (smif) {
35 case 0x99:
36 printk(BIOS_DEBUG, "Sample\n");
37 smm_get_gnvs()->smif = 0;
38 break;
39 default:
40 return 0;
41 }
42
43 /* On success, the IO Trap Handler returns 0
44 * On failure, the IO Trap Handler returns a value != 0
45 *
46 * For now, we force the return value to 0 and log all traps to
47 * see what's going on.
48 */
49 return 1;
50}
51
52/* gpi_sts is GPIO 47:32 */
53void mainboard_smi_gpi(u32 gpi_sts)
54{
55}
56
57void mainboard_smi_sleep(u8 slp_typ)
58{
59 /* Disable USB charging if required */
60 switch (slp_typ) {
Aaron Durbin30b0c7a2016-07-13 13:01:13 -050061 case ACPI_S3:
Matt DeVillier0148fcb2016-12-17 17:13:23 -060062 set_power_led(LED_BLINK);
63
64 /* Enable DCP mode */
65 if (IS_ENABLED(CONFIG_BOARD_GOOGLE_TIDUS)) {
66 set_gpio(GPIO_USB_CTL_1, 0);
67 }
Patrick Georgi04746fc2015-06-05 18:53:43 +020068 break;
Aaron Durbin30b0c7a2016-07-13 13:01:13 -050069 case ACPI_S5:
Matt DeVillier0148fcb2016-12-17 17:13:23 -060070 set_power_led(LED_OFF);
Patrick Georgi04746fc2015-06-05 18:53:43 +020071 break;
72 }
73}
74
75int mainboard_smi_apmc(u8 apmc)
76{
77 switch (apmc) {
78 case APM_CNT_ACPI_ENABLE:
79 break;
80 case APM_CNT_ACPI_DISABLE:
81 break;
82 }
83 return 0;
84}