MA-12283-4 remove the limitation of lock when use uuu

For imx8 chips, if boot from usb, lock status will be ignored for the
convenience of using uuu. For imx6 and imx7, the presistdata partition
is ignored, so unlock operation can alway succeed.

Change-Id: I842bab9fd2c04f8a864f4a134b63efc4436f71a4
Signed-off-by: faqiang.zhu <faqiang.zhu@nxp.com>
This commit is contained in:
faqiang.zhu 2018-09-26 16:24:36 +08:00
parent 26766be892
commit bea54d4fbe
2 changed files with 23 additions and 13 deletions

View File

@ -3426,21 +3426,24 @@ static void cb_flash(struct usb_ep *ep, struct usb_request *req)
fb_response_str = response;
#ifdef CONFIG_FASTBOOT_LOCK
int status;
status = fastboot_get_lock_stat();
/* for imx8 boot from USB, lock status can be ignored for uuu.*/
if (!(is_imx8() || is_imx8m()) || !(is_boot_from_usb())) {
int status;
status = fastboot_get_lock_stat();
if (status == FASTBOOT_LOCK) {
pr_err("device is LOCKed!\n");
strcpy(response, "FAIL device is locked.");
fastboot_tx_write_str(response);
return;
if (status == FASTBOOT_LOCK) {
pr_err("device is LOCKed!\n");
strcpy(response, "FAIL device is locked.");
fastboot_tx_write_str(response);
return;
} else if (status == FASTBOOT_LOCK_ERROR) {
pr_err("write lock status into device!\n");
fastboot_set_lock_stat(FASTBOOT_LOCK);
strcpy(response, "FAILdevice is locked.");
fastboot_tx_write_str(response);
return;
} else if (status == FASTBOOT_LOCK_ERROR) {
pr_err("write lock status into device!\n");
fastboot_set_lock_stat(FASTBOOT_LOCK);
strcpy(response, "FAILdevice is locked.");
fastboot_tx_write_str(response);
return;
}
}
#endif
fastboot_fail("no flash device defined");

View File

@ -38,6 +38,7 @@
#include "fastboot_lock_unlock.h"
#include <fsl_fastboot.h>
#include <memalign.h>
#include <asm/mach-imx/sys_proto.h>
#ifdef CONFIG_IMX_TRUSTY_OS
#include <trusty/libtipc.h>
#include <asm/mach-imx/hab.h>
@ -476,6 +477,12 @@ FbLockEnableResult fastboot_lock_enable() {
int mmc_id;
FbLockEnableResult ret;
/* for imx6 and imx7 platforms, ignore presistdata partition
* for the convenience of using uuu
*/
if (is_mx6() || is_mx7() || is_mx7ulp())
return FASTBOOT_UL_ENABLE;
bdata = (unsigned char *)memalign(ALIGN_BYTES, SECTOR_SIZE);
if (bdata == NULL)
return FASTBOOT_UL_ERROR;