Skip to contentSkip to conversation

gpu/nouveau/nouveau_acpi.c: Fix Type Mismatch ACPI warning

PATCH In review Marcos Paulo de Souza 3 participants 4 messages May 19, 2016 – May 22, 2016 2 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpu/nouveau/nouveau_acpi.c: Fix Type Mismatch ACPI warning

nouveau_optimus_dsm is using ACPI_TYPE_BUFFER, and this triggers warnings on ACPI:

[    7.730564] ACPI: \_SB_.PCI0.RP05.PEGP: failed to evaluate _DSM
[    7.730570] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (201509    30/nsarguments-95)

To fix it, change ACPI_TYPE_BUFFER to ACPI_TYPE_PACKAGE, as the warning tells to do.

---

After booting my Asus Laptop, and after a suspend/resume too, dmesg shows warnings:

[    1.633361] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[    1.633434] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[    7.730176] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[    7.730564] ACPI: \_SB_.PCI0.RP05.PEGP: failed to evaluate _DSM
[    7.730570] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[   49.732059] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[   49.732424] ACPI: \_SB_.PCI0.RP05.PEGP: failed to evaluate _DSM
[   49.732430] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[   74.366300] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[   74.366657] ACPI: \_SB_.PCI0.RP05.PEGP: failed to evaluate _DSM
[   74.366663] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[  140.357789] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[  140.358532] ACPI: \_SB_.PCI0.RP05.PEGP: failed to evaluate _DSM
[  140.358547] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)

I don't know if this is the right thing to do, I just looked at intel_acpi.c to check how to use/check for ACPI Package. The patch below silenced the "type mismatch" warnings, and some of the "evaluated _DSM" ones.

If this is not the right approach, please let me know how to fix it, I don't have knowledge in ACPI, but I really want to help.

 drivers/gpu/drm/nouveau/nouveau_acpi.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/gpu/drm/nouveau/nouveau_acpi.c +1 -13
index cdf5227..f04aef3 100644
@@ -73,22 +73,10 @@ static const char nouveau_op_dsm_muid[] = {
 
 static int nouveau_optimus_dsm(acpi_handle handle, int func, int arg, uint32_t *result)
 {
-	int i;
 	union acpi_object *obj;
-	char args_buff[4];
-	union acpi_object argv4 = {
-		.buffer.type = ACPI_TYPE_BUFFER,
-		.buffer.length = 4,
-		.buffer.pointer = args_buff
-	};
-
-	/* ACPI is little endian, AABBCCDD becomes {DD,CC,BB,AA} */
-	for (i = 0; i < 4; i++)
-		args_buff[i] = (arg >> i * 8) & 0xFF;
-
 	*result = 0;
 	obj = acpi_evaluate_dsm_typed(handle, nouveau_op_dsm_muid, 0x00000100,
-				      func, &argv4, ACPI_TYPE_BUFFER);
+				      func, NULL, ACPI_TYPE_PACKAGE);
 	if (!obj) {
 		acpi_handle_info(handle, "failed to evaluate _DSM\n");
 		return AE_ERROR;
Signature · 6 lines
2.5.5

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): 1463618578-5662-1-git-send-email-marcos.souza.org-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#2 lore raw

Hello Marcos,

I sent a serie a year ago to fix some of the ACPI handling in Nouveau and add runtime pm support for laptops with an Apple GMUX (see [0], and especially [1] and [2]). I was told that a more generic work for the runtime pm was in the work, so I let the whole serie slip away. I was thinking of resubmitting the serie without the runtime pm additions, to at least fix those warning/error messages. I thought I had a patch to fix this issue in my serie, but going through it again, it looks like I did not.
Note that even, though the spec says the 4th argument should be a package, some old BIOSes expect a different type, like a buffer (see the comment above [5]; I think there was also a comment about it in the spec, but I can’t find it anymore).

I added some comments below. I’ll test this patch tonight, to see how it works on my laptop as I think it expects a buffer as 4th argument.

Thank you!

Regards,
Pierre

[0]: https://lists.freedesktop.org/archives/dri-devel/2015-May/083444.html
[1]: https://lists.freedesktop.org/archives/dri-devel/2015-May/083448.html
[2]: https://lists.freedesktop.org/archives/dri-devel/2015-May/083449.html

Quoted 10 lines · Marcos Paulo de Souza

nouveau_optimus_dsm is using ACPI_TYPE_BUFFER, and this triggers warnings on ACPI:

[    7.730564] ACPI: \_SB_.PCI0.RP05.PEGP: failed to evaluate _DSM
[    7.730570] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (201509    30/nsarguments-95)

To fix it, change ACPI_TYPE_BUFFER to ACPI_TYPE_PACKAGE, as the warning tells to do.

---

After booting my Asus Laptop, and after a suspend/resume too, dmesg shows warnings:

Quoted 14 lines
[    1.633361] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[    1.633434] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[    7.730176] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[    7.730564] ACPI: \_SB_.PCI0.RP05.PEGP: failed to evaluate _DSM
[    7.730570] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[   49.732059] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[   49.732424] ACPI: \_SB_.PCI0.RP05.PEGP: failed to evaluate _DSM
[   49.732430] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[   74.366300] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[   74.366657] ACPI: \_SB_.PCI0.RP05.PEGP: failed to evaluate _DSM
[   74.366663] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[  140.357789] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)
[  140.358532] ACPI: \_SB_.PCI0.RP05.PEGP: failed to evaluate _DSM
[  140.358547] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)

Out of curiosity, which GPU(s) do you have in your laptop? I guess there is at least an NVIDIA one, but is it an Optimus configuration? And if so, does the unused card go automatically to sleep after a few seconds?

Quoted 24 lines

I don't know if this is the right thing to do, I just looked at intel_acpi.c to check how to use/check for ACPI Package. The patch below silenced the "type mismatch" warnings, and some of the "evaluated _DSM" ones.

If this is not the right approach, please let me know how to fix it, I don't have knowledge in ACPI, but I really want to help.

 drivers/gpu/drm/nouveau/nouveau_acpi.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/gpu/drm/nouveau/nouveau_acpi.c +0 -6
index cdf5227..f04aef3 100644
@@ -73,22 +73,10 @@ static const char nouveau_op_dsm_muid[] = {
 
 static int nouveau_optimus_dsm(acpi_handle handle, int func, int arg, uint32_t *result)
 {
-	int i;
 	union acpi_object *obj;
-	char args_buff[4];
-	union acpi_object argv4 = {
-		.buffer.type = ACPI_TYPE_BUFFER,
-		.buffer.length = 4,
-		.buffer.pointer = args_buff

drivers/gpu/drm/nouveau/nouveau_acpi.c static const char nouveau_op_dsm_muid[] = { · line 79

Quoted 10 lines
drivers/gpu/drm/nouveau/nouveau_acpi.c +1 -7
-	};
-
-	/* ACPI is little endian, AABBCCDD becomes {DD,CC,BB,AA} */
-	for (i = 0; i < 4; i++)
-		args_buff[i] = (arg >> i * 8) & 0xFF;
-
 	*result = 0;
 	obj = acpi_evaluate_dsm_typed(handle, nouveau_op_dsm_muid, 0x00000100,
-				      func, &argv4, ACPI_TYPE_BUFFER);
+				      func, NULL, ACPI_TYPE_PACKAGE);

The last parameter you give to acpi_evaluate_dsm_typed() is the return type you expect (see [3]), which will be a buffer if func is 0, and is implementation dependent otherwise (see section 9.14.1 _DSM of [4]). So you don’t want to change it to ACPI_TYPE_PACKAGE. If you look at the implementation of acpi_evaluate_dsm() (which is called by acpi_evaluate_dsm_typed()), it will automatically create a package for the 4th argument, if you pass it a NULL pointer (see [5]).

[3]: https://github.com/torvalds/linux/blob/46c13450624e36302547a2ac3695f2350fe7ffc3/include/acpi/acpi_bus.h#L69
[4]: http://www.acpi.info/DOWNLOADS/ACPI_5_Errata%20A.pdf
[5]: https://github.com/torvalds/linux/blob/46c13450624e36302547a2ac3695f2350fe7ffc3/drivers/acpi/utils.c#L628

Quoted 10 lines
drivers/gpu/drm/nouveau/nouveau_acpi.c +0 -0
 	if (!obj) {
 		acpi_handle_info(handle, "failed to evaluate _DSM\n");
 		return AE_ERROR;
Signature · 6 lines
2.5.5

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

#3 lore raw

Hi Pierre,

Em qui, 19 de mai de 2016 às 06:49, Pierre Moreau <[email protected]> escreveu:

Quoted 19 lines

Hello Marcos,

I sent a serie a year ago to fix some of the ACPI handling in Nouveau and add
runtime pm support for laptops with an Apple GMUX (see [0], and especially
[1]
and [2]). I was told that a more generic work for the runtime pm was in the work, so I let the whole serie slip away. I was thinking of resubmitting the
serie without the runtime pm additions, to at least fix those warning/error messages. I thought I had a patch to fix this issue in my serie, but going through it again, it looks like I did not.
Note that even, though the spec says the 4th argument should be a package, some
old BIOSes expect a different type, like a buffer (see the comment above [5]; I
think there was also a comment about it in the spec, but I can’t find it anymore).

Quoted 4 lines

I added some comments below. I’ll test this patch tonight, to see how it works
on my laptop as I think it expects a buffer as 4th argument.

Good, I'm learning a lot here. I'm reading all links you pasted here.

Quoted 50 lines

Thank you!

Regards,
Pierre

[0]: https://lists.freedesktop.org/archives/dri-devel/2015-May/083444.html
[1]: https://lists.freedesktop.org/archives/dri-devel/2015-May/083448.html
[2]: https://lists.freedesktop.org/archives/dri-devel/2015-May/083449.html

Quoted 1 line · Marcos Paulo de Souza

nouveau_optimus_dsm is using ACPI_TYPE_BUFFER, and this triggers

warnings on ACPI:

Quoted 2 lines
[    7.730564] ACPI: \_SB_.PCI0.RP05.PEGP: failed to evaluate _DSM
[    7.730570] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type

mismatch - Found [Buffer], ACPI requires [Package] (201509 30/nsarguments-95)

Quoted 2 lines

To fix it, change ACPI_TYPE_BUFFER to ACPI_TYPE_PACKAGE, as the warning

tells to do.

Quoted 5 lines

---

After booting my Asus Laptop, and after a suspend/resume too, dmesg

shows warnings:

Quoted 1 line
[    1.633361] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type

mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)

Quoted 1 line
[    1.633434] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type

mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)

Quoted 1 line
[    7.730176] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type

mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)

Quoted 2 lines
[    7.730564] ACPI: \_SB_.PCI0.RP05.PEGP: failed to evaluate _DSM
[    7.730570] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type

mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)

Quoted 1 line
[   49.732059] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type

mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)

Quoted 2 lines
[   49.732424] ACPI: \_SB_.PCI0.RP05.PEGP: failed to evaluate _DSM
[   49.732430] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type

mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)

Quoted 1 line
[   74.366300] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type

mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)

Quoted 2 lines
[   74.366657] ACPI: \_SB_.PCI0.RP05.PEGP: failed to evaluate _DSM
[   74.366663] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type

mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)

Quoted 1 line
[  140.357789] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type

mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)

Quoted 2 lines
[  140.358532] ACPI: \_SB_.PCI0.RP05.PEGP: failed to evaluate _DSM
[  140.358547] ACPI Warning: \_SB_.PCI0.RP05.PEGP._DSM: Argument #4 type
Quoted 8 lines

mismatch - Found [Buffer], ACPI requires [Package] (20150930/nsarguments-95)

Out of curiosity, which GPU(s) do you have in your laptop? I guess there is at
least an NVIDIA one, but is it an Optimus configuration? And if so, does the
unused card go automatically to sleep after a few seconds?

I have an Asus laptop with a NVD7 (GF117) Fermi card, and a Haswell onboard graphic card. About the automatic sleep, I really don't don't know, I'm just seeing these messages :)

Quoted 54 lines
Quoted 3 lines

I don't know if this is the right thing to do, I just looked at

intel_acpi.c to check how to use/check for ACPI Package.

Quoted 1 line

The patch below silenced the "type mismatch" warnings, and some of the

"evaluated _DSM" ones.

Quoted 2 lines

If this is not the right approach, please let me know how to fix it, I

don't have knowledge in ACPI, but I really want to help.

Review

Quoted 5 lines
 drivers/gpu/drm/nouveau/nouveau_acpi.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/nouveau/nouveau_acpi.c

drivers/gpu/drm/nouveau/nouveau_acpi.c static const char nouveau_op_dsm_muid[] = { · line 74

Quoted 6 lines

index cdf5227..f04aef3 100644

drivers/gpu/drm/nouveau/nouveau_acpi.c +0 -0
@@ -73,22 +73,10 @@ static const char nouveau_op_dsm_muid[] = {
 
 static int nouveau_optimus_dsm(acpi_handle handle, int func, int arg,

uint32_t *result)

Quoted 6 lines
drivers/gpu/drm/nouveau/nouveau_acpi.c +0 -4
 {
-     int i;
      union acpi_object *obj;
-     char args_buff[4];
-     union acpi_object argv4 = {
-             .buffer.type = ACPI_TYPE_BUFFER,

drivers/gpu/drm/nouveau/nouveau_acpi.c static const char nouveau_op_dsm_muid[] = {

Quoted 10 lines
drivers/gpu/drm/nouveau/nouveau_acpi.c +0 -8
-             .buffer.length = 4,
-             .buffer.pointer = args_buff
-     };
-
-     /* ACPI is little endian, AABBCCDD becomes {DD,CC,BB,AA} */
-     for (i = 0; i < 4; i++)
-             args_buff[i] = (arg >> i * 8) & 0xFF;
-
      *result = 0;
      obj = acpi_evaluate_dsm_typed(handle, nouveau_op_dsm_muid,

0x00000100,

drivers/gpu/drm/nouveau/nouveau_acpi.c static const char nouveau_op_dsm_muid[] = { · line 79

Quoted 2 lines
drivers/gpu/drm/nouveau/nouveau_acpi.c +1 -1
-                                   func, &argv4, ACPI_TYPE_BUFFER);
+                                   func, NULL, ACPI_TYPE_PACKAGE);

The last parameter you give to acpi_evaluate_dsm_typed() is the return type
you expect (see [3]), which will be a buffer if func is 0, and is implementation dependent otherwise (see section 9.14.1 _DSM of [4]). So you don’t want to change it to ACPI_TYPE_PACKAGE. If you look at the implementation
of acpi_evaluate_dsm() (which is called by acpi_evaluate_dsm_typed()), it
will automatically create a package for the 4th argument, if you pass it a NULL
pointer (see [5]).

Quoted 5 lines

[3]:
https://github.com/torvalds/linux/blob/46c13450624e36302547a2ac3695f2350fe7ffc3/include/acpi/acpi_bus.h#L69
[4]: http://www.acpi.info/DOWNLOADS/ACPI_5_Errata%20A.pdf
[5]:
https://github.com/torvalds/linux/blob/46c13450624e36302547a2ac3695f2350fe7ffc3/drivers/acpi/utils.c#L628

Thanks for all the links. I'll read the docs and send a new version of the patch when it makes more sense instead of just replacing random things.

Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/nouveau/nouveau_acpi.c +0 -1
      if (!obj) {
              acpi_handle_info(handle, "failed to evaluate _DSM\n");
              return AE_ERROR;
--

2.5.5

Quoted 5 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): CAH0vN5+s8CGjTwW_W7Z-AC9ZMsq7GqygYtCbEkL2+9y3DhJWAw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#5 lore raw

On Fri, May 20, 2016 at 02:22:57AM +0000, Marcos Souza wrote:
[..]

Quoted 37 lines
Quoted 37 lines
Quoted 1 line

I don't know if this is the right thing to do, I just looked at

intel_acpi.c to check how to use/check for ACPI Package.

Quoted 1 line

The patch below silenced the "type mismatch" warnings, and some of the

"evaluated _DSM" ones.

Quoted 2 lines

If this is not the right approach, please let me know how to fix it, I

don't have knowledge in ACPI, but I really want to help.

Review

Quoted 5 lines
 drivers/gpu/drm/nouveau/nouveau_acpi.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/nouveau/nouveau_acpi.c

drivers/gpu/drm/nouveau/nouveau_acpi.c static const char nouveau_op_dsm_muid[] = { · line 74

Quoted 6 lines

index cdf5227..f04aef3 100644

drivers/gpu/drm/nouveau/nouveau_acpi.c +0 -0
@@ -73,22 +73,10 @@ static const char nouveau_op_dsm_muid[] = {
 
 static int nouveau_optimus_dsm(acpi_handle handle, int func, int arg,

uint32_t *result)

Quoted 6 lines
drivers/gpu/drm/nouveau/nouveau_acpi.c +0 -4
 {
-     int i;
      union acpi_object *obj;
-     char args_buff[4];
-     union acpi_object argv4 = {
-             .buffer.type = ACPI_TYPE_BUFFER,

drivers/gpu/drm/nouveau/nouveau_acpi.c static const char nouveau_op_dsm_muid[] = {

Quoted 10 lines
drivers/gpu/drm/nouveau/nouveau_acpi.c +0 -8
-             .buffer.length = 4,
-             .buffer.pointer = args_buff
-     };
-
-     /* ACPI is little endian, AABBCCDD becomes {DD,CC,BB,AA} */
-     for (i = 0; i < 4; i++)
-             args_buff[i] = (arg >> i * 8) & 0xFF;
-
      *result = 0;
      obj = acpi_evaluate_dsm_typed(handle, nouveau_op_dsm_muid,

0x00000100,

Quoted 2 lines
Quoted 2 lines

drivers/gpu/drm/nouveau/nouveau_acpi.c static const char nouveau_op_dsm_muid[] = { · line 79

Quoted 2 lines
drivers/gpu/drm/nouveau/nouveau_acpi.c +1 -1
-                                   func, &argv4, ACPI_TYPE_BUFFER);
+                                   func, NULL, ACPI_TYPE_PACKAGE);

This effectively removes the fourth parameter (actually, using a zero as fourth argument), making the function useless.

Quoted 19 lines
Quoted 12 lines

The last parameter you give to acpi_evaluate_dsm_typed() is the return type
you expect (see [3]), which will be a buffer if func is 0, and is implementation dependent otherwise (see section 9.14.1 _DSM of [4]). So you don’t want to change it to ACPI_TYPE_PACKAGE. If you look at the implementation
of acpi_evaluate_dsm() (which is called by acpi_evaluate_dsm_typed()), it
will automatically create a package for the 4th argument, if you pass it a NULL
pointer (see [5]).

Quoted 5 lines

[3]:
https://github.com/torvalds/linux/blob/46c13450624e36302547a2ac3695f2350fe7ffc3/include/acpi/acpi_bus.h#L69
[4]: http://www.acpi.info/DOWNLOADS/ACPI_5_Errata%20A.pdf
[5]:
https://github.com/torvalds/linux/blob/46c13450624e36302547a2ac3695f2350fe7ffc3/drivers/acpi/utils.c#L628

Quoted 2 lines

Thanks for all the links. I'll read the docs and send a new version of the patch when it makes more sense instead of just replacing random things.

The warning is unavoidable, most firmware expect a Buffer for the fourth argument (counting from 0, this is Arg3). Excerpt from the DSM method on a recent Skylake laptop (Clevo P651, but this format is found on many other models from various manufacturers too):

    If ((Arg2 == 0x1A))
    {
        CreateField (Arg3, 0x18, 0x02, OMPR)
        CreateField (Arg3, Zero, One, FLCH)
        CreateField (Arg3, One, One, DVSR)
        CreateField (Arg3, 0x02, One, DVSC)

(The sections below refer to the one in the ACPI 6.1 document that can be found at http://uefi.org/specifications.)

The first parameter for CreateField is evaluated as buffer (sec 19.6.21). According to 19.3.5.6 (Data Types and Type Conversions) an implicit conversion to a Buffer is only possible from an Integer and String, a Package does not belong to the possibilities.

Note that the return value may be an integer for unsupported revision IDs or UUIDs (like 0x80000002). These should be compatible with Buffers though as stated above and acpi_check_dsm() can handle that case, but unfortunately sets a Package as fourth argument and can therefore not be used in nouveau.

Signature · 7 lines
Kind regards,
Peter Wu
https://lekensteyn.nl
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau