2015-12-16 01:06:15 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the coreboot project.
|
|
|
|
*
|
2017-11-28 13:24:15 +01:00
|
|
|
* Copyright (C) 2015-2017 Intel Corp.
|
2015-12-16 01:06:15 +01:00
|
|
|
* (Written by Alexandru Gagniuc <alexandrux.gagniuc@intel.com> for Intel Corp.)
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*/
|
|
|
|
|
2016-05-13 04:11:48 +02:00
|
|
|
#include <arch/acpigen.h>
|
2015-12-16 01:06:15 +01:00
|
|
|
#include <console/console.h>
|
|
|
|
#include <fsp/util.h>
|
|
|
|
#include <device/device.h>
|
|
|
|
#include <device/pci.h>
|
2017-11-28 13:24:15 +01:00
|
|
|
#include <intelblocks/graphics.h>
|
2016-05-13 04:11:48 +02:00
|
|
|
#include <soc/intel/common/opregion.h>
|
2015-12-16 01:06:15 +01:00
|
|
|
|
2016-09-08 18:57:04 +02:00
|
|
|
uintptr_t fsp_soc_get_igd_bar(void)
|
2015-12-16 01:06:15 +01:00
|
|
|
{
|
2017-11-28 13:24:15 +01:00
|
|
|
return graphics_get_memory_base();
|
2015-12-16 01:06:15 +01:00
|
|
|
}
|
|
|
|
|
2017-11-28 13:24:15 +01:00
|
|
|
uintptr_t graphics_soc_write_acpi_opregion(struct device *device,
|
|
|
|
uintptr_t current, struct acpi_rsdp *rsdp)
|
2016-05-13 04:11:48 +02:00
|
|
|
{
|
|
|
|
igd_opregion_t *opregion;
|
|
|
|
uint16_t reg16;
|
|
|
|
|
|
|
|
printk(BIOS_DEBUG, "ACPI: * IGD OpRegion\n");
|
|
|
|
opregion = (igd_opregion_t *)current;
|
|
|
|
|
2017-06-15 08:43:11 +02:00
|
|
|
if (init_igd_opregion(opregion) != CB_SUCCESS)
|
2016-05-13 04:11:48 +02:00
|
|
|
return current;
|
|
|
|
|
|
|
|
current += sizeof(igd_opregion_t);
|
|
|
|
|
|
|
|
/* TODO Initialize Mailbox 3 */
|
|
|
|
opregion->mailbox3.bclp = IGD_BACKLIGHT_BRIGHTNESS;
|
|
|
|
opregion->mailbox3.pfit = IGD_FIELD_VALID | IGD_PFIT_STRETCH;
|
|
|
|
opregion->mailbox3.pcft = 0; /* should be (IMON << 1) & 0x3e */
|
|
|
|
opregion->mailbox3.cblv = IGD_FIELD_VALID | IGD_INITIAL_BRIGHTNESS;
|
|
|
|
opregion->mailbox3.bclm[0] = IGD_WORD_FIELD_VALID + 0x0000;
|
|
|
|
opregion->mailbox3.bclm[1] = IGD_WORD_FIELD_VALID + 0x0a19;
|
|
|
|
opregion->mailbox3.bclm[2] = IGD_WORD_FIELD_VALID + 0x1433;
|
|
|
|
opregion->mailbox3.bclm[3] = IGD_WORD_FIELD_VALID + 0x1e4c;
|
|
|
|
opregion->mailbox3.bclm[4] = IGD_WORD_FIELD_VALID + 0x2866;
|
|
|
|
opregion->mailbox3.bclm[5] = IGD_WORD_FIELD_VALID + 0x327f;
|
|
|
|
opregion->mailbox3.bclm[6] = IGD_WORD_FIELD_VALID + 0x3c99;
|
|
|
|
opregion->mailbox3.bclm[7] = IGD_WORD_FIELD_VALID + 0x46b2;
|
|
|
|
opregion->mailbox3.bclm[8] = IGD_WORD_FIELD_VALID + 0x50cc;
|
|
|
|
opregion->mailbox3.bclm[9] = IGD_WORD_FIELD_VALID + 0x5ae5;
|
|
|
|
opregion->mailbox3.bclm[10] = IGD_WORD_FIELD_VALID + 0x64ff;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* TODO This needs to happen in S3 resume, too.
|
|
|
|
* Maybe it should move to the finalize handler.
|
|
|
|
*/
|
|
|
|
|
2017-11-28 13:24:15 +01:00
|
|
|
pci_write_config32(device, ASLS, (uintptr_t)opregion);
|
|
|
|
reg16 = pci_read_config16(device, SWSCI);
|
2016-05-13 04:11:48 +02:00
|
|
|
reg16 &= ~(1 << 0);
|
|
|
|
reg16 |= (1 << 15);
|
2017-11-28 13:24:15 +01:00
|
|
|
pci_write_config16(device, SWSCI, reg16);
|
2016-05-13 04:11:48 +02:00
|
|
|
|
|
|
|
return acpi_align_current(current);
|
|
|
|
}
|