Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/arch/atari/dev/ncr5380.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/arch/atari/dev/ncr5380.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.55.52.2 retrieving revision 1.56 diff -u -p -r1.55.52.2 -r1.56 --- src/sys/arch/atari/dev/ncr5380.c 2009/04/28 07:33:47 1.55.52.2 +++ src/sys/arch/atari/dev/ncr5380.c 2008/10/28 11:44:14 1.56 @@ -1,4 +1,4 @@ -/* $NetBSD: ncr5380.c,v 1.55.52.2 2009/04/28 07:33:47 skrll Exp $ */ +/* $NetBSD: ncr5380.c,v 1.56 2008/10/28 11:44:14 abs Exp $ */ /* * Copyright (c) 1995 Leo Weppelman. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ncr5380.c,v 1.55.52.2 2009/04/28 07:33:47 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ncr5380.c,v 1.56 2008/10/28 11:44:14 abs Exp $"); /* * Bit mask of targets you want debugging to be shown @@ -80,10 +80,10 @@ static volatile int main_running = 0; */ static u_char busy; -static void ncr5380_minphys(struct buf *bp); -static void ncr5380_scsi_request(struct scsipi_channel *, - scsipi_adapter_req_t, void *); -static void ncr5380_show_scsi_cmd(struct scsipi_xfer *xs); +static void ncr5380_minphys __P((struct buf *bp)); +static void ncr5380_scsi_request __P((struct scsipi_channel *, + scsipi_adapter_req_t, void *)); +static void ncr5380_show_scsi_cmd __P((struct scsipi_xfer *xs)); static SC_REQ req_queue[NREQ]; static SC_REQ *free_head = NULL; /* Free request structures */ @@ -123,7 +123,7 @@ extern inline int wait_req_false(void) return (!(GET_5380_REG(NCR5380_IDSTAT) & SC_S_REQ)); } -extern inline void ack_message(void) +extern inline void ack_message() { SET_5380_REG(NCR5380_ICOM, 0); } @@ -169,8 +169,8 @@ extern inline void finish_req(SC_REQ *re /* * Auto config stuff.... */ -void ncr_attach(struct device *, struct device *, void *); -int ncr_match(struct device *, struct cfdata *, void *); +void ncr_attach __P((struct device *, struct device *, void *)); +int ncr_match __P((struct device *, struct cfdata *, void *)); /* * Tricks to make driver-name configurable @@ -186,13 +186,18 @@ CFATTACH_DECL(CFDRNAME(DRNAME), sizeof(s extern struct cfdriver CFNAME(DRNAME); int -ncr_match(struct device *pdp, struct cfdata *cfp, void *auxp) +ncr_match(pdp, cfp, auxp) +struct device *pdp; +struct cfdata *cfp; +void *auxp; { return (machine_match(pdp, cfp, auxp, &CFNAME(DRNAME))); } void -ncr_attach(struct device *pdp, struct device *dp, void *auxp) +ncr_attach(pdp, dp, auxp) +struct device *pdp, *dp; +void *auxp; { struct ncr_softc *sc; int i; @@ -258,7 +263,10 @@ ncr_attach(struct device *pdp, struct de * Carry out a request from the high level driver. */ static void -ncr5380_scsi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req, void *arg) +ncr5380_scsi_request(chan, req, arg) + struct scsipi_channel *chan; + scsipi_adapter_req_t req; + void *arg; { struct scsipi_xfer *xs; struct scsipi_periph *periph; @@ -373,7 +381,7 @@ ncr5380_scsi_request(struct scsipi_chann tmp->xs = reqp->xs; tmp->targ_id = reqp->targ_id; tmp->targ_lun = reqp->targ_lun; - memcpy( &tmp->xcmd, sense_cmd, sizeof(sense_cmd)); + bcopy(sense_cmd, &tmp->xcmd, sizeof(sense_cmd)); tmp->xcmd_len = sizeof(sense_cmd); tmp->xdata_ptr = (u_char *)&tmp->xs->sense.scsi_sense; tmp->xdata_len = sizeof(tmp->xs->sense.scsi_sense); @@ -444,7 +452,8 @@ ncr5380_show_scsi_cmd(struct scsipi_xfer * The body of the driver. */ static void -scsi_main(struct ncr_softc *sc) +scsi_main(sc) +struct ncr_softc *sc; { SC_REQ *req, *prev; int itype; @@ -624,7 +633,8 @@ main_exit: * out of a single buffer. */ static void -ncr_dma_intr(struct ncr_softc *sc) +ncr_dma_intr(sc) +struct ncr_softc *sc; { SC_REQ *reqp; int dma_done; @@ -647,7 +657,8 @@ ncr_dma_intr(struct ncr_softc *sc) * the machine-dependent hardware interrupt. */ static void -ncr_ctrl_intr(struct ncr_softc *sc) +ncr_ctrl_intr(sc) +struct ncr_softc *sc; { int itype; @@ -691,7 +702,9 @@ ncr_ctrl_intr(struct ncr_softc *sc) * to a non-zero value. This is the case when 'select' is called by abort. */ static int -scsi_select(SC_REQ *reqp, int code) +scsi_select(reqp, code) +SC_REQ *reqp; +int code; { u_char tmp[1]; u_char phase; @@ -945,7 +958,8 @@ identify_failed: * -1: keep on calling information_transfer() from scsi_main() */ static int -information_transfer(struct ncr_softc *sc) +information_transfer(sc) +struct ncr_softc *sc; { SC_REQ *reqp = connected; u_char tmp, phase; @@ -1019,7 +1033,7 @@ information_transfer(struct ncr_softc *s */ if (reqp->xdata_ptr == reqp->xs->data) { /* XXX */ if (reqp->dr_flag & DRIVER_BOUNCING) - memcpy( reqp->bounceb, reqp->xdata_ptr, reqp->xdata_len); + bcopy(reqp->xdata_ptr, reqp->bounceb, reqp->xdata_len); } case PH_DATAIN: @@ -1103,7 +1117,9 @@ information_transfer(struct ncr_softc *s * -1 : Get on to the next phase. */ static int -handle_message(SC_REQ *reqp, u_int msg) +handle_message(reqp, msg) +SC_REQ *reqp; +u_int msg; { int sps; SC_REQ *prev, *req; @@ -1236,7 +1252,8 @@ handle_message(SC_REQ *reqp, u_int msg) * disconnected queue. */ static void -reselect(struct ncr_softc *sc) +reselect(sc) +struct ncr_softc *sc; { u_char phase; u_long len; @@ -1338,7 +1355,11 @@ reselect(struct ncr_softc *sc) * phase. */ static int -transfer_pio(u_char *phase, u_char *data, u_long *len, int dont_drop_ack) +transfer_pio(phase, data, len, dont_drop_ack) +u_char *phase; +u_char *data; +u_long *len; +int dont_drop_ack; { u_int cnt = *len; u_char ph = *phase; @@ -1410,7 +1431,10 @@ transfer_pio(u_char *phase, u_char *data * If 'poll' is true, the function busy-waits until DMA has completed. */ static void -transfer_dma(SC_REQ *reqp, u_int phase, int poll) +transfer_dma(reqp, phase, poll) +SC_REQ *reqp; +u_int phase; +int poll; { int dma_done; u_char mbase = 0; @@ -1466,7 +1490,7 @@ again: * Check results of a DMA data-transfer. */ static int -dma_ready(void) +dma_ready() { SC_REQ *reqp = connected; int dmstat, is_edma; @@ -1508,7 +1532,7 @@ dma_ready(void) * before copying. */ PCIA(); - memcpy( reqp->xdata_ptr, reqp->bouncerp, bytes_done); + bcopy(reqp->bouncerp, reqp->xdata_ptr, bytes_done); reqp->bouncerp += bytes_done; } @@ -1569,7 +1593,9 @@ ncr_tprint(reqp, "dma-ready: code = %d\n #endif /* REAL_DMA */ static int -check_autosense(SC_REQ *reqp, int linked) +check_autosense(reqp, linked) +SC_REQ *reqp; +int linked; { int sps; @@ -1594,7 +1620,7 @@ check_autosense(SC_REQ *reqp, int linked if (!(reqp->dr_flag & DRIVER_AUTOSEN)) { switch (reqp->status & SCSMASK) { case SCSCHKC: - memcpy( &reqp->xcmd, sense_cmd, sizeof(sense_cmd)); + bcopy(sense_cmd, &reqp->xcmd, sizeof(sense_cmd)); reqp->xcmd_len = sizeof(sense_cmd); reqp->xdata_ptr = (u_char *)&reqp->xs->sense.scsi_sense; reqp->xdata_len = sizeof(reqp->xs->sense.scsi_sense); @@ -1609,7 +1635,7 @@ check_autosense(SC_REQ *reqp, int linked else reqp->xcmd.bytes[sizeof(sense_cmd)-2] |= 1; #ifdef DBG_REQ - memset(reqp->xdata_ptr, 0, reqp->xdata_len); + bzero(reqp->xdata_ptr, reqp->xdata_len); if (dbg_target_mask & (1 << reqp->targ_id)) show_request(reqp, "AUTO-SENSE"); #endif @@ -1634,7 +1660,9 @@ check_autosense(SC_REQ *reqp, int linked } static int -reach_msg_out(struct ncr_softc *sc, u_long len) +reach_msg_out(sc, len) +struct ncr_softc *sc; +u_long len; { u_char phase; u_char data; @@ -1684,7 +1712,7 @@ reach_msg_out(struct ncr_softc *sc, u_lo } void -scsi_reset(void) +scsi_reset() { SC_REQ *tmp, *next; int sps; @@ -1736,7 +1764,9 @@ scsi_reset(void) } static void -scsi_reset_verbose(struct ncr_softc *sc, const char *why) +scsi_reset_verbose(sc, why) +struct ncr_softc *sc; +const char *why; { ncr_aprint(sc, "Resetting SCSI-bus (%s)\n", why); @@ -1750,7 +1780,8 @@ scsi_reset_verbose(struct ncr_softc *sc, * and INTR_SPURIOUS is returned. */ static int -check_intr(struct ncr_softc *sc) +check_intr(sc) +struct ncr_softc *sc; { SC_REQ *reqp; @@ -1776,7 +1807,8 @@ check_intr(struct ncr_softc *sc) * the DMA-chain. */ static int -scsi_dmaok(SC_REQ *reqp) +scsi_dmaok(reqp) +SC_REQ *reqp; { u_long phy_buf; u_long phy_len; @@ -1785,12 +1817,6 @@ scsi_dmaok(SC_REQ *reqp) struct dma_chain *dm; /* - * To be safe, do not use DMA for Falcon - */ - if (machineid & ATARI_FALCON) - return (0); - - /* * Initialize locals and requests' DMA-chain. */ req_len = reqp->xdata_len; @@ -1884,7 +1910,8 @@ bounceit: #endif /* REAL_DMA */ static void -run_main(struct ncr_softc *sc) +run_main(sc) +struct ncr_softc *sc; { int sps = splbio(); @@ -1944,13 +1971,16 @@ static const char *phase_names[] = { }; static void -show_phase(SC_REQ *reqp, int phase) +show_phase(reqp, phase) +SC_REQ *reqp; +int phase; { printf("INFTRANS: %d Phase = %s\n", reqp->targ_id, phase_names[phase]); } static void -show_data_sense(struct scsipi_xfer *xs) +show_data_sense(xs) +struct scsipi_xfer *xs; { u_char *p1, *p2; int i; @@ -1969,7 +1999,9 @@ show_data_sense(struct scsipi_xfer *xs) } static void -show_request(SC_REQ *reqp, const char *qtxt) +show_request(reqp, qtxt) +SC_REQ *reqp; +const char *qtxt; { printf("REQ-%s: %d %p[%ld] cmd[0]=%x S=%x M=%x R=%x resid=%d dr_flag=%x %s\n", qtxt, reqp->targ_id, reqp->xdata_ptr, reqp->xdata_len, @@ -1986,7 +2018,8 @@ static const char *sig_names[] = { }; static void -show_signals(u_char dmstat, u_char idstat) +show_signals(dmstat, idstat) +u_char dmstat, idstat; { u_short tmp, mask; int j, need_pipe; @@ -2006,7 +2039,7 @@ show_signals(u_char dmstat, u_char idsta } void -scsi_show(void) +scsi_show() { SC_REQ *tmp; int sps = splhigh();