Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Dec 1995 15:10:52 -0800
From:      David Greenman <davidg@Root.COM>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        CVS-committers@freefall.freebsd.org, cvs-sys@freefall.freebsd.org
Subject:   Re: cvs commit: src/sys/i386/isa if_ed.c 
Message-ID:  <199512152310.PAA01962@corbin.Root.COM>
In-Reply-To: Your message of "Sat, 16 Dec 95 04:54:01 %2B1100." <199512151754.EAA24327@godzilla.zeta.org.au> 

next in thread | previous in thread | raw e-mail | index | archive | help
>>  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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199512152310.PAA01962>