From owner-freebsd-bugs@FreeBSD.ORG Thu Oct 12 03:30:26 2006 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E272E16A47C for ; Thu, 12 Oct 2006 03:30:25 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 49FDF43D83 for ; Thu, 12 Oct 2006 03:30:10 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k9C3UAqQ038504 for ; Thu, 12 Oct 2006 03:30:10 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k9C3UA9E038499; Thu, 12 Oct 2006 03:30:10 GMT (envelope-from gnats) Resent-Date: Thu, 12 Oct 2006 03:30:10 GMT Resent-Message-Id: <200610120330.k9C3UA9E038499@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Rich Wales Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 344C916A494 for ; Thu, 12 Oct 2006 03:22:20 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id 60B5743D5E for ; Thu, 12 Oct 2006 03:22:19 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k9C3MIdL051463 for ; Thu, 12 Oct 2006 03:22:18 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id k9C3MIbT051462; Thu, 12 Oct 2006 03:22:18 GMT (envelope-from nobody) Message-Id: <200610120322.k9C3MIbT051462@www.freebsd.org> Date: Thu, 12 Oct 2006 03:22:18 GMT From: Rich Wales To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.0 Cc: Subject: kern/104318: Promise SATA PDC4xxxx cards -- port numbering problem X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Oct 2006 03:30:26 -0000 >Number: 104318 >Category: kern >Synopsis: Promise SATA PDC4xxxx cards -- port numbering problem >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Oct 12 03:30:09 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Rich Wales >Release: 6.1-RELEASE-p10 >Organization: >Environment: FreeBSD tapeworm.richw.org 6.1-RELEASE-p10 FreeBSD 6.1-RELEASE-p10 #8: Tue Oct 10 18:37:52 PDT 2006 richw@tapeworm.richw.org:/usr/obj/usr/src/sys/WHODUNIT i386 >Description: On the newer 4-port Promise non-RAID SATA cards (with PDC4xxxx-series chips), the enumeration of the ports is jumbled. The port labelled as "Port 1" on the card, for example, is being recognized as if it were port 4. This problem has been noted with Linux systems as well; see this page, for instance: http://www.thisishull.net/printthread.php?t=150545 >How-To-Repeat: >Fix: The accompanying patch rearranges the unit numbers so the enumeration of the ports will correspond to the physical labelling on the card. This code assumes that ata_promise_mio_allocate() will only be called once for each device. Patch attached with submission follows: --- sys/dev/ata/ata-chipset.c.orig Thu Mar 16 13:28:51 2006 +++ sys/dev/ata/ata-chipset.c Tue Oct 10 00:14:16 2006 @@ -3332,6 +3332,11 @@ return 0; } +/* + * translation map for port enumeration on PDC4xxxx-series controllers + */ +static int pdc4_port_map[4] = {3, 1, 0, 2}; + static int ata_promise_mio_allocate(device_t dev) { @@ -3339,6 +3344,15 @@ struct ata_channel *ch = device_get_softc(dev); int offset = (ctlr->chip->cfg2 & PRSX4X) ? 0x000c0000 : 0; int i; + + /* + * port enumeration on PDC4xxxx-series controllers + * doesn't correspond to labelling on the card; + * rearrange unit numbers to make them correspond + */ + if ((ctlr->chip->cfg2 & PRSATA2) + && ch->unit >= 0 && ch->unit <= 3) + ch->unit = pdc4_port_map[ch->unit]; for (i = ATA_DATA; i <= ATA_COMMAND; i++) { ch->r_io[i].res = ctlr->r_res2; >Release-Note: >Audit-Trail: >Unformatted: