Aaron Durbin | f6933a6 | 2012-10-30 09:09:39 -0500 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2012 The Chromium OS Authors. All rights reserved. |
| 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 Durbin | f6933a6 | 2012-10-30 09:09:39 -0500 | [diff] [blame] | 14 | */ |
| 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> |
Aaron Durbin | f6933a6 | 2012-10-30 09:09:39 -0500 | [diff] [blame] | 27 | #include <vendorcode/google/chromeos/gnvs.h> |
| 28 | |
Aaron Durbin | f6933a6 | 2012-10-30 09:09:39 -0500 | [diff] [blame] | 29 | #include <southbridge/intel/lynxpoint/pch.h> |
| 30 | #include <southbridge/intel/lynxpoint/nvs.h> |
| 31 | #include "thermal.h" |
| 32 | |
| 33 | static void acpi_update_thermal_table(global_nvs_t *gnvs) |
| 34 | { |
| 35 | gnvs->f4of = FAN4_THRESHOLD_OFF; |
| 36 | gnvs->f4on = FAN4_THRESHOLD_ON; |
| 37 | gnvs->f4pw = FAN4_PWM; |
| 38 | |
| 39 | gnvs->f3of = FAN3_THRESHOLD_OFF; |
| 40 | gnvs->f3on = FAN3_THRESHOLD_ON; |
| 41 | gnvs->f3pw = FAN3_PWM; |
| 42 | |
| 43 | gnvs->f2of = FAN2_THRESHOLD_OFF; |
| 44 | gnvs->f2on = FAN2_THRESHOLD_ON; |
| 45 | gnvs->f2pw = FAN2_PWM; |
| 46 | |
| 47 | gnvs->f1of = FAN1_THRESHOLD_OFF; |
| 48 | gnvs->f1on = FAN1_THRESHOLD_ON; |
| 49 | gnvs->f1pw = FAN1_PWM; |
| 50 | |
| 51 | gnvs->f0of = FAN0_THRESHOLD_OFF; |
| 52 | gnvs->f0on = FAN0_THRESHOLD_ON; |
| 53 | gnvs->f0pw = FAN0_PWM; |
| 54 | |
| 55 | gnvs->tcrt = CRITICAL_TEMPERATURE; |
| 56 | gnvs->tpsv = PASSIVE_TEMPERATURE; |
| 57 | gnvs->tmax = MAX_TEMPERATURE; |
| 58 | } |
| 59 | |
Vladimir Serbinenko | c6e566a | 2014-08-31 17:43:51 +0200 | [diff] [blame] | 60 | void acpi_create_gnvs(global_nvs_t *gnvs) |
Aaron Durbin | f6933a6 | 2012-10-30 09:09:39 -0500 | [diff] [blame] | 61 | { |
Aaron Durbin | f6933a6 | 2012-10-30 09:09:39 -0500 | [diff] [blame] | 62 | /* Enable USB ports in S3 */ |
| 63 | gnvs->s3u0 = 1; |
| 64 | gnvs->s3u1 = 1; |
| 65 | |
| 66 | /* |
| 67 | * Enable Front USB ports in S5 by default |
| 68 | * to be consistent with back port behavior |
| 69 | */ |
| 70 | gnvs->s5u0 = 1; |
| 71 | gnvs->s5u1 = 1; |
| 72 | |
Duncan Laurie | f6763db | 2013-03-22 11:01:37 -0700 | [diff] [blame] | 73 | /* TPM Present */ |
| 74 | gnvs->tpmp = 1; |
| 75 | |
Aaron Durbin | f6933a6 | 2012-10-30 09:09:39 -0500 | [diff] [blame] | 76 | |
| 77 | #if CONFIG_CHROMEOS |
Aaron Durbin | f6933a6 | 2012-10-30 09:09:39 -0500 | [diff] [blame] | 78 | /* Emerald Lake has no EC (?) */ |
| 79 | gnvs->chromeos.vbt2 = ACTIVE_ECFW_RO; |
| 80 | #endif |
| 81 | |
| 82 | acpi_update_thermal_table(gnvs); |
| 83 | } |
| 84 | |
| 85 | unsigned long acpi_fill_madt(unsigned long current) |
| 86 | { |
| 87 | /* Local APICs */ |
| 88 | current = acpi_create_madt_lapics(current); |
| 89 | |
| 90 | /* IOAPIC */ |
| 91 | current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *) current, |
| 92 | 2, IO_APIC_ADDR, 0); |
| 93 | |
| 94 | /* INT_SRC_OVR */ |
| 95 | current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) |
| 96 | current, 0, 0, 2, 0); |
| 97 | current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) |
| 98 | current, 0, 9, 9, MP_IRQ_TRIGGER_LEVEL | MP_IRQ_POLARITY_HIGH); |
| 99 | |
| 100 | return current; |
| 101 | } |