From owner-freebsd-current@FreeBSD.ORG Fri Aug 21 16:41:29 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 857D8106568B; Fri, 21 Aug 2009 16:41:29 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 1D2458FC16; Fri, 21 Aug 2009 16:41:29 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id n7LGentr081258; Fri, 21 Aug 2009 10:40:49 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Fri, 21 Aug 2009 10:41:49 -0600 (MDT) Message-Id: <20090821.104149.1723938629.imp@bsdimp.com> To: rnoland@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <1250865154.8177.2.camel@balrog.2hip.net> References: <200908201705.21310.jhb@freebsd.org> <1250865154.8177.2.camel@balrog.2hip.net> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: current@FreeBSD.org, jhb@FreeBSD.org 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 16:41:29 -0000 In message: <1250865154.8177.2.camel@balrog.2hip.net> Robert Noland writes: : 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. These changes look good to me as well... I never did like the match IRQ requirement... Warner : 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 : :