From owner-freebsd-hackers@FreeBSD.ORG Thu May 15 21:44:27 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 10C6437B401 for ; Thu, 15 May 2003 21:44:27 -0700 (PDT) Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id 54EE943F75 for ; Thu, 15 May 2003 21:44:26 -0700 (PDT) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.8/8.12.3) with ESMTP id h4G4iOkA052323; Thu, 15 May 2003 22:44:25 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Thu, 15 May 2003 22:43:50 -0600 (MDT) Message-Id: <20030515.224350.48400302.imp@bsdimp.com> To: mcgovern@beta.com From: "M. Warner Losh" In-Reply-To: <200305160121.h4G1LkPS036046@spoon.beta.com> References: <200305160121.h4G1LkPS036046@spoon.beta.com> X-Mailer: Mew version 2.1 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: hackers@freebsd.org Subject: Re: 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 04:44:27 -0000 In message: <200305160121.h4G1LkPS036046@spoon.beta.com> "Brian J. McGovern" writes: : 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. Use bus_space_read() and you'll be fine. : If I'm on track, how would I then properly convert these physical addresses : to usable virtual addresses? You don't have to worry abou tit. : 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? :) res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0ul, ~0ul, size, RF_ACTIVE); bt = rman_get_bustag(res); bh = rman_get_bushandle(res); (you do this a second time for the other window). reg = bus_space_read_4(bt, bh, SOME_REGISTER); reg |= SR_ENABLE; bus_space_write_4(bt, bh, SOME_REGISTER, reg); Warner