SCSI generic(sg) overview
UFS固件升级来袭,QCOM/UEFI平台都懂的,发现西数提供一个工具叫ufs-utils,里面提到了FFU:
The following options may work with the SCSI BSG device |
What is sg v4? sg v3? ok,让我们先了解下sg。
SCSI设备驱动主要有四类:sd(disk), st(tape), sr(CDROM), sg(generic)。
menuconfig:
*** SCSI support type (dis, tape, SD-ROM) *** |
sg: 顾名思义就是更通用的了,大概看下sg v3和v4,以下参考kernel 5.x。
v4的Kconfig定义:
config BLK_DEV_BSG |
block/Makefile:15:obj-$(CONFIG_BLK_DEV_BSG) += bsg.o |
ok, sg v3的code:block/scsi_ioctl.c + drivers/scsi/sg.c (CONFIG_CHR_DEV_SG)
sg v4的code:block/bsg.c (CONFIG_BLK_DEV_BSG)
v3的interface: include/scsi/sg.h:
typedef struct sg_io_hdr |
v4的interface: include/uapi/linux/bsg.h:
struct sg_io_v4 { |
block layer来源于driver/scsi,bsg是block layer sg, bsg只支持sg v4。
当前qcom平台只能看到/dev/block/sda,用sg v3就能FFU for UFS? to be continue.
refer
- Documentation/scsi/scsi-generic.rst
- https://github.com/westerndigitalcorporation/ufs-utils/README.md
- http://sg.danny.cz/sg/sg_v40.html
版权声明:本站所有文章均采用 CC BY-NC-SA 4.0 CN 许可协议。转载请注明原文链接!