From owner-freebsd-arch@FreeBSD.ORG Wed Mar 17 10:18:19 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 D806F106564A for ; Wed, 17 Mar 2010 10:18:19 +0000 (UTC) (envelope-from cole@opteqint.net) Received: from mail-pw0-f54.google.com (mail-pw0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id BEB1A8FC0C for ; Wed, 17 Mar 2010 10:18:19 +0000 (UTC) Received: by pwj4 with SMTP id 4so664361pwj.13 for ; Wed, 17 Mar 2010 03:18:19 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.247.23 with SMTP id u23mr271685wfh.319.1268819414158; Wed, 17 Mar 2010 02:50:14 -0700 (PDT) X-Originating-IP: [196.210.171.238] Date: Wed, 17 Mar 2010 11:50:14 +0200 Message-ID: <9f206d1a1003170250r2727a55ajb636a0bdf1a2f137@mail.gmail.com> From: Cole To: freebsd-arch@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Subject: 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:18:19 -0000 Hi. Sorry if this is not the correct list, I have tried posting to freebsd-hackers, and didnt get a response. Maybe im being stupid and not connecting something, or just not understanding, in which case sorry again. 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. 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? I also know I can get the softc structure from the device_t, but I dont wish to use that, as it might change without my knowledge, especially if the driver becomes closed in the future. I dont really do a lot of driver development, or this sort of programming, so any help would be appreciated, and once again, im sorry if this is all basic stuff and im not understanding something, or if im posting to the wrong list. Regards /Cole