From owner-freebsd-hackers@FreeBSD.ORG Thu Dec 25 09:53:35 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B9DE71065670 for ; Thu, 25 Dec 2008 09:53:35 +0000 (UTC) (envelope-from Andre.Albsmeier@siemens.com) Received: from david.siemens.de (david.siemens.de [192.35.17.14]) by mx1.freebsd.org (Postfix) with ESMTP id 53AF18FC17 for ; Thu, 25 Dec 2008 09:53:34 +0000 (UTC) (envelope-from Andre.Albsmeier@siemens.com) Received: from mail3.siemens.de (localhost [127.0.0.1]) by david.siemens.de (8.12.11.20060308/8.12.11) with ESMTP id mBP9rX0a003814 for ; Thu, 25 Dec 2008 10:53:34 +0100 Received: from curry.mchp.siemens.de (curry.mchp.siemens.de [139.25.40.130]) by mail3.siemens.de (8.12.11.20060308/8.12.11) with ESMTP id mBP9rXfv028463 for ; Thu, 25 Dec 2008 10:53:33 +0100 Received: (from localhost) by curry.mchp.siemens.de (8.14.3/8.14.3) id mBP9rX77070383; Date: Thu, 25 Dec 2008 10:53:33 +0100 From: Andre Albsmeier To: freebsd-hackers@freebsd.org Message-ID: <20081225095333.GA12699@curry.mchp.siemens.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Echelon: X-Advice: Drop that crappy M$-Outlook, I'm tired of your viruses! User-Agent: Mutt/1.5.18 (2008-05-17) Cc: Andre.Albsmeier@siemens.com Subject: Writing device drivers: How to access a specific memory area? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Dec 2008 09:53:35 -0000 Hello all, I am writing a driver which needs to access memory at a specific location. The location depends on what the BIOS has configured into the host bridge. For example, my current machine uses an Intel 975X chipset and the memory location I am interested in has been set to 0xFED14000 and is 16KB in size (this is MCHBAR of the 975X memory hub). I have no idea how to access this space from my driver. I have played around with bus_alloc_resource() but this only gives me back NULL. However, a devinfo -r gives me: nexus0 npx0 acpi0 Interrupt request lines: 9 I/O ports: 0x10-0x1f ... 0x800-0x87f I/O memory addresses: 0x0-0x9ffff 0xc0000-0xdffff 0xe0000-0xfffff 0x100000-0x7fffffff 0xf0000000-0xf3ffffff 0xfec00000-0xfec00fff 0xfed13000-0xfed19fff <--- 0xfed1c000-0xfed1ffff 0xfed20000-0xfed3ffff 0xfed50000-0xfed8ffff 0xfee00000-0xfee00fff 0xffb00000-0xffbfffff 0xfff00000-0xffffffff cpu0 ... The line marked with <--- shows the range which includes the location I am interested in. It is probably assigned to the acpi0 device. How do I proceed from this? Do I have to hack around in the ACPI-Code? I don't hope so ;-) I only need access to this memory location during the probe of my driver to read some configuration data. I do not need to access it later anymore... Thanks a lot for any hints, -Andre