blob: 229085d16185c23ca56c37d02c4ed83cc1f8638d [file] [log] [blame]
Aaron Durbinf6933a62012-10-30 09:09:39 -05001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2008-2009 coresystems GmbH
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
Aaron Durbinf6933a62012-10-30 09:09:39 -050014 */
15
Aaron Durbin30b0c7a2016-07-13 13:01:13 -050016#include <arch/acpi.h>
Aaron Durbinf6933a62012-10-30 09:09:39 -050017#include <arch/io.h>
Aaron Durbinf6933a62012-10-30 09:09:39 -050018#include <console/console.h>
19#include <cpu/x86/smm.h>
20#include <southbridge/intel/lynxpoint/nvs.h>
21#include <southbridge/intel/lynxpoint/pch.h>
22#include <southbridge/intel/lynxpoint/me.h>
23#include <northbridge/intel/haswell/haswell.h>
24#include <cpu/intel/haswell/haswell.h>
25
Aaron Durbinf6933a62012-10-30 09:09:39 -050026/*
27 * Change LED_POWER# (SIO GPIO 45) state based on sleep type.
28 * The IO address is hardcoded as we don't have device path in SMM.
29 */
30#define SIO_GPIO_BASE_SET4 (0x730 + 3)
31#define SIO_GPIO_BLINK_GPIO45 0x25
32void mainboard_smi_sleep(u8 slp_typ)
33{
34 u8 reg8;
35
36 switch (slp_typ) {
Aaron Durbin30b0c7a2016-07-13 13:01:13 -050037 case ACPI_S3:
38 case ACPI_S4:
Aaron Durbinf6933a62012-10-30 09:09:39 -050039 break;
40
Aaron Durbin30b0c7a2016-07-13 13:01:13 -050041 case ACPI_S5:
Aaron Durbinf6933a62012-10-30 09:09:39 -050042 /* Turn off LED */
43 reg8 = inb(SIO_GPIO_BASE_SET4);
44 reg8 |= (1 << 5);
45 outb(reg8, SIO_GPIO_BASE_SET4);
46 break;
47 }
48}
49
Aaron Durbinf6933a62012-10-30 09:09:39 -050050
51static int mainboard_finalized = 0;
52
53int mainboard_smi_apmc(u8 apmc)
54{
55 switch (apmc) {
Vladimir Serbinenko3026e472015-05-16 13:33:49 +020056 case APM_CNT_FINALIZE:
Aaron Durbinf6933a62012-10-30 09:09:39 -050057 if (mainboard_finalized) {
58 printk(BIOS_DEBUG, "SMI#: Already finalized\n");
59 return 0;
60 }
61
Aaron Durbinf6933a62012-10-30 09:09:39 -050062 intel_pch_finalize_smm();
63 intel_northbridge_haswell_finalize_smm();
64 intel_cpu_haswell_finalize_smm();
65
66 mainboard_finalized = 1;
67 break;
68 }
69 return 0;
70}