From owner-freebsd-sparc64@FreeBSD.ORG Sun Aug 31 09:45:12 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 80EE816A4BF for ; Sun, 31 Aug 2003 09:45:12 -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 EE7C443F93 for ; Sun, 31 Aug 2003 09:45:10 -0700 (PDT) (envelope-from marcel@xcllnt.net) Received: from dhcp01.pn.xcllnt.net (dhcp01.pn.xcllnt.net [192.168.4.201]) by ns1.xcllnt.net (8.12.9/8.12.9) with ESMTP id h7VGjAwO017001 for ; Sun, 31 Aug 2003 09:45:10 -0700 (PDT) (envelope-from marcel@piii.pn.xcllnt.net) Received: from dhcp01.pn.xcllnt.net (localhost [127.0.0.1]) by dhcp01.pn.xcllnt.net (8.12.9/8.12.9) with ESMTP id h7VGjA8a000686 for ; Sun, 31 Aug 2003 09:45:10 -0700 (PDT) (envelope-from marcel@dhcp01.pn.xcllnt.net) Received: (from marcel@localhost) by dhcp01.pn.xcllnt.net (8.12.9/8.12.9/Submit) id h7VGjAC9000685 for sparc64@freebsd.org; Sun, 31 Aug 2003 09:45:10 -0700 (PDT) (envelope-from marcel) Date: Sun, 31 Aug 2003 09:45:10 -0700 From: Marcel Moolenaar To: sparc64@freebsd.org Message-ID: <20030831164510.GA570@dhcp01.pn.xcllnt.net> References: <20030829211641.GA628@athlon.pn.xcllnt.net> <20030831124536.GA679@timesink.dyndns.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030831124536.GA679@timesink.dyndns.org> User-Agent: Mutt/1.5.4i Subject: Re: Q: resource range for SBus oddity 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: Sun, 31 Aug 2003 16:45:12 -0000 On Sun, Aug 31, 2003 at 02:45:36PM +0200, Thomas Moestl wrote: > > puc1: mem 0x1000000-0x1000003 irq 2024 on sbus0 > > > > As you can see, the memory I/O resource is 4 bytes wide. However, > > the channel A registers on the z8530 chip are at offsets 4 > > (control) and 6 (data). This lies outside the reserved range. > > > > I would think that with 2 channels and 2 addressable registers > > per channel we would be using offsets 0-3. > > > > Question: Is there an implied multiplication or division factor? > > No, the ranges should in general be correct; I've checked this with > other devices. The register space of a single zs channel is indeed 4 > bytes, but IIRC each channel has a separate device node, and there was > some oddity which required both channels to use the register addresses > specified in the first one, which is why the zs driver attaches two > zsttys to the first device, and does not attach to the second zs > instance. Jake can probably give more details on that. I'm not sure you understand what I mean. The firmware has given a single zs device 4 bytes of (s)bus space. We print the I/O range in accordance with the firmware. The zs device has 4 bus-accessable registers (2 channels, 2 registers per channel). This matches the I/O range given to it, provided the offsets within the range are: channel B control 0 channel B data 1 channel A control 2 channel A data 3 But this is not the case. The registers of a single zs device are at the following offsets: channel B control 0 channel B data 2 channel A control 4 channel A data 6 Thus: given the actual offsets of a single zs device, the firmware should have assigned 8 bytes of (s)bus space to it, not 4. Unless the I/O range is interleaved with another independent device, such as a second zs device of course. But this is not the case. The zstty devices you talk about are created for each channel of a zs device. The second zs device is not attached because we only attach the device with number 0 (see sys/dev/zs/zs_sbus.c), I think because the second is for the keyboard and mouse? I do something the same with uart(4), only I use puc(4) to attach to the zs proper and attach uart(4) to each channel. The oddity can therefore also be explained as follows: puc0 has 4 bytes of bus space assigned to it. uart0 on puc0 takes up 4 bytes of bus space. uart1 on puc0 takes up 4 bytes of bus space. Thus uart0 and uart1 take up 8 bytes of bus space, even though the parent (puc0) only have 4 bytes assigned to it. -- Marcel Moolenaar USPA: A-39004 marcel@xcllnt.net