Date: Tue, 7 Nov 2006 09:36:12 GMT From: Warner Losh <imp@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 109430 for review Message-ID: <200611070936.kA79aC3E099646@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=109430 Change 109430 by imp@imp_lighthouse on 2006/11/07 09:35:32 This loop can't be all we need... But I think it might be, apart from some additional init... Affected files ... .. //depot/projects/arm/src/sys/dev/flash/at45d.c#9 edit Differences ... ==== //depot/projects/arm/src/sys/dev/flash/at45d.c#9 (text+ko) ==== @@ -305,8 +305,16 @@ { struct at45d_softc *sc = (struct at45d_softc*)arg; struct bio *bp; + uint8_t txBuf[8], rxBuf[8]; + struct spi_command cmd; + int sz; + daddr_t block, end; + device_t dev, pdev; + int err; for (;;) { + dev = sc->dev; + pdev = device_get_parent(dev); AT45D_LOCK(sc); do { bp = bioq_first(&sc->bio_queue); @@ -315,8 +323,29 @@ } while (bp == NULL); bioq_remove(&sc->bio_queue, bp); AT45D_UNLOCK(sc); - // XXX need to make the read/write request, maybe even - // XXX breaking things down into smaller blocks. + sz = sc->disk->d_sectorsize; + end = bp->bio_pblkno + (bp->bio_bcount / sz); + for (block = bp->bio_pblkno; block < end; ) { + char *vaddr = bp->bio_data + (block - bp->bio_pblkno) * sz; + if (bp->bio_cmd == BIO_READ) + txBuf[0] = CONTINUOUS_ARRAY_READ_HF; + else + txBuf[0] = PROGRAM_THROUGH_BUFFER; + // XXX only works on certain devices... Fixme + txBuf[1] = ((block >> 5) & 0xFF); + txBuf[2] = ((block << 3) & 0xF8); + txBuf[3] = 0; + cmd.tx_cmd = txBuf; + cmd.tx_cmd_sz = 5; + cmd.rx_cmd = rxBuf; + cmd.rx_cmd_sz = 5; + cmd.tx_data = vaddr; + cmd.tx_data_sz = sz; + cmd.rx_data = vaddr; + cmd.rx_data_sz = sz; + err = SPIBUS_TRANSFER(pdev, dev, &cmd); + // XXX err check? + } biodone(bp); } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200611070936.kA79aC3E099646>