[PATCH] Adjust hints matching for ACPI devices

Robert Noland rnoland at FreeBSD.org
Fri Aug 21 14:32:42 UTC 2009


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 <rnoland at FreeBSD.org>
FreeBSD



More information about the freebsd-current mailing list