PERFORCE change 107284 for review
Warner Losh
imp at FreeBSD.org
Wed Oct 4 17:55:08 PDT 2006
http://perforce.freebsd.org/chv.cgi?CH=107284
Change 107284 by imp at imp_lighthouse on 2006/10/05 00:54:24
Multi block read support, ifdef'd. It doesn't quite work right
for reasons unknown. Committed so I don't lose it.
Affected files ...
.. //depot/projects/arm/src/sys/dev/mmc/mmcsd.c#10 edit
Differences ...
==== //depot/projects/arm/src/sys/dev/mmc/mmcsd.c#10 (text+ko) ====
@@ -52,6 +52,8 @@
struct bio_queue_head bio_queue;
};
+#define MULTI_BLOCK_READ_BROKEN
+
/* bus entry points */
static int mmcsd_probe(device_t dev);
static int mmcsd_attach(device_t dev);
@@ -143,12 +145,11 @@
struct mmcsd_softc *sc = (struct mmcsd_softc*)arg;
struct bio *bp;
int sz;
- daddr_t end;
+ daddr_t block, end;
struct mmc_command cmd;
struct mmc_command stop;
struct mmc_request req;
struct mmc_data data;
- uint32_t block;
device_t dev;
dev = sc->dev;
@@ -166,32 +167,53 @@
sz = sc->disk->d_sectorsize;
end = bp->bio_pblkno + (bp->bio_bcount / sz);
// XXX should use read/write_mulit
- for (block = bp->bio_pblkno; block < end; block++) {
+ for (block = bp->bio_pblkno; block < end;) {
char *vaddr = bp->bio_data + (block - bp->bio_pblkno) * sz;
memset(&req, 0, sizeof(req));
memset(&cmd, 0, sizeof(cmd));
memset(&stop, 0, sizeof(stop));
req.cmd = &cmd;
cmd.data = &data;
-// req.stop = &stop;
- if (bp->bio_cmd == BIO_READ)
+ if (bp->bio_cmd == BIO_READ) {
+#ifdef MULTI_BLOCK_READ
+ if (end - block > 1)
+ cmd.opcode = MMC_READ_MULTIPLE_BLOCK;
+ else
+ cmd.opcode = MMC_READ_SINGLE_BLOCK;
+#else
cmd.opcode = MMC_READ_SINGLE_BLOCK;
- else
+#endif
+ } else
cmd.opcode = MMC_WRITE_BLOCK;
cmd.arg = block << 9;
cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC;
// data.timeout_ns = ;
// data.timeout_clks = ;
- data.len = 512;
data.data = vaddr;
data.mrq = &req;
- if (bp->bio_cmd == BIO_READ)
+ if (bp->bio_cmd == BIO_READ) {
data.flags = MMC_DATA_READ;
- else
+#ifdef MULTI_BLOCK_READ
+ data.len = bp->bio_bcount;
+ if (end - block > 1) {
+ req.stop = &stop;
+ data.flags |= MMC_DATA_MULTI;
+ }
+ printf("Len %d %lld-%lld flags %#x sz %d\n",
+ data.len, block, end, data.flags, sz);
+ block = end;
+#else
+ data.len = sz;
+ block++;
+#endif
+ } else {
data.flags = MMC_DATA_WRITE;
-// stop.opcode = MMC_STOP_TRANSMISSION;
-// stop.arg = 0;
-// stop.flags = MMC_RSP_R1B | MMC_CMD_AC;
+ data.len = sz;
+ block++;
+ }
+ stop.opcode = MMC_STOP_TRANSMISSION;
+ stop.arg = 0;
+ stop.flags = MMC_RSP_R1B | MMC_CMD_AC;
MMCBUS_WAIT_FOR_REQUEST(device_get_parent(dev), dev,
&req);
// XXX error handling
More information about the p4-projects
mailing list