From owner-svn-src-stable-8@FreeBSD.ORG Thu Aug 27 16:34:04 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB74F106568C; Thu, 27 Aug 2009 16:34:04 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D820A8FC3A; Thu, 27 Aug 2009 16:34:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RGY4Rn001532; Thu, 27 Aug 2009 16:34:04 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RGY4FV001529; Thu, 27 Aug 2009 16:34:04 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200908271634.n7RGY4FV001529@svn.freebsd.org> From: John Baldwin Date: Thu, 27 Aug 2009 16:34:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196593 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/acpica dev/xen/xenpci isa X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2009 16:34:05 -0000 Author: jhb Date: Thu Aug 27 16:34:04 2009 New Revision: 196593 URL: http://svn.freebsd.org/changeset/base/196593 Log: MFC 196520: Tweak the way that the ACPI and ISA bus drivers match hint devices to BIOS-enumerated devices: - Assume a device is a match if the memory and I/O ports match even if the IRQ or DRQ is wrong or missing. Some BIOSes don't include an IRQ for the atrtc device for example. - Add a hack to better match floppy controller devices. Many BIOSes do not include the starting port of the floppy controller listed in the hints (0x3f0) in the resources for the device. So far, however, all the BIOS variations encountered do include the 'port + 2' resource (0x3f2), so adjust the matching for "fdc" devices to look for 'port + 2'. Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/acpica/acpi.c stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/isa/isahint.c Modified: stable/8/sys/dev/acpica/acpi.c ============================================================================== --- stable/8/sys/dev/acpica/acpi.c Thu Aug 27 16:15:51 2009 (r196592) +++ stable/8/sys/dev/acpica/acpi.c Thu Aug 27 16:34:04 2009 (r196593) @@ -1014,14 +1014,27 @@ acpi_hint_device_unit(device_t acdev, de 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 @@ -1033,6 +1046,8 @@ acpi_hint_device_unit(device_t acdev, de 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++; @@ -1046,6 +1061,7 @@ acpi_hint_device_unit(device_t acdev, de continue; } + matched: if (matches > 0) { /* We have a winner! */ *unitp = unit; Modified: stable/8/sys/isa/isahint.c ============================================================================== --- stable/8/sys/isa/isahint.c Thu Aug 27 16:15:51 2009 (r196592) +++ stable/8/sys/isa/isahint.c Thu Aug 27 16:34:04 2009 (r196593) @@ -118,14 +118,30 @@ isa_hint_device_unit(device_t bus, devic 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. + * 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 (isa_match_resource_hint(child, SYS_RES_IOPORT, value)) matches++; @@ -139,6 +155,8 @@ isa_hint_device_unit(device_t bus, devic else continue; } + if (matches > 0) + goto matched; if (resource_long_value(name, unit, "irq", &value) == 0) { if (isa_match_resource_hint(child, SYS_RES_IRQ, value)) matches++; @@ -152,6 +170,7 @@ isa_hint_device_unit(device_t bus, devic continue; } + matched: if (matches > 0) { /* We have a winner! */ *unitp = unit;