Dell acpi_video patch

John Baldwin jhb at freebsd.org
Thu Oct 18 13:47:35 UTC 2012


On Wednesday, October 17, 2012 9:08:34 pm Alberto Villa wrote:
> On Mon, Oct 15, 2012 at 5:12 PM, John Baldwin <jhb at freebsd.org> wrote:
> > Interesting.  Can you get an acpidump?
> 
> Sure:
> http://people.FreeBSD.org/~avilla/files/avilla.asl.gz
> 
> I'd be glad to solve my problems with ACPI!

Ah, looks like your BIOS excludes DOD_DEVID_SCHEME_STD from it's _ADR
methods (but does included it in on the list of displays returned by
_DOD).

Please test this updated version:

Index: acpi_video.c
===================================================================
--- acpi_video.c	(revision 241683)
+++ acpi_video.c	(working copy)
@@ -320,7 +320,8 @@ acpi_video_resume(device_t dev)
 	ACPI_SERIAL_BEGIN(video_output);
 	STAILQ_FOREACH_SAFE(vo, &sc->vid_outputs, vo_next, vn) {
 		if ((vo->adr & DOD_DEVID_MASK_FULL) != DOD_DEVID_LCD &&
-		    (vo->adr & DOD_DEVID_MASK) != DOD_DEVID_INTDFP)
+		    (vo->adr & (DOD_DEVID_SCHEME_STD | DOD_DEVID_MASK)) !=
+		    (DOD_DEVID_SCHEME_STD | DOD_DEVID_INTDFP))
 			continue;
 
 		if ((vo_get_device_status(vo->handle) & DCS_ACTIVE) == 0)
@@ -467,38 +468,40 @@ acpi_video_vo_init(UINT32 adr)
 
 	ACPI_SERIAL_ASSERT(video);
 
-	switch (adr & DOD_DEVID_MASK) {
+	/* Assume an unknown unit by default. */
+	desc = "unknown output";
+	type = "out";
+	voqh = &other_units;
+
+	switch (adr & (DOD_DEVID_SCHEME_STD | DOD_DEVID_MASK)) {
 	case DOD_DEVID_MONITOR:
 		if ((adr & DOD_DEVID_MASK_FULL) == DOD_DEVID_LCD) {
 			/* DOD_DEVID_LCD is a common, backward compatible ID */
 			desc = "Internal/Integrated Digital Flat Panel";
 			type = "lcd";
 			voqh = &lcd_units;
-		} else {
-			desc = "VGA CRT or VESA Compatible Analog Monitor";
-			type = "crt";
-			voqh = &crt_units;
 		}
 		break;
-	case DOD_DEVID_TV:
+	case DOD_DEVID_SCHEME_STD | DOD_DEVID_MONITOR:
+		desc = "VGA CRT or VESA Compatible Analog Monitor";
+		type = "crt";
+		voqh = &crt_units;
+		break;
+	case DOD_DEVID_SCHEME_STD | DOD_DEVID_TV:
 		desc = "TV/HDTV or Analog-Video Monitor";
 		type = "tv";
 		voqh = &tv_units;
 		break;
-	case DOD_DEVID_EXT:
+	case DOD_DEVID_SCHEME_STD | DOD_DEVID_EXT:
 		desc = "External Digital Monitor";
 		type = "ext";
 		voqh = &ext_units;
 		break;
-	case DOD_DEVID_INTDFP:
+	case DOD_DEVID_SCHEME_STD | DOD_DEVID_INTDFP:
 		desc = "Internal/Integrated Digital Flat Panel";
 		type = "lcd";
 		voqh = &lcd_units;
 		break;
-	default:
-		desc = "unknown output";
-		type = "out";
-		voqh = &other_units;
 	}
 
 	n = 0;
@@ -633,21 +636,25 @@ acpi_video_vo_destroy(struct acpi_video_output *vo
 		AcpiOsFree(vo->vo_levels);
 	}
 
-	switch (vo->adr & DOD_DEVID_MASK) {
+	voqh = &other_units;
+
+	switch (vo->adr & (DOD_DEVID_SCHEME_STD | DOD_DEVID_MASK)) {
 	case DOD_DEVID_MONITOR:
+		if ((vo->adr & DOD_DEVID_MASK_FULL) == DOD_DEVID_LCD)
+			voqh = &lcd_units;
+		break;
+	case DOD_DEVID_SCHEME_STD | DOD_DEVID_MONITOR:
 		voqh = &crt_units;
 		break;
-	case DOD_DEVID_TV:
+	case DOD_DEVID_SCHEME_STD | DOD_DEVID_TV:
 		voqh = &tv_units;
 		break;
-	case DOD_DEVID_EXT:
+	case DOD_DEVID_SCHEME_STD | DOD_DEVID_EXT:
 		voqh = &ext_units;
 		break;
-	case DOD_DEVID_INTDFP:
+	case DOD_DEVID_SCHEME_STD | DOD_DEVID_INTDFP:
 		voqh = &lcd_units;
 		break;
-	default:
-		voqh = &other_units;
 	}
 	STAILQ_REMOVE(voqh, vo, acpi_video_output, vo_unit.next);
 	free(vo, M_ACPIVIDEO);
@@ -905,8 +912,14 @@ vid_enum_outputs_subr(ACPI_HANDLE handle, UINT32 l
 		return (AE_OK);
 
 	for (i = 0; i < argset->dod_pkg->Package.Count; i++) {
+		/*
+		 * Some systems do not include DOD_DEVID_SCHEME_STD in
+		 * the _ADR of output devices and some do, so just
+		 * ignore DOD_DEVID_SCHEME_STD.
+		 */
 		if (acpi_PkgInt32(argset->dod_pkg, i, &val) == 0 &&
-		    (val & DOD_DEVID_MASK_FULL) == adr) {
+		    (val & DOD_DEVID_MASK_FULL) ==
+		    (adr & ~DOD_DEVID_SCHEME_STD)) {
 			argset->callback(handle, val, argset->context);
 			argset->count++;
 		}

-- 
John Baldwin


More information about the freebsd-mobile mailing list