From owner-freebsd-current@FreeBSD.ORG Tue Dec 28 12:50:03 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3FF8416A4CE; Tue, 28 Dec 2004 12:50:03 +0000 (GMT) Received: from spider.deepcore.dk (cpe.atm2-0-53484.0x50a6c9a6.abnxx9.customer.tele.dk [80.166.201.166]) by mx1.FreeBSD.org (Postfix) with ESMTP id 72F5943D54; Tue, 28 Dec 2004 12:50:02 +0000 (GMT) (envelope-from sos@DeepCore.dk) Received: from [194.192.25.143] (laptop.deepcore.dk [194.192.25.143]) by spider.deepcore.dk (8.12.11/8.12.10) with ESMTP id iBSCnvak071262; Tue, 28 Dec 2004 13:49:59 +0100 (CET) (envelope-from sos@DeepCore.dk) Message-ID: <41D15650.7080504@DeepCore.dk> Date: Tue, 28 Dec 2004 13:49:20 +0100 From: =?ISO-8859-1?Q?S=F8ren_Schmidt?= User-Agent: Mozilla Thunderbird 0.7.2 (X11/20040802) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Ruslan Ermilov References: <20041223221047.GB6049@ip.net.ua> <20041224094127.GA75931@ip.net.ua> <41CC425C.7050906@DeepCore.dk> <20041224220821.GB86330@ip.net.ua> <41CC9BDA.7020203@DeepCore.dk> <20041224233021.GA43419@ip.net.ua> <41CFEFAF.8040100@DeepCore.dk> <20041227141310.GA95767@ip.net.ua> <41D03AA4.3020908@DeepCore.dk> <20041228110644.GB14010@ip.net.ua> In-Reply-To: <20041228110644.GB14010@ip.net.ua> Content-Type: multipart/mixed; boundary="------------000403030802040804010706" X-mail-scanned: by DeepCore Virus & Spam killer v1.4 cc: current@FreeBSD.ORG cc: Soren Schmidt Subject: Re: ATA regression [PATCH] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Dec 2004 12:50:03 -0000 This is a multi-part message in MIME format. --------------000403030802040804010706 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Ruslan Ermilov wrote: > So I analyzed what was changed in this ata-chipset.c revision > when it comes to my chip, and tried the following patch, and > it brought me back my ad8 drive: Hmm, there are grimlins in there alright. Could you try the attached=20 patch as thats what I have in my WIP and it cleans up the code a bit as=20 well.. --=20 -S=F8ren --------------000403030802040804010706 Content-Type: text/plain; name="promdiff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="promdiff" Index: ata-chipset.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ata/ata-chipset.c,v retrieving revision 1.97 diff -u -r1.97 ata-chipset.c --- ata-chipset.c 24 Dec 2004 13:36:04 -0000 1.97 +++ ata-chipset.c 28 Dec 2004 12:47:10 -0000 @@ -1367,6 +1367,11 @@ return ENXIO; } + if (ctlr->chip->max_dma >= ATA_SA150) + ctlr->setmode = ata_sata_setmode; + else + ctlr->setmode = ata_promise_setmode; + switch (ctlr->chip->cfg1) { case PRNEW: /* setup clocks */ @@ -1413,22 +1418,33 @@ ctlr->dmainit = ata_promise_mio_dmainit; ctlr->allocate = ata_promise_mio_allocate; - if (ctlr->chip->cfg2 & PRPATA) { - ctlr->channels = ((ATA_INL(ctlr->r_res2, 0x48) & 0x01) > 0) + - ((ATA_INL(ctlr->r_res2, 0x48) & 0x02) > 0) + 2; - } - else if (ctlr->chip->cfg2 & PRCMBO) { - ATA_OUTL(ctlr->r_res2, 0x06c, 0x000000ff); - ctlr->channels = ((ATA_INL(ctlr->r_res2, 0x48) & 0x02) > 0) + 3; - } - else if (ctlr->chip->cfg2 & PRCMBO2) { - ATA_OUTL(ctlr->r_res2, 0x060, 0x000000ff); - ctlr->channels = 3; - } - else - ctlr->channels = 4; + switch (ctlr->chip->cfg2) { + case PRPATA: + ctlr->channels = ((ATA_INL(ctlr->r_res2, 0x48) & 0x01) > 0) + + ((ATA_INL(ctlr->r_res2, 0x48) & 0x02) > 0) + 2; + break; - if (ctlr->chip->cfg2 & PRSX4X) { + case PRCMBO: + ATA_OUTL(ctlr->r_res2, 0x06c, 0x000000ff); + ctlr->channels = ((ATA_INL(ctlr->r_res2, 0x48) & 0x02) > 0) + 3; + break; + + case PRSATA: + ATA_OUTL(ctlr->r_res2, 0x06c, 0x000000ff); + ctlr->channels = 4; + break; + + case PRCMBO2: + ATA_OUTL(ctlr->r_res2, 0x060, 0x000000ff); + ctlr->channels = 3; + break; + + case PRSATA2: + ATA_OUTL(ctlr->r_res2, 0x060, 0x000000ff); + ctlr->channels = 4; + break; + + case PRSX4X: { struct ata_promise_sx4 *hpkt; u_int32_t dimm = ATA_INL(ctlr->r_res2, 0x000c0080); @@ -1448,26 +1464,25 @@ mtx_init(&hpkt->mtx, "ATA promise HPKT lock", NULL, MTX_DEF); hpkt->busy = hpkt->head = hpkt->tail = 0; + ctlr->channels = 4; + if ((bus_setup_intr(dev, ctlr->r_irq, ATA_INTR_FLAGS, ata_promise_sx4_intr, ctlr, &ctlr->handle))) { device_printf(dev, "unable to setup interrupt\n"); return ENXIO; } - } - else { - if ((bus_setup_intr(dev, ctlr->r_irq, ATA_INTR_FLAGS, - ata_promise_mio_intr, ctlr, &ctlr->handle))) { - device_printf(dev, "unable to setup interrupt\n"); - return ENXIO; + return 0; } } - break; + + if ((bus_setup_intr(dev, ctlr->r_irq, ATA_INTR_FLAGS, + ata_promise_mio_intr, ctlr, &ctlr->handle))) { + device_printf(dev, "unable to setup interrupt\n"); + return ENXIO; + } + return 0; } - if (ctlr->chip->max_dma >= ATA_SA150) - ctlr->setmode = ata_sata_setmode; - else - ctlr->setmode = ata_promise_setmode; - return 0; + return ENXIO; } static int --------------000403030802040804010706--