PERFORCE change 109720 for review

Sam Leffler sam at FreeBSD.org
Sat Nov 11 04:52:54 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=109720

Change 109720 by sam at sam_ebb on 2006/11/11 04:51:49

	o must setup ALTSTAT for ata_generic_status
	o setup IREASON just in case; looks to only be required
	  for ATAPI which'll never exist on this board
	o change some useless code into assertions

Affected files ...

.. //depot/projects/arm/src/sys/arm/xscale/ixp425/avila_ata.c#6 edit

Differences ...

==== //depot/projects/arm/src/sys/arm/xscale/ixp425/avila_ata.c#6 (text+ko) ====

@@ -191,9 +191,6 @@
 {
 	struct ata_avila_softc *sc = xsc;
 
-#if 0
-printf("%s: cb %p arg %p\n", __func__, sc->sc_intr[0].cb, sc->sc_intr[0].arg);/*XXX*/
-#endif
 	if (sc->sc_intr[0].cb != NULL)
 		sc->sc_intr[0].cb(sc->sc_intr[0].arg);
 }
@@ -204,20 +201,21 @@
 {
 	struct ata_avila_softc *sc = device_get_softc(dev);
 
-	if (type == SYS_RES_IRQ && *rid == ATA_IRQ_RID) {
-		/* doesn't matter what we return so reuse the real thing */
-		return sc->sc_irq;
-	}
-	return NULL;
+	KASSERT(type == SYS_RES_IRQ && *rid == ATA_IRQ_RID,
+	    ("type %u rid %u start %lu end %lu count %lu flags %u",
+	     type, *rid, start, end, count, flags));
+
+	/* doesn't matter what we return so reuse the real thing */
+	return sc->sc_irq;
 }
 
 static int
 ata_avila_release_resource(device_t dev, device_t child, int type, int rid,
 			 struct resource *r)
 {
-	if (type == SYS_RES_IRQ)
-		return rid != ATA_IRQ_RID ? ENOENT : 0;
-	return EINVAL;
+	KASSERT(type == SYS_RES_IRQ && rid == ATA_IRQ_RID,
+	    ("type %u rid %u", type, rid));
+	return 0;
 }
 
 static int
@@ -424,6 +422,11 @@
 	ch->r_io[ATA_IDX_ADDR].res = &sc->sc_ata;
 	ch->r_io[ATA_IDX_ADDR].offset = 0;
 
+	/* NB: should be used only for ATAPI devices */
+	ch->r_io[ATA_IREASON] = ch->r_io[ATA_COUNT];
+	/* alias this; required by ata_generic_status */
+	ch->r_io[ATA_ALTSTAT] = ch->r_io[ATA_CONTROL];
+
 	ata_generic_hw(dev);
 	return ata_attach(dev);
 }


More information about the p4-projects mailing list