fix: 解决OsMountRootfs失败问题

主干存在该问题,下一步同步主干.

挂载rootfs需要emmc驱动,emmc驱动还没有初始化好,内核就尝试挂载rootfs了,
现修改为通过一个事件同步,emmc驱动完成后写事件,内核读到这个事件再挂载rootfs

close: #I43WLG
Signed-off-by: wanghao-free <wanghao453@huawei.com>
This commit is contained in:
wanghao-free 2021-09-08 01:43:22 -07:00
parent 3ad07bc40f
commit 672cff7ee5
3 changed files with 35 additions and 0 deletions

View File

@ -700,6 +700,8 @@ INT32 los_alloc_diskid_byname(const CHAR *diskName);
*
*/
INT32 los_get_diskid_byname(const CHAR *diskName);
INT32 DiskEventRead(void);
INT32 DiskEventInit(void);
#ifdef __cplusplus
#if __cplusplus

View File

@ -58,6 +58,10 @@ spinlock_t g_diskFatBlockSpinlock;
UINT32 g_usbMode = 0;
#ifdef LOSCFG_STORAGE_EMMC
static struct tagEvent g_diskInitEvent;
#endif
#define MEM_ADDR_ALIGN_BYTE 64
#define RWE_RW_RW 0755
@ -1360,6 +1364,16 @@ INT32 los_disk_init(const CHAR *diskName, const struct block_operations *bops,
} else {
disk->type = OTHERS;
}
#ifdef LOSCFG_STORAGE_EMMC
ret = LOS_EventWrite(&g_diskInitEvent, 1);
if (ret < 0) {
PRINT_ERR("Disk initialization event write fail \n");
(void)unregister_blockdriver(diskName);
disk->disk_status = STAT_UNUSED;
return VFS_ERROR;
}
#endif
return ENOERR;
DISK_BLKDRIVER_ERROR:
@ -1370,6 +1384,24 @@ DISK_FIND_ERROR:
return VFS_ERROR;
}
INT32 DiskEventInit(void)
{
#ifdef LOSCFG_STORAGE_EMMC
return LOS_EventInit(&g_diskInitEvent);
#else
return LOS_OK;
#endif
}
INT32 DiskEventRead(void)
{
#ifdef LOSCFG_STORAGE_EMMC
return LOS_EventRead(&g_diskInitEvent, 1, LOS_WAITMODE_OR, LOS_WAIT_FOREVER);
#else
return LOS_OK;
#endif
}
INT32 los_disk_deinit(INT32 diskID)
{
los_disk *disk = get_disk(diskID);

View File

@ -246,6 +246,7 @@ STATIC INT32 GetArgs(CHAR **args)
}
#ifdef LOSCFG_STORAGE_EMMC
(void)DiskEventRead();
g_emmcDisk = GetMmcDisk(EMMC);
if (g_emmcDisk == NULL) {
PRINT_ERR("Get EMMC disk failed!\n");