From owner-freebsd-drivers@FreeBSD.ORG Fri Dec 9 16:04:23 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 E6EDD1065673 for ; Fri, 9 Dec 2011 16:04:23 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id BDFDB8FC17 for ; Fri, 9 Dec 2011 16:04:23 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 7063146B43; Fri, 9 Dec 2011 11:04:23 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id D35FCB96B; Fri, 9 Dec 2011 11:04:22 -0500 (EST) From: John Baldwin To: lixin.pang@emc.com Date: Fri, 9 Dec 2011 11:03:03 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p8; KDE/4.5.5; amd64; ; ) References: <04C45E3CCE5E1B46AE8A29F585F6743A0221EE4B19@MX32A.corp.emc.com> <201112090801.37711.jhb@freebsd.org> <04C45E3CCE5E1B46AE8A29F585F6743A0221EE4B58@MX32A.corp.emc.com> In-Reply-To: <04C45E3CCE5E1B46AE8A29F585F6743A0221EE4B58@MX32A.corp.emc.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201112091103.03065.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 09 Dec 2011 11:04:22 -0500 (EST) Cc: freebsd-drivers@freebsd.org 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 16:04:24 -0000 On Friday, December 09, 2011 9:31:04 am lixin.pang@emc.com wrote: > Thanks John, It turned that it's blacklisted. The reason is that some how it does not recognizes it as pcie or pcix chipset. > > 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 got set. It wants that set on at least some device somewhere in the system. I can look at your pciconf -lc output if that is something you are able to share. > I changed the parameter pci_honor_msi_blacklist to 0 and everything worked. I think there is a tunable and sysctl to let you do this as well: 'hw.pci.honor_msi_blacklist'. > Lixin > > -----Original Message----- > From: John Baldwin [mailto:jhb@freebsd.org] > 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, > > > > pci_enable_busmaster(dev) returns 0, > > > > pci_msi_count(dev) returns 1, > > > > however, error = pci_alloc_msi(dev, &msi) failed with error == 6 > > (device not > configured). > > I assume you set msi to 1 before you called it? (It is both an input and output 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 > > -- John Baldwin