Subject: Re: Floppy driver for Sun IPX
To: None <port-sparc@NetBSD.ORG, Michael.Eriksson@era-t.ericsson.se>
From: Paul Kranenburg <pk@cs.few.eur.nl>
List: port-sparc
Date: 05/16/1995 14:27:15
> When I try to boot the new kernel, it hangs after printing:
> 
> fdc0 at mainbus0 ioaddr 0xf7200000 Hmmm..  pri 11, softpri 4: chip 82077
> 

Apparently, a sun4c can be equipped with either a 82072 or a 82077 chip.

I've changed the probe logic a bit, so both are potentially recognised.
Please try it out, as I've only a 82072 to play with. Note that, apart
from the probe routines, 82077 support might be non-functional anyway.

-pk
Index: fd.c
===================================================================
RCS file: /a/cvsroot/src/sys/arch/sparc/dev/fd.c,v
retrieving revision 1.6
diff -c -r1.6 fd.c
*** fd.c	1995/04/25 14:44:44	1.6
--- fd.c	1995/05/16 12:26:47
***************
*** 318,332 ****
  						ca->ca_ra.ra_len,
  						ca->ca_bustype);
  
- 	if (cputyp == CPU_SUN4M) {
- 		fdc->sc_reg_msr = &((struct fdreg_sun4m *)fdc->sc_reg)->fd_msr;
- 		fdc->sc_reg_fifo = &((struct fdreg_sun4m *)fdc->sc_reg)->fd_fifo;
- 		fdc->sc_reg_dor = &((struct fdreg_sun4m *)fdc->sc_reg)->fd_dor;
- 	} else {
- 		fdc->sc_reg_msr = &((struct fdreg_sun4c *)fdc->sc_reg)->fd_msr;
- 		fdc->sc_reg_fifo = &((struct fdreg_sun4c *)fdc->sc_reg)->fd_fifo;
- 	}
- 
  	fdc->sc_state = DEVIDLE;
  	fdc->sc_istate = ISTATE_IDLE;
  	fdc->sc_flags |= FDC_EIS;
--- 318,323 ----
***************
*** 345,364 ****
  	fdc->sc_sih.ih_arg = fdc;
  	intr_establish(PIL_FDSOFT, &fdc->sc_sih);
  
! 	if (out_fdc(fdc, NE7CMD_VERSION)) {
! 		printf(" misconfigured\n");
! 		return;
! 	}
  
! 	n = fdcresult(fdc);
! 	if (n == 1 && fdc->sc_status[0] == 0x90) {
  		fdc->sc_flags |= FDC_82077;
! 		if (cputyp != CPU_SUN4M)
! 			printf(" Hmmm.. ");
  	} else {
! 		/* Not a 82077 */
! 		if (cputyp != CPU_SUN4C)
! 			printf(" Hmmm.. ");
  	}
  
  	/*
--- 336,364 ----
  	fdc->sc_sih.ih_arg = fdc;
  	intr_establish(PIL_FDSOFT, &fdc->sc_sih);
  
! 	/* Test for 82077 first */
! 	fdc->sc_reg_msr = &((struct fdreg_sun4m *)fdc->sc_reg)->fd_msr;
! 	fdc->sc_reg_fifo = &((struct fdreg_sun4m *)fdc->sc_reg)->fd_fifo;
  
! 	if (out_fdc(fdc, NE7CMD_VERSION) == 0 &&
! 	    fdcresult(fdc) == 1 && fdc->sc_status[0] == 0x90) {
  		fdc->sc_flags |= FDC_82077;
! 		fdc->sc_reg_dor = &((struct fdreg_sun4m *)fdc->sc_reg)->fd_dor;
  	} else {
! 		/* Next try a 82072 */
! 		fdc->sc_reg_msr = &((struct fdreg_sun4c *)fdc->sc_reg)->fd_msr;
! 		fdc->sc_reg_fifo = &((struct fdreg_sun4c *)fdc->sc_reg)->fd_fifo;
! 		if (out_fdc(fdc, NE7CMD_VERSION) != 0) {
! 			printf(" misconfigured\n");
! 			return;
! 		} else {
! 			n = fdcresult(fdc);
! 			if (n != 1)
! 				printf("# status bytes %d, unexpected\n", n);
! 			else if (fdc->sc_status[0] != 0x80)
! 				printf("fdc status[0] = %x\n",
! 					fdc->sc_status[0]);
! 		}
  	}
  
  	/*