Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Nov 1998 16:38:09 -0500 (EST)
From:      Simon Shapiro <shimon@simon-shapiro.org>
To:        freebsd-alpha@FreeBSD.ORG
Subject:   UnAligned Access, but why?
Message-ID:  <XFMail.981123163809.shimon@simon-shapiro.org>

next in thread | raw e-mail | index | archive | help
Am trying to get the DPT driver running on alpha.
Narrowed down the problem to this:

In sys/alpha/include/bus.h there is a series of static inline functions to
do the equivalient of inb, inw, and inl, as well as outb, outw, outl.  they
are called bus_space_{read,write}_[124].

The bus_space_read_[14] are causing unaligned access panics.  These panics
can be eliminated by casting explicitly:

                return (inb((u_int32_t)(handle + offset)));
and
                return (inl((u_int32_t)(handle + offset)));

However, bus_space_write_[14] will panic on unaligned access even when
modified to be:

                outb((u_int32_t)(bsh + offset), (u_int8_t)value);
and
                outl((u_int32_t)(bsh + offset), (u_int32_t)value);

I even tried to modify bus_space_write_4 to be:

/* 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;

                outl(port, data);
        }
#endif
#if defined(_ALPHA_BUS_MEMIO_H_)
#if defined(_ALPHA_BUS_PIO_H_)
        else
#endif
                writel(bsh + offset, value);
#endif
}

I.E made the function non static, not inline and copied the values to local
variables before doing the outl thing.  The panic occurs right at the outl
line.  I can get the kernel to printf exactly to that point.

Any help will be appreciated.  I tried to trace the functions but end at
the chipset structure.  IS there a set of functions in ROM that is mapped
in this manner?

Simon


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?XFMail.981123163809.shimon>