From owner-freebsd-drivers@FreeBSD.ORG Fri Dec 9 14:31:15 2011 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B8FA106566B for ; Fri, 9 Dec 2011 14:31:15 +0000 (UTC) (envelope-from lixin.pang@emc.com) Received: from mexforward.lss.emc.com (mexforward.lss.emc.com [128.222.32.20]) by mx1.freebsd.org (Postfix) with ESMTP id 22D168FC12 for ; Fri, 9 Dec 2011 14:31:14 +0000 (UTC) Received: from hop04-l1d11-si01.isus.emc.com (HOP04-L1D11-SI01.isus.emc.com [10.254.111.54]) by mexforward.lss.emc.com (Switch-3.4.3/Switch-3.4.3) with ESMTP id pB9EV4VV005216 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 9 Dec 2011 09:31:13 -0500 Received: from mailhub.lss.emc.com (mailhub.lss.emc.com [10.254.222.130]) by hop04-l1d11-si01.isus.emc.com (RSA Interceptor); Fri, 9 Dec 2011 09:30:49 -0500 Received: from mxhub23.corp.emc.com (mxhub23.corp.emc.com [128.222.70.135]) by mailhub.lss.emc.com (Switch-3.4.3/Switch-3.4.3) with ESMTP id pB9EUn88028334; Fri, 9 Dec 2011 09:30:49 -0500 Received: from mx32a.corp.emc.com ([169.254.1.158]) by mxhub23.corp.emc.com ([128.222.70.135]) with mapi; Fri, 9 Dec 2011 09:30:48 -0500 From: To: , Date: Fri, 9 Dec 2011 09:31:04 -0500 Thread-Topic: pci_alloc_msi error Thread-Index: Acy2crjteQFfUhiRTdaTToH7uh66YwACLqlA Message-ID: <04C45E3CCE5E1B46AE8A29F585F6743A0221EE4B58@MX32A.corp.emc.com> References: <04C45E3CCE5E1B46AE8A29F585F6743A0221EE4B19@MX32A.corp.emc.com> <201112090801.37711.jhb@freebsd.org> In-Reply-To: <201112090801.37711.jhb@freebsd.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-EMM-MHVC: 1 Cc: Subject: RE: pci_alloc_msi error X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 14:31:15 -0000 Thanks John, It turned that it's blacklisted. The reason is that some how= it does not recognizes it as pcie or pcix chipset. =20 I noticed that the MSI_CAP_NXT ptr is null for our PCI device, is that the = reason why it doesn't recognize it as pcie or pcix? I looked at the code, = pci_read_extcap is the only place that the pcie_chipset and pcix_chipset go= t set. =20 I changed the parameter pci_honor_msi_blacklist to 0 and everything worked. Lixin -----Original Message----- From: John Baldwin [mailto:jhb@freebsd.org]=20 Sent: Friday, December 09, 2011 8:02 AM To: freebsd-drivers@freebsd.org Cc: pang, lixin Subject: Re: pci_alloc_msi error On Thursday, December 08, 2011 8:56:39 pm lixin.pang@emc.com wrote: > I'm writing a PCI device driver for freebsd 7.3. In the driver attach function, >=20 > pci_enable_busmaster(dev) returns 0, >=20 > pci_msi_count(dev) returns 1, >=20 > however, error =3D pci_alloc_msi(dev, &msi) failed with error =3D=3D 6=20 > (device not configured). I assume you set msi to 1 before you called it? (It is both an input and o= utput parameter.) > Am I missing any steps before calling pci_alloc_msi? I don't believe so. The reasons I see that pci_alloc_msi() will fail with = ENXIO are: - the driver has allocated its INTx IRQ via bus_alloc_resource() of rid 0 of the SYS_RES_IRQ type - the driver has already allocated MSI or MSI-X IRQs - MSI is blacklisted for the system or for a parent PCI-PCI bridge - APIC mode is disabled or your system has an unsupported CPU (only Intel, AMD, and certain VIA CPUs are known to work, other CPUs might work, we just haven't heard of it). - The system is completely out of MSI IRQ tokens (there are 512 of these, so this is doubtful) -- John Baldwin