#include <linux/pci.h>
 #include <linux/vgaarb.h>
 
-#include <drm/i915_drm.h>
 #include <video/vga.h>
 
+#include "soc/intel_gmch.h"
+
 #include "i915_drv.h"
 #include "i915_reg.h"
 #include "intel_de.h"
        vga_put(pdev, VGA_RSRC_LEGACY_IO);
 }
 
-static int
-intel_vga_set_state(struct drm_i915_private *i915, bool enable_decode)
-{
-       unsigned int reg = DISPLAY_VER(i915) >= 6 ? SNB_GMCH_CTRL : INTEL_GMCH_CTRL;
-       u16 gmch_ctrl;
-
-       if (pci_read_config_word(i915->gmch.pdev, reg, &gmch_ctrl)) {
-               drm_err(&i915->drm, "failed to read control word\n");
-               return -EIO;
-       }
-
-       if (!!(gmch_ctrl & INTEL_GMCH_VGA_DISABLE) == !enable_decode)
-               return 0;
-
-       if (enable_decode)
-               gmch_ctrl &= ~INTEL_GMCH_VGA_DISABLE;
-       else
-               gmch_ctrl |= INTEL_GMCH_VGA_DISABLE;
-
-       if (pci_write_config_word(i915->gmch.pdev, reg, gmch_ctrl)) {
-               drm_err(&i915->drm, "failed to write control word\n");
-               return -EIO;
-       }
-
-       return 0;
-}
-
 static unsigned int
 intel_vga_set_decode(struct pci_dev *pdev, bool enable_decode)
 {
        struct drm_i915_private *i915 = pdev_to_i915(pdev);
 
-       intel_vga_set_state(i915, enable_decode);
+       intel_gmch_vga_set_state(i915, enable_decode);
 
        if (enable_decode)
                return VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM |
 
 #include <linux/pnp.h>
 
 #include <drm/drm_managed.h>
+#include <drm/i915_drm.h>
 
 #include "i915_drv.h"
 #include "intel_gmch.h"
        if (i915->gmch.mch_res.start)
                release_resource(&i915->gmch.mch_res);
 }
+
+int intel_gmch_vga_set_state(struct drm_i915_private *i915, bool enable_decode)
+{
+       unsigned int reg = DISPLAY_VER(i915) >= 6 ? SNB_GMCH_CTRL : INTEL_GMCH_CTRL;
+       u16 gmch_ctrl;
+
+       if (pci_read_config_word(i915->gmch.pdev, reg, &gmch_ctrl)) {
+               drm_err(&i915->drm, "failed to read control word\n");
+               return -EIO;
+       }
+
+       if (!!(gmch_ctrl & INTEL_GMCH_VGA_DISABLE) == !enable_decode)
+               return 0;
+
+       if (enable_decode)
+               gmch_ctrl &= ~INTEL_GMCH_VGA_DISABLE;
+       else
+               gmch_ctrl |= INTEL_GMCH_VGA_DISABLE;
+
+       if (pci_write_config_word(i915->gmch.pdev, reg, gmch_ctrl)) {
+               drm_err(&i915->drm, "failed to write control word\n");
+               return -EIO;
+       }
+
+       return 0;
+}
 
 #ifndef __INTEL_GMCH_H__
 #define __INTEL_GMCH_H__
 
+#include <linux/types.h>
+
 struct drm_i915_private;
 
 int intel_gmch_bridge_setup(struct drm_i915_private *i915);
 void intel_gmch_bar_setup(struct drm_i915_private *i915);
 void intel_gmch_bar_teardown(struct drm_i915_private *i915);
+int intel_gmch_vga_set_state(struct drm_i915_private *i915, bool enable_decode);
 
 #endif /* __INTEL_GMCH_H__ */