From owner-freebsd-sparc64@FreeBSD.ORG Tue Sep 2 00:06:44 2003 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BEFCB16A4BF for ; Tue, 2 Sep 2003 00:06:44 -0700 (PDT) Received: from ns1.xcllnt.net (209-128-86-226.bayarea.net [209.128.86.226]) by mx1.FreeBSD.org (Postfix) with ESMTP id E730744005 for ; Tue, 2 Sep 2003 00:06:42 -0700 (PDT) (envelope-from marcel@xcllnt.net) Received: from athlon.pn.xcllnt.net (athlon.pn.xcllnt.net [192.168.4.3]) by ns1.xcllnt.net (8.12.9/8.12.9) with ESMTP id h8276gwO028699 for ; Tue, 2 Sep 2003 00:06:42 -0700 (PDT) (envelope-from marcel@piii.pn.xcllnt.net) Received: from athlon.pn.xcllnt.net (localhost [127.0.0.1]) by athlon.pn.xcllnt.net (8.12.9/8.12.9) with ESMTP id h8276gIi060296 for ; Tue, 2 Sep 2003 00:06:42 -0700 (PDT) (envelope-from marcel@athlon.pn.xcllnt.net) Received: (from marcel@localhost) by athlon.pn.xcllnt.net (8.12.9/8.12.9/Submit) id h8276gUT060295 for sparc64@freebsd.org; Tue, 2 Sep 2003 00:06:42 -0700 (PDT) (envelope-from marcel) Date: Tue, 2 Sep 2003 00:06:42 -0700 From: Marcel Moolenaar To: sparc64@freebsd.org Message-ID: <20030902070642.GA659@athlon.pn.xcllnt.net> References: <20030902021813.GA2300@dhcp01.pn.xcllnt.net> <20030902064956.GA16766@funkthat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030902064956.GA16766@funkthat.com> User-Agent: Mutt/1.5.4i Subject: Re: Req review: OF_decode_addr() X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Sep 2003 07:06:44 -0000 On Mon, Sep 01, 2003 at 11:49:56PM -0700, John-Mark Gurney wrote: > Marcel Moolenaar wrote this message on Mon, Sep 01, 2003 at 19:18 -0700: > > Attached a patch to add function OF_decode_addr(). The function > > takes a package handle (phandle_t) and returns the physical > > (decoded) address at which it resides as well as it space. > > You mean physical address as viewed by the CPU, correct? Yes. > > This function is needed by uart(4) to for low-level console > > access. > > > > There's one thing I'm not happy about and that's the call to > > ofw_isa_map_iorange(). It makes it impossible to create a kernel > > without isa. It makes sense to move the bulk of the code in > > OF_decode_addr() to the respective bus drivers and have some > > linker set to tie bus name to function pointer. I'm not sure > > it's important to have that right away or if we can commit this > > and deal with that later? > > Why don't you wrap the ebus/isa part around an #if defined(NISA) || > defined(NEBUS) to prevent the inclusion of isa when not necessary? That would work. The sbus part is sufficiently seperated from the ebus part. > I would like to see this code in a more general format instead of in > a MD file. OpenFirmware is quite specific on how each bus lists it's > registers and ranges. We should leverage this so that other platforms > don't have to have lots of special code to implement the same thing. Good point. PowerPC immediately comes to mind. However, there's a pitfall: The prototype uses both phandle_t and bus_addr_t. A lot of files include OFW headers, but most do not have both types visible. A more generic implementation will have a cost: We need to do a more extensive shuffling/cleaning to get something that builds. That definitely is beyond my scope. > I don't have an OFW dump handy, so I can't verify correctness of code. The code has been tested on an U2 (sbus) and an U5 (ebus/pci). -- Marcel Moolenaar USPA: A-39004 marcel@xcllnt.net