blob: 5edcf1371597727bb7f5b36469d7e81e422317ab [file] [log] [blame]
Martin Rothbf6b83a2015-10-11 10:37:02 +02001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2008-2009 coresystems GmbH
5 * Copyright (C) 2013 Sage Electronic Engineering, LLC.
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.
Martin Rothbf6b83a2015-10-11 10:37:02 +020015 */
16
Aaron Durbin30b0c7a2016-07-13 13:01:13 -050017#include <arch/acpi.h>
Martin Rothbf6b83a2015-10-11 10:37:02 +020018#include <arch/io.h>
19#include <console/console.h>
20#include <cpu/x86/smm.h>
21#include <southbridge/intel/fsp_bd82x6x/nvs.h>
22#include <southbridge/intel/fsp_bd82x6x/pch.h>
23#include <southbridge/intel/fsp_bd82x6x/me.h>
24#include <northbridge/intel/fsp_sandybridge/sandybridge.h>
25#include <cpu/intel/fsp_model_206ax/model_206ax.h>
26
27/*
28 * Change LED_POWER# (SIO GPIO 45) state based on sleep type.
29 * The IO address is hardcoded as we don't have device path in SMM.
30 */
31#define SIO_GPIO_BASE_SET4 (0x730 + 3)
32#define SIO_GPIO_BLINK_GPIO45 0x25
33void mainboard_smi_sleep(u8 slp_typ)
34{
35 u8 reg8;
36
37 switch (slp_typ) {
Aaron Durbin30b0c7a2016-07-13 13:01:13 -050038 case ACPI_S3:
39 case ACPI_S4:
Martin Rothbf6b83a2015-10-11 10:37:02 +020040 break;
41
Aaron Durbin30b0c7a2016-07-13 13:01:13 -050042 case ACPI_S5:
Martin Rothbf6b83a2015-10-11 10:37:02 +020043 /* Turn off LED */
44 reg8 = inb(SIO_GPIO_BASE_SET4);
45 reg8 |= (1 << 5);
46 outb(reg8, SIO_GPIO_BASE_SET4);
47 break;
48 }
49}
50
51
52static int mainboard_finalized = 0;
53
54int mainboard_smi_apmc(u8 apmc)
55{
56 switch (apmc) {
57 case APM_CNT_FINALIZE:
58 if (mainboard_finalized) {
59 printk(BIOS_DEBUG, "SMI#: Already finalized\n");
60 return 0;
61 }
62
63 intel_me_finalize_smm();
64 intel_pch_finalize_smm();
65 intel_sandybridge_finalize_smm();
66 intel_model_206ax_finalize_smm();
67
68 mainboard_finalized = 1;
69 break;
70 }
71 return 0;
72}