From owner-freebsd-alpha Tue Sep 8 01:39:21 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id BAA25535 for freebsd-alpha-outgoing; Tue, 8 Sep 1998 01:39:21 -0700 (PDT) (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 BAA25528 for ; Tue, 8 Sep 1998 01:39:18 -0700 (PDT) (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 JAA13408; Tue, 8 Sep 1998 09:38:51 +0100 (BST) Date: Tue, 8 Sep 1998 09:38:51 +0100 (BST) From: Doug Rabson To: Roger Hardiman cc: freebsd-alpha@FreeBSD.ORG Subject: Re: Bt848 driver for Alpha In-Reply-To: <35F3B83B.167E@cs.strath.ac.uk> 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, 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