treewide: Move "is part of the coreboot project" line in its own comment
[coreboot.git] / src / soc / intel / apollolake / graphics.c
blobaff4c38fbae6873502fea839052d8382657042a2
1 /* This file is part of the coreboot project. */
2 /*
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
15 #include <stdint.h>
16 #include <acpi/acpi.h>
17 #include <bootmode.h>
18 #include <console/console.h>
19 #include <fsp/util.h>
20 #include <device/device.h>
21 #include <device/pci.h>
22 #include <device/pci_ops.h>
23 #include <intelblocks/graphics.h>
24 #include <drivers/intel/gma/opregion.h>
25 #include <drivers/intel/gma/libgfxinit.h>
26 #include <types.h>
28 uintptr_t fsp_soc_get_igd_bar(void)
30 return graphics_get_memory_base();
33 void graphics_soc_init(struct device *const dev)
35 if (CONFIG(RUN_FSP_GOP))
36 return;
38 uint32_t reg32 = pci_read_config32(dev, PCI_COMMAND);
39 reg32 |= PCI_COMMAND_MASTER;
40 pci_write_config32(dev, PCI_COMMAND, reg32);
42 if (CONFIG(MAINBOARD_USE_LIBGFXINIT)) {
43 if (!acpi_is_wakeup_s3() && display_init_required()) {
44 int lightup_ok;
45 gma_gfxinit(&lightup_ok);
46 gfx_set_init_done(lightup_ok);
48 } else {
49 /* Initialize PCI device, load/execute BIOS Option ROM */
50 pci_dev_init(dev);
54 uintptr_t graphics_soc_write_acpi_opregion(const struct device *device,
55 uintptr_t current, struct acpi_rsdp *rsdp)
57 igd_opregion_t *opregion;
59 printk(BIOS_DEBUG, "ACPI: * IGD OpRegion\n");
60 opregion = (igd_opregion_t *)current;
62 if (intel_gma_init_igd_opregion(opregion) != CB_SUCCESS)
63 return current;
65 /* FIXME: Add platform specific mailbox initialization */
67 current += sizeof(igd_opregion_t);
68 return acpi_align_current(current);