coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
gma.c File Reference
#include <console/console.h>
#include <bootmode.h>
#include <device/mmio.h>
#include <delay.h>
#include <arch/io.h>
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ops.h>
#include <device/pci_ids.h>
#include <option.h>
#include <edid.h>
#include <drivers/intel/gma/edid.h>
#include <drivers/intel/gma/i915.h>
#include <drivers/intel/gma/opregion.h>
#include <string.h>
#include <pc80/vga.h>
#include <pc80/vga_io.h>
#include <commonlib/helpers.h>
#include <types.h>
#include <framebuffer_info.h>
#include "i945.h"
#include "chip.h"
Include dependency graph for gma.c:

Go to the source code of this file.

Macros

#define GDRST   0xc0
 
#define MSAC   0x62 /* Multi Size Aperture Control */
 
#define LVDS_CLOCK_A_POWERUP_ALL   (3 << 8)
 
#define LVDS_CLOCK_B_POWERUP_ALL   (3 << 4)
 
#define LVDS_CLOCK_BOTH_POWERUP_ALL   (3 << 2)
 
#define DPLLB_LVDS_P2_CLOCK_DIV_7   (1 << 24) /* i915 */
 
#define DPLL_INTEGRATED_CRI_CLK_VLV   (1 << 14)
 
#define PGETBL_CTL   0x2020
 
#define PGETBL_ENABLED   0x00000001
 
#define BASE_FREQUENCY   100000
 
#define DEFAULT_BLC_PWM   180
 

Functions

static int gtt_setup (u8 *mmiobase)
 
static int intel_gma_init_lvds (struct northbridge_intel_i945_config *conf, unsigned int pphysbase, unsigned int piobase, u8 *mmiobase, uintptr_t pgfx)
 
static int intel_gma_init_vga (struct northbridge_intel_i945_config *conf, unsigned int pphysbase, unsigned int piobase, u8 *mmiobase, uintptr_t pgfx)
 
static int probe_edid (u8 *mmiobase, u8 slave)
 
static u32 get_cdclk (struct device *const dev)
 
static u32 freq_to_blc_pwm_ctl (struct device *const dev, u16 pwm_freq)
 
static void panel_setup (u8 *mmiobase, struct device *const dev)
 
static void gma_ngi (struct device *const dev)
 
static void gma_func0_init (struct device *dev)
 
static void gma_func0_disable (struct device *dev)
 
static void gma_func1_init (struct device *dev)
 
static void gma_generate_ssdt (const struct device *device)
 
static void gma_func0_read_resources (struct device *dev)
 
static const char * gma_acpi_name (const struct device *dev)
 

Variables

static struct device_operations gma_func0_ops
 
static struct device_operations gma_func1_ops
 
static const unsigned short i945_gma_func0_ids []
 
static const unsigned short i945_gma_func1_ids []
 
static const struct pci_driver i945_gma_func0_driver __pci_driver
 

Macro Definition Documentation

◆ BASE_FREQUENCY

#define BASE_FREQUENCY   100000

Definition at line 41 of file gma.c.

◆ DEFAULT_BLC_PWM

#define DEFAULT_BLC_PWM   180

Definition at line 43 of file gma.c.

◆ DPLL_INTEGRATED_CRI_CLK_VLV

#define DPLL_INTEGRATED_CRI_CLK_VLV   (1 << 14)

Definition at line 36 of file gma.c.

◆ DPLLB_LVDS_P2_CLOCK_DIV_7

#define DPLLB_LVDS_P2_CLOCK_DIV_7   (1 << 24) /* i915 */

Definition at line 34 of file gma.c.

◆ GDRST

#define GDRST   0xc0

Definition at line 27 of file gma.c.

◆ LVDS_CLOCK_A_POWERUP_ALL

#define LVDS_CLOCK_A_POWERUP_ALL   (3 << 8)

Definition at line 30 of file gma.c.

◆ LVDS_CLOCK_B_POWERUP_ALL

#define LVDS_CLOCK_B_POWERUP_ALL   (3 << 4)

Definition at line 31 of file gma.c.

◆ LVDS_CLOCK_BOTH_POWERUP_ALL

#define LVDS_CLOCK_BOTH_POWERUP_ALL   (3 << 2)

Definition at line 32 of file gma.c.

◆ MSAC

#define MSAC   0x62 /* Multi Size Aperture Control */

Definition at line 28 of file gma.c.

◆ PGETBL_CTL

#define PGETBL_CTL   0x2020

Definition at line 38 of file gma.c.

◆ PGETBL_ENABLED

#define PGETBL_ENABLED   0x00000001

Definition at line 39 of file gma.c.

Function Documentation

◆ freq_to_blc_pwm_ctl()

static u32 freq_to_blc_pwm_ctl ( struct device *const  dev,
u16  pwm_freq 
)
static

Definition at line 579 of file gma.c.

References BLM_LEGACY_MODE, and get_cdclk().

Referenced by panel_setup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_cdclk()

static u32 get_cdclk ( struct device *const  dev)
static

Definition at line 563 of file gma.c.

References GC_DISPLAY_CLOCK_190_200_MHZ, GC_DISPLAY_CLOCK_333_320_MHZ, GC_DISPLAY_CLOCK_MASK, GC_LOW_FREQUENCY_ENABLE, GCFGC, and pci_read_config16().

Referenced by freq_to_blc_pwm_ctl(), and panel_setup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gma_acpi_name()

static const char* gma_acpi_name ( const struct device dev)
static

Definition at line 731 of file gma.c.

◆ gma_func0_disable()

static void gma_func0_disable ( struct device dev)
static

Definition at line 696 of file gma.c.

References DEVEN, DEVEN_D2F0, DEVEN_D2F1, device::enabled, GCFC, GGC, pci_and_config32(), pci_write_config16(), and pcidev_on_root().

Here is the call graph for this function:

◆ gma_func0_init()

static void gma_func0_init ( struct device dev)
static

◆ gma_func0_read_resources()

static void gma_func0_read_resources ( struct device dev)
static

Definition at line 723 of file gma.c.

References MSAC, pci_dev_read_resources(), and pci_update_config8().

Here is the call graph for this function:

◆ gma_func1_init()

static void gma_func1_init ( struct device dev)
static

Definition at line 708 of file gma.c.

References CONFIG, get_uint_option(), PCI_COMMAND, PCI_COMMAND_MASTER, pci_or_config16(), and pci_write_config8().

Here is the call graph for this function:

◆ gma_generate_ssdt()

static void gma_generate_ssdt ( const struct device device)
static

Definition at line 716 of file gma.c.

References chip, device::chip_info, and drivers_intel_gma_displays_ssdt_generate().

Here is the call graph for this function:

◆ gma_ngi()

static void gma_ngi ( struct device *const  dev)
static

◆ gtt_setup()

static int gtt_setup ( u8 mmiobase)
static

Definition at line 45 of file gma.c.

References BIOS_DEBUG, GFX_FLSH_CNTL, KiB, pci_read_config8(), pcidev_on_root(), PGETBL_CTL, PGETBL_ENABLED, printk, read32(), TOLUD, and write32().

Referenced by intel_gma_init_lvds(), and intel_gma_init_vga().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ intel_gma_init_lvds()

static int intel_gma_init_lvds ( struct northbridge_intel_i945_config conf,
unsigned int  pphysbase,
unsigned int  piobase,
u8 mmiobase,
uintptr_t  pgfx 
)
static

Definition at line 74 of file gma.c.

References BASE_FREQUENCY, BIOS_DEBUG, BIOS_ERR, BIOS_INFO, BIOS_SPEW, edid::bytes_per_line, CONFIG, D_STATE, decode_edid(), decode_igd_memory_size(), DEIIR, DISPLAY_PLANE_ENABLE, DISPPLANE_BGRX888, DISPPLANE_GAMMA_ENABLE, DISPPLANE_SEL_PIPE_B, DIV_ROUND_CLOSEST, DPLL, DPLL_INTEGRATED_CLOCK_VLV, DPLL_INTEGRATED_CRI_CLK_VLV, DPLL_VCO_ENABLE, DPLL_VGA_MODE_DIS, DPLLB_LVDS_P2_CLOCK_DIV_14, DPLLB_LVDS_P2_CLOCK_DIV_7, DPLLB_MODE_LVDS, DSPADDR, DSPCNTR, DSPPOS, DSPSIZE, DSPSTRIDE, DSPSURF, DSTATE_DOT_CLOCK_GATING, DSTATE_GFX_CLOCK_GATING, DSTATE_PLL_D3_OFF, ECOSKPD, EIR, fb_new_framebuffer_info_from_edid(), FENCE_REG_965_0, FP0, GGC, GMBUS0, GMBUS_PORT_PANEL, northbridge_intel_i945_config::gpu_hotplug, northbridge_intel_i945_config::gpu_lvds_use_spread_spectrum_clock, gtt_setup(), edid_mode::hbl, HBLANK, edid_mode::hborder, HORIZ_AUTO_SCALE, edid_mode::hso, edid_mode::hspw, HSYNC, HTOTAL, HWS_PGA, HWSTAM, IIR, IMR, INSTPM, INSTPM_AGPBUSY_DIS, intel_gmbus_read_edid(), LVDS, LVDS_CLOCK_A_POWERUP_ALL, LVDS_CLOCK_B_POWERUP_ALL, LVDS_CLOCK_BOTH_POWERUP_ALL, edid_mode::lvds_dual_channel, LVDS_ON, LVDS_PIPE, m, MAX, mdelay(), memset(), MI_ARB_C3_LP_WRITE_ENABLE, MI_ARB_STATE, MIN, edid::mode, outl(), PALETTE, PANEL_POWER_OFF, PANEL_POWER_ON, PANEL_POWER_RESET, PANEL_UNLOCK_MASK, PANEL_UNLOCK_REGS, PCH_PP_CONTROL, pci_read_config16(), pcidev_on_root(), PF_CTL, PF_ENABLE, PF_FILTER_MED_3x3, PF_WIN_POS, PF_WIN_SZ, PFIT_CONTROL, PFIT_ENABLE, PFIT_PGM_RATIOS, PFIT_PIPE_SHIFT, PGETBL_CTL, edid_mode::phsync, PIPECONF, PIPECONF_ENABLE, PIPESRC, edid_mode::pixel_clock, PORT_HOTPLUG_EN, PP_CONTROL, PP_SEQUENCE_MASK, PP_SEQUENCE_NONE, PP_STATUS, PRB0_CTL, PRB0_HEAD, PRB0_START, PRB0_TAIL, printk, edid_mode::pvsync, read32(), RENDER_RING_BASE, SDEIIR, edid_mode::vbl, VBLANK, edid_mode::vborder, VERT_AUTO_SCALE, VGA_DISP_DISABLE, vga_misc_write(), VGA_PIPE_B_SELECT, vga_textmode_init(), VGACNTRL, edid_mode::vso, edid_mode::vspw, VSYNC, VTOTAL, write32(), edid::x_resolution, and edid::y_resolution.

Referenced by gma_ngi().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ intel_gma_init_vga()

◆ panel_setup()

◆ probe_edid()

static int probe_edid ( u8 mmiobase,
u8  slave 
)
static

Definition at line 545 of file gma.c.

References BIOS_DEBUG, BIOS_SPEW, GMBUS0, header, intel_gmbus_read_edid(), intel_gmbus_stop(), printk, and slave.

Referenced by gma_ngi().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ __pci_driver

static const struct pci_driver i945_gma_func1_driver __pci_driver
static
Initial value:
= {
.ops = &gma_func0_ops,
.vendor = PCI_VID_INTEL,
.devices = i945_gma_func0_ids,
}
static struct device_operations gma_func0_ops
Definition: gma.c:736
static const unsigned short i945_gma_func0_ids[]
Definition: gma.c:755
#define PCI_VID_INTEL
Definition: pci_ids.h:2157

Definition at line 762 of file gma.c.

◆ gma_func0_ops

struct device_operations gma_func0_ops
static
Initial value:
= {
.read_resources = gma_func0_read_resources,
.set_resources = pci_dev_set_resources,
.enable_resources = pci_dev_enable_resources,
.init = gma_func0_init,
.acpi_fill_ssdt = gma_generate_ssdt,
.vga_disable = gma_func0_disable,
.ops_pci = &pci_dev_ops_pci,
.acpi_name = gma_acpi_name,
}
static const char * gma_acpi_name(const struct device *dev)
Definition: gma.c:731
static void gma_func0_read_resources(struct device *dev)
Definition: gma.c:723
static void gma_func0_init(struct device *dev)
Definition: gma.c:660
static void gma_func0_disable(struct device *dev)
Definition: gma.c:696
static void gma_generate_ssdt(const struct device *device)
Definition: gma.c:716
void pci_dev_enable_resources(struct device *dev)
Definition: pci_device.c:721
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

Definition at line 731 of file gma.c.

◆ gma_func1_ops

struct device_operations gma_func1_ops
static
Initial value:
= {
.read_resources = pci_dev_read_resources,
.set_resources = pci_dev_set_resources,
.enable_resources = pci_dev_enable_resources,
.init = gma_func1_init,
.ops_pci = &pci_dev_ops_pci,
}
static void gma_func1_init(struct device *dev)
Definition: gma.c:708
void pci_dev_read_resources(struct device *dev)
Definition: pci_device.c:534

Definition at line 731 of file gma.c.

◆ i945_gma_func0_ids

const unsigned short i945_gma_func0_ids[]
static
Initial value:
= {
0x2772,
0x27a2,
0x27ae,
0
}

Definition at line 755 of file gma.c.

◆ i945_gma_func1_ids

const unsigned short i945_gma_func1_ids[]
static
Initial value:
= {
0x2776,
0x27a6,
0
}

Definition at line 762 of file gma.c.