Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/i915: merge soc/intel_gmch.[ch] to display/intel_vga.c

The sole user of the remaining functions in intel_gmch.[ch] is in
intel_vga.c. Move everything there.

Since intel_gmch.c hasn't been part of xe, use a dummy function
relocated from xe_display_misc.c, with #ifdef. This is purely to keep
this change non-functional.

This allows us to remove soc/intel_gmch.[ch] from i915, compat
soc/intel_gmch.h from xe, and xe_display_misc.c from xe.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patch.msgid.link/b0f853ad7eae686738defa9e8f08a8848df8f226.1763578288.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>

+50 -100
-4
drivers/gpu/drm/i915/Makefile
··· 57 57 vlv_iosf_sb.o \ 58 58 vlv_suspend.o 59 59 60 - # core peripheral code 61 - i915-y += \ 62 - soc/intel_gmch.o 63 - 64 60 # core library code 65 61 i915-y += \ 66 62 i915_memcpy.o \
+50 -2
drivers/gpu/drm/i915/display/intel_vga.c
··· 9 9 10 10 #include <drm/drm_device.h> 11 11 #include <drm/drm_print.h> 12 + #include <drm/intel/i915_drm.h> 12 13 #include <video/vga.h> 13 - 14 - #include "soc/intel_gmch.h" 15 14 16 15 #include "intel_de.h" 17 16 #include "intel_display.h" 17 + #include "intel_display_types.h" 18 18 #include "intel_vga.h" 19 19 #include "intel_vga_regs.h" 20 20 ··· 94 94 outb(inb(VGA_MIS_R), VGA_MIS_W); 95 95 vga_put(pdev, VGA_RSRC_LEGACY_IO); 96 96 } 97 + 98 + #ifdef I915 99 + static int intel_gmch_vga_set_state(struct intel_display *display, bool enable_decode) 100 + { 101 + struct pci_dev *pdev = to_pci_dev(display->drm->dev); 102 + unsigned int reg = DISPLAY_VER(display) >= 6 ? SNB_GMCH_CTRL : INTEL_GMCH_CTRL; 103 + u16 gmch_ctrl; 104 + 105 + if (pci_bus_read_config_word(pdev->bus, PCI_DEVFN(0, 0), reg, &gmch_ctrl)) { 106 + drm_err(display->drm, "failed to read control word\n"); 107 + return -EIO; 108 + } 109 + 110 + if (!!(gmch_ctrl & INTEL_GMCH_VGA_DISABLE) == !enable_decode) 111 + return 0; 112 + 113 + if (enable_decode) 114 + gmch_ctrl &= ~INTEL_GMCH_VGA_DISABLE; 115 + else 116 + gmch_ctrl |= INTEL_GMCH_VGA_DISABLE; 117 + 118 + if (pci_bus_write_config_word(pdev->bus, PCI_DEVFN(0, 0), reg, gmch_ctrl)) { 119 + drm_err(display->drm, "failed to write control word\n"); 120 + return -EIO; 121 + } 122 + 123 + return 0; 124 + } 125 + 126 + static unsigned int intel_gmch_vga_set_decode(struct pci_dev *pdev, bool enable_decode) 127 + { 128 + struct intel_display *display = to_intel_display(pdev); 129 + 130 + intel_gmch_vga_set_state(display, enable_decode); 131 + 132 + if (enable_decode) 133 + return VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM | 134 + VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM; 135 + else 136 + return VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM; 137 + } 138 + #else 139 + static unsigned int intel_gmch_vga_set_decode(struct pci_dev *pdev, bool enable_decode) 140 + { 141 + /* ToDo: Implement the actual handling of vga decode */ 142 + return 0; 143 + } 144 + #endif 97 145 98 146 int intel_vga_register(struct intel_display *display) 99 147 {
-56
drivers/gpu/drm/i915/soc/intel_gmch.c
··· 1 - // SPDX-License-Identifier: MIT 2 - /* 3 - * Copyright © 2023 Intel Corporation 4 - */ 5 - 6 - #include <linux/pci.h> 7 - #include <linux/vgaarb.h> 8 - 9 - #include <drm/drm_print.h> 10 - #include <drm/intel/i915_drm.h> 11 - 12 - #include "../display/intel_display_core.h" /* FIXME */ 13 - #include "../display/intel_display_types.h" /* FIXME */ 14 - 15 - #include "intel_gmch.h" 16 - #include "intel_pci_config.h" 17 - 18 - static int intel_gmch_vga_set_state(struct intel_display *display, bool enable_decode) 19 - { 20 - struct pci_dev *pdev = to_pci_dev(display->drm->dev); 21 - unsigned int reg = DISPLAY_VER(display) >= 6 ? SNB_GMCH_CTRL : INTEL_GMCH_CTRL; 22 - u16 gmch_ctrl; 23 - 24 - if (pci_bus_read_config_word(pdev->bus, PCI_DEVFN(0, 0), reg, &gmch_ctrl)) { 25 - drm_err(display->drm, "failed to read control word\n"); 26 - return -EIO; 27 - } 28 - 29 - if (!!(gmch_ctrl & INTEL_GMCH_VGA_DISABLE) == !enable_decode) 30 - return 0; 31 - 32 - if (enable_decode) 33 - gmch_ctrl &= ~INTEL_GMCH_VGA_DISABLE; 34 - else 35 - gmch_ctrl |= INTEL_GMCH_VGA_DISABLE; 36 - 37 - if (pci_bus_write_config_word(pdev->bus, PCI_DEVFN(0, 0), reg, gmch_ctrl)) { 38 - drm_err(display->drm, "failed to write control word\n"); 39 - return -EIO; 40 - } 41 - 42 - return 0; 43 - } 44 - 45 - unsigned int intel_gmch_vga_set_decode(struct pci_dev *pdev, bool enable_decode) 46 - { 47 - struct intel_display *display = to_intel_display(pdev); 48 - 49 - intel_gmch_vga_set_state(display, enable_decode); 50 - 51 - if (enable_decode) 52 - return VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM | 53 - VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM; 54 - else 55 - return VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM; 56 - }
-15
drivers/gpu/drm/i915/soc/intel_gmch.h
··· 1 - /* SPDX-License-Identifier: MIT */ 2 - /* 3 - * Copyright © 2023 Intel Corporation 4 - */ 5 - 6 - #ifndef __INTEL_GMCH_H__ 7 - #define __INTEL_GMCH_H__ 8 - 9 - #include <linux/types.h> 10 - 11 - struct pci_dev; 12 - 13 - unsigned int intel_gmch_vga_set_decode(struct pci_dev *pdev, bool enable_decode); 14 - 15 - #endif /* __INTEL_GMCH_H__ */
-1
drivers/gpu/drm/xe/Makefile
··· 202 202 display/intel_fb_bo.o \ 203 203 display/intel_fbdev_fb.o \ 204 204 display/xe_display.o \ 205 - display/xe_display_misc.o \ 206 205 display/xe_display_rpm.o \ 207 206 display/xe_display_wa.o \ 208 207 display/xe_dsb_buffer.o \
-6
drivers/gpu/drm/xe/compat-i915-headers/soc/intel_gmch.h
··· 1 - /* SPDX-License-Identifier: MIT */ 2 - /* 3 - * Copyright © 2023 Intel Corporation 4 - */ 5 - 6 - #include "../../../i915/soc/intel_gmch.h"
-16
drivers/gpu/drm/xe/display/xe_display_misc.c
··· 1 - // SPDX-License-Identifier: MIT 2 - /* 3 - * Copyright © 2023 Intel Corporation 4 - */ 5 - 6 - #include "intel_display_types.h" 7 - 8 - struct pci_dev; 9 - 10 - unsigned int intel_gmch_vga_set_decode(struct pci_dev *pdev, bool enable_decode); 11 - 12 - unsigned int intel_gmch_vga_set_decode(struct pci_dev *pdev, bool enable_decode) 13 - { 14 - /* ToDo: Implement the actual handling of vga decode */ 15 - return 0; 16 - }