Skip to contentSkip to conversation

docs: i2c: piix4: Add ACPI section

PATCH Superseded Konstantin Aladyshev 4 participants 9 messages Nov 11, 2024 – Nov 14, 2024

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

PATCH 1/1 docs: i2c: piix4: Add ACPI section

Provide information how to reference I2C busses created by the PIIX4 chip driver from the ACPI code.

---
 Documentation/i2c/busses/i2c-piix4.rst | 56 ++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)
Documentation/i2c/busses/i2c-piix4.rst +56 -0
index 07fe6f6f4b18..2a00158b508a 100644
@@ -109,3 +109,59 @@ which can easily get corrupted due to a state machine bug. These are mostly
 Thinkpad laptops, but desktop systems may also be affected. We have no list
 of all affected systems, so the only safe solution was to prevent access to
 the SMBus on all IBM systems (detected using DMI data.)
+
+
+Description in the ACPI code
+----------------------------
+
+Device driver for the PIIX4 chip creates a separate I2C bus for each of its ports::
+
+    $ i2cdetect -l
+    ...
+    i2c-7   unknown         SMBus PIIX4 adapter port 0 at 0b00      N/A
+    i2c-8   unknown         SMBus PIIX4 adapter port 2 at 0b00      N/A
+    i2c-9   unknown         SMBus PIIX4 adapter port 1 at 0b20      N/A
+    ...
+
+Therefore if you want to access one of these busses in the ACPI code, you need to
+declare port subdevices inside the PIIX device::
+
+    Scope (\_SB_.PCI0.SMBS)
+    {
+        Name (_ADR, 0x00140000)
+
+        Device (SMB0) {
+            Name (_ADR, 0)
+        }
+        Device (SMB1) {
+            Name (_ADR, 1)
+        }
+        Device (SMB2) {
+            Name (_ADR, 2)
+        }
+    }
+
+As an example of usage here is the ACPI snippet code that would assign jc42 driver
+to the 0x1C device on the I2C bus created by the PIIX port 0::
+
+    Device (JC42) {
+        Name (_HID, "PRP0001")
+        Name (_DDN, "JC42 Temperature sensor")
+        Name (_CRS, ResourceTemplate () {
+            I2cSerialBusV2 (
+                0x001c,
+                ControllerInitiated,
+                100000,
+                AddressingMode7Bit,
+                "\\_SB.PCI0.SMBS.SMB0",
+                0
+            )
+        })
+
+        Name (_DSD, Package () {
+            ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
+            Package () {
+                Package () { "compatible", Package() { "jedec,jc-42.4-temp" } },
+            }
+        })
+    }
Signature · 1 line
2.43.0
#1 lore raw
Quoted 2 lines · Konstantin Aladyshev

Provide information how to reference I2C busses created by the PIIX4 chip driver from the ACPI code.

...

Quoted 7 lines
Documentation/i2c/busses/i2c-piix4.rst +7 -0
+Therefore if you want to access one of these busses in the ACPI code, you need to
+declare port subdevices inside the PIIX device::
+
+    Scope (\_SB_.PCI0.SMBS)
+    {
+        Name (_ADR, 0x00140000)
+

Documentation/i2c/busses/i2c-piix4.rst which can easily get corrupted due to a state machine bug. These are mostly · line 142

Quoted 10 lines
Documentation/i2c/busses/i2c-piix4.rst +10 -0
+        Device (SMB0) {
+            Name (_ADR, 0)
+        }
+        Device (SMB1) {
+            Name (_ADR, 1)
+        }
+        Device (SMB2) {
+            Name (_ADR, 2)
+        }
+    }

You need to elaborate that some of this data may be already present in the BIOS DSDT (you give your example as it seems most common so far) and hence requires an additional per-port addresses. With that you should add a note that this will require to load SSDT quite in advance to make sure that the driver will see these changes before its ->probe().

...

The rest is LGTM.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw
Quoted 3 lines · Andy Shevchenko
Quoted 2 lines · Konstantin Aladyshev

Provide information how to reference I2C busses created by the PIIX4 chip driver from the ACPI code.

...

Quoted 24 lines
Quoted 7 lines
Documentation/i2c/busses/i2c-piix4.rst +7 -0
+Therefore if you want to access one of these busses in the ACPI code, you need to
+declare port subdevices inside the PIIX device::
+
+    Scope (\_SB_.PCI0.SMBS)
+    {
+        Name (_ADR, 0x00140000)
+

Documentation/i2c/busses/i2c-piix4.rst which can easily get corrupted due to a state machine bug. These are mostly · line 142

Quoted 10 lines
Documentation/i2c/busses/i2c-piix4.rst +10 -0
+        Device (SMB0) {
+            Name (_ADR, 0)
+        }
+        Device (SMB1) {
+            Name (_ADR, 1)
+        }
+        Device (SMB2) {
+            Name (_ADR, 2)
+        }
+    }

You need to elaborate that some of this data may be already present in the BIOS DSDT (you give your example as it seems most common so far) and hence requires an additional per-port addresses. With that you should add a note that this will require to load SSDT quite in advance to make sure that the driver will see these changes before its ->probe().

Quoted 3 lines

...

The rest is LGTM.

Also Cc new version to Andi Shyti who is I2C host driver maintainer. It's probably he who is going to apply the change.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw

PATCH v2 1/1 docs: i2c: piix4: Add ACPI section

In reply to Andy Shevchenko

Provide information how to reference I2C busses created by the PIIX4 chip driver from the ACPI code.

---
 Documentation/i2c/busses/i2c-piix4.rst | 62 ++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)
Documentation/i2c/busses/i2c-piix4.rst +62 -0
index 07fe6f6f4b18..90447dff7419 100644
@@ -109,3 +109,65 @@ which can easily get corrupted due to a state machine bug. These are mostly
 Thinkpad laptops, but desktop systems may also be affected. We have no list
 of all affected systems, so the only safe solution was to prevent access to
 the SMBus on all IBM systems (detected using DMI data.)
+
+
+Description in the ACPI code
+----------------------------
+
+Device driver for the PIIX4 chip creates a separate I2C bus for each of its ports::
+
+    $ i2cdetect -l
+    ...
+    i2c-7   unknown         SMBus PIIX4 adapter port 0 at 0b00      N/A
+    i2c-8   unknown         SMBus PIIX4 adapter port 2 at 0b00      N/A
+    i2c-9   unknown         SMBus PIIX4 adapter port 1 at 0b20      N/A
+    ...
+
+Therefore if you want to access one of these busses in the ACPI code, port subdevices
+are needed to be declared inside the PIIX device::
+
+    Scope (\_SB_.PCI0.SMBS)
+    {
+        Name (_ADR, 0x00140000)
+
+        Device (SMB0) {
+            Name (_ADR, 0)
+        }
+        Device (SMB1) {
+            Name (_ADR, 1)
+        }
+        Device (SMB2) {
+            Name (_ADR, 2)
+        }
+    }
+
+If it is not the case for your UEFI firmware and you don't have access to the source
+code, you can use ACPI SSDT Overlays to provide the missing parts. Just keep in mind
+that in this case you would need to load your extra SSDT table before the piix4 driver
+start, i.e. you should provide SSDT via initrd or EFI variable methods and not via
+configfs.
+
+As an example of usage here is the ACPI snippet code that would assign jc42 driver
+to the 0x1C device on the I2C bus created by the PIIX port 0::
+
+    Device (JC42) {
+        Name (_HID, "PRP0001")
+        Name (_DDN, "JC42 Temperature sensor")
+        Name (_CRS, ResourceTemplate () {
+            I2cSerialBusV2 (
+                0x001c,
+                ControllerInitiated,
+                100000,
+                AddressingMode7Bit,
+                "\\_SB.PCI0.SMBS.SMB0",
+                0
+            )
+        })
+
+        Name (_DSD, Package () {
+            ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
+            Package () {
+                Package () { "compatible", Package() { "jedec,jc-42.4-temp" } },
+            }
+        })
+    }
Signature · 1 line
2.43.0
Reviewed-by on v2 1/1
#4 lore raw

+Cc: Andi

Quoted 2 lines · Konstantin Aladyshev

Provide information how to reference I2C busses created by the PIIX4 chip driver from the ACPI code.

So, this is not ideal, but it's a good start so far.

We may amend this later on.

Thanks!

Quoted 2 lines

---

This place is for changelog and comments, if any. Since this is a v2 of a standalone patch, the changelog is good to have. No need to resend now, you can just reply to your original v2 with the missing changelog.

Quoted 2 lines
 Documentation/i2c/busses/i2c-piix4.rst | 62 ++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)
Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer
#5 lore raw
In reply to Konstantin Aladyshev

Hi Konstantin,

thanks for your driver, just few grammatical thoughts.

...

Quoted 1 line

+If it is not the case for your UEFI firmware and you don't have access to the source

Not a grammatical error, but it sounds a bit more linear:

/If it is not/If this is not/

Documentation/i2c/busses/i2c-piix4.rst which can easily get corrupted due to a state machine bug. These are mostly · line 147

Quoted 3 lines
Documentation/i2c/busses/i2c-piix4.rst +3 -0
+code, you can use ACPI SSDT Overlays to provide the missing parts. Just keep in mind
+that in this case you would need to load your extra SSDT table before the piix4 driver
+start, i.e. you should provide SSDT via initrd or EFI variable methods and not via

/start/starts/

If you agree, I would go ahead and merge this.

Andi

Quoted 1 line

+configfs.

Reviewed-by on v2 1/1
#6 lore raw
In reply to Konstantin Aladyshev
Quoted 60 lines · Konstantin Aladyshev
Documentation/i2c/busses/i2c-piix4.rst +52 -0
index 07fe6f6f4b18..90447dff7419 100644
@@ -109,3 +109,65 @@ which can easily get corrupted due to a state machine bug. These are mostly
 Thinkpad laptops, but desktop systems may also be affected. We have no list
 of all affected systems, so the only safe solution was to prevent access to
 the SMBus on all IBM systems (detected using DMI data.)
+
+
+Description in the ACPI code
+----------------------------
+
+Device driver for the PIIX4 chip creates a separate I2C bus for each of its ports::
+
+    $ i2cdetect -l
+    ...
+    i2c-7   unknown         SMBus PIIX4 adapter port 0 at 0b00      N/A
+    i2c-8   unknown         SMBus PIIX4 adapter port 2 at 0b00      N/A
+    i2c-9   unknown         SMBus PIIX4 adapter port 1 at 0b20      N/A
+    ...
+
+Therefore if you want to access one of these busses in the ACPI code, port subdevices
+are needed to be declared inside the PIIX device::
+
+    Scope (\_SB_.PCI0.SMBS)
+    {
+        Name (_ADR, 0x00140000)
+
+        Device (SMB0) {
+            Name (_ADR, 0)
+        }
+        Device (SMB1) {
+            Name (_ADR, 1)
+        }
+        Device (SMB2) {
+            Name (_ADR, 2)
+        }
+    }
+
+If it is not the case for your UEFI firmware and you don't have access to the source
+code, you can use ACPI SSDT Overlays to provide the missing parts. Just keep in mind
+that in this case you would need to load your extra SSDT table before the piix4 driver
+start, i.e. you should provide SSDT via initrd or EFI variable methods and not via
+configfs.
+
+As an example of usage here is the ACPI snippet code that would assign jc42 driver
+to the 0x1C device on the I2C bus created by the PIIX port 0::
+
+    Device (JC42) {
+        Name (_HID, "PRP0001")
+        Name (_DDN, "JC42 Temperature sensor")
+        Name (_CRS, ResourceTemplate () {
+            I2cSerialBusV2 (
+                0x001c,
+                ControllerInitiated,
+                100000,
+                AddressingMode7Bit,
+                "\\_SB.PCI0.SMBS.SMB0",
+                0

Documentation/i2c/busses/i2c-piix4.rst which can easily get corrupted due to a state machine bug. These are mostly · line 173

Quoted 10 lines
Documentation/i2c/busses/i2c-piix4.rst +10 -0
+            )
+        })
+
+        Name (_DSD, Package () {
+            ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
+            Package () {
+                Package () { "compatible", Package() { "jedec,jc-42.4-temp" } },
+            }
+        })
+    }

Looks good, thanks!

Signature · 1 line
An old man doll... just what I always wanted! - Clara
maintainer
#7 lore raw
In reply to Konstantin Aladyshev

Hi Konstantin,

Quoted 4 lines · Konstantin Aladyshev

Provide information how to reference I2C busses created by the PIIX4 chip driver from the ACPI code.

I merged the patch into i2c/i2c-host with the changes I suggested and I also wrapped the lines to 80 characters to keep a uniform style throughout the doc file.

Andi

#8 lore raw

Hi Andi!

Sorry, I just didn't have time to fix it yesterday. Of course I don't mind your changes. Thanks for the help!

Best regards,
Konstantin Aladyshev

Quoted 14 lines · Andi Shyti

Hi Konstantin,

Quoted 4 lines · Konstantin Aladyshev

Provide information how to reference I2C busses created by the PIIX4 chip driver from the ACPI code.

I merged the patch into i2c/i2c-host with the changes I suggested and I also wrapped the lines to 80 characters to keep a uniform style throughout the doc file.

Andi