Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Nov 1998 20:41:18 +0000 (GMT)
From:      Doug Rabson <dfr@nlsystems.com>
To:        Simon Shapiro <shimon@simon-shapiro.org>
Cc:        freebsd-alpha@FreeBSD.ORG, Mike Smith <mike@smith.net.au>
Subject:   Re: UnAligned Access, but why?
Message-ID:  <Pine.BSF.4.01.9811242035450.21711-100000@herring.nlsystems.com>
In-Reply-To: <XFMail.981124113917.shimon@simon-shapiro.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 24 Nov 1998, Simon Shapiro wrote:

> OK.  This all makes lots of sense, but look at the example I provided in
> the original post.  It is a modification of code I did not write, but some
> of you may have:
> 
> /* static __inline void */
> void
> bus_space_write_4(bus_space_tag_t tag, bus_space_handle_t bsh,
>                        bus_size_t offset, u_int32_t value)
> {
> #if defined(_ALPHA_BUS_PIO_H_)
> #if defined(_ALPHA_BUS_MEMIO_H_)
>         if (tag == ALPHA_BUS_SPACE_IO)
> #endif
>         {
>                 u_int32_t port, data;
> 
>                 port = (u_int32_t)bsh + (u_int32_t)offset;
>                 data = (u_int32_t)value;
> 
> printf("%s.%d I/O handle = %x, offset = %x, value = %x\n", __FILE__,
> __LINE__, b
> sh, offset, value);
> printf("%s.%d I/O port = %x, data = %x\n", __FILE__, __LINE__, port, data);
> 
> >>>>-------->>>> Everything is honky-dory until this point <<<<--------<<<<
>                 outl(port, data);
> >>>>-------->>>>  This printf never happens.  We panic before it happens 
> 
> printf("%s.%d I/O DONE = %x, data = %x\n", __FILE__, __LINE__, port, data);
>         }
> #endif
> #if defined(_ALPHA_BUS_MEMIO_H_)
> #if defined(_ALPHA_BUS_PIO_H_)
>         else
> #endif
>                 writel(bsh + offset, value);
> #endif
> }
> 
> You can trace back this call to the sys/dev/dpt/dpt_scsi.c file the
> dpt_send_eata_command function, line 1088, where the line:
> 
>         dpt_outl(dpt, HA_WDMAADDR, cmd_busaddr);
> 
> can be traced back to bus_space_write_4 above.  Please trust me in saying
> that I tried everything you suggest before posting my mssage.  The casts at
> the top of my example were necessary to avoid a similar panic.  All  the
> data types involoved are taken from the CAM code and are either pointers or
> 64bit integers.

Ok, its fairly obvious that something strange is happening here.  What is
the faulting address for the unaligned access (the value of a0 in the
printtrap() report)?

The code which implements the various variants of inx, outx etc. is in the
chipset implementations in sys/alpha/pci.  You are probably using the
implementation in cia.c (you have a Miata right?) which uses the
byte-word-extension instructions to access the i/o memory. The functions
for this combination are named cia_bwx_in*, etc.

--
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.01.9811242035450.21711-100000>