changeset 13766:adffc698eaf5

2560 ACPI parser fails to identify COM3 on Tyan motherboard Reviewed by: Gordon Ross <gwr@nexenta.com> Reviewed by: Garrett D'Amore <garrett@damore.org> Approved by: Dan McDonald <danmcd@nexenta.com>
author Gary Mills <gary_mills@fastmail.fm>
date Tue, 24 Jul 2012 18:52:10 -0500
parents 9410cf539b11
children 8c906b14afbd
files usr/src/uts/intel/io/acpica/acpi_enum.c
diffstat 1 files changed, 38 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/intel/io/acpica/acpi_enum.c	Wed Aug 01 16:40:39 2012 -0400
+++ b/usr/src/uts/intel/io/acpica/acpi_enum.c	Tue Jul 24 18:52:10 2012 -0500
@@ -19,6 +19,8 @@
  * CDDL HEADER END
  */
 /*
+ * Copyright (c) 2012 Gary Mills
+ *
  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
@@ -436,7 +438,7 @@
 }
 
 static ACPI_STATUS
-parse_resources(ACPI_HANDLE handle, dev_info_t *xdip)
+parse_resources(ACPI_HANDLE handle, dev_info_t *xdip, char *path)
 {
 	ACPI_BUFFER	buf;
 	ACPI_RESOURCE	*resource_ptr;
@@ -448,8 +450,26 @@
 
 	buf.Length = ACPI_ALLOCATE_BUFFER;
 	status = AcpiGetCurrentResources(handle, &buf);
-	if (status != AE_OK) {
+	switch (status) {
+	case AE_OK:
+		break;
+	case AE_NOT_FOUND:
+		/*
+		 * Workaround for faulty DSDT tables that omit the _CRS
+		 * method for the UAR3 device but have a valid _PRS method
+		 * for that device.
+		 */
+		status = AcpiGetPossibleResources(handle, &buf);
+		if (status != AE_OK) {
+			return (status);
+		}
+		break;
+	default:
+		cmn_err(CE_WARN,
+		    "!AcpiGetCurrentResources failed for %s, exception: %s",
+		    path, AcpiFormatException(status));
 		return (status);
+		break;
 	}
 	io = (struct regspec *)kmem_zalloc(sizeof (struct regspec) *
 	    MAX_PARSED_ACPI_RESOURCES, KM_SLEEP);
@@ -803,6 +823,11 @@
 		 * Bit 2 -- device is shown in UI
 		 */
 		if (!((info->CurrentStatus & 0x7) == 7)) {
+			if (acpi_enum_debug & DEVICES_NOT_ENUMED) {
+				cmn_err(CE_NOTE, "parse_resources() "
+				    "Bad status 0x%x for %s",
+				    info->CurrentStatus, path);
+			}
 			goto done;
 		}
 	} else {
@@ -815,6 +840,10 @@
 	 */
 	if (!(info->Valid & ACPI_VALID_HID)) {
 		/* No _HID, we skip this node */
+		if (acpi_enum_debug & DEVICES_NOT_ENUMED) {
+			cmn_err(CE_NOTE, "parse_resources() "
+			    "No _HID for %s", path);
+		}
 		goto done;
 	}
 	hidstr = info->HardwareId.String;
@@ -896,7 +925,7 @@
 				(void) ndi_prop_update_string(DDI_DEV_T_NONE,
 				    xdip, "model", "PNP0Fxx mouse");
 			} else {
-				(void) parse_resources(ObjHandle, xdip);
+				(void) parse_resources(ObjHandle, xdip, path);
 				goto done;
 			}
 		}
@@ -905,7 +934,7 @@
 	(void) ndi_prop_update_string(DDI_DEV_T_NONE, xdip, "acpi-namespace",
 	    path);
 
-	(void) parse_resources(ObjHandle, xdip);
+	(void) parse_resources(ObjHandle, xdip, path);
 
 	/* Special processing for mouse and keyboard devices per IEEE 1275 */
 	/* if master entry doesn't contain "compatible" then we add default */
@@ -1056,9 +1085,12 @@
 	process_master_file();
 
 	/*
-	 * Do the actual enumeration
+	 * Do the actual enumeration.  Avoid AcpiGetDevices because it
+	 * has an unnecessary internal callback that duplicates
+	 * determining if the device is present.
 	 */
-	(void) AcpiGetDevices(NULL, isa_acpi_callback, isa_dip, 0);
+	(void) AcpiWalkNamespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
+	    UINT32_MAX, isa_acpi_callback, NULL, isa_dip, NULL);
 
 	free_master_data();
 	used_res_interrupts();