Skip to contentSkip to conversation

gigabyte-wmi: smbus over wmi?

DISCUSSION Jan Kneschke 2 participants 2 messages Apr 27, 2021 x86 platform drivers

lore
Share & tools
lore
#0 lore raw

Hi,

the new gigabyte-wmi driver only works only for a subset of current boards.

For boards with two ITE chips like the X570 AORUS ULTRA the corresponding functions on the WMBB method are just not handled:

...
ElseIf (((Arg1 >= 0x0118) && (Arg1 <= 0x0121))) {} // GET_TEMP is 0x125.
ElseIf ((Arg1 == 0x012C)) {}
...

One way to handle other gigabyte boards may be using the smbus functions that are exposed through ACPI:

$ sudo cat /sys/bus/wmi/drivers/wmi-bmof/05901221-D566-11D1-B2F0-00A0C9062910/bmof | bmf2mof

...
[WmiMethodId(98)] void SMBQuickWrite([in] uint8 bus, [in] uint8 addr,
[out] GSA1_ret32 ret);
[WmiMethodId(99)] void SMBQuickRead([in] uint8 bus, [in] uint8 addr,
[out] GSA1_ret32 ret);
[WmiMethodId(100)] void SMBIoBaseAddr([out] uint16 data); [WmiMethodId(101)] void SMBSendByte([in] uint8 bus, [in] uint8 addr,
[in] uint8 data, [out] GSA1_ret32 ret);
[WmiMethodId(102)] void SMBReceiveByte([in] uint8 bus, [in] uint8
addr, [out] GSA1_ret32 ret);
[WmiMethodId(103)] void SMBWriteByte([in] uint8 bus, [in] uint8 addr,
[in] uint8 cmd, [in] uint8 data, [out] GSA1_ret32 ret);
[WmiMethodId(104)] void SMBReadByte([in] uint8 bus, [in] uint8 addr,
[in] uint8 cmd, [out] GSA1_ret32 ret);
[WmiMethodId(105)] void SMBWriteWord([in] uint8 bus, [in] uint8 addr,
[in] uint8 cmd, [in] uint16 data, [out] GSA1_ret32 ret);
[WmiMethodId(106)] void SMBReadWord([in] uint8 bus, [in] uint8 addr,
[in] uint8 cmd, [out] GSA1_ret32 ret);
[WmiMethodId(107)] void SMBBlockWrite([in] uint8 bus, [in] uint8
addr, [in] uint8 cmd, [in] uint8 data[260], [out] GSA1_ret32 ret);
[WmiMethodId(108)] void SMBBlockRead([in] uint8 bus, [in] uint8 addr,
[in] uint8 cmd, [out] GSA1_Buff260 ret);
[WmiMethodId(109)] void SMBBlockWriteE32B([in] uint8 bus, [in] uint8
addr, [in] uint8 cmd, [in] uint8 data[260], [out] GSA1_ret32 ret);
...

This time, those methods are wired up in WMBB:

  ElseIf (((Arg1 >= 0x62) && (Arg1 <= 0x6D))) {
    ...
    if (Arg1 == 0x67) { ... SMM2(...); }
    ...
  }

SMM2(bus, addr, ret) locks a mutex SMMB|SMME, calls SMB2(bus, addr, ret) to call the low-level, unlocked smbus_write_byte().

// bus==0x02
Mutex (SMMB, 0x00)
OperationRegion (SMBI, SystemIO, 0x0B00, 0x10)

// bus==0x03
Mutex (SMME, 0x00)
OperationRegion (SMG0, SystemIO, 0x0B20, 0x20)

The same pattern repeats for the other smbus methods.

It looks like this should be enough to expose the smbus as /dev/i2c-* which calls those WMI functions.

From there the it87 should be able take over the rest.

Has that been done for other drivers yet? Is that even reasonable?

Bonus:

There are also methods exposed for:

- MEM(Read|Write)(8|16|32)
- PCI(Read|Write)(8|16|32)
- PIO(Read|Write)(8|16|32)

if that's needed for the it87 driver.

regards,
Jan

#1 lore raw
Quoted 8 lines · Jan Kneschke

Hi,

the new gigabyte-wmi driver only works only for a subset of current boards.

For boards with two ITE chips like the X570 AORUS ULTRA the corresponding functions on the WMBB method are just not handled:

Quoted 9 lines

...
ElseIf (((Arg1 >= 0x0118) && (Arg1 <= 0x0121))) {} // GET_TEMP is 0x125.
ElseIf ((Arg1 == 0x012C)) {}
...

One way to handle other gigabyte boards may be using the smbus functions that are exposed through ACPI:

The ITE chips are not connected to the system using SMBus. They are connected through the LPC bus.

Guenter