bzero(xdc->reqs, XDC_MAXIOPB * sizeof(struct xd_iorq));
xdcattach(parent, self, aux)	struct device *parent, *self;	void   *aux;{	struct xdc_softc *xdc = (void *) self;	struct confargs *ca = aux;	struct xdc_attach_args xa;	int     lcv, rqno, err, pri;	struct xd_iopb_ctrl *ctl;	/* get addressing and intr level stuff from autoconfig and load it	 * into our xdc_softc. */	xdc->xdc = (struct xdc *) 		bus_mapin(ca->ca_bustype, ca->ca_paddr, sizeof(struct xdc));	xdc->ipl = ca->ca_intpri;	xdc->vector = ca->ca_intvec;	for (lcv = 0; lcv < XDC_MAXDEV; lcv++)		xdc->sc_drives[lcv] = (struct xd_softc *) 0;	/* allocate and zero buffers	 * 	 * note: we simplify the code by allocating the max number of iopbs and	 * iorq's up front.   thus, we avoid linked lists and the costs	 * associated with them in exchange for wasting a little memory. */	xdc->iopbase = (struct xd_iopb *)	    dvma_malloc(XDC_MAXIOPB * sizeof(struct xd_iopb));	/* KVA */	bzero(xdc->iopbase, XDC_MAXIOPB * sizeof(struct xd_iopb));	xdc->dvmaiopb = (struct xd_iopb *)		dvma_kvtopa((long) xdc->iopbase, BUS_VME32);	xdc->reqs = (struct xd_iorq *)	    malloc(XDC_MAXIOPB * sizeof(struct xd_iorq), M_DEVBUF, M_NOWAIT);	bzero(xdc->reqs, XDC_MAXIOPB * sizeof(struct xd_iorq));	if (xdc->reqs == NULL)		panic("xdc malloc");	/* init free list, iorq to iopb pointers, and non-zero fields in the	 * iopb which never change. */	for (lcv = 0; lcv < XDC_MAXIOPB; lcv++) {		xdc->reqs[lcv].iopb = &xdc->iopbase[lcv];		xdc->freereq[lcv] = lcv;		xdc->iopbase[lcv].fixd = 1;	/* always the same */		xdc->iopbase[lcv].naddrmod = XDC_ADDRMOD; /* always the same */		xdc->iopbase[lcv].intr_vec = xdc->vector; /* always the same */	}	xdc->nfree = XDC_MAXIOPB;	xdc->nrun = 0;	xdc->waithead = xdc->waitend = xdc->nwait = 0;	xdc->ndone = 0;	/* init queue of waiting bufs */	xdc->sc_wq.b_active = 0;	xdc->sc_wq.b_actf = 0;	xdc->sc_wq.b_actb = &xdc->sc_wq.b_actf;	/*	 * section 7 of the manual tells us how to init the controller:	 * - read controller parameters (6/0)	 * - write controller parameters (5/0)	 */	/* read controller parameters and insure we have a 753/7053 */	rqno = xdc_cmd(xdc, XDCMD_RDP, XDFUN_CTL, 0, 0, 0, 0, XD_SUB_POLL);	if (rqno == XD_ERR_FAIL) {		printf(": couldn't read controller params\n");		return;		/* shouldn't ever happen */	}	ctl = (struct xd_iopb_ctrl *) & xdc->iopbase[rqno];	if (ctl->ctype != XDCT_753) {		if (xdc->reqs[rqno].errno)			printf(": %s: ", xdc_e2str(xdc->reqs[rqno].errno));		printf(": doesn't identify as a 753/7053\n");		XDC_DONE(xdc, rqno, err);		return;	}	printf(": Xylogics 753/7053, PROM=%x.%02x.%02x\n",	    ctl->eprom_partno, ctl->eprom_lvl, ctl->eprom_rev);	XDC_DONE(xdc, rqno, err);	/* now write controller parameters (xdc_cmd sets all params for us) */	rqno = xdc_cmd(xdc, XDCMD_WRP, XDFUN_CTL, 0, 0, 0, 0, XD_SUB_POLL);	XDC_DONE(xdc, rqno, err);	if (err) {		printf("%s: controller config error: %s\n",			xdc->sc_dev.dv_xname, xdc_e2str(err));		return;	}	/* link in interrupt with higher level software */	isr_add_vectored(xdcintr, (void *)xdc,	                 ca->ca_intpri, ca->ca_intvec);	evcnt_attach(&xdc->sc_dev, "intr", &xdc->sc_intrcnt);	/* now we must look for disks using autoconfig */	xa.dvmabuf = (char *) dvma_malloc(XDFM_BPS);	xa.fullmode = XD_SUB_POLL;	xa.booting = 1;	for (xa.driveno = 0; xa.driveno < XDC_MAXDEV; xa.driveno++)		(void) config_found(self, (void *) &xa, NULL);	dvma_free(xa.dvmabuf, XDFM_BPS);	/* start the watchdog clock */	timeout(xdc_tick, xdc, XDC_TICKCNT);}