From owner-freebsd-hackers@FreeBSD.ORG Thu May 15 18:21:50 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7525037B401 for ; Thu, 15 May 2003 18:21:50 -0700 (PDT) Received: from spoon.beta.com (spoon.beta.com [199.165.180.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9F9E543F93 for ; Thu, 15 May 2003 18:21:49 -0700 (PDT) (envelope-from mcgovern@spoon.beta.com) Received: from spoon.beta.com (localhost.beta.com [127.0.0.1]) by spoon.beta.com (8.12.6/8.12.6) with ESMTP id h4G1LkPS036046 for ; Thu, 15 May 2003 21:21:47 -0400 (EDT) (envelope-from mcgovern@spoon.beta.com) Message-Id: <200305160121.h4G1LkPS036046@spoon.beta.com> To: hackers@freebsd.org Date: Thu, 15 May 2003 21:21:46 -0400 From: "Brian J. McGovern" X-Spam-Status: No, hits=0.8 required=5.0 tests=SPAM_PHRASE_00_01 version=2.43 Subject: Questions on newbus... X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 May 2003 01:21:50 -0000 I've been starting to update my Cyclades-Z driver to work with FreeBSD 5.0. I've read the docs in the developer's handbook, and the article on new bus. Searching the mailing lists for "newbus" found 2 items... I've been trying to use other drivers as guides, but they don't seem to be either consistent or well documented :) I seem to be getting stuck during the mapping of resources. I currently go out and use bus_alloc_resource() to get the PCI resources for the two configuration registers that will give me the board's registers and memory window. I then use rman_get_bustag and rman_get_bushandle to get the tags and handles, respectively, then call bus_space_read_4() to read the configuration registers. Now, I haven't done a lot of testing with the actual hardware (I haven't updated the initialization code yet), but I'm assuming that these bus_space_read() calls should give me physical address locations... In 4.x (and earlier), the routines for allocating the resources would provide both physical and virtual addresses. If I'm on track, how would I then properly convert these physical addresses to usable virtual addresses? If I'm off track (and I somehow expect I am), can someone take a few minutes and coach me on how to read the PCI configuration registers, and get my two memory windows mapped so I can start bit-banging the hardware? :) -Brian