From owner-freebsd-alpha Tue Nov 24 03:34:04 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id DAA08770 for freebsd-alpha-outgoing; Tue, 24 Nov 1998 03:34:04 -0800 (PST) (envelope-from owner-freebsd-alpha@FreeBSD.ORG) Received: from nlsystems.com (nlsys.demon.co.uk [158.152.125.33]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id DAA08762 for ; Tue, 24 Nov 1998 03:34:02 -0800 (PST) (envelope-from dfr@nlsystems.com) Received: from herring.nlsystems.com (herring.nlsystems.com [10.0.0.2]) by nlsystems.com (8.9.1/8.8.5) with SMTP id LAA06690; Tue, 24 Nov 1998 11:34:27 GMT Date: Tue, 24 Nov 1998 11:34:27 +0000 (GMT) From: Doug Rabson To: Mike Smith cc: shimon@simon-shapiro.org, freebsd-alpha@FreeBSD.ORG Subject: Re: UnAligned Access, but why? In-Reply-To: <199811240553.VAA02779@dingo.cdrom.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-alpha@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Mon, 23 Nov 1998, Mike Smith wrote: > > > > > > > > The bus_space_read_[14] are causing unaligned access panics. These > > > > panics > > > > can be eliminated by casting explicitly: > > > > > > Don't do this. Align the objects you're trying to transfer instead. > > > > Thanx, but how? I took the CAM driver as is and just triesd to actually > > align the data. It makes no difference at all. I am still getting the > > panics. If you look again at my example (the one following the casts), you > > will see that it does not help. > > I saw no evidence that you were performing aligned transfers; your > example was, if I remember correctly, casting some arbitrary pointer to > a pointer to a 32-bit object. This will fail if the arbitrary > pointer's value is not 32-bit aligned. > > > Also (forgive my ignorance here), different PCI busss appear to have > > different sizes for the same thing. Or, at least this is how all this > > bus_rea/write stuff tries to imply. > > No. Different PCI bus implementations used different host methods to > achieve identical PCI bus transactions. > > > The end result is a mass confusion on my part. i am trying to fit the > > driver into the existing framework, not change the framework (unless > > obviously broken). I do not have enough information to suggest anything is > > broken, except the panics. > > The problem is most likely that you are attempting to access a local > memory data structure member of a given size that is not aligned to > that size, or you are attempting to access a data structure inside a > PCI device where the region in question is memory-mapped and the data > structure is not aligned in the mapping according to its size. > > > I may need some detailed help here.... > > You may need to provide a more detailed example. To begin with, it'd > help if you can clarify whether you're sure you understand what > constitutes an "unaligned access", as that's pretty key to working out > where you're falling over here. You must not pass unaligned offsets to in[wl], out[wl], read[wl] and write[wl]. For 'w' sized accesses, the offset must be even aligned, for 'l' sized accesses, the offset must be a multiple of 4. I think NetBSD has code to panic if an illegal offset is used to access device memory. I may do the same (probably for kernels compiled with DIAGNOSTIC defined). -- Doug Rabson Mail: dfr@nlsystems.com Nonlinear Systems Ltd. Phone: +44 181 951 1891 Fax: +44 181 381 1039 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-alpha" in the body of the message