fd9df33f | 07-Dec-2017 |
Corey Minyard <cminyard@mvista.com> |
i2c:smbus_eeprom: Add vmstate handling to the smbus eeprom
Transfer the state of the EEPROM on a migration. This way the data remains consistent on migration.
This required moving the actual data
i2c:smbus_eeprom: Add vmstate handling to the smbus eeprom
Transfer the state of the EEPROM on a migration. This way the data remains consistent on migration.
This required moving the actual data to a separate array and using the data provided in the init function as a separate initialization array, since a pointer property has to be a void * and the array needs to be uint8_t[].
Signed-off-by: Corey Minyard <cminyard@mvista.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Michael S. Tsirkin <mst@redhat.com> Cc: Dr. David Alan Gilbert <dgilbert@redhat.com> Cc: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
show more ...
|
0cf487e5 | 08-Nov-2018 |
Corey Minyard <cminyard@mvista.com> |
i2c:smbus_eeprom: Add a size constant for the smbus_eeprom size
It was hard-coded to 256 in a number of places, create a constant for that.
Signed-off-by: Corey Minyard <cminyard@mvista.com> Review
i2c:smbus_eeprom: Add a size constant for the smbus_eeprom size
It was hard-coded to 256 in a number of places, create a constant for that.
Signed-off-by: Corey Minyard <cminyard@mvista.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
show more ...
|
b398a924 | 08-Nov-2018 |
Corey Minyard <cminyard@mvista.com> |
i2c:smbus_eeprom: Add normal type name and cast to smbus_eeprom.c
Create a type name and a cast macro and use those through the code.
Signed-off-by: Corey Minyard <cminyard@mvista.com> Reviewed-by:
i2c:smbus_eeprom: Add normal type name and cast to smbus_eeprom.c
Create a type name and a cast macro and use those through the code.
Signed-off-by: Corey Minyard <cminyard@mvista.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
show more ...
|
547db24a | 07-Dec-2017 |
Corey Minyard <cminyard@mvista.com> |
i2c:smbus_slave: Add an SMBus vmstate structure
There is no vmstate handling for SMBus, so no device sitting on SMBus can have a state transfer that works reliably. So add it.
Signed-off-by: Corey
i2c:smbus_slave: Add an SMBus vmstate structure
There is no vmstate handling for SMBus, so no device sitting on SMBus can have a state transfer that works reliably. So add it.
Signed-off-by: Corey Minyard <cminyard@mvista.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Michael S. Tsirkin <mst@redhat.com> Cc: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
show more ...
|
52cc6a49 | 14-Nov-2018 |
Corey Minyard <cminyard@mvista.com> |
i2c:pm_smbus: Fix pm_smbus handling of I2C block read
The I2C block read function of pm_smbus was completely broken. It required doing some direct I2C handling because it didn't have a defined size
i2c:pm_smbus: Fix pm_smbus handling of I2C block read
The I2C block read function of pm_smbus was completely broken. It required doing some direct I2C handling because it didn't have a defined size, the OS code just reads bytes until it marks the transaction finished.
This also required adjusting how the AMIBIOS workaround code worked, the I2C block mode was setting STS_HOST_BUSY during a transaction, so that bit could no longer be used to inform the host status read code to start the transaction. Create a explicit bool for that operation.
Also, don't read the next byte from the device in byte-by-byte mode unless the OS is actually clearing the byte done bit. Just assuming that's what the OS is doing is a bad idea.
Signed-off-by: Corey Minyard <cminyard@mvista.com>
show more ...
|
031ac498 | 30-Nov-2018 |
Corey Minyard <cminyard@mvista.com> |
i2c:smbus: Simplify read handling
There were two different read functions, and with the removal of the command passed in there is no functional difference. So remove one of them. With that you don
i2c:smbus: Simplify read handling
There were two different read functions, and with the removal of the command passed in there is no functional difference. So remove one of them. With that you don't need one of the states, so that can be removed, too.
Signed-off-by: Corey Minyard <cminyard@mvista.com>
show more ...
|
9cf27d74 | 30-Nov-2018 |
Corey Minyard <cminyard@mvista.com> |
i2c:smbus: Simplify write operation
There were two different write functions and the SMBus code kept track of the command.
Keeping track of the command wasn't useful, in fact it wasn't quite correc
i2c:smbus: Simplify write operation
There were two different write functions and the SMBus code kept track of the command.
Keeping track of the command wasn't useful, in fact it wasn't quite correct for the eeprom_smbus code. And there is no need for two write functions. Just have one write function and the first byte in the buffer is the command.
Signed-off-by: Corey Minyard <cminyard@mvista.com>
show more ...
|
905cec6d | 30-Nov-2018 |
Corey Minyard <cminyard@mvista.com> |
i2c:smbus: Correct the working of quick commands
The logic of handling quick SMBus commands was wrong. If you get a finish event with no data, that's a quick command.
Document the quick command wh
i2c:smbus: Correct the working of quick commands
The logic of handling quick SMBus commands was wrong. If you get a finish event with no data, that's a quick command.
Document the quick command while we are at it.
Signed-off-by: Corey Minyard <cminyard@mvista.com>
show more ...
|
bc15cde0 | 20-Nov-2018 |
Corey Minyard <cminyard@mvista.com> |
i2c: Don't check return value from i2c_recv()
i2c_recv() cannot fail, so there is no need to check the return value. It also returns unt8_t, so comparing with < 0 is not meaningful.
Fix up various
i2c: Don't check return value from i2c_recv()
i2c_recv() cannot fail, so there is no need to check the return value. It also returns unt8_t, so comparing with < 0 is not meaningful.
Fix up various I2C controllers to remove the unneeded code.
Signed-off-by: Corey Minyard <cminyard@mvista.com> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
show more ...
|
2ac4c5f4 | 14-Nov-2018 |
Corey Minyard <cminyard@mvista.com> |
i2c: have I2C receive operation return uint8_t
It is never supposed to fail and cannot return an error, so just have it return the proper type. Have it return 0xff on nothing available, since that'
i2c: have I2C receive operation return uint8_t
It is never supposed to fail and cannot return an error, so just have it return the proper type. Have it return 0xff on nothing available, since that's what would happen on a real bus.
Signed-off-by: Corey Minyard <cminyard@mvista.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
show more ...
|
f2609ffd | 06-Dec-2018 |
Prasad J Pandit <pjp@fedoraproject.org> |
i2c: pm_smbus: check smb_index before block transfer write
While performing block transfer write in smb_ioport_writeb(), 'smb_index' is incremented and used to index smb_data[] array. Check 'smb_ind
i2c: pm_smbus: check smb_index before block transfer write
While performing block transfer write in smb_ioport_writeb(), 'smb_index' is incremented and used to index smb_data[] array. Check 'smb_index' value to avoid OOB access.
Note that this bug is exploitable by a guest to escape from the virtual machine. However the commit which introduced the bug was only made after the 3.0 release, and so it is not present in any released QEMU versions.
Fixes: 38ad4fae43 i2c: pm_smbus: Add block transfer capability Reported-by: Michael Hanselmann <public@hansmi.ch> Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Li Qiang <liq3ea@gmail.com> Reviewed-by: Michael Hanselmann <public@hansmi.ch> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Message-id: 20181206121830.6177-1-ppandit@redhat.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
show more ...
|
bb626e5b | 25-Sep-2018 |
Guenter Roeck <linux@roeck-us.net> |
aspeed/i2c: Fix receive done interrupt handling
The AST2500 datasheet says:
I2CD10 Interrupt Status Register bit 2 Receive Done Interrupt status S/W needs to clear this status b
aspeed/i2c: Fix receive done interrupt handling
The AST2500 datasheet says:
I2CD10 Interrupt Status Register bit 2 Receive Done Interrupt status S/W needs to clear this status bit to allow next data receiving
The Rx interrupt done interrupt status bit needs to be cleared explicitly before the next byte can be received, and must therefore not be auto-cleared. Also, receiving the next byte must be delayed until the bit has been cleared.
Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Cédric Le Goater <clg@kaod.org> Message-id: 20180914063506.20815-4-clg@kaod.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
show more ...
|
7bd9c60d | 25-Sep-2018 |
Guenter Roeck <linux@roeck-us.net> |
aspeed/i2c: Handle receive command in separate function
Receive command handling may have to be deferred if a previous receive done interrupt was not yet acknowledged. Move receive command handling
aspeed/i2c: Handle receive command in separate function
Receive command handling may have to be deferred if a previous receive done interrupt was not yet acknowledged. Move receive command handling into a separate function to prepare for the necessary changes.
Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Cédric Le Goater <clg@kaod.org> Message-id: 20180914063506.20815-3-clg@kaod.org Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
show more ...
|