Skip to contentSkip to conversation

type mismatch in SSDT

DISCUSSION Michael S. Tsirkin 2 participants 4 messages Oct 27, 2022 – Oct 31, 2022

lore
Share & tools
lore
#0 lore raw

Just noticed this when disassembling:

Parsing completed
ACPI Warning: NsLookup: Type mismatch on ODAT (RegionField), searching for (Buffer) (20210604/nsaccess-760) Disassembly completed
ASL Output: /tmp/old-asl2/tests/data/acpi/virt/SSDT.memhp.dsl - 14945 bytes

Did not look into this yet but it seems new.

Signature · 1 line
MST
#1 lore raw
Quoted 8 lines · On Thu, 27 Oct 2022 01:59:22 -0400 "Michael S. Tsirkin" <[email protected]> wrote:

Just noticed this when disassembling:

Parsing completed
ACPI Warning: NsLookup: Type mismatch on ODAT (RegionField), searching for (Buffer) (20210604/nsaccess-760) Disassembly completed
ASL Output: /tmp/old-asl2/tests/data/acpi/virt/SSDT.memhp.dsl - 14945 bytes

Did not look into this yet but it seems new.

It was there practically 'forever'.

ODAT should be treated as Buffer according to implicit Field/data conversion rules, that's probably the reason why it works. So warning looks a bit bogus to me.

however:
DefCreateByteField := CreateByteFieldOp SourceBuff ByteIndex NameString SourceBuff := TermArg => Buffer
TermArg := ExpressionOpcode | DataObject | ArgObj | LocalObj

and none of that explicitly leads to

TermObj := Object | StatementOpcode | ExpressionOpcode Object := NameSpaceModifierObj | NamedObj

So if we are to be as pedantic as IASL, we need to supply
field to CreateByteField not by name but via one of TermArg.
We could copy/assign whole buffer to a LocalObj
or summarily use ExpressionOpcode => ToBuffer() // this one has a bit controversial definition in 6.4 spec or to avoid any copying add 'useless' DerefOf(RefOf())
wrapper around name to make argument of ExpressionOpcode kind.

following should silence warning.

hw/acpi/nvdimm.c +1 -1
index 31e46df0bd..7488007540 100644
@@ -1127,7 +1127,7 @@ static void nvdimm_build_common_dsm(Aml *dev,
     /* If RLEN >= Integer size, just use CreateField() operator */
     aml_append(method, aml_store(aml_shiftleft(dsm_out_buf_size, aml_int(3)),
                                  dsm_out_buf_size));
-    aml_append(method, aml_create_field(aml_name(NVDIMM_DSM_OUT_BUF),
+    aml_append(method, aml_create_field(aml_derefof(aml_refof(aml_name(NVDIMM_DSM_OUT_BUF))),
                aml_int(0), dsm_out_buf_size, "OBUF"));
     aml_append(method, aml_return(aml_name("OBUF")));
 
#2 lore raw
Quoted 40 lines · Igor Mammedov
Quoted 8 lines · On Thu, 27 Oct 2022 01:59:22 -0400 "Michael S. Tsirkin" <[email protected]> wrote:

Just noticed this when disassembling:

Parsing completed
ACPI Warning: NsLookup: Type mismatch on ODAT (RegionField), searching for (Buffer) (20210604/nsaccess-760) Disassembly completed
ASL Output: /tmp/old-asl2/tests/data/acpi/virt/SSDT.memhp.dsl - 14945 bytes

Did not look into this yet but it seems new.

It was there practically 'forever'.

ODAT should be treated as Buffer according to implicit Field/data conversion rules, that's probably the reason why it works. So warning looks a bit bogus to me.

however:
DefCreateByteField := CreateByteFieldOp SourceBuff ByteIndex NameString SourceBuff := TermArg => Buffer
TermArg := ExpressionOpcode | DataObject | ArgObj | LocalObj

and none of that explicitly leads to

TermObj := Object | StatementOpcode | ExpressionOpcode Object := NameSpaceModifierObj | NamedObj

So if we are to be as pedantic as IASL, we need to supply
field to CreateByteField not by name but via one of TermArg.
We could copy/assign whole buffer to a LocalObj
or summarily use ExpressionOpcode => ToBuffer() // this one has a bit controversial definition in 6.4 spec or to avoid any copying add 'useless' DerefOf(RefOf())
wrapper around name to make argument of ExpressionOpcode kind.

following should silence warning.

hw/acpi/nvdimm.c +0 -0
index 31e46df0bd..7488007540 100644

hw/acpi/nvdimm.c static void nvdimm_build_common_dsm(Aml *dev, · line 1132

Quoted 7 lines
hw/acpi/nvdimm.c +1 -1
@@ -1127,7 +1127,7 @@ static void nvdimm_build_common_dsm(Aml *dev,
     /* If RLEN >= Integer size, just use CreateField() operator */
     aml_append(method, aml_store(aml_shiftleft(dsm_out_buf_size, aml_int(3)),
                                  dsm_out_buf_size));
-    aml_append(method, aml_create_field(aml_name(NVDIMM_DSM_OUT_BUF),
+    aml_append(method, aml_create_field(aml_derefof(aml_refof(aml_name(NVDIMM_DSM_OUT_BUF))),
                aml_int(0), dsm_out_buf_size, "OBUF"));
     aml_append(method, aml_return(aml_name("OBUF")));

Thanks! Let's try to raise this with ACPI committee?

Signature · 1 line
MST
#3 lore raw
Quoted 36 lines · On Thu, 27 Oct 2022 10:15:58 -0400 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 35 lines · Igor Mammedov
Quoted 8 lines · On Thu, 27 Oct 2022 01:59:22 -0400 "Michael S. Tsirkin" <[email protected]> wrote:

Just noticed this when disassembling:

Parsing completed
ACPI Warning: NsLookup: Type mismatch on ODAT (RegionField), searching for (Buffer) (20210604/nsaccess-760) Disassembly completed
ASL Output: /tmp/old-asl2/tests/data/acpi/virt/SSDT.memhp.dsl - 14945 bytes

Did not look into this yet but it seems new.

It was there practically 'forever'.

ODAT should be treated as Buffer according to implicit Field/data conversion rules, that's probably the reason why it works. So warning looks a bit bogus to me.

however:
DefCreateByteField := CreateByteFieldOp SourceBuff ByteIndex NameString SourceBuff := TermArg => Buffer
TermArg := ExpressionOpcode | DataObject | ArgObj | LocalObj

and none of that explicitly leads to

TermObj := Object | StatementOpcode | ExpressionOpcode Object := NameSpaceModifierObj | NamedObj

So if we are to be as pedantic as IASL, we need to supply
field to CreateByteField not by name but via one of TermArg.
We could copy/assign whole buffer to a LocalObj
or summarily use ExpressionOpcode => ToBuffer() // this one has a bit controversial definition in 6.4 spec or to avoid any copying add 'useless' DerefOf(RefOf())
wrapper around name to make argument of ExpressionOpcode kind.

following should silence warning.

Quoted 15 lines

hw/acpi/nvdimm.c static void nvdimm_build_common_dsm(Aml *dev, · line 1132

Quoted 12 lines
hw/acpi/nvdimm.c +1 -1
index 31e46df0bd..7488007540 100644
@@ -1127,7 +1127,7 @@ static void nvdimm_build_common_dsm(Aml *dev,
     /* If RLEN >= Integer size, just use CreateField() operator */
     aml_append(method, aml_store(aml_shiftleft(dsm_out_buf_size, aml_int(3)),
                                  dsm_out_buf_size));
-    aml_append(method, aml_create_field(aml_name(NVDIMM_DSM_OUT_BUF),
+    aml_append(method, aml_create_field(aml_derefof(aml_refof(aml_name(NVDIMM_DSM_OUT_BUF))),
                aml_int(0), dsm_out_buf_size, "OBUF"));
     aml_append(method, aml_return(aml_name("OBUF")));  

Thanks! Let's try to raise this with ACPI committee?

Do you have a contact there or know how to rise the issue?