From owner-freebsd-arch@FreeBSD.ORG Wed Mar 17 10:49:55 2010 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 68259106564A for ; Wed, 17 Mar 2010 10:49:55 +0000 (UTC) (envelope-from kmsujit@gmail.com) Received: from mail-px0-f200.google.com (mail-px0-f200.google.com [209.85.216.200]) by mx1.freebsd.org (Postfix) with ESMTP id 3FDC88FC17 for ; Wed, 17 Mar 2010 10:49:54 +0000 (UTC) Received: by pxi38 with SMTP id 38so123680pxi.27 for ; Wed, 17 Mar 2010 03:49:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=FlQRahRTdsdpbtujSCWOmbmZEKzR5pnWPxlJrF+0m1Q=; b=DVJ2a+gD+INq5FwJ+H2a3doTUFhkZgkTiKttZteHUs3d5MvuXIL4y4Ba6ZVPpJTF8n hl20UDjLi2ngOuwWrTvHbb9/1IzDOGA8KSBl2dRFcLNcIrWzBivk7YCBWxvt9SahJiuH lK7lhWxxJQ1U4XVCRy/lhalj/lONMZMmII5m0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=Fn7awXRctW4utGP6ZrwirdlZya9JQFoSx9K2S/Ppm3J6FCVGiXRij0aQ3qprOiy781 vB/fnjrvujMXPdOVIkfoysxboSkF6fYq8fLg8IDl2iRsNoooi3l+f4vxRvmijx3jpQEc WI8peRPgxoHImAa0PgcZHwYpUAqunad1bKQhk= MIME-Version: 1.0 Received: by 10.114.188.23 with SMTP id l23mr464667waf.40.1268821471426; Wed, 17 Mar 2010 03:24:31 -0700 (PDT) In-Reply-To: <9f206d1a1003170250r2727a55ajb636a0bdf1a2f137@mail.gmail.com> References: <9f206d1a1003170250r2727a55ajb636a0bdf1a2f137@mail.gmail.com> Date: Wed, 17 Mar 2010 15:54:31 +0530 Message-ID: <74fe56021003170324l7379e8f8mcd2da23887d78667@mail.gmail.com> From: Sujit K M To: Cole Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-arch@freebsd.org Subject: Re: PCI and Resouce question X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2010 10:49:55 -0000 > What im trying to achieve is writing to a few registers/memory > addresses for the memory location of BAR 0 for a pci card. I do not > want to modify the drivers source code, since it might become > unavailable sometime in the future. So what im looking to do is write > another kernel module, that can obtain the cards device_t structure, > as well as the resource structure of the card. My aim is to obtain the > resource structure so that I can then obtain the bus_tag and > bus_handle, and use those to write to the BAR 0 memory space. You can still do this if you use port related functionality. But would not be done at the device level, but at the driver level. Also the related functionality like poll/select as the case may be will be utilized at an device level(device_t). > > My understanding is that I would use pci_find_device to obtain the > device_t, then I think I can use bus_alloc_resource_any to obtain the > resource, I see there used to be a bus_get_resource, but the man page > for that no longer seems to exist, and references to it seem to have > been removed. If there is another way or better way of doing this, > please let me know. Also im not familiar with the specifics of > bus_alloc_resouce_any, and I dont know if calling this function from > another kernel module will give me the already allocated memory for > this pci card, or will it create a new one and assign it to the BAR 0 > register on the card? This again is at higher level than the device_t related. Would be much more usefull in developing HA(High Availability). Thanks, Sujit