- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
We are trying to write a small UEFI program to scan all available I2C busses and the devices in it.
We know the platform we are working on has at least 20 i2c busses (as confirmed from Linux).
However, when we try to achieve the same in UEFI environment, we are not able to see the busses that are beyond the I2C multiplexers.
Code snippet for your reference:
// Locate all the handles that support the SmbusHcProtocol
Status = gBS->LocateHandleBuffer(ByProtocol, &gEfiSmbusHcProtocolGuid, NULL, &NumHandles, &HandleBuffer);
if (EFI_ERROR(Status)) {
Print(L"Failed to locate SMBus handles\n");
return Status;
}
for (Index = 0; Index < NumHandles; Index++) {
Status = gBS->HandleProtocol(HandleBuffer[Index], &gEfiSmbusHcProtocolGuid, (VOID**)&SmbusProtocol);
if (EFI_ERROR(Status)) {
continue; // Skip if unable to get the protocol for this handle
}
// Attempt to read from each possible SMBus address to discover devices
for (SlaveAddress.SmbusDeviceAddress = 0x02; SlaveAddress.SmbusDeviceAddress < 0x7F; SlaveAddress.SmbusDeviceAddress++) {
Status = SmbusProtocol->Execute(
SmbusProtocol,
SlaveAddress,
0, // Unique command identifier (not used here)
SmbusOperation,
PecCheck,
&DataLength,
&DataBuffer
);
if (!EFI_ERROR(Status)) {
// Device found, print its address
Print(L"Device found at address 0x%X on Bus %d\n", SlaveAddress.SmbusDeviceAddress, Index);
}
}
}
if (HandleBuffer != NULL) {
FreePool(HandleBuffer);
}
return EFI_SUCCESS;
}
Output of the above program:
FS0:\tests\> smbusscan2.efi
Device found at address 0x44 on Bus 0
Device found at address 0x61 on Bus 0
Device found at address 0x68 on Bus 0
Device found at address 0x69 on Bus 0
Device found at address 0x6A on Bus 0
Device found at address 0x6C on Bus 0
Device found at address 0x6D on Bus 0
Device found at address 0x6F on Bus 0
Device found at address 0x72 on Bus 0
Device found at address 0x75 on Bus 0
FS0:\tests\>
All the above devices are from I2C bus 0 spawned from PCH.
However, we are not seeing other busses being detected.
From Linux:
root@ubuntu-22-04# ls /dev/i2c*
/dev/i2c-0 /dev/i2c-10 /dev/i2c-12 /dev/i2c-14 /dev/i2c-16 /dev/i2c-18 /dev/i2c-2 /dev/i2c-21 /dev/i2c-23 /dev/i2c-25 /dev/i2c-3 /dev/i2c-5 /dev/i2c-7 /dev/i2c-9
/dev/i2c-1 /dev/i2c-11 /dev/i2c-13 /dev/i2c-15 /dev/i2c-17 /dev/i2c-19 /dev/i2c-20 /dev/i2c-22 /dev/i2c-24 /dev/i2c-26 /dev/i2c-4 /dev/i2c-6 /dev/i2c-8
root@ubuntu-22-04#
Do we need special drivers to be loaded in order to detect other i2c-busses in uefi shell?
Thanks for your time.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi HarishSekar,
Thank you for reaching out to the Intel community. We apologize for any delay in our response.
We acknowledge receipt of your concern and want to assure you that assisting you is our top priority. To effectively troubleshoot the issue you're facing, we require some additional information from your end.
Could you kindly provide the following details?
- Please confirm which Intel product you are using.
- What is the intended purpose of this product?
Your prompt response with this information will greatly assist us in diagnosing and resolving the issue as quickly as possible.
We look forward to hearing from you soon.
Regards,
Simon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Simon,
Thanks for your response.
We can close this ticket as we are able to access the I2C devices after manually enabling the I2C muxes and its channels.
And for your query: We are using Emerald and Sapphire Rapid CPUs, and we are doing to enable few SMBus tests on UEFI environment.
Thanks for your time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello HarishSekar,
Thank you for your response. We will proceed with case closure.
Please don’t hesitate to contact us for any further assistance.
Regards,
Simon

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page