On 26 April 2016 at 18:23, Bartosz Szczepanek bsz@semihalf.com wrote:
2016-04-26 17:43 GMT+02:00 Ard Biesheuvel ard.biesheuvel@linaro.org:
On 26 April 2016 at 17:37, Bartosz Szczepanek bsz@semihalf.com wrote:
Hello Ard,
the commit can be disregarded, as the change was already introduced by Leif since we forked (50e8d39 - ArmPlatformPkg/IntelBds: call BdsLibConnectAll()).
Anyway, I'll explain a bit more so as to address your concerns. In our case, the need to call BdsLibConnectAll() emerged with introduction of I2C and EEPROM drivers. MvI2cDxe implements EFI_I2C_BUS_CONFIGURATION_MANAGEMENT_PROTOCOL, EFI_I2C_MASTER_PROTOCOL and EFI_I2C_ENUMERATE_PROTOCOL, which are required by generic I2C stack. These protocols are installed on a new handle, which should be recognized in I2cHostDriverSupported() call. On bad, without BdsLibConnectAll() this function is not called for newly created handle, hence I2C stack attachment doesn't proceed.
I found no other way to handle that. Please let me know if you know better solution.
What kind of devices are on the I2C bus? And why do you need to access them during boot?
Currently there is EEPROM driver, which produces protocol required by 'eeprom' command we introduced. It's likely there will be other I2C devices added. So the I2C stack must be set up before user invokes given command from UEFI shell. Apart from that, there are no calls to EFI_I2C_IO_PROTOCOL during boot.
If you need BdsLibConnectAll(), it suggests that you are looking for a certain device path. The 'eeprom' command could connect that device path explicitly, or perform an equivalent of BdsLibConnectAll() if it needs (and in fact, the UEFI Shell connects all controllers as well). The only place where we don't want it is on the default boot path.
If you need I2C to implement architectural protocols rather than driver binding protocols, you should probably not be using the UEFI driver model in this case
We do not follow UEFI driver model in case of MvI2cDxe, driver binding protocol is not implemented. Protocols are installed at driver entry point (and these are only the ones required by I2C stack). Is there an alternative approach I am missing?
As I said, 'connect all' implies UEFI driver model. If you are using simple protocol dependencies, you should use depexes instead. But for a shell command like 'eeprom', it makes sense to find a way to only connect all the drivers if really needed.