coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
gma.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <console/console.h>
4 #include <device/device.h>
5 #include <device/pci.h>
6 #include <device/pci_ids.h>
7 #include <device/pci_ops.h>
8 #include <commonlib/helpers.h>
10 #include <drivers/intel/gma/edid.h>
11 #include <drivers/intel/gma/i915.h>
14 #include <pc80/vga.h>
15 
16 #include "chip.h"
18 #include "x4x.h"
19 
20 #define BASE_FREQUENCY 96000
21 
22 static void gma_func0_init(struct device *dev)
23 {
25 
26  if (!CONFIG(NO_GFX_INIT))
28 
29  /* configure GMBUSFREQ */
30  pci_update_config16(dev, 0xcc, ~0x1ff, 0xbc);
31 
32  int vga_disable = (pci_read_config16(dev, D0F0_GGC) & 2) >> 1;
33 
34  if (CONFIG(MAINBOARD_USE_LIBGFXINIT)) {
35  if (vga_disable) {
37  "IGD is not decoding legacy VGA MEM and IO: skipping NATIVE graphic init\n");
38  } else {
39  int lightup_ok;
40  gma_gfxinit(&lightup_ok);
41  }
42  } else {
43  pci_dev_init(dev);
44  }
45 }
46 
47 static void gma_func0_disable(struct device *dev)
48 {
49  struct device *dev_host = pcidev_on_root(0, 0);
50 
51  /* VGA cycles to discrete GPU */
52  pci_or_config16(dev_host, D0F0_GGC, 1 << 1);
53 }
54 
55 static void gma_generate_ssdt(const struct device *device)
56 {
58 
60 }
61 
62 static const char *gma_acpi_name(const struct device *dev)
63 {
64  return "GFX0";
65 }
66 
67 static struct device_operations gma_func0_ops = {
69  .set_resources = pci_dev_set_resources,
70  .enable_resources = pci_dev_enable_resources,
71  .acpi_fill_ssdt = gma_generate_ssdt,
72  .init = gma_func0_init,
73  .ops_pci = &pci_dev_ops_pci,
74  .vga_disable = gma_func0_disable,
75  .acpi_name = gma_acpi_name,
76 };
77 
78 static const unsigned short pci_device_ids[] = {
79  0x2e02, /* Eaglelake */
80  0x2e12, /* Q43/Q45 */
81  0x2e22, /* G43/G45 */
82  0x2e32, /* G41 */
83  0x2e42, /* B43 */
84  0x2e92, /* B43_I */
85  0
86 };
87 
88 static const struct pci_driver gma __pci_driver = {
89  .ops = &gma_func0_ops,
90  .vendor = PCI_VID_INTEL,
91  .devices = pci_device_ids,
92 };
#define printk(level,...)
Definition: stdlib.h:16
DEVTREE_CONST struct device * pcidev_on_root(uint8_t dev, uint8_t fn)
Definition: device_const.c:260
void drivers_intel_gma_displays_ssdt_generate(const struct i915_gpu_controller_info *conf)
Definition: acpi.c:8
@ CONFIG
Definition: dsi_common.h:201
#define D0F0_GGC
Definition: gm45.h:176
static struct tpm_chip chip
Definition: tis.c:17
static __always_inline void pci_or_config16(const struct device *dev, u16 reg, u16 ormask)
Definition: pci_ops.h:180
static __always_inline u16 pci_read_config16(const struct device *dev, u16 reg)
Definition: pci_ops.h:52
static __always_inline void pci_update_config16(const struct device *dev, u16 reg, u16 mask, u16 or)
Definition: pci_ops.h:104
void gma_gfxinit(int *lightup_ok)
#define BIOS_INFO
BIOS_INFO - Expected events.
Definition: loglevel.h:113
static const char * gma_acpi_name(const struct device *dev)
Definition: gma.c:62
static void gma_func0_init(struct device *dev)
Definition: gma.c:22
static const struct pci_driver gma __pci_driver
Definition: gma.c:88
static const unsigned short pci_device_ids[]
Definition: gma.c:78
static struct device_operations gma_func0_ops
Definition: gma.c:67
static void gma_func0_disable(struct device *dev)
Definition: gma.c:47
static void gma_generate_ssdt(const struct device *device)
Definition: gma.c:55
enum cb_err intel_gma_init_igd_opregion(void)
Definition: opregion.c:310
#define PCI_COMMAND_MASTER
Definition: pci_def.h:13
#define PCI_COMMAND
Definition: pci_def.h:10
void pci_dev_init(struct device *dev)
Default handler: only runs the relevant PCI BIOS.
Definition: pci_device.c:873
void pci_dev_enable_resources(struct device *dev)
Definition: pci_device.c:721
void pci_dev_read_resources(struct device *dev)
Definition: pci_device.c:534
struct pci_operations pci_dev_ops_pci
Default device operation for PCI devices.
Definition: pci_device.c:911
void pci_dev_set_resources(struct device *dev)
Definition: pci_device.c:691
#define PCI_VID_INTEL
Definition: pci_ids.h:2157
void(* read_resources)(struct device *dev)
Definition: device.h:39
Definition: device.h:107
DEVTREE_CONST void * chip_info
Definition: device.h:164