ACPI display brightness control not detected

2017-06-18 Thread Hans Petter Selasky

Hi,

I've dumped the relevant ACPI tables below. Does anyone know why the 
parsing of the ACPI DOD fails in acpi_video.c ?


Any patch suggestions?

--HPS

acpidump:


Scope (\_SB.PCI0.GFX0)
{
Method (_DOS, 1, NotSerialized)  // _DOS: Disable Output Switching
{
DSEN = (Arg0 & 0x07)
If ((Arg0 & 0x03) == Zero)
{
If (CondRefOf (HDOS))
{
HDOS ()
}
}
}

Method (_DOD, 0, NotSerialized)  // _DOD: Display Output Devices
{
If (IMTP == One)
{
NDID = One
}
Else
{
NDID = Zero
}

If (DIDL != Zero)
{
DID1 = SDDL (DIDL)
}

If (DDL2 != Zero)
{
DID2 = SDDL (DDL2)
}

If (DDL3 != Zero)
{
DID3 = SDDL (DDL3)
}

If (DDL4 != Zero)
{
DID4 = SDDL (DDL4)
}

If (DDL5 != Zero)
{
DID5 = SDDL (DDL5)
}

If (DDL6 != Zero)
{
DID6 = SDDL (DDL6)
}

If (DDL7 != Zero)
{
DID7 = SDDL (DDL7)
}

If (DDL8 != Zero)
{
DID8 = SDDL (DDL8)
}

If (DDL9 != Zero)
{
DID9 = SDDL (DDL9)
}

If (DD10 != Zero)
{
DIDA = SDDL (DD10)
}

If (DD11 != Zero)
{
DIDB = SDDL (DD11)
}

If (DD12 != Zero)
{
DIDC = SDDL (DD12)
}

If (DD13 != Zero)
{
DIDD = SDDL (DD13)
}

If (DD14 != Zero)
{
DIDE = SDDL (DD14)
}

If (DD15 != Zero)
{
DIDF = SDDL (DD15)
}

If (NDID == One)
{
Name (TMP1, Package (0x01)
{
0x
})
If (IMTP == One)
{
TMP1 [Zero] = 0x0002CA00
}
Else
{
TMP1 [Zero] = (0x0001 | DID1)
}

Return (TMP1) /* \_SB_.PCI0.GFX0._DOD.TMP1 */
}

If (NDID == 0x02)
{
Name (TMP2, Package (0x02)
{
0x, 
0x

})
TMP2 [Zero] = (0x0001 | DID1)
If (IMTP == One)
{
TMP2 [One] = 0x0002CA00
}
Else
{
TMP2 [One] = (0x0001 | DID2)
}

Return (TMP2) /* \_SB_.PCI0.GFX0._DOD.TMP2 */
}

If (NDID == 0x03)
{
Name (TMP3, Package (0x03)
{
0x, 
0x, 
0x

})
TMP3 [Zero] = (0x0001 | DID1)
TMP3 [One] = (0x0001 | DID2)
If (IMTP == One)
{
TMP3 [0x02] = 0x0002CA00
}
Else
{
TMP3 [0x02] = (0x0001 | DID3)
}

Return (TMP3) /* \_SB_.PCI0.GFX0._DOD.TMP3 */
}

If (NDID == 0x04)
{
Name (TMP4, Package (0x04)
{
0x, 
0x, 
0x, 
0x

})
TMP4 [Zero] = (0x0001 | DID1)
TMP4 [One] = (0x0001 | DID2)
TMP4 [0x02] = (0x0001 | DID3)
If (IMTP == One)
{
TMP4 [0x03] = 0x0002CA00
}
Else
{
TMP4 [0x03] = (0x0001 | DID4)
}

Return (TMP4) /* \_SB_.PCI0.GFX0._DOD.TMP4 */
}

If (NDID == 0x05)
{
Name (TMP5, Package (0x05)
{
0x, 
0x, 
0x, 
0x, 
0x

})
TMP5 [Zero] = (0x0001 | DID1)
TMP5 [One] = (0x0001 | DID2)
TMP5 [0x02] = (0x0001 | DID3)
TMP5 [0x03] = (0x0001 | DID4)
If (IMTP == One)

[Bug 220096][PATCH] acpi_thermal: Fix a possible sleep-under-mutex bug in acpi_tz_thread

2017-06-18 Thread Jia-Ju Bai
The driver may sleep under a mutex, and the code path is:
acpi_tz_thread [line 992: acquire the mutex]
acpi_tz_thread [line 993]
acpi_tz_thread [line 1003]
acpi_tz_thread [line 1004] (msleep is excuted)
acpi_tz_thread [line 1008]
acpi_tz_thread [line 970]
acpi_tz_thread [line 971]
acpi_tz_thread [line 975]
   malloc(M_WAITOK) [line 976]

The possible fix of this bug is to replace "M_WAITOK" in malloc with 
"M_NOWAIT".

This bug is found by a static analysis tool written by myself, and it is 
checked by my review of the FreeBSD code.

Signed-off-by: Jia-Ju Bai 
---
 sys/dev/acpica/acpi_thermal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/acpica/acpi_thermal.c b/sys/dev/acpica/acpi_thermal.c
index b2b2a13aa88..fb9f44b5711 100644
--- a/sys/dev/acpica/acpi_thermal.c
+++ b/sys/dev/acpica/acpi_thermal.c
@@ -974,7 +974,7 @@ acpi_tz_thread(void *arg)
}
devclass_get_devices(acpi_tz_devclass, , );
sc = malloc(sizeof(struct acpi_tz_softc *) * devcount, M_TEMP,
-   M_WAITOK | M_ZERO);
+   M_NOWAIT | M_ZERO);
for (i = 0; i < devcount; i++)
sc[i] = device_get_softc(devs[i]);
}
-- 
2.13.0


___
freebsd-acpi@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-acpi
To unsubscribe, send any mail to "freebsd-acpi-unsubscr...@freebsd.org"