Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Nov 1998 21:53:36 -0800
From:      Mike Smith <mike@smith.net.au>
To:        shimon@simon-shapiro.org
Cc:        Mike Smith <mike@smith.net.au>, freebsd-alpha@FreeBSD.ORG
Subject:   Re: UnAligned Access, but why? 
Message-ID:  <199811240553.VAA02779@dingo.cdrom.com>
In-Reply-To: Your message of "Tue, 24 Nov 1998 00:22:30 EST." <XFMail.981124002230.shimon@simon-shapiro.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
> > > 
> > > 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.


-- 
\\  Sometimes you're ahead,       \\  Mike Smith
\\  sometimes you're behind.      \\  mike@smith.net.au
\\  The race is long, and in the  \\  msmith@freebsd.org
\\  end it's only with yourself.  \\  msmith@cdrom.com



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-alpha" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199811240553.VAA02779>