obj-$(CONFIG_DRM_DP_AUX_BUS) += drm_dp_aux_bus.o
 
+obj-$(CONFIG_VGA_CONSOLE) += drm_nomodeset.o
+
 drm_cma_helper-y := drm_gem_cma_helper.o
 obj-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_cma_helper.o
 
 
 #include "amdgpu_drv.h"
 
 #include <drm/drm_pciids.h>
-#include <linux/console.h>
 #include <linux/module.h>
 #include <linux/pm_runtime.h>
 #include <linux/vga_switcheroo.h>
 {
        int r;
 
-       if (vgacon_text_force())
+       if (drm_firmware_drivers_only())
                return -EINVAL;
 
        r = amdgpu_sync_init();
 
  * Authors: Dave Airlie <airlied@redhat.com>
  */
 
-#include <linux/console.h>
 #include <linux/module.h>
 #include <linux/pci.h>
 
 
 static int __init ast_init(void)
 {
-       if (vgacon_text_force() && ast_modeset == -1)
+       if (drm_firmware_drivers_only() && ast_modeset == -1)
                return -EINVAL;
 
        if (ast_modeset == 0)
 
  * Copyright © 2021 Intel Corporation
  */
 
-#include <linux/console.h>
+#include <drm/drm_drv.h>
 
 #include "gem/i915_gem_context.h"
 #include "gem/i915_gem_object.h"
        if (i915_modparams.modeset == 0)
                use_kms = false;
 
-       if (vgacon_text_force() && i915_modparams.modeset == -1)
+       if (drm_firmware_drivers_only() && i915_modparams.modeset == -1)
                use_kms = false;
 
        if (!use_kms) {
 
  *          Dave Airlie
  */
 
-#include <linux/console.h>
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/vmalloc.h>
 
 static int __init mgag200_init(void)
 {
-       if (vgacon_text_force() && mgag200_modeset == -1)
+       if (drm_firmware_drivers_only() && mgag200_modeset == -1)
                return -EINVAL;
 
        if (mgag200_modeset == 0)
 
  * Authors: Ben Skeggs
  */
 
-#include <linux/console.h>
 #include <linux/delay.h>
 #include <linux/module.h>
 #include <linux/pci.h>
 
 #include <drm/drm_aperture.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_drv.h>
 #include <drm/drm_gem_ttm_helper.h>
 #include <drm/drm_ioctl.h>
 #include <drm/drm_vblank.h>
        nouveau_display_options();
 
        if (nouveau_modeset == -1) {
-               if (vgacon_text_force())
+               if (drm_firmware_drivers_only())
                        nouveau_modeset = 0;
        }
 
 
 
 #include "qxl_drv.h"
 
-#include <linux/console.h>
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/vgaarb.h>
 
 static int __init qxl_init(void)
 {
-       if (vgacon_text_force() && qxl_modeset == -1)
+       if (drm_firmware_drivers_only() && qxl_modeset == -1)
                return -EINVAL;
 
        if (qxl_modeset == 0)
 
 
 
 #include <linux/compat.h>
-#include <linux/console.h>
 #include <linux/module.h>
 #include <linux/pm_runtime.h>
 #include <linux/vga_switcheroo.h>
 
 static int __init radeon_module_init(void)
 {
-       if (vgacon_text_force() && radeon_modeset == -1)
+       if (drm_firmware_drivers_only() && radeon_modeset == -1)
                radeon_modeset = 0;
 
        if (radeon_modeset == 0)
 
 // SPDX-License-Identifier: GPL-2.0-or-later
 
-#include <linux/console.h>
 #include <linux/pci.h>
 
 #include <drm/drm_aperture.h>
 
 static int __init bochs_init(void)
 {
-       if (vgacon_text_force() && bochs_modeset == -1)
+       if (drm_firmware_drivers_only() && bochs_modeset == -1)
                return -EINVAL;
 
        if (bochs_modeset == 0)
 
  * Copyright 1999-2001 Jeff Garzik <jgarzik@pobox.com>
  */
 
-#include <linux/console.h>
 #include <linux/dma-buf-map.h>
 #include <linux/module.h>
 #include <linux/pci.h>
 
 static int __init cirrus_init(void)
 {
-       if (vgacon_text_force())
+       if (drm_firmware_drivers_only())
                return -EINVAL;
+
        return pci_register_driver(&cirrus_pci_driver);
 }
 
 
  *          Michael Thayer <michael.thayer@oracle.com,
  *          Hans de Goede <hdegoede@redhat.com>
  */
-#include <linux/console.h>
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/vt_kern.h>
 
 static int __init vbox_init(void)
 {
-       if (vgacon_text_force() && vbox_modeset == -1)
+       if (drm_firmware_drivers_only() && vbox_modeset == -1)
                return -EINVAL;
 
        if (vbox_modeset == 0)
 
  */
 
 #include <linux/module.h>
-#include <linux/console.h>
 #include <linux/pci.h>
 #include <linux/poll.h>
 #include <linux/wait.h>
        struct drm_device *dev;
        int ret;
 
-       if (vgacon_text_force() && virtio_gpu_modeset == -1)
+       if (drm_firmware_drivers_only() && virtio_gpu_modeset == -1)
                return -EINVAL;
 
        if (virtio_gpu_modeset == 0)
 
  *
  **************************************************************************/
 
-#include <linux/console.h>
 #include <linux/dma-mapping.h>
 #include <linux/module.h>
 #include <linux/pci.h>
 {
        int ret;
 
-       if (vgacon_text_force())
+       if (drm_firmware_drivers_only())
                return -EINVAL;
 
        ret = pci_register_driver(&vmw_pci_driver);
 
 static int             vga_scan_lines          __read_mostly;
 static unsigned int    vga_rolled_over; /* last vc_origin offset before wrap */
 
-static bool vgacon_text_mode_force;
 static bool vga_hardscroll_enabled;
 static bool vga_hardscroll_user_enable = true;
 
-bool vgacon_text_force(void)
-{
-       return vgacon_text_mode_force;
-}
-EXPORT_SYMBOL(vgacon_text_force);
-
-static int __init text_mode(char *str)
-{
-       vgacon_text_mode_force = true;
-
-       pr_warn("You have booted with nomodeset. This means your GPU drivers are DISABLED\n");
-       pr_warn("Any video related functionality will be severely degraded, and you may not even be able to suspend the system properly\n");
-       pr_warn("Unless you actually understand what nomodeset does, you should reboot without enabling it\n");
-
-       return 1;
-}
-
-/* force text mode - used by kernel modesetting */
-__setup("nomodeset", text_mode);
-
 static int __init no_scroll(char *str)
 {
        /*
 
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/module.h>
+#include <linux/types.h>
+
+static bool drm_nomodeset;
+
+bool drm_firmware_drivers_only(void)
+{
+       return drm_nomodeset;
+}
+EXPORT_SYMBOL(drm_firmware_drivers_only);
+
+static int __init disable_modeset(char *str)
+{
+       drm_nomodeset = true;
+
+       pr_warn("You have booted with nomodeset. This means your GPU drivers are DISABLED\n");
+       pr_warn("Any video related functionality will be severely degraded, and you may not even be able to suspend the system properly\n");
+       pr_warn("Unless you actually understand what nomodeset does, you should reboot without enabling it\n");
+
+       return 1;
+}
+
+/* Disable kernel modesetting */
+__setup("nomodeset", disable_modeset);
 
 
 int drm_dev_set_unique(struct drm_device *dev, const char *name);
 
+#ifdef CONFIG_VGA_CONSOLE
+extern bool drm_firmware_drivers_only(void);
+#else
+static inline bool drm_firmware_drivers_only(void) { return false; }
+#endif
 
 #endif
 
 #define VESA_HSYNC_SUSPEND      2
 #define VESA_POWERDOWN          3
 
-#ifdef CONFIG_VGA_CONSOLE
-extern bool vgacon_text_force(void);
-#else
-static inline bool vgacon_text_force(void) { return false; }
-#endif
-
 extern void console_init(void);
 
 /* For deferred console takeover */