drivers/gpu/drm/i915/display/intel_vga.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/display/intel_vga.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/display/intel_vga.c- Extension
.c- Size
- 9324 bytes
- Lines
- 344
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hlinux/pci.hlinux/vgaarb.hdrm/drm_device.hdrm/drm_print.hdrm/intel/i915_drm.hvideo/vga.hintel_de.hintel_display.hintel_display_types.hintel_vga.hintel_vga_regs.h
Detected Declarations
function intel_gmch_ctrl_regfunction intel_vga_decode_is_enabledfunction intel_vga_cntrl_regfunction has_vga_pipe_selfunction has_vga_mmio_accessfunction intel_pci_has_vga_io_decodefunction intel_pci_set_io_decodefunction intel_pci_bridge_set_vgafunction intel_vga_getfunction intel_vga_putfunction intel_vga_readfunction intel_vga_writefunction intel_vga_disablefunction intel_vga_set_decodefunction intel_disable_vgafunction intel_vga_registerfunction intel_vga_unregister
Annotated Snippet
// SPDX-License-Identifier: MIT
/*
* Copyright © 2019 Intel Corporation
*/
#include <linux/delay.h>
#include <linux/pci.h>
#include <linux/vgaarb.h>
#include <drm/drm_device.h>
#include <drm/drm_print.h>
#include <drm/intel/i915_drm.h>
#include <video/vga.h>
#include "intel_de.h"
#include "intel_display.h"
#include "intel_display_types.h"
#include "intel_vga.h"
#include "intel_vga_regs.h"
static unsigned int intel_gmch_ctrl_reg(struct intel_display *display)
{
return DISPLAY_VER(display) >= 6 ? SNB_GMCH_CTRL : I830_GMCH_CTRL;
}
static bool intel_vga_decode_is_enabled(struct intel_display *display)
{
struct pci_dev *pdev = to_pci_dev(display->drm->dev);
u16 gmch_ctrl = 0;
if (pci_bus_read_config_word(pdev->bus, PCI_DEVFN(0, 0),
intel_gmch_ctrl_reg(display), &gmch_ctrl))
return false;
return !(gmch_ctrl & INTEL_GMCH_VGA_DISABLE);
}
static intel_reg_t intel_vga_cntrl_reg(struct intel_display *display)
{
if (display->platform.valleyview || display->platform.cherryview)
return VLV_VGACNTRL;
else if (DISPLAY_VER(display) >= 5)
return CPU_VGACNTRL;
else
return VGACNTRL;
}
static bool has_vga_pipe_sel(struct intel_display *display)
{
if (display->platform.i845g ||
display->platform.i865g)
return false;
if (display->platform.valleyview ||
display->platform.cherryview)
return true;
return DISPLAY_VER(display) < 7;
}
static bool has_vga_mmio_access(struct intel_display *display)
{
/* WaEnableVGAAccessThroughIOPort:ctg+ */
return DISPLAY_VER(display) < 5 && !display->platform.g4x;
}
static bool intel_pci_has_vga_io_decode(struct pci_dev *pdev)
{
u16 cmd = 0;
pci_read_config_word(pdev, PCI_COMMAND, &cmd);
if ((cmd & PCI_COMMAND_IO) == 0)
return false;
pdev = pdev->bus->self;
while (pdev) {
u16 ctl = 0;
pci_read_config_word(pdev, PCI_BRIDGE_CONTROL, &ctl);
if ((ctl & PCI_BRIDGE_CTL_VGA) == 0)
return false;
pdev = pdev->bus->self;
}
return true;
}
static bool intel_pci_set_io_decode(struct pci_dev *pdev, bool enable)
{
Annotation
- Immediate include surface: `linux/delay.h`, `linux/pci.h`, `linux/vgaarb.h`, `drm/drm_device.h`, `drm/drm_print.h`, `drm/intel/i915_drm.h`, `video/vga.h`, `intel_de.h`.
- Detected declarations: `function intel_gmch_ctrl_reg`, `function intel_vga_decode_is_enabled`, `function intel_vga_cntrl_reg`, `function has_vga_pipe_sel`, `function has_vga_mmio_access`, `function intel_pci_has_vga_io_decode`, `function intel_pci_set_io_decode`, `function intel_pci_bridge_set_vga`, `function intel_vga_get`, `function intel_vga_put`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.