Subject: Re: port-i386/2109: ultra14f.c byte-read of board ID fails on 34f (mine at least)
To: <>
From: Mark H. Weaver <mhw@netris.org>
List: netbsd-bugs
Date: 02/23/1996 04:39:53
Chris_G_Demetriou@NIAGARA.NECTAR.CS.CMU.EDU wrote:
> > 
> > Recent changes to ultra14f.c cause it to read the board ID and
> > configuration using byte-reads instead of word-reads, perhaps because
> > this was necessary for someone else.  On my 34f (VLB), the byte-reads
> > don't yield a valid board ID, and the board is not recognized.
> 
> What _is_ returned by byte reads?

I wrote:
> Sorry, should've thought to check for that.  0x4156 is read, and
> 0x5641 is what we want, meaning that the word-read seems to be
> returning the big-endian representation for some reason.
> 
> Was the change to byte-reads ever tested?

Oops, I didn't notice the htons's used in the word-read code; I just
copied it blind from version 1.60 of ultra14f.c.

I guess it was never tested, and is a simple mistake.  How about the
following patch instead?

*** /usr/src/sys/dev/isa/ultra14f.c.mhw1	Sat Feb 10 07:31:52 1996
--- /usr/src/sys/dev/isa/ultra14f.c	Fri Feb 23 04:38:57 1996
***************
*** 916,926 ****
  	if (ia->ia_iobase == IOBASEUNK)
  		return ENXIO;
  
! 	model = inb(iobase + U14_ID) | (inb(iobase + U14_ID + 1) << 8);
  	if ((model & 0xfff0) != 0x5640)
  		return ENXIO;
  
! 	config = inb(iobase + U14_CONFIG) | (inb(iobase + U14_CONFIG + 1) << 8);
  
  	switch (model & 0x000f) {
  	case 0x0001:
--- 916,926 ----
  	if (ia->ia_iobase == IOBASEUNK)
  		return ENXIO;
  
! 	model = (inb(iobase + U14_ID) << 8) | inb(iobase + U14_ID + 1);
  	if ((model & 0xfff0) != 0x5640)
  		return ENXIO;
  
! 	config = (inb(iobase + U14_CONFIG) << 8) | inb(iobase + U14_CONFIG + 1);
  
  	switch (model & 0x000f) {
  	case 0x0001:

___________________  ___________________
\  Mark H. Weaver  \ \  mhw@netris.org  \
 ~~~~~~~~~~~~~~~~~~~  ~~~~~~~~~~~~~~~~~~~