From owner-freebsd-commit Fri Dec 15 15:12:25 1995 Return-Path: owner-commit Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id PAA25186 for freebsd-commit-outgoing; Fri, 15 Dec 1995 15:12:25 -0800 (PST) Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id PAA25111 for cvs-all-outgoing; Fri, 15 Dec 1995 15:10:54 -0800 (PST) Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id PAA25097 for cvs-sys-outgoing; Fri, 15 Dec 1995 15:10:51 -0800 (PST) Received: from Root.COM (implode.Root.COM [198.145.90.17]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id PAA25080 Fri, 15 Dec 1995 15:10:48 -0800 (PST) Received: from corbin.Root.COM (corbin [198.145.90.50]) by Root.COM (8.6.12/8.6.5) with ESMTP id PAA01837; Fri, 15 Dec 1995 15:10:44 -0800 Received: from localhost (localhost [127.0.0.1]) by corbin.Root.COM (8.6.12/8.6.5) with SMTP id PAA01962; Fri, 15 Dec 1995 15:10:53 -0800 Message-Id: <199512152310.PAA01962@corbin.Root.COM> To: Bruce Evans cc: CVS-committers@freefall.freebsd.org, cvs-sys@freefall.freebsd.org Subject: Re: cvs commit: src/sys/i386/isa if_ed.c In-reply-to: Your message of "Sat, 16 Dec 95 04:54:01 +1100." <199512151754.EAA24327@godzilla.zeta.org.au> From: David Greenman Reply-To: davidg@Root.COM Date: Fri, 15 Dec 1995 15:10:52 -0800 Sender: owner-commit@FreeBSD.ORG Precedence: bulk >> Modified: sys/i386/isa if_ed.c >> Log: >> Changed arg type for pio functions. >> Cast a few things appropriately to shut up the compiler. > >Please fix problems, not compiler warnings. The compiler warning was bogus. >In this case, I think the casts only work because the hardware ignores >some bits in the address (bits 14-15 of 0-31 for 16K cards and bits >13-15 for 8K cards?). Conversions of the form > > (int)(buf - base) > ((int)buf) & 0x3fff > >would be more obviously correct, but might be slower. That's not quite correct. The offset within the NIC memory segment is a 16 bit number but is written out a byte at a time. The fact that only the lower two bytes are written out *implies* a masking of the upper bits. This is both intended and correct. I chose to fix the problem the way I did to avoid casting a pointer to a short (which I think is indeed incorrect). This driver is highly i386-specific and I'm not trying to generalize it. The only questionable thing about the change I made above would be in casting the pointer to an int...but again, I'm not trying to be general. In the case of the PIO mode, the 'address' is an offset, not a pointer. -DG