drm/i915/gmch: convert intel_gmch.c to struct intel_display

Convert intel_gmch.[ch] to struct intel_display. Remove the final
dependency on struct drm_i915_private and i915_drv.h. This is in
preparation of moving the code under display/.

intel_gmch_vga_set_state() is only used internally, make it static while
at it.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patch.msgid.link/a4b317656eef0781d4f53ae337083fb05ce602bc.1763578288.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
This commit is contained in:
Jani Nikula 2025-11-19 20:52:50 +02:00
parent 3018e582da
commit fff15f68eb
2 changed files with 6 additions and 9 deletions

View File

@ -10,20 +10,19 @@
#include <drm/intel/i915_drm.h>
#include "../display/intel_display_core.h" /* FIXME */
#include "../display/intel_display_types.h" /* FIXME */
#include "i915_drv.h"
#include "intel_gmch.h"
#include "intel_pci_config.h"
int intel_gmch_vga_set_state(struct drm_i915_private *i915, bool enable_decode)
static int intel_gmch_vga_set_state(struct intel_display *display, bool enable_decode)
{
struct intel_display *display = i915->display;
struct pci_dev *pdev = to_pci_dev(display->drm->dev);
unsigned int reg = DISPLAY_VER(display) >= 6 ? SNB_GMCH_CTRL : INTEL_GMCH_CTRL;
u16 gmch_ctrl;
if (pci_bus_read_config_word(pdev->bus, PCI_DEVFN(0, 0), reg, &gmch_ctrl)) {
drm_err(&i915->drm, "failed to read control word\n");
drm_err(display->drm, "failed to read control word\n");
return -EIO;
}
@ -36,7 +35,7 @@ int intel_gmch_vga_set_state(struct drm_i915_private *i915, bool enable_decode)
gmch_ctrl |= INTEL_GMCH_VGA_DISABLE;
if (pci_bus_write_config_word(pdev->bus, PCI_DEVFN(0, 0), reg, gmch_ctrl)) {
drm_err(&i915->drm, "failed to write control word\n");
drm_err(display->drm, "failed to write control word\n");
return -EIO;
}
@ -45,9 +44,9 @@ int intel_gmch_vga_set_state(struct drm_i915_private *i915, bool enable_decode)
unsigned int intel_gmch_vga_set_decode(struct pci_dev *pdev, bool enable_decode)
{
struct drm_i915_private *i915 = pdev_to_i915(pdev);
struct intel_display *display = to_intel_display(pdev);
intel_gmch_vga_set_state(i915, enable_decode);
intel_gmch_vga_set_state(display, enable_decode);
if (enable_decode)
return VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM |

View File

@ -9,9 +9,7 @@
#include <linux/types.h>
struct pci_dev;
struct drm_i915_private;
int intel_gmch_vga_set_state(struct drm_i915_private *i915, bool enable_decode);
unsigned int intel_gmch_vga_set_decode(struct pci_dev *pdev, bool enable_decode);
#endif /* __INTEL_GMCH_H__ */