Module Name:    src
Committed By:   jakllsch
Date:           Mon Apr 24 13:09:37 UTC 2017

Modified Files:
        src/sys/dev/ic [jdolecek-ncq]: siisata.c

Log Message:
Merge HEAD.


To generate a diff of this commit:
cvs rdiff -u -r1.30.4.11 -r1.30.4.12 src/sys/dev/ic/siisata.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/siisata.c
diff -u src/sys/dev/ic/siisata.c:1.30.4.11 src/sys/dev/ic/siisata.c:1.30.4.12
--- src/sys/dev/ic/siisata.c:1.30.4.11	Sun Apr 23 14:33:28 2017
+++ src/sys/dev/ic/siisata.c	Mon Apr 24 13:09:37 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: siisata.c,v 1.30.4.11 2017/04/23 14:33:28 jakllsch Exp $ */
+/* $NetBSD: siisata.c,v 1.30.4.12 2017/04/24 13:09:37 jakllsch Exp $ */
 
 /* from ahcisata_core.c */
 
@@ -79,7 +79,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: siisata.c,v 1.30.4.11 2017/04/23 14:33:28 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: siisata.c,v 1.30.4.12 2017/04/24 13:09:37 jakllsch Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -122,7 +122,8 @@ bus_space_read_stream_4(bus_space_tag_t 
 }
 
 static inline void
-bus_space_read_region_stream_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, uint32_t *p, bus_size_t c)
+bus_space_read_region_stream_4(bus_space_tag_t t, bus_space_handle_t h,
+    bus_size_t o, uint32_t *p, bus_size_t c)
 {
 	bus_space_read_region_4(t, h, o, p, c);
 	for (bus_size_t i = 0; i < c; i++) {
@@ -161,8 +162,8 @@ static void siisata_reinit_port(struct a
 static void siisata_device_reset(struct ata_channel *);
 static void siisata_activate_prb(struct siisata_channel *, int);
 static void siisata_deactivate_prb(struct siisata_channel *, int);
-static int siisata_dma_setup(struct ata_channel *chp, int slot,
-    void *data, size_t, int);
+static int siisata_dma_setup(struct ata_channel *chp, int, void *,
+    size_t, int);
 
 #if NATAPIBUS > 0
 void siisata_atapibus_attach(struct atabus_softc *);
@@ -171,7 +172,6 @@ void siisata_atapi_minphys(struct buf *)
 void siisata_atapi_start(struct ata_channel *,struct ata_xfer *);
 int siisata_atapi_complete(struct ata_channel *, struct ata_xfer *, int);
 void siisata_atapi_kill_xfer(struct ata_channel *, struct ata_xfer *, int);
-void siisata_atapi_done(struct ata_channel *, struct ata_xfer *, int);
 void siisata_atapi_scsipi_request(struct scsipi_channel *,
     scsipi_adapter_req_t, void *);
 void siisata_atapi_kill_pending(struct scsipi_periph *);
@@ -219,7 +219,7 @@ siisata_attach(struct siisata_softc *sc)
 	sc->sc_atac.atac_set_modes = siisata_setup_channel;
 #if NATAPIBUS > 0
 	sc->sc_atac.atac_atapibus_attach = siisata_atapibus_attach;
-#endif	
+#endif
 
 	/* come out of reset state */
 	GRWRITE(sc, GR_GC, 0);
@@ -228,9 +228,8 @@ siisata_attach(struct siisata_softc *sc)
 		siisata_attach_port(sc, i);
 	}
 
-	SIISATA_DEBUG_PRINT(("%s: %s: GR_GC: 0x%08x\n",
-	    SIISATANAME(sc), __func__, GRREAD(sc, GR_GC)),
-	    DEBUG_FUNCS);
+	SIISATA_DEBUG_PRINT(("%s: %s: GR_GC: 0x%08x\n", SIISATANAME(sc),
+	    __func__, GRREAD(sc, GR_GC)), DEBUG_FUNCS);
 	return;
 }
 
@@ -448,7 +447,7 @@ siisata_resume(struct siisata_softc *sc)
 	for (i = 0; i < sc->sc_atac.atac_nchannels; i++) {
 		siisata_init_port(sc, i);
 	}
-	
+
 }
 
 int
@@ -485,8 +484,8 @@ siisata_intr_port(struct siisata_channel
 
 	pis = PRREAD(sc, PRX(chp->ch_channel, PRO_PIS));
 
-	SIISATA_DEBUG_PRINT(("%s: %s port %d, pis 0x%x ",
-	    SIISATANAME(sc), __func__, chp->ch_channel, pis), DEBUG_INTR);
+	SIISATA_DEBUG_PRINT(("%s: %s port %d, pis 0x%x ", SIISATANAME(sc),
+	    __func__, chp->ch_channel, pis), DEBUG_INTR);
 
 	if (pis & PR_PIS_CMDCMPL) {
 		/* get slot status, clearing completion interrupt */
@@ -499,7 +498,7 @@ siisata_intr_port(struct siisata_channel
 			    "completion on port %d\n",
 			    SIISATANAME(sc), chp->ch_channel);
 			return;
-		} 
+		}
 		if ((~pss & __BIT(slot)) == 0) {
 			aprint_error( "%s: unknown slot "
 			    "completion on port %d, pss 0x%x\n",
@@ -520,7 +519,7 @@ siisata_intr_port(struct siisata_channel
 				/* read in specific information about error */
 				prbfis = bus_space_read_stream_4(
 				    sc->sc_prt, sc->sc_prh,
-		    		    PRSX(chp->ch_channel, slot, PRSO_FIS));
+				    PRSX(chp->ch_channel, slot, PRSO_FIS));
 				/* set ch_status and ch_error */
 				satafis_rdh_parse(chp, (uint8_t *)&prbfis);
 			}
@@ -820,9 +819,8 @@ siisata_cmd_start(struct ata_channel *ch
 	int i;
 
 	SIISATA_DEBUG_PRINT(("%s: %s port %d drive %d command 0x%x, slot %d\n",
-	    SIISATANAME((struct siisata_softc *)chp->ch_atac),
-	    __func__, chp->ch_channel, xfer->c_drive,
-	    ata_c->r_command, slot),
+	    SIISATANAME((struct siisata_softc *)chp->ch_atac), __func__,
+	    chp->ch_channel, xfer->c_drive, ata_c->r_command, slot),
 	    DEBUG_FUNCS|DEBUG_XFERS);
 
 	chp->ch_status = 0;
@@ -845,7 +843,7 @@ siisata_cmd_start(struct ata_channel *ch
 	if (siisata_dma_setup(chp, slot,
 	    (ata_c->flags & (AT_READ | AT_WRITE)) ? ata_c->data : NULL,
 	    ata_c->bcount,
-	    (ata_c->flags & AT_READ) ? BUS_DMA_READ : BUS_DMA_WRITE)) { 
+	    (ata_c->flags & AT_READ) ? BUS_DMA_READ : BUS_DMA_WRITE)) {
 		ata_c->flags |= AT_DF;
 		siisata_cmd_complete(chp, xfer, 0);
 		return;
@@ -884,8 +882,9 @@ siisata_cmd_start(struct ata_channel *ch
 	/* reenable interrupts */
 	siisata_enable_port_interrupt(chp);
 out:
-	SIISATA_DEBUG_PRINT(
-	    ("%s: %s: done\n", SIISATANAME((struct siisata_softc *)chp->ch_atac), __func__), DEBUG_FUNCS);
+	SIISATA_DEBUG_PRINT(("%s: %s: done\n",
+	    SIISATANAME((struct siisata_softc *)chp->ch_atac), __func__),
+	    DEBUG_FUNCS);
 	return;
 }
 
@@ -919,8 +918,8 @@ siisata_cmd_complete(struct ata_channel 
 #endif
 	int slot = SIISATA_NON_NCQ_SLOT;
 
-	SIISATA_DEBUG_PRINT(
-	    ("%s: %s\n", SIISATANAME(sc), __func__), DEBUG_FUNCS|DEBUG_XFERS);
+	SIISATA_DEBUG_PRINT(("%s: %s\n", SIISATANAME(sc), __func__),
+	    DEBUG_FUNCS|DEBUG_XFERS);
 
 	chp->ch_flags &= ~ATACH_IRQ_WAIT;
 	if (xfer->c_flags & C_TIMEOU)
@@ -954,9 +953,8 @@ siisata_cmd_done(struct ata_channel *chp
 	uint16_t *idwordbuf;
 	int i;
 
-	SIISATA_DEBUG_PRINT(
-	    ("%s: %s flags 0x%x error 0x%x\n", SIISATANAME(sc), __func__,
-		ata_c->flags, ata_c->r_error), DEBUG_FUNCS|DEBUG_XFERS);
+	SIISATA_DEBUG_PRINT(("%s: %s flags 0x%x error 0x%x\n", SIISATANAME(sc),
+	    __func__, ata_c->flags, ata_c->r_error), DEBUG_FUNCS|DEBUG_XFERS);
 
 	siisata_deactivate_prb(schp, slot);
 
@@ -1002,9 +1000,9 @@ siisata_ata_bio(struct ata_drive_datas *
 	struct ata_channel *chp = drvp->chnl_softc;
 	struct ata_bio *ata_bio = &xfer->c_bio;
 
-	SIISATA_DEBUG_PRINT( ("%s: %s.\n",
-	    SIISATANAME((struct siisata_softc *)chp->ch_atac),
-	    __func__), DEBUG_FUNCS);
+	SIISATA_DEBUG_PRINT(("%s: %s.\n",
+	    SIISATANAME((struct siisata_softc *)chp->ch_atac), __func__),
+	    DEBUG_FUNCS);
 
 	if (xfer == NULL)
 		return ATACMD_TRY_AGAIN;
@@ -1030,10 +1028,9 @@ siisata_bio_start(struct ata_channel *ch
 	int slot = SIISATA_NON_NCQ_SLOT;
 	int i;
 
-	SIISATA_DEBUG_PRINT(
-	    ("%s: %s port %d, slot %d\n",
-	    SIISATANAME((struct siisata_softc *)chp->ch_atac), __func__, chp->ch_channel, slot),
-	    DEBUG_FUNCS);
+	SIISATA_DEBUG_PRINT(("%s: %s port %d, slot %d\n",
+	    SIISATANAME((struct siisata_softc *)chp->ch_atac), __func__,
+	    chp->ch_channel, slot), DEBUG_FUNCS);
 
 	chp->ch_status = 0;
 	chp->ch_error = 0;
@@ -1082,8 +1079,9 @@ siisata_bio_start(struct ata_channel *ch
 
 	siisata_enable_port_interrupt(chp);
 out:
-	SIISATA_DEBUG_PRINT(
-	    ("%s: %s: done\n", SIISATANAME((struct siisata_softc *)chp->ch_atac), __func__), DEBUG_FUNCS);
+	SIISATA_DEBUG_PRINT(("%s: %s: done\n",
+	    SIISATANAME((struct siisata_softc *)chp->ch_atac), __func__),
+	    DEBUG_FUNCS);
 	return;
 }
 
@@ -1097,8 +1095,8 @@ siisata_bio_kill_xfer(struct ata_channel
 	int slot = SIISATA_NON_NCQ_SLOT;
 
 	SIISATA_DEBUG_PRINT(("%s: %s: port %d\n",
-	    SIISATANAME((struct siisata_softc *)chp->ch_atac),
-	    __func__, chp->ch_channel), DEBUG_FUNCS);
+	    SIISATANAME((struct siisata_softc *)chp->ch_atac), __func__,
+	    chp->ch_channel), DEBUG_FUNCS);
 
 	siisata_deactivate_prb(schp, slot);
 
@@ -1157,8 +1155,8 @@ siisata_bio_complete(struct ata_channel 
 	} else if (chp->ch_status & WDCS_CORR)
 		ata_bio->flags |= ATA_CORR;
 
-	SIISATA_DEBUG_PRINT(("%s: %s bcount: %ld", SIISATANAME(sc),
-	    __func__, ata_bio->bcount), DEBUG_XFERS); 
+	SIISATA_DEBUG_PRINT(("%s: %s bcount: %ld", SIISATANAME(sc), __func__,
+	    ata_bio->bcount), DEBUG_XFERS);
 	if (ata_bio->error == NOERROR) {
 		if (ata_bio->flags & ATA_READ)
 			ata_bio->bcount -=
@@ -1166,7 +1164,7 @@ siisata_bio_complete(struct ata_channel 
 		else
 			ata_bio->bcount = 0;
 	}
-	SIISATA_DEBUG_PRINT((" now %ld\n", ata_bio->bcount), DEBUG_XFERS); 
+	SIISATA_DEBUG_PRINT((" now %ld\n", ata_bio->bcount), DEBUG_XFERS);
 	if (ata_bio->flags & ATA_POLL)
 		return 1;
 	(*chp->ch_drive[drive].drv_done)(chp->ch_drive[drive].drv_softc, xfer);
@@ -1266,7 +1264,7 @@ static void
 siisata_deactivate_prb(struct siisata_channel *schp, int slot)
 {
 	struct siisata_softc *sc;
-	
+
 	sc = (struct siisata_softc *)schp->ata_channel.ch_atac;
 
 	KASSERTMSG((schp->sch_active_slots & __BIT(slot)) != 0,
@@ -1404,8 +1402,8 @@ siisata_atapi_probe_device(struct atapib
 
 	/* if no ATAPI device detected at attach time, skip */
 	if (drvp->drive_type != ATA_DRIVET_ATAPI) {
-		SIISATA_DEBUG_PRINT(("%s: drive %d "
-		    "not present\n", __func__, target), DEBUG_PROBE);
+		SIISATA_DEBUG_PRINT(("%s: drive %d not present\n", __func__,
+		    target), DEBUG_PROBE);
 		return;
 	}
 
@@ -1461,7 +1459,7 @@ siisata_atapi_probe_device(struct atapib
 		if ((id->atap_config & ATAPI_CFG_CMD_MASK)
 		    == ATAPI_CFG_CMD_16) {
 			periph->periph_cap |= PERIPH_CAP_CMD16;
-		
+
 			/* configure port for packet length */
 			PRWRITE(siic, PRX(chp->ch_channel, PRO_PCS),
 			    PR_PC_PACKET_LENGTH);
@@ -1630,8 +1628,9 @@ siisata_atapi_start(struct ata_channel *
 	/* reenable interrupts */
 	siisata_enable_port_interrupt(chp);
 out:
-	SIISATA_DEBUG_PRINT(
-	    ("%s: %s: done\n", SIISATANAME((struct siisata_softc *)chp->ch_atac), __func__), DEBUG_FUNCS);
+	SIISATA_DEBUG_PRINT(("%s: %s: done\n",
+	    SIISATANAME((struct siisata_softc *)chp->ch_atac), __func__),
+	    DEBUG_FUNCS);
 	return;
 }
 
@@ -1644,8 +1643,8 @@ siisata_atapi_complete(struct ata_channe
 	struct scsipi_xfer *sc_xfer = xfer->c_scsipi;
 	int slot = SIISATA_NON_NCQ_SLOT;
 
-	SIISATA_DEBUG_PRINT(
-	    ("%s: %s()\n", SIISATANAME(sc), __func__), DEBUG_INTR);
+	SIISATA_DEBUG_PRINT(("%s: %s()\n", SIISATANAME(sc), __func__),
+	    DEBUG_INTR);
 
 	/* this comamnd is not active any more */
 	schp->sch_active_slots &= ~__BIT(slot);
@@ -1674,7 +1673,7 @@ siisata_atapi_complete(struct ata_channe
 	sc_xfer->resid = sc_xfer->datalen;
 	sc_xfer->resid -= PRREAD(sc, PRSX(chp->ch_channel, slot, PRSO_RTC));
 	SIISATA_DEBUG_PRINT(("%s: %s datalen %d resid %d\n", SIISATANAME(sc),
-	    __func__, sc_xfer->datalen, sc_xfer->resid), DEBUG_XFERS); 
+	    __func__, sc_xfer->datalen, sc_xfer->resid), DEBUG_XFERS);
 	if ((chp->ch_status & WDCS_ERR) &&
 	    ((sc_xfer->xs_control & XS_CTL_REQSENSE) == 0 ||
 	    sc_xfer->resid == sc_xfer->datalen)) {

Reply via email to