Date: Fri, 21 Aug 2009 10:41:49 -0600 (MDT) From: "M. Warner Losh" <imp@bsdimp.com> To: rnoland@FreeBSD.org Cc: current@FreeBSD.org, jhb@FreeBSD.org Subject: Re: [PATCH] Adjust hints matching for ACPI devices Message-ID: <20090821.104149.1723938629.imp@bsdimp.com> In-Reply-To: <1250865154.8177.2.camel@balrog.2hip.net> References: <200908201705.21310.jhb@freebsd.org> <1250865154.8177.2.camel@balrog.2hip.net>
next in thread | previous in thread | raw e-mail | index | archive | help
In message: <1250865154.8177.2.camel@balrog.2hip.net> Robert Noland <rnoland@FreeBSD.org> 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 <rnoland@FreeBSD.org> : FreeBSD : :
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090821.104149.1723938629.imp>