On 05/08/14 23:10, Piotr Król wrote:
> On Wed, May 07, 2014 at 10:22:06AM +0200, Paolo Bonzini wrote:
>>
>> What Laszlo said is correct.  In PIIX4, the SMBus registers are not in a 
>> BAR, instead you can read the base I/O address in the PCI configuration 
>> space of the device at 00:01.3, bytes 0x90...0x91 (bit 0 is 1 for I/O 
>> space).  Writing 0x9 at byte 0xd2 of the configuration space enables it, 
>> so from Linux you'd have:
>>
>>      $ setpci -s 01.3 0x90.w
>>      0xb101
>>
>> 0xb100 is the default, but it can be changed.
>>
>> Because they're not in a BAR you probably need to access them directly 
>> without using the PCI support in UEFI.  You can use PCI support routines 
>> to access the configuration space.
>>
> 
> Laszlo, Paolo,
> thank you for reply. I will try to implement UEFI application to read
> temperature sensor in OVMF. I saw some I2cDxe and I2c protocol code so
> will investigate that.

It doesn't seem easy.

>From a cursory look, the by-the-book solution would be:
- Write a driver that implements the following three protocols for the
  QEMU i2c hardware:

  - EFI_I2C_BUS_CONFIGURATION_MANAGEMENT_PROTOCOL
    MdePkg/Include/Protocol/I2cBusConfigurationManagement.h

  - EFI_I2C_MASTER_PROTOCOL
    MdePkg/Include/Protocol/I2cMaster.h

  - EFI_I2C_ENUMERATE_PROTOCOL
    MdePkg/Include/Protocol/I2cEnumerate.h

- Include this new driver in the OVMF build (DSC, FDF files).

- Include "MdeModulePkg/Bus/I2c/I2cDxe/I2cDxe.inf" too. What happens is

  EFI_I2C_BUS_CONFIGURATION_MANAGEMENT_PROTOCOL  EFI_I2C_MASTER_PROTOCOL
                                              \  /
        EFI_I2C_ENUMERATE_PROTOCOL  EFI_I2C_HOST_PROTOCOL (by I2cHost.c)
                                 \  /
                          EFI_I2C_IO_PROTOCOL (by I2cBus.c)

- Write an application that locates handles that have an
  EFI_I2C_IO_PROTOCOL interface, identifies the one device that you
  care about, and communicates with it.

It's probably much simpler to go for an app that accesses ports directly.

Laszlo

------------------------------------------------------------------------------
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
• 3 signs your SCM is hindering your productivity
• Requirements for releasing software faster
• Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to