Deleted Added
full compact
29c29
< * $FreeBSD: head/sys/dev/aac/aac_disk.c 93495 2002-03-31 22:29:52Z phk $
---
> * $FreeBSD: head/sys/dev/aac/aac_disk.c 95350 2002-04-24 05:12:50Z scottl $
110a111,112
> #define AAC_MAXIO 65536
>
114c116
< static unsigned int aac_iosize_max = 65536; /* due to limits of the card */
---
> static unsigned int aac_iosize_max = AAC_MAXIO; /* due to limits of the card */
121,122d122
< #define AAC_MAXIO 65536
<
215a216,240
> * Map the S/G elements for doing a dump.
> */
> static void
> aac_dump_map_sg(void *arg, bus_dma_segment_t *segs, int nsegs, int error)
> {
> struct aac_fib *fib;
> struct aac_blockwrite *bw;
> struct aac_sg_table *sg;
> int i;
>
> fib = (struct aac_fib *)arg;
> bw = (struct aac_blockwrite *)&fib->data[0];
> sg = &bw->SgMap;
>
> if (sg != NULL) {
> sg->SgCount = nsegs;
> for (i = 0; i < nsegs; i++) {
> sg->SgEntry[i].SgAddress = segs[i].ds_addr;
> sg->SgEntry[i].SgByteCount = segs[i].ds_len;
> }
> fib->Header.Size = nsegs * sizeof(struct aac_sg_entry);
> }
> }
>
> /*
218,219c243
< * This queues blocks of memory of size AAC_MAXIO to the controller and waits
< * for the controller to complete the requests.
---
> * Send out one command at a time with up to AAC_MAXIO of data.
224,227d247
<
< /* XXX: This needs modified for the new dump API */
< return (ENXIO);
< #if 0
230,234c250,255
< vm_offset_t addr;
< long blkcnt;
< unsigned int count, blkno, secsize;
< int dumppages;
< int i, error;
---
> struct aac_fib *fib;
> struct aac_blockwrite *bw;
> size_t len;
> int size;
> static bus_dmamap_t dump_datamap;
> static int first = 0;
237,238d257
< addr = 0;
< dumppages = AAC_MAXIO / PAGE_SIZE;
240,242d258
< if ((error = disk_dumpcheck(dev, &count, &blkno, &secsize)))
< return (error);
<
244c260
< return (ENXIO);
---
> return (EINVAL);
248,262c264,268
< blkcnt = howmany(PAGE_SIZE, secsize);
<
< while (count > 0) {
< caddr_t va = NULL;
<
< if ((count / blkcnt) < dumppages)
< dumppages = count / blkcnt;
<
< for (i = 0; i < dumppages; ++i) {
< vm_offset_t a = addr + (i * PAGE_SIZE);
< if (is_physical_memory(a)) {
< va = pmap_kenter_temporary(trunc_page(a), i);
< } else {
< va = pmap_kenter_temporary(trunc_page(0), i);
< }
---
> if (!first) {
> first = 1;
> if (bus_dmamap_create(sc->aac_buffer_dmat, 0, &dump_datamap)) {
> printf("bus_dmamap_create failed\n");
> return (ENOMEM);
263a270
> }
265,272c272,273
< retry:
< /*
< * Queue the block to the controller. If the queue is full,
< * EBUSY will be returned.
< */
< error = aac_dump_enqueue(ad, blkno, va, dumppages);
< if (error && (error != EBUSY))
< return (error);
---
> aac_get_sync_fib(sc, &fib, AAC_SYNC_LOCK_FORCE);
> bw = (struct aac_blockwrite *)&fib->data[0];
274,276c275,285
< if (!error) {
< if (dumpstatus(addr, (off_t)(count * DEV_BSIZE)) < 0)
< return (EINTR);
---
> while (length > 0) {
> len = (length > AAC_MAXIO) ? AAC_MAXIO : length;
> bw->Command = VM_CtBlockWrite;
> bw->ContainerId = ad->ad_container->co_mntobj.ObjectId;
> bw->BlockNumber = offset / AAC_BLOCK_SIZE;
> bw->ByteCount = len;
> bw->Stable = CUNSTABLE;
> bus_dmamap_load(sc->aac_buffer_dmat, dump_datamap, virtual,
> len, aac_dump_map_sg, fib, 0);
> bus_dmamap_sync(sc->aac_buffer_dmat, dump_datamap,
> BUS_DMASYNC_PREWRITE);
278,283c287,288
< blkno += blkcnt * dumppages;
< count -= blkcnt * dumppages;
< addr += PAGE_SIZE * dumppages;
< if (count > 0)
< continue;
< }
---
> /* fib->Header.Size is set in aac_dump_map_sg */
> size = fib->Header.Size + sizeof(struct aac_blockwrite);
285,293c290,295
< /*
< * Either the queue was full on the last attemp, or we have no
< * more data to dump. Let the queue drain out and retry the
< * block if the queue was full.
< */
< aac_dump_complete(sc);
<
< if (error == EBUSY)
< goto retry;
---
> if (aac_sync_fib(sc, ContainerCommand, 0, fib, size)) {
> printf("Error dumping block 0x%x\n", physical);
> return (EIO);
> }
> length -= len;
> offset += len;
297d298
< #endif