From owner-svn-src-head@FreeBSD.ORG Sun Dec 19 11:14:35 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F359106566C; Sun, 19 Dec 2010 11:14:35 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D81B18FC18; Sun, 19 Dec 2010 11:14:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oBJBEYmF073156; Sun, 19 Dec 2010 11:14:34 GMT (envelope-from tijl@svn.freebsd.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oBJBEYob073154; Sun, 19 Dec 2010 11:14:34 GMT (envelope-from tijl@svn.freebsd.org) Message-Id: <201012191114.oBJBEYob073154@svn.freebsd.org> From: Tijl Coosemans Date: Sun, 19 Dec 2010 11:14:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r216558 - head/sys/dev/if_ndis X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Dec 2010 11:14:35 -0000 Author: tijl Date: Sun Dec 19 11:14:34 2010 New Revision: 216558 URL: http://svn.freebsd.org/changeset/base/216558 Log: Fix a bug introduced in r216518. The ndis_subsys field holds the PCI subdevice ID in addition to the subvendor ID. Reported by: Paul B Mahol 'onemda gmail com' Approved by: kib (mentor) Modified: head/sys/dev/if_ndis/if_ndis_pci.c Modified: head/sys/dev/if_ndis/if_ndis_pci.c ============================================================================== --- head/sys/dev/if_ndis/if_ndis_pci.c Sun Dec 19 10:36:06 2010 (r216557) +++ head/sys/dev/if_ndis/if_ndis_pci.c Sun Dec 19 11:14:34 2010 (r216558) @@ -110,14 +110,20 @@ ndis_devcompare(bustype, t, dev) struct ndis_pci_type *t; device_t dev; { + uint16_t vid, did; + uint32_t subsys; + if (bustype != PCIBus) return(FALSE); + vid = pci_get_vendor(dev); + did = pci_get_device(dev); + subsys = pci_get_subdevice(dev); + subsys = (subsys << 16) | pci_get_subvendor(dev); + while(t->ndis_name != NULL) { - if ((pci_get_vendor(dev) == t->ndis_vid) && - (pci_get_device(dev) == t->ndis_did) && - (pci_get_subvendor(dev) == t->ndis_subsys || - t->ndis_subsys == 0)) { + if ((t->ndis_vid == vid) && (t->ndis_did == did) && + (t->ndis_subsys == subsys || t->ndis_subsys == 0)) { device_set_desc(dev, t->ndis_name); return(TRUE); } @@ -169,6 +175,8 @@ ndis_attach_pci(dev) struct resource_list *rl; struct resource_list_entry *rle; struct drvdb_ent *db; + uint16_t vid, did; + uint32_t subsys; sc = device_get_softc(dev); unit = device_get_unit(dev); @@ -300,14 +308,18 @@ ndis_attach_pci(dev) /* Figure out exactly which device we matched. */ + vid = pci_get_vendor(dev); + did = pci_get_device(dev); + subsys = pci_get_subdevice(dev); + subsys = (subsys << 16) | pci_get_subvendor(dev); + t = db->windrv_devlist; while(t->ndis_name != NULL) { - if ((pci_get_vendor(dev) == t->ndis_vid) && - (pci_get_device(dev) == t->ndis_did)) { + if (t->ndis_vid == vid && t->ndis_did == did) { if (t->ndis_subsys == 0) defidx = devidx; - else if (pci_get_subvendor(dev) == t->ndis_subsys) + else if (t->ndis_subsys == subsys) break; } t++;