From owner-freebsd-current@FreeBSD.ORG Thu Jun 5 04:18:53 2003 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 0089637B401 for ; Thu, 5 Jun 2003 04:18:53 -0700 (PDT) Received: from heron.mail.pas.earthlink.net (heron.mail.pas.earthlink.net [207.217.120.189]) by mx1.FreeBSD.org (Postfix) with ESMTP id 60AC443FA3 for ; Thu, 5 Jun 2003 04:18:52 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from user-2ivfmr7.dialup.mindspring.com ([165.247.219.103] helo=mindspring.com) by heron.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 19Nslc-0003LW-00; Thu, 05 Jun 2003 04:18:49 -0700 Message-ID: <3EDF26D2.C93A93DF@mindspring.com> Date: Thu, 05 Jun 2003 04:17:38 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: "David P. Reese Jr." References: <20030602222009.A16160@armor.free.fr> <20030603175430.GA4039@tombstone.localnet.gomerbud.com> <20030604072907.GA10742@tombstone.localnet.gomerbud.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a4e20d29f0969304a7655e4bba089602b8666fa475841a1c7a350badd9bab72f9c350badd9bab72f9c cc: current@freebsd.org Subject: Re: viapropm doesnt like sys/dev/pci.c rev 1.214 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: Thu, 05 Jun 2003 11:18:53 -0000 "David P. Reese Jr." wrote: > > > A snip of code from sys/dev/pci/pci.c:pci_enable_io_method(): > > > > > > pci_set_command_bit(dev, child, bit); > > > command = PCI_READ_CONFIG(dev, child, PCIR_COMMAND, 2); > > > if (command & bit) > > > return (0); > > > device_printf(child, "failed to enable %s mapping!\n", error); > > > return (ENXIO); > > > > > > Because the viapropm's command register bits will always read as zero, > > > this code will always fail when trying to enable port mapping. [ ... ] > > How about adding another flag to bus_alloc_resource() which would signal > that we are not to check the value of the command register after calling > pci_set_command_bit(). > > RF_WILLFAIL? > > After pci_enable_io_method() gets swallowed into pci_alloc_resource(), > this would be pretty easy because the flag would be in scope when we > check the value of the command register. > > I can do so this weekend if anyone thinks this is worthwhile. How about RF_DONTCHECK or RF_ALWAYSWORKS? It better implies what's happening here, since you're going to assume success in the face of diagnostics to the contrary. So instead of: if (flag) return (0); command = PCI_READ_CONFIG(dev, child, PCIR_COMMAND, 2); if (command & bit) return (0); device_printf(child, "failed to enable %s mapping!\n", error); return (ENXIO); You do: command = PCI_READ_CONFIG(dev, child, PCIR_COMMAND, 2); if ((command & bit) || flag) return (0); device_printf(child, "failed to enable %s mapping!\n", error); return (ENXIO); Yeah, I know the disctinction is subtle, but there migh be other PCI_READ_CONFIG() results later that people care about, besides just this one bit, which *do* work on some other chip with the same issue. -- Terry