Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Aug 2012 01:10:30 GMT
From:      Brandon Gooch <jamesbrandongooch@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/170949: [patch] Use DRIVER_MODULE_ORDERED and SI_ORDER_ANY in vga_isa.c to ensure driver ordering 
Message-ID:  <201208240110.q7O1AUHJ080159@red.freebsd.org>
Resent-Message-ID: <201208240120.q7O1K4JV005075@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         170949
>Category:       kern
>Synopsis:       [patch] Use DRIVER_MODULE_ORDERED and SI_ORDER_ANY in vga_isa.c to ensure driver ordering
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Aug 24 01:20:03 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Brandon Gooch
>Release:        10-CURRENT
>Organization:
>Environment:
FreeBSD m6500.local 10.0-CURRENT FreeBSD 10.0-CURRENT #0 r239550M: Wed Aug 22 00:35:46 CDT 2012     root@m6500.local:/usr/obj/usr/src/sys/DELL_M6500  amd64

>Description:
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.
>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

>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:

Index: sys/isa/vga_isa.c
===================================================================
--- sys/isa/vga_isa.c	(revision 239550)
+++ sys/isa/vga_isa.c	(working copy)
@@ -379,4 +379,4 @@
 	0
 };
 
-DRIVER_MODULE(vgapm, vgapci, vgapm_driver, vgapm_devclass, 0, 0);
+DRIVER_MODULE_ORDERED(vgapm, vgapci, vgapm_driver, vgapm_devclass, NULL, NULL, SI_ORDER_ANY);


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208240110.q7O1AUHJ080159>