Bug 170949

Summary: [vga] [patch] Use DRIVER_MODULE_ORDERED and SI_ORDER_ANY in vga_isa.c to ensure driver ordering
Product: Base System Reporter: Brandon Gooch <jamesbrandongooch>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Open ---    
Severity: Affects Only Me Keywords: patch
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Brandon Gooch 2012-08-24 02:20:03 UTC
The vgapm device driver must register after the NVIDIA device driver to allow for a functional ACPI suspend and resume cycle.

This patch makes use of the DRIVER_MODULE_ORDERED macro and SI_ORDER_ANY constants to ensure the ordering of device driver registration.

I have used this patch on a variety of systems with success.

Fix: After applying the attached patch, rebuild the kernel (install, and reboot). After boot, notice the vgapm0 device driver is registered after the nvidia0 device driver:

    pcib0 pnpinfo _HID=PNP0A03 _UID=0 at handle=\_SB_.PCI0
      pci0
        hostb0 pnpinfo vendor=0x8086 device=0xd132 subvendor=0x1028 subdevice=0x02ef class=0x060000 at slot=0 function=0
        pcib1 pnpinfo vendor=0x8086 device=0xd138 subvendor=0x1028 subdevice=0x02ef class=0x060400 at slot=3 function=0 handle=\_SB_.PCI0.AGP1
          pci1
            vgapci0 pnpinfo vendor=0x10de device=0x061f subvendor=0x1028 subdevice=0x02ef class=0x030000 at slot=0 function=0 handle=\_SB_.PCI0.AGP1.VID_
              nvidia0
              vgapm0

You should be able to perform and suspend/resume cycle successfully.

Patch attached with submission follows:
How-To-Repeat: Use the NVIDIA driver (from ports or from vendor-supplied tarball) with power management enabled. Attempt an ACPI suspend and resume cycle. The video card is not reinitialized properly due to the device driver ordering of vgapm0 and nvidia0:

    pcib0 pnpinfo _HID=PNP0A03 _UID=0 at handle=\_SB_.PCI0
      pci0
        hostb0 pnpinfo vendor=0x8086 device=0xd132 subvendor=0x1028 subdevice=0x02ef class=0x060000 at slot=0 function=0
        pcib1 pnpinfo vendor=0x8086 device=0xd138 subvendor=0x1028 subdevice=0x02ef class=0x060400 at slot=3 function=0 handle=\_SB_.PCI0.AGP1
          pci1
            vgapci0 pnpinfo vendor=0x10de device=0x061f subvendor=0x1028 subdevice=0x02ef class=0x030000 at slot=0 function=0 handle=\_SB_.PCI0.AGP1.VID_
              vgapm0
              nvidia0
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:18 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 2 Graham Perrin freebsd_committer freebsd_triage 2022-10-17 12:38:21 UTC
Keyword: 

    patch
or  patch-ready

– in lieu of summary line prefix: 

    [patch]

* bulk change for the keyword
* summary lines may be edited manually (not in bulk). 

Keyword descriptions and search interface: 

    <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>