Date: Mon, 20 Apr 1998 10:53:12 -0600 From: "Justin T. Gibbs" <gibbs@plutotech.com> To: Peter Wemm <peter@netplex.com.au> Cc: gibbs@FreeBSD.ORG, scsi@FreeBSD.ORG Subject: Re: ahh, I think I see part of the problem.. (CAM bouncing) Message-ID: <199804201657.KAA28393@pluto.plutotech.com> In-Reply-To: Your message of "Mon, 20 Apr 1998 23:02:13 %2B0800." <199804201502.XAA05663@spinner.netplex.com.au>
next in thread | previous in thread | raw e-mail | index | archive | help
>It seems that bus_dmamem_alloc() is flawed if a filter function is active, >for starters. With a Bt-445S, it's got to bounce the 'paddr % 16MB == >biosaddr' pages, so the contigmalloc() will allocate pages from the entire >memory pool (since the 445S has a 32bit dma limit), and yet bouncing may >still need to happen. Incidently, what happens if contigmalloc() >allocates a page from the shadow of the bios rom addr? :-) Take a good look at the initialization code in bt_isa.c. If we have to install a filter, we set the address range for the filter to be 16MB->4GB. bus_dmamem_alloc and the code that allocates bounce pages only allocates space below the low address specified in the dma tag. This should ensure that we allocate pages that can replace any page rejected by the filter. So, the setup for a broken 445S is the same as an ISA card except that we include a filter that will allow 99% of the pages above 16MB. >Also, there doesn't appear to be anything to stop the DMA counters crossing >the dreaded 16MB boundary.. ??? If you are talking about the problem below, feel free to adjust the filter to exclude the pages that may cause a wrap. >I have a revision of the card that does not >incrememt the top 8 bits at the end of the 16MB space. Ie: the counters >wrap from 15MB->0MB instead of 15MB->16MB (and 31MB->16MB instead of 31MB-> >32MB). Damn this card. :-) (However, I seem to recall that this >particular problem was fixable with a firmware upgrade (microprocessor >firmware, not the PC bios), unlike the incomplete address decode problem >that creates the bios shadow). This I don't know about, but Mylex was happy to send me a firmware upgrade for my 747C without charge, just last week. > >Cheers, >-Peter >-- >Peter Wemm <peter@netplex.com.au> Netplex Consulting Here are the patches I promised... -- Justin ==== //depot/cam/sys/dev/buslogic/bt.c#6 - /a/perforce/src/sys/dev/buslogic/bt.c ==== *** /tmp/tmp.14455.1 Mon Apr 20 10:27:58 1998 --- /a/perforce/src/sys/dev/buslogic/bt.c Mon Apr 20 10:25:38 1998 *************** *** 865,873 **** --- 865,879 ---- newcount = (PAGE_SIZE / (BT_NSEG * sizeof(bt_sg_t))); for (i = 0; bt->num_ccbs < bt->max_ccbs && i < newcount; i++) { + int error; + next_ccb->sg_list = segs; next_ccb->sg_list_phys = physaddr; next_ccb->flags = BCCB_FREE; + error = bus_dmamap_create(bt->buffer_dmat, /*flags*/0, + &next_ccb->dmamap); + if (error != 0) + break; SLIST_INSERT_HEAD(&bt->free_bt_ccbs, next_ccb, links); segs += BT_NSEG; physaddr += (BT_NSEG * sizeof(bt_sg_t)); *************** *** 1240,1260 **** return; } - s = splcam(); - - /* - * Last time we need to check if this CCB needs to - * be aborted. - */ - if (ccb->ccb_h.status != CAM_REQ_INPROG) { - if (nseg != 0) - bus_dmamap_unload(bt->buffer_dmat, bccb->dmamap); - btfreeccb(bt, bccb); - xpt_done(ccb); - splx(s); - return; - } - if (nseg != 0) { bt_sg_t *sg; bus_dma_segment_t *end_seg; --- 1246,1251 ---- *************** *** 1291,1296 **** --- 1282,1302 ---- bccb->hccb.opcode = INITIATOR_SG_CCB; bccb->hccb.data_len = 0; bccb->hccb.data_addr = 0; + } + + s = splcam(); + + /* + * Last time we need to check if this CCB needs to + * be aborted. + */ + if (ccb->ccb_h.status != CAM_REQ_INPROG) { + if (nseg != 0) + bus_dmamap_unload(bt->buffer_dmat, bccb->dmamap); + btfreeccb(bt, bccb); + xpt_done(ccb); + splx(s); + return; } bccb->flags = BCCB_ACTIVE; ==== //depot/cam/sys/i386/i386/busdma_machdep.c#13 - /a/perforce/src/sys/i386/i386/busdma_machdep.c ==== *** /tmp/tmp.14455.3 Mon Apr 20 10:27:58 1998 --- /a/perforce/src/sys/i386/i386/busdma_machdep.c Mon Apr 20 10:21:17 1998 *************** *** 280,286 **** } } } else { ! *mapp = NULL; } if (error == 0) dmat->map_count++; --- 280,286 ---- } } } else { ! *mapp = &nobounce_dmamap; } if (error == 0) dmat->map_count++; *************** *** 314,320 **** bus_dmamap_t *mapp) { /* If we succeed, no mapping/bouncing will be required */ ! *mapp = NULL; if ((dmat->maxsize <= PAGE_SIZE) && dmat->lowaddr >= ptoa(Maxmem)) { *vaddr = malloc(dmat->maxsize, M_DEVBUF, --- 314,320 ---- bus_dmamap_t *mapp) { /* If we succeed, no mapping/bouncing will be required */ ! *mapp = &nobounce_dmamap; if ((dmat->maxsize <= PAGE_SIZE) && dmat->lowaddr >= ptoa(Maxmem)) { *vaddr = malloc(dmat->maxsize, M_DEVBUF, *************** *** 401,409 **** vaddr += PAGE_SIZE; } } - - if (map == NULL) - map = &nobounce_dmamap; /* Reserve Necessary Bounce Pages */ if (map->pagesneeded != 0) { --- 401,406 ---- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-scsi" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199804201657.KAA28393>