mirror of https://gitee.com/openkylin/linux.git
Amlogic driver updates for v4.12:
- firmware: updates/fixes for meson-sm -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAABCAAGBQJY3CaCAAoJEFk3GJrT+8ZllAEP/3VyRMuBN4PoF/yO85+X4pyz 8qcv/58zHMD7Y6pzW6ubp9PDZ2Qk1yOh5uua5oeSm4zV+VpRDDHdA8fYuiloPz2F NMMQTkGWp78Srw88rVH18U8R4q33pM+VnW1yuifvjlVLRm/oG2b9Sw/Z1p4ePme1 SkPy/APeESMj8a807wGtgC3QBurkeM3j0FvmlbSncF+0EOwIOwjh+fmNIkRdoAPQ XFEE40zC77nGrLcsm7YTSBGnTkwTxT128dnXGw9EqWg6l+EXs2YXz2NdDV4Dxvt3 7om+IRuvuw16JrHiuqGz2rmyxECgzCmt29iTa7VJqA5h3/lX/L3OLWKV2BG3IA4H KNrE72YZoPE185ryUnWYAfw21rnUo6L+9P1G2Q7z465Gasqzvia1G31OvBR/r7oQ QQOKVyDZxjyIq8v77q4pfvIg3wI2Z8JAltWcoLNdrBNN2Ee5Xrc215ioJ10vI+kD NtFnVufEHc3ql/GqCDhVaF/LIlLUPICaVbJYfu9b6mOtkUrbLo5KgAKQwP9D5vbE 66hroEvvsZO5ZKvigrTLDKFJR65D+rAsPllk60BWVV/rZd7Ji0fYgt/w1B29E15A lmvN1rENLMl6LXG6eJlU8sSV9i08A9y3UvJSTsLClAT14aYiWFgvc2zoY4mlePna aAotrnJLrZ29UPx1sPvt =1052 -----END PGP SIGNATURE----- Merge tag 'amlogic-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-amlogic into next/drivers Pull "Amlogic driver updates for v4.12" from Kevin Hilman: - firmware: updates/fixes for meson-sm * tag 'amlogic-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-amlogic: firmware: meson-sm: Allow 0 as valid return value firmware: meson-sm: Check for buffer output size
This commit is contained in:
commit
99b19a1f21
|
@ -127,6 +127,7 @@ EXPORT_SYMBOL(meson_sm_call);
|
|||
* meson_sm_call_read - retrieve data from secure-monitor
|
||||
*
|
||||
* @buffer: Buffer to store the retrieved data
|
||||
* @bsize: Size of the buffer
|
||||
* @cmd_index: Index of the SMC32 function ID
|
||||
* @arg0: SMC32 Argument 0
|
||||
* @arg1: SMC32 Argument 1
|
||||
|
@ -135,11 +136,14 @@ EXPORT_SYMBOL(meson_sm_call);
|
|||
* @arg4: SMC32 Argument 4
|
||||
*
|
||||
* Return: size of read data on success, a negative value on error
|
||||
* When 0 is returned there is no guarantee about the amount of
|
||||
* data read and bsize bytes are copied in buffer.
|
||||
*/
|
||||
int meson_sm_call_read(void *buffer, unsigned int cmd_index, u32 arg0,
|
||||
u32 arg1, u32 arg2, u32 arg3, u32 arg4)
|
||||
int meson_sm_call_read(void *buffer, unsigned int bsize, unsigned int cmd_index,
|
||||
u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4)
|
||||
{
|
||||
u32 size;
|
||||
int ret;
|
||||
|
||||
if (!fw.chip)
|
||||
return -ENOENT;
|
||||
|
@ -147,16 +151,24 @@ int meson_sm_call_read(void *buffer, unsigned int cmd_index, u32 arg0,
|
|||
if (!fw.chip->cmd_shmem_out_base)
|
||||
return -EINVAL;
|
||||
|
||||
if (bsize > fw.chip->shmem_size)
|
||||
return -EINVAL;
|
||||
|
||||
if (meson_sm_call(cmd_index, &size, arg0, arg1, arg2, arg3, arg4) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (!size || size > fw.chip->shmem_size)
|
||||
if (size > bsize)
|
||||
return -EINVAL;
|
||||
|
||||
ret = size;
|
||||
|
||||
if (!size)
|
||||
size = bsize;
|
||||
|
||||
if (buffer)
|
||||
memcpy(buffer, fw.sm_shmem_out_base, size);
|
||||
|
||||
return size;
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(meson_sm_call_read);
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ static int meson_efuse_read(void *context, unsigned int offset,
|
|||
u8 *buf = val;
|
||||
int ret;
|
||||
|
||||
ret = meson_sm_call_read(buf, SM_EFUSE_READ, offset,
|
||||
ret = meson_sm_call_read(buf, bytes, SM_EFUSE_READ, offset,
|
||||
bytes, 0, 0, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
|
|
@ -25,7 +25,7 @@ int meson_sm_call(unsigned int cmd_index, u32 *ret, u32 arg0, u32 arg1,
|
|||
u32 arg2, u32 arg3, u32 arg4);
|
||||
int meson_sm_call_write(void *buffer, unsigned int b_size, unsigned int cmd_index,
|
||||
u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4);
|
||||
int meson_sm_call_read(void *buffer, unsigned int cmd_index, u32 arg0, u32 arg1,
|
||||
u32 arg2, u32 arg3, u32 arg4);
|
||||
int meson_sm_call_read(void *buffer, unsigned int bsize, unsigned int cmd_index,
|
||||
u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4);
|
||||
|
||||
#endif /* _MESON_SM_FW_H_ */
|
||||
|
|
Loading…
Reference in New Issue