Subject: getting NEWCONF working
To: 532bsd Mailing List <port-pc532@sun-lamp.cs.berkeley.edu>
From: Matthias Pfaller <leo@marco.de>
List: port-pc532
Date: 09/05/1994 10:53:50
Hi,
I got a NEWCONF running up in multiuser mode. Everything seems fine
except that tape and cdrom don't work. Making it work was no big deal.
I just deleted code I didn't understand from nncr.c :-)

	Matthias

*** autoconf.c.orig	Fri Sep  2 20:57:38 1994
--- autoconf.c	Sun Sep  4 17:48:14 1994
***************
*** 298,304 ****
  }
  
  static	char *name_list[] =
! 	{"scn", "scn", "scn", "scn", "scn", "scn", "scn", "scn",
  	 "ncr", /* "dp", "aic", */ NULL };
  
  void
--- 298,304 ----
  }
  
  static	char *name_list[] =
! 	{"scn", "scn", "scn", "scn", /* "scn", "scn", "scn", "scn", */
  	 "ncr", /* "dp", "aic", */ NULL };
  
  void
***************
*** 311,317 ****
  
  	printf ("\n");
  
! 	for (name=name_list ; name ; name++) {
  		if (!config_found(dev, name, membusprint)) {
  			fail++;
  		}
--- 311,317 ----
  
  	printf ("\n");
  
! 	for (name=name_list ; *name ; name++) {
  		if (!config_found(dev, name, membusprint)) {
  			fail++;
  		}
*** nncr.c.orig	Thu Sep  1 23:06:38 1994
--- nncr.c	Thu Sep  1 23:32:28 1994
***************
*** 113,132 ****
  
  #define NNCR5380	1
  
! struct ncr5380_data {
  	struct device		sc_dev;
- 
- 	void			*reg_base;
- 	int			adapter_target;
  	struct scsi_link	sc_link;
! } *ncr5380data[NNCR5380];
  
  /* From the mapping of the pc532 address space.  See pc532/machdep.c */
  static volatile sci_padded_regmap_t	*ncr  =   (sci_regmap_t *) 0xffd00000;
  static volatile long			*sci_4byte_addr=  (long *) 0xffe00000;
  static volatile u_char			*sci_1byte_addr=(u_char *) 0xffe00000;
  
! static unsigned int	ncr5380_adapter_info(struct ncr5380_data *ncr5380);
  static void		ncr5380_minphys(struct buf *bp);
  static int		ncr5380_scsi_cmd(struct scsi_xfer *xs);
  
--- 113,129 ----
  
  #define NNCR5380	1
  
! struct ncr5380_softc {
  	struct device		sc_dev;
  	struct scsi_link	sc_link;
! };
  
  /* From the mapping of the pc532 address space.  See pc532/machdep.c */
  static volatile sci_padded_regmap_t	*ncr  =   (sci_regmap_t *) 0xffd00000;
  static volatile long			*sci_4byte_addr=  (long *) 0xffe00000;
  static volatile u_char			*sci_1byte_addr=(u_char *) 0xffe00000;
  
! static unsigned int	ncr5380_adapter_info(struct ncr5380_softc *ncr5380);
  static void		ncr5380_minphys(struct buf *bp);
  static int		ncr5380_scsi_cmd(struct scsi_xfer *xs);
  
***************
*** 175,181 ****
  
  struct cfdriver ncrcd =
        {	NULL, "ncr", ncrprobe, ncrattach,
! 	DV_DULL, sizeof(struct ncr5380_data), NULL, 0 };
  
  static int
  ncr_print(aux, name)
--- 172,178 ----
  
  struct cfdriver ncrcd =
        {	NULL, "ncr", ncrprobe, ncrattach,
! 	DV_DULL, sizeof(struct ncr5380_softc), NULL, 0 };
  
  static int
  ncr_print(aux, name)
***************
*** 187,217 ****
  }
  
  static int
! ncrprobe(parent, cf, aux)
! 	struct device	*parent;
! 	struct cfdata	*cf;
  	void		*aux;
  {
! 	int			unit = cf->cf_unit;
! 	struct ncr5380_data	*ncr5380;
! 
! 	if (strcmp(*((char **) aux), ncrcd.cd_name)) {
! 		return 0;
! 	}
! 
!  	if (unit >= NNCR5380) {
! 		printf("ncr5380attach: unit %d more than %d configured.\n",
! 			unit+1, NNCR5380);
! 		return 0;
! 	}
! 	ncr5380 = malloc(sizeof(struct ncr5380_data), M_TEMP, M_NOWAIT);
! 	if (!ncr5380) {
! 		printf("ncr5380attach: Can't malloc.\n");
! 		return 0;
! 	}
! 
! 	bzero(ncr5380, sizeof(*ncr5380));
! 	ncr5380data[unit] = ncr5380;
  
  	/* If we call this, we need to add SPL_DP to the bio mask! */
  	/*  PL_bio |= SPL_DP;  Not yet ... no interrupts */
--- 184,194 ----
  }
  
  static int
! ncrprobe(parent, self, aux)
! 	struct device	*parent, *self;
  	void		*aux;
  {
! 	struct nc5380_softc *ncr5380 = (void *)self;
  
  	/* If we call this, we need to add SPL_DP to the bio mask! */
  	/*  PL_bio |= SPL_DP;  Not yet ... no interrupts */
***************
*** 221,254 ****
  }
  
  static void
! ncrattach(parent, dev, aux)
! 	struct device	*parent, *dev;
  	void		*aux;
  {
! register volatile sci_padded_regmap_t	*regs = ncr;
! 	int				unit = dev->dv_unit;
! 	struct ncr5380_data		*ncr5380 = ncr5380data[unit];
! 	int				r;
! 
! 	bcopy((char *) ncr5380 + sizeof(struct device),
! 	      (char *) dev + sizeof(struct device),
! 	      sizeof(struct ncr5380_data) - sizeof(struct device));
! 	free(ncr5380, M_TEMP);
! 
! 	ncr5380data[unit] = ncr5380 = (struct ncr5380_data *) dev;
  
! 	ncr5380->sc_link.scsibus = unit;
  	ncr5380->sc_link.adapter_targ = 7;
  	ncr5380->sc_link.adapter = &ncr5380_switch;
  	ncr5380->sc_link.device = &ncr_dev;
  
  	printf("\n");
  
! 	config_found(dev, &(ncr5380->sc_link), ncr_print);
  }
  
  static unsigned int
! ncr5380_adapter_info(struct ncr5380_data *ncr5380)
  {
  	return 1;
  }
--- 198,224 ----
  }
  
  static void
! ncrattach(parent, self, aux)
! 	struct device	*parent, *self;
  	void		*aux;
  {
! 	register volatile sci_padded_regmap_t *regs = ncr;
! 	struct ncr5380_softc *ncr5380 = (void *)self;
! 	int r;
  
! 	ncr5380->sc_link.adapter_softc = ncr5380;
! 	ncr5380->sc_link.scsibus = 0;
  	ncr5380->sc_link.adapter_targ = 7;
  	ncr5380->sc_link.adapter = &ncr5380_switch;
  	ncr5380->sc_link.device = &ncr_dev;
  
  	printf("\n");
  
! 	config_found(self, &(ncr5380->sc_link), ncr_print);
  }
  
  static unsigned int
! ncr5380_adapter_info(struct ncr5380_softc *ncr5380)
  {
  	return 1;
  }
***************
*** 308,316 ****
  	}
  	 */
  
- printf ("before ncr5380_send_cmd\n");
  	r = ncr5380_send_cmd(xs);
- printf ("after ncr5380_send_cmd\n");
  	xs->flags |= ITSDONE;
  	scsi_done(xs);
  	switch(r) {
--- 278,284 ----
***************
*** 437,443 ****
--- 405,413 ----
  	int	s;
  	int	sense;
  
+ #if 0
  	ncr5380_show_scsi_cmd(xs); 
+ #endif
  	s = splbio();
  	sense = scsi_gen( xs->sc_link->scsibus, xs->sc_link->target,
  			  xs->sc_link->lun, xs->cmd, xs->cmdlen,


------------------------------------------------------------------------------