From nobody@FreeBSD.org  Mon Jan 31 04:32:26 2005
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 5DBA016A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 31 Jan 2005 04:32:26 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 3DC8043D4C
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 31 Jan 2005 04:32:26 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id j0V4WNsB051779
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 31 Jan 2005 04:32:23 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id j0V4WNiI051778;
	Mon, 31 Jan 2005 04:32:23 GMT
	(envelope-from nobody)
Message-Id: <200501310432.j0V4WNiI051778@www.freebsd.org>
Date: Mon, 31 Jan 2005 04:32:23 GMT
From: Alex <lesha@intercaf.ru>
To: freebsd-gnats-submit@FreeBSD.org
Subject: ports/dri:  for some reason drm.ko PCI vendor/device id detection is broken
X-Send-Pr-Version: www-2.3

>Number:         76879
>Category:       kern
>Synopsis:       drm.ko PCI vendor/device id detection is broken
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    anholt
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan 31 04:40:22 GMT 2005
>Closed-Date:    Thu Apr 14 01:49:13 GMT 2005
>Last-Modified:  Thu Apr 14 01:49:13 GMT 2005
>Originator:     Alex
>Release:        5.3-RELEASE-p5
>Organization:
Intercaf
>Environment:
FreeBSD life.offshoredrive.com 5.3-RELEASE-p5 FreeBSD 5.3-RELEASE-p5 #2: Sun Jan 23 16:28:10 MSK 2005     lesha@life.offshoredrive.com:/usr/obj/usr/src/sys/LIFE  i386

Graphics Card:
Intel i852GM/i855GM GMCH

Computer:
Fujitsu-Siemens LifeBook S 7010
>Description:
During drm_probe vendor and device ids are messed up.

------------ [from drm_drv.c] ------------
if (!strcmp(device_get_name(dev), "drmsub"))
                pciid = pci_get_devid(device_get_parent(dev));
        else
                pciid = pci_get_devid(dev);

        vendor = (pciid & 0x0000ffff);
        device = (pciid & 0xffff0000) >> 16;
------------
This returns trash instead of real vendor/device ids for probed hardware.

Why not to use  pci_get_vendor(dev)  and  pci_get_device(dev) ??

p.s. I'm totally lame, but curious.  ;)
>How-To-Repeat:
Install DRI port and see that your i915 is not detected/working 
;)
>Fix:
*** drm_drv.c.org       Mon Jan 31 07:14:19 2005
--- drm_drv.c   Mon Jan 31 07:16:19 2005
*************** int drm_probe(device_t dev, drm_pci_id_l
*** 150,155 ****
--- 150,159 ----

        vendor = (pciid & 0x0000ffff);
        device = (pciid & 0xffff0000) >> 16;
+
+ // override
+         vendor = pci_get_vendor(dev);
+         device = pci_get_device(dev);

        s = drm_find_description(vendor, device, idlist);
        if (s != NULL) {


--------
after this patch:
drmsub1: <Intel i852GM/i855GM GMCH> mem 0xd0080000-0xd00fffff,0xe0000000-0xe7ffffff at device 2.1 on pci0
info: [drm] AGP at 0xd8000000 128MB
info: [drm] Initialized i915 1.2.0 20041217 on minor 1
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->anholt 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Tue Feb 1 06:49:55 GMT 2005 
Responsible-Changed-Why:  
Over to maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=76879 

From: Eric Anholt <eta@lclark.edu>
To: gnats <freebsd-gnats-submit@FreeBSD.ORG>
Cc:  
Subject: Re: ports/76879
Date: Sat, 12 Feb 2005 16:20:08 -0800

 I tried your fix, as I've been wanting to get i915 to work for a long
 time, but it didn't work.  I got three drmsub1 (why 1?  devinfo -v shows
 a drmsub0) probes, for the ac97, the smbus, and the ehci controller, but
 none for the GMCH.  Chipset is an i845 with integrated graphics.
 
 -- 
 Eric Anholt                                eta@lclark.edu          
 http://people.freebsd.org/~anholt/         anholt@FreeBSD.org
State-Changed-From-To: open->closed 
State-Changed-By: anholt 
State-Changed-When: Thu Apr 14 01:48:38 GMT 2005 
State-Changed-Why:  
Committed with DRM update to -current.  Still doesn't get i915 working, but 
covers the issue brought up. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=76879 
>Unformatted:
