From owner-freebsd-current@FreeBSD.ORG Fri Aug 21 14:32:42 2009 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E4AA106568D; Fri, 21 Aug 2009 14:32:42 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from gizmo.2hip.net (gizmo.2hip.net [64.74.207.195]) by mx1.freebsd.org (Postfix) with ESMTP id 104168FC47; Fri, 21 Aug 2009 14:32:41 +0000 (UTC) Received: from [192.168.1.4] (adsl-154-198-91.ard.bellsouth.net [72.154.198.91]) (authenticated bits=0) by gizmo.2hip.net (8.14.3/8.14.3) with ESMTP id n7LEWdND087087 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 21 Aug 2009 10:32:40 -0400 (EDT) (envelope-from rnoland@FreeBSD.org) From: Robert Noland To: John Baldwin In-Reply-To: <200908201705.21310.jhb@freebsd.org> References: <200908201705.21310.jhb@freebsd.org> Content-Type: text/plain Organization: FreeBSD Date: Fri, 21 Aug 2009 09:32:33 -0500 Message-Id: <1250865154.8177.2.camel@balrog.2hip.net> Mime-Version: 1.0 X-Mailer: Evolution 2.26.3 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_PBL, RCVD_IN_SORBS_DUL, RDNS_DYNAMIC, SPF_SOFTFAIL autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on gizmo.2hip.net Cc: Warner Losh , FreeBSD Current Subject: Re: [PATCH] Adjust hints matching for ACPI devices X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 21 Aug 2009 14:32:42 -0000 On Thu, 2009-08-20 at 17:05 -0400, John Baldwin wrote: > This patch adjusts how the acpi0 device matches hint devices with built-in > devices. First, it relaxes the matching somewhat so that if the memory and > I/O ports specified in hints match a device then mismatches in IRQs or DRQs > are ignored. This should fix the problem with atrtc1 devices because the > ACPI-enumerated atrtc device did not include an IRQ. The second change is a > hack to allow floppy drive controllers to match the hints on systems where > the BIOS does not include 0x3f0 in the list of resources for the floppy drive > (see the comments above fdc_isa_alloc_resources() for the gory details). > This should fix the reports of the floppy controller showing up as fdc1 > rather than fdc0. I've restored my hints file to default and atrtc seems to DTRT now. robert. > --- //depot/vendor/freebsd/src/sys/dev/acpica/acpi.c 2009/08/02 14:30:16 > +++ //depot/user/jhb/acpipci/dev/acpica/acpi.c 2009/08/20 21:00:30 > @@ -1008,14 +1004,27 @@ > continue; > > /* > - * Check for matching resources. We must have at least one, > - * and all resources specified have to match. > + * Check for matching resources. We must have at least one match. > + * Since I/O and memory resources cannot be shared, if we get a > + * match on either of those, ignore any mismatches in IRQs or DRQs. > * > * XXX: We may want to revisit this to be more lenient and wire > * as long as it gets one match. > */ > matches = 0; > if (resource_long_value(name, unit, "port", &value) == 0) { > + /* > + * Floppy drive controllers are notorious for having a > + * wide variety of resources not all of which include the > + * first port that is specified by the hint (typically > + * 0x3f0) (see the comment above fdc_isa_alloc_resources() > + * in fdc_isa.c). However, they do all seem to include > + * port + 2 (e.g. 0x3f2) so for a floppy device, look for > + * 'value + 2' in the port resources instead of the hint > + * value. > + */ > + if (strcmp(name, "fdc") == 0) > + value += 2; > if (acpi_match_resource_hint(child, SYS_RES_IOPORT, value)) > matches++; > else > @@ -1027,6 +1036,8 @@ > else > continue; > } > + if (matches > 0) > + goto matched; > if (resource_long_value(name, unit, "irq", &value) == 0) { > if (acpi_match_resource_hint(child, SYS_RES_IRQ, value)) > matches++; > @@ -1040,6 +1051,7 @@ > continue; > } > > + matched: > if (matches > 0) { > /* We have a winner! */ > *unitp = unit; > -- Robert Noland FreeBSD