From owner-freebsd-arch Wed Jan 10 17: 3:33 2001 Delivered-To: freebsd-arch@freebsd.org Received: from mass.osd.bsdi.com (dhcp244.osd.bsdi.com [204.216.28.244]) by hub.freebsd.org (Postfix) with ESMTP id 8619D37B400; Wed, 10 Jan 2001 17:03:16 -0800 (PST) Received: from mass.osd.bsdi.com (localhost [127.0.0.1]) by mass.osd.bsdi.com (8.11.1/8.11.1) with ESMTP id f0B1G8f00436; Wed, 10 Jan 2001 17:16:08 -0800 (PST) (envelope-from msmith@mass.osd.bsdi.com) Message-Id: <200101110116.f0B1G8f00436@mass.osd.bsdi.com> X-Mailer: exmh version 2.1.1 10/15/1999 To: Peter Wemm Cc: Jonathan Lemon , Peter Jeremy , Sergey Babkin , freebsd-arch@FreeBSD.ORG Subject: Re: cvs commit: src/sys/gnu/i386/isa dgb.c dgm.c dgmreg.h dgreg.h In-reply-to: Your message of "Wed, 10 Jan 2001 15:23:38 PST." <200101102323.f0ANNcQ63145@mobile.wemm.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 10 Jan 2001 17:16:08 -0800 From: Mike Smith Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > > This means that the code does a lot of checking to see if the card > > > is PCI or not, resulting in expressions like: > > > ((IS_PCI(board_type)) ? *mem[reg] : inb(base + reg)) > > > > This should be taken care of by the bus_space() macros; which is > > already done by most drivers in the tree. (Many drivers can run > > in either PIO or memory mapped mode) > > But the bus_space_() stuff doesn't handle changing register windows etc. > eg: if you have a 64K memory space and can read/write it directly when > memory mapped, but when on ISA it is all crammed into 16 lots of 4K windows > then bus_space_() cannot save you from this. > > ie: > if (IS_PCI(board_type)) { > value = *mem[reg]; > } else { > if (board->window != window(reg)) > board->window = window(reg); > value = inb(base + (reg % winsize)); > } Typically, if you have half a clue, you will separate the ISA-aware parts of the driver from the PCI-aware parts and use a set of function vectors. Makes for much cleaner code. 8) -- ... every activity meets with opposition, everyone who acts has his rivals and unfortunately opponents also. But not because people want to be opponents, rather because the tasks and relationships force people to take different points of view. [Dr. Fritz Todt] V I C T O R Y N O T V E N G E A N C E To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message