blob: 3daf192432595cf83e67e2af3dc18253d6ac8729 [file] [log] [blame]
Duncan Laurieafad0562013-01-14 08:50:03 -08001/*
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.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#include <types.h>
21#include <string.h>
22#include <cbmem.h>
23#include <console/console.h>
24#include <arch/acpi.h>
25#include <arch/ioapic.h>
26#include <arch/acpigen.h>
27#include <arch/smp/mpspec.h>
28#include <device/device.h>
29#include <device/pci.h>
30#include <device/pci_ids.h>
31#include <cpu/cpu.h>
32#include <cpu/x86/msr.h>
33#include <vendorcode/google/chromeos/gnvs.h>
34
Duncan Laurieafad0562013-01-14 08:50:03 -080035#include <southbridge/intel/lynxpoint/pch.h>
36#include <southbridge/intel/lynxpoint/nvs.h>
37#include "thermal.h"
38
39static void acpi_update_thermal_table(global_nvs_t *gnvs)
40{
41 gnvs->f4of = FAN4_THRESHOLD_OFF;
42 gnvs->f4on = FAN4_THRESHOLD_ON;
43 gnvs->f4pw = FAN4_PWM;
44
45 gnvs->f3of = FAN3_THRESHOLD_OFF;
46 gnvs->f3on = FAN3_THRESHOLD_ON;
47 gnvs->f3pw = FAN3_PWM;
48
49 gnvs->f2of = FAN2_THRESHOLD_OFF;
50 gnvs->f2on = FAN2_THRESHOLD_ON;
51 gnvs->f2pw = FAN2_PWM;
52
53 gnvs->f1of = FAN1_THRESHOLD_OFF;
54 gnvs->f1on = FAN1_THRESHOLD_ON;
55 gnvs->f1pw = FAN1_PWM;
56
57 gnvs->f0of = FAN0_THRESHOLD_OFF;
58 gnvs->f0on = FAN0_THRESHOLD_ON;
59 gnvs->f0pw = FAN0_PWM;
60
61 gnvs->tcrt = CRITICAL_TEMPERATURE;
62 gnvs->tpsv = PASSIVE_TEMPERATURE;
63 gnvs->tmax = MAX_TEMPERATURE;
64}
65
Vladimir Serbinenkoc6e566a2014-08-31 17:43:51 +020066void acpi_create_gnvs(global_nvs_t *gnvs)
Duncan Laurieafad0562013-01-14 08:50:03 -080067{
Duncan Laurieafad0562013-01-14 08:50:03 -080068 gnvs->apic = 1;
69 gnvs->mpen = 1; /* Enable Multi Processing */
70 gnvs->pcnt = dev_count_cpu();
71
72 /* Enable USB ports in S3 */
73 gnvs->s3u0 = 1;
74 gnvs->s3u1 = 1;
75
76 /* Disable USB ports in S5 */
77 gnvs->s5u0 = 0;
78 gnvs->s5u1 = 0;
79
Duncan Laurief6763db2013-03-22 11:01:37 -070080 /* TPM Present */
81 gnvs->tpmp = 1;
82
Duncan Laurieafad0562013-01-14 08:50:03 -080083 /* IGD Displays */
84 gnvs->ndid = 3;
85 gnvs->did[0] = 0x80000100;
86 gnvs->did[1] = 0x80000240;
87 gnvs->did[2] = 0x80000410;
88 gnvs->did[3] = 0x80000410;
89 gnvs->did[4] = 0x00000005;
90
91#if CONFIG_CHROMEOS
92 // TODO(reinauer) this could move elsewhere?
93 chromeos_init_vboot(&(gnvs->chromeos));
94 /* Emerald Lake has no EC (?) */
95 gnvs->chromeos.vbt2 = ACTIVE_ECFW_RO;
96#endif
97
Aaron Durbin764d0092013-05-01 13:41:44 -050098 /* Update the mem console pointer. */
99 gnvs->cbmc = (u32)cbmem_find(CBMEM_ID_CONSOLE);
100
Duncan Laurieafad0562013-01-14 08:50:03 -0800101 acpi_update_thermal_table(gnvs);
102}
103
104unsigned long acpi_fill_madt(unsigned long current)
105{
106 /* Local APICs */
107 current = acpi_create_madt_lapics(current);
108
109 /* IOAPIC */
110 current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *) current,
111 2, IO_APIC_ADDR, 0);
112
113 /* INT_SRC_OVR */
114 current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)
115 current, 0, 0, 2, 0);
116 current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)
117 current, 0, 9, 9, MP_IRQ_TRIGGER_LEVEL | MP_IRQ_POLARITY_HIGH);
118
119 return current;
120}
121
Duncan Laurieafad0562013-01-14 08:50:03 -0800122unsigned long acpi_fill_slit(unsigned long current)
123{
124 // Not implemented
125 return current;
126}
127
128unsigned long acpi_fill_srat(unsigned long current)
129{
130 /* No NUMA, no SRAT */
131 return current;
132}