blob: cd75eb204fb3e4d11cbd8d0765d847f4cb18d1da [file] [log] [blame]
Shawn Nematbakhshe9d060d2013-05-23 15:13:46 -07001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2012 Google Inc.
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.
Shawn Nematbakhshe9d060d2013-05-23 15:13:46 -070014 */
15
16#include <types.h>
17#include <string.h>
18#include <cbmem.h>
19#include <console/console.h>
20#include <arch/acpi.h>
21#include <arch/ioapic.h>
22#include <arch/acpigen.h>
23#include <arch/smp/mpspec.h>
24#include <device/device.h>
25#include <device/pci.h>
26#include <device/pci_ids.h>
27#include <cpu/cpu.h>
28#include <cpu/x86/msr.h>
29#include <vendorcode/google/chromeos/gnvs.h>
30#include <ec/google/chromeec/ec.h>
31
Shawn Nematbakhshe9d060d2013-05-23 15:13:46 -070032#include <southbridge/intel/lynxpoint/pch.h>
33#include <southbridge/intel/lynxpoint/nvs.h>
34#include "thermal.h"
35
36static void acpi_update_thermal_table(global_nvs_t *gnvs)
37{
Duncan Laurieddf68902013-06-28 15:59:19 -070038 gnvs->tmps = CTL_TDP_SENSOR_ID;
Shawn Nematbakhshe9d060d2013-05-23 15:13:46 -070039
Duncan Laurieddf68902013-06-28 15:59:19 -070040 /* Normal TDP */
41 gnvs->f1of = 0;
42 gnvs->f1on = 0;
Shawn Nematbakhshe9d060d2013-05-23 15:13:46 -070043
Duncan Laurieddf68902013-06-28 15:59:19 -070044 /* Limited TDP */
45 gnvs->f0of = CTL_TDP_THRESHOLD_OFF;
46 gnvs->f0on = CTL_TDP_THRESHOLD_ON;
47 gnvs->f0pw = CTL_TDP_POWER_LIMIT;
Shawn Nematbakhshe9d060d2013-05-23 15:13:46 -070048
49 gnvs->tcrt = CRITICAL_TEMPERATURE;
50 gnvs->tpsv = PASSIVE_TEMPERATURE;
51 gnvs->tmax = MAX_TEMPERATURE;
52 gnvs->flvl = 1;
53}
54
Vladimir Serbinenkoc6e566a2014-08-31 17:43:51 +020055void acpi_create_gnvs(global_nvs_t *gnvs)
Shawn Nematbakhshe9d060d2013-05-23 15:13:46 -070056{
Shawn Nematbakhshe9d060d2013-05-23 15:13:46 -070057 /* Enable USB ports in S3 */
58 gnvs->s3u0 = 1;
59 gnvs->s3u1 = 1;
60
61 /* Disable USB ports in S5 */
62 gnvs->s5u0 = 0;
63 gnvs->s5u1 = 0;
64
Shawn Nematbakhshe9d060d2013-05-23 15:13:46 -070065 /* TPM Present */
66 gnvs->tpmp = 1;
67
Shawn Nematbakhshe9d060d2013-05-23 15:13:46 -070068
69#if CONFIG_CHROMEOS
Shawn Nematbakhshe9d060d2013-05-23 15:13:46 -070070 gnvs->chromeos.vbt2 = google_ec_running_ro() ?
71 ACTIVE_ECFW_RO : ACTIVE_ECFW_RW;
72#endif
73
Shawn Nematbakhshe9d060d2013-05-23 15:13:46 -070074 acpi_update_thermal_table(gnvs);
75}
76
77unsigned long acpi_fill_madt(unsigned long current)
78{
79 /* Local APICs */
80 current = acpi_create_madt_lapics(current);
81
82 /* IOAPIC */
83 current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *) current,
84 2, IO_APIC_ADDR, 0);
85
86 /* INT_SRC_OVR */
87 current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)
88 current, 0, 0, 2, 0);
89 current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)
90 current, 0, 9, 9, MP_IRQ_TRIGGER_LEVEL | MP_IRQ_POLARITY_HIGH);
91
92 return current;
93}