From owner-freebsd-alpha@FreeBSD.ORG Mon Dec 20 16:40:13 2004 Return-Path: Delivered-To: freebsd-alpha@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 371D216A4CF for ; Mon, 20 Dec 2004 16:40:13 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0CBAF43D5C for ; Mon, 20 Dec 2004 16:40:13 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.1/8.13.1) with ESMTP id iBKGeC1V096937 for ; Mon, 20 Dec 2004 16:40:12 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.1/8.13.1/Submit) id iBKGeC7d096936; Mon, 20 Dec 2004 16:40:12 GMT (envelope-from gnats) Resent-Date: Mon, 20 Dec 2004 16:40:12 GMT Resent-Message-Id: <200412201640.iBKGeC7d096936@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-alpha@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Sven Petai Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2205916A4CE for ; Mon, 20 Dec 2004 16:38:38 +0000 (GMT) Received: from bsd.ee (bsd.ee [194.126.101.115]) by mx1.FreeBSD.org (Postfix) with SMTP id 1352643D41 for ; Mon, 20 Dec 2004 16:38:37 +0000 (GMT) (envelope-from hadara@bsd.ee) Received: (qmail 90712 invoked by uid 1000); 20 Dec 2004 16:39:15 -0000 Message-Id: <20041220163915.90711.qmail@bsd.ee> Date: 20 Dec 2004 16:39:15 -0000 From: Sven Petai To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 cc: sos@FreeBSD.org Subject: alpha/75317: ATA DMA broken on PCalpha X-BeenThere: freebsd-alpha@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Sven Petai List-Id: Porting FreeBSD to the Alpha List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Dec 2004 16:40:13 -0000 >Number: 75317 >Category: alpha >Synopsis: ATA DMA broken on PCalpha >Confidential: no >Severity: critical >Priority: medium >Responsible: freebsd-alpha >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Dec 20 16:40:12 GMT 2004 >Closed-Date: >Last-Modified: >Originator: Sven Petai >Release: FreeBSD 6.0-CURRENT >Organization: NPO BSD Estonia >Environment: >Description: Machine fails to boot with various different symptoms after mounting root, sometimes it hangs, sometimes it gets machine check etc. I traced it down to introduction of version 1.129 of the file src/sys/dev/ata/ata-dma.c which among other changes removes code that did split up segments into page sized chunks to avoid running into some kind of bug in busdma. it was commented as: "A maximum segment size was specified for bus_dma_tag_create, but some busdma code does not seem to honor this, so fix up if needed." >How-To-Repeat: Just try to boot fbsd 5.3 release on similar hardware. >Fix: easy & ugly workaround is to just disable ata dma from the loader with set hw.ata.ata_dma=0 maybe a little bit better workaround is following patch, which just reverts to previous behaviour: --- sys/dev/ata/ata-dma.c.orig Mon Dec 20 08:27:25 2004 +++ sys/dev/ata/ata-dma.c Mon Dec 20 08:47:15 2004 @@ -198,16 +198,22 @@ { struct ata_dmasetprd_args *args = xsc; struct ata_dma_prdentry *prd = args->dmatab; - int i; + int i,j; + bus_size_t cnt; + u_int32_t lastcount; if ((args->error = error)) return; + lastcount = j = 0; for (i = 0; i < nsegs; i++) { - prd[i].addr = htole32(segs[i].ds_addr); - prd[i].count = htole32(segs[i].ds_len); + for (cnt = 0; cnt < segs[i].ds_len; cnt += PAGE_SIZE, j++) { + prd[j].addr = htole32(segs[i].ds_addr + cnt); + lastcount = ulmin(segs[i].ds_len - cnt, PAGE_SIZE) & 0xffff; + prd[j].count = htole32(lastcount); + } } - prd[i - 1].count |= htole32(ATA_DMA_EOT); + prd[j - 1].count |= htole32(lastcount | ATA_DMA_EOT); } static int of course the real solution should be finding and fixing the bug in busdma code. >Release-Note: >Audit-Trail: >Unformatted: >System: FreeBSD alpha 6.0-CURRENT FreeBSD 6.0-CURRENT #23: Mon Dec 20 05:07:30 EET 2004 root@alpha:/mnt/disk/obj/usr/src/sys/HADARA alpha dmesg can be found @ http://bsd.ee/~hadara/debug/pcalpha/kernel.txt but relevant details of it should be: Digital AlphaPC 164LX 533 MHz, 531MHz 8192 byte page size, 1 processor. ... ad0: 1226MB [2491/16/63] at ata0-master WDMA2 ad1: 3052MB [11024/9/63] at ata0-slave WDMA2 ... this is IDE only machine