GMBUS never asserts HW_RDY during read
Posted: Mon Jun 13, 2022 4:51 am
I'm writing a driver for Intel HD Graphics (specifically, a HD Graphics 5500 from a HP EliteBook Folio 1040 G2). Right now I'm trying to get the EDID of my laptop's display but the GMBUS seems to get stuck while reading from some ports.
I'm trying to get the EDID as follows:
- Reset the GMBUS by asserting and deasserting bit 31 of GMBUS1 ("Software Clear Interrupt").
- Write either 0x2, 0x4, 0x5 or 0x6 to GMBUS0 (pin pair DAC DDC, DDIC, DDIB, DDID at 100KHz respectively).
- Write 0x468000a1 to GMBUS1 ("Software Ready", Bus cycle "Index, No Stop, Wait", 128 byte count, index 0, address 0x50, read).
- Wait for "Hardware Ready" or "Not Acknowledged".
I get the following values for each pin pair:
- DAC DDC: GMBUS2 reads 0x0800 after setting GMBUS0 ("Hardware Ready"), 0x8200 during read ("INUSE" and "GMBUS Active").
- DDIB: GMBUS2 reads 0x8c00 after setting GMBUS0 ("INUSE", "Hardware Ready" and "NAK Indicator"), same during read.
- DDIC: GMBUS2 reads 0x8000 after setting GMBUS0 ("INUSE"), 0x8c00 during read.
- DDID: GMBUS2 reads 0x8000 after setting GMBUS0, 0x8200 during read.
I would expect to read 0x8a00 ("INUSE", "Hardware Ready" and "GMBUS Active") at some point, though this is evidently not happening. Switching the order of each attempt on each pin doesn't seem to affect the results. Trying to write a byte first like in managarm's driver doesn't seem to do anything either.
You can find my current code here. It is based on:
- managarm's Intel Native Graphics driver
- Intel's GPU documentation for Broadwell chips
- The OSDev's wiki article on Intel HD Graphics
I'm trying to get the EDID as follows:
- Reset the GMBUS by asserting and deasserting bit 31 of GMBUS1 ("Software Clear Interrupt").
- Write either 0x2, 0x4, 0x5 or 0x6 to GMBUS0 (pin pair DAC DDC, DDIC, DDIB, DDID at 100KHz respectively).
- Write 0x468000a1 to GMBUS1 ("Software Ready", Bus cycle "Index, No Stop, Wait", 128 byte count, index 0, address 0x50, read).
- Wait for "Hardware Ready" or "Not Acknowledged".
I get the following values for each pin pair:
- DAC DDC: GMBUS2 reads 0x0800 after setting GMBUS0 ("Hardware Ready"), 0x8200 during read ("INUSE" and "GMBUS Active").
- DDIB: GMBUS2 reads 0x8c00 after setting GMBUS0 ("INUSE", "Hardware Ready" and "NAK Indicator"), same during read.
- DDIC: GMBUS2 reads 0x8000 after setting GMBUS0 ("INUSE"), 0x8c00 during read.
- DDID: GMBUS2 reads 0x8000 after setting GMBUS0, 0x8200 during read.
I would expect to read 0x8a00 ("INUSE", "Hardware Ready" and "GMBUS Active") at some point, though this is evidently not happening. Switching the order of each attempt on each pin doesn't seem to affect the results. Trying to write a byte first like in managarm's driver doesn't seem to do anything either.
You can find my current code here. It is based on:
- managarm's Intel Native Graphics driver
- Intel's GPU documentation for Broadwell chips
- The OSDev's wiki article on Intel HD Graphics