Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Sep 1998 09:38:51 +0100 (BST)
From:      Doug Rabson <dfr@nlsystems.com>
To:        Roger Hardiman <roger@cs.strath.ac.uk>
Cc:        freebsd-alpha@FreeBSD.ORG
Subject:   Re: Bt848 driver for Alpha
Message-ID:  <Pine.BSF.4.01.9809080932410.796-100000@herring.nlsystems.com>
In-Reply-To: <35F3B83B.167E@cs.strath.ac.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 7 Sep 1998, Roger Hardiman wrote:

> Hi,
> A question on porting the bt848 driver to Alpha hardware.
> 
> Anyway, there are 2 32bit dependent sections
> a) memory mapped registers in the bt848 chip
> b) RISC code
> 
> 
> Q) The driver maps the registers (of which the bt848/878 has
> around 30) into the memory space and then writes to the registers
> as if you were writing to a normal variable (crude example
>   bt848->register1 = some_value;
>   bt848->register2 = some_value;
> 
> 
> Question: Can I write to just a 32 bit register with the Alpha.
> (in the same memory mapped way)
> Or, does the Alpha sneakilly do a 32 bit read of address n+1 and
> then do a 64 bit write. (think some old Alpha chips did this)
> 
> I do not want to go writing to registers I was not intending to write
> to.

You can write code like this but as you suspected, the alpha will prefetch
and buffer up writes in a hardware unfriendly way.  What you have to do is
change all register access to use the macros read[bwl]/write[bwl].  These
do the right thing to ensure that a single transaction is made on the PCI
bus.

I would suggest something like the ncr driver:

	...
	vm_offset_t	bt848;

	#define REGOFF(x) (bt848 + offsetof(struct bt848_reg, x)
	#define READREGB(x) readb(REGOFF(x))
	#define WRITEREGB(x, v) writeb(REGOFF(x), v)

--
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.9809080932410.796-100000>