upper lever driver : sd sr st sg 抽象的硬盘,磁带等节点,sd的驱动程序注册;
middle lever driver:scsi core:提供API给上层和下层,第一优先级加载;
lower lever:HBAS 具体控制器的驱动程序,控制器注册并探测到设备,注册设备
lower lever三部曲:
第一步
scsi_host_alloc
=>shost->ehandler = kthread_run(scsi_error_handler, shost, "scsi_eh_%d", shost->host_no);
第二步
scsi_add_host //注册host
第三步
scsi_scan_host //扫描并注册节点
=>do_scsi_scan_host(shost);
=>scsi_scan_host_selected(shost, SCAN_WILD_CARD, SCAN_WILD_CARD, SCAN_WILD_CARD, 0);
=>scsi_scan_channel(shost, channel, id, lun, rescan);
=>__scsi_scan_target(&shost->shost_gendev, channel, order_id, lun, rescan);
=>scsi_probe_and_add_lun(starget, lun, NULL, NULL, rescan, NULL);
=>res = scsi_add_lun(sdev, result, &bflags, shost->async_scan);
=>scsi_sysfs_add_sdev(sdev) //scsi_sysfs_add_sdev - add scsi device to sysfs 注册scsi device
sd_rw_intr //potentially run from within an ISR. Must not block. SCpnt->done = sd_rw_intr;
=>scsi_io_completion(SCpnt, good_bytes);
=>error = -EIO
linux 文件写入流程(从vfs层, 通用block层到 scsi磁盘驱动
http://blog.chinaunix.net/uid-28792672-id-3984577.html
scsi总线驱动的初始化
http://blog.csdn.net/yunsongice/article/details/6171286
作者的疯狂内核系列有机会好好学习一下
linux驱动子系统–SCSI
https://blog.csdn.net/u011955950/article/details/14229239
SCSI驱动框架分析
https://blog.csdn.net/xuao20060793/article/details/46530213
kernel 3.10内核源码分析–IO–SCSI错误处理机制
http://blog.chinaunix.net/uid-14528823-id-4924157.html
Linux存储IO栈(4)-- SCSI子系统之概述 文章不错
https://blog.csdn.net/haleycomet/article/details/52596355
kernel 3.10内核源码分析–IO–SCSI错误处理机制
http://blog.chinaunix.net/uid-14528823-id-4924157.html
Linux scsi 异步扫描分析笔记
http://blog.chinaunix.net/uid-709830-id-2069884.html
Linux3.10.0块IO子系统流程(0)-- 块IO子系统概述 文章不错
https://www.cnblogs.com/luxiaodai/p/9254118.html
Linux3.10.0块IO子系统流程(5)-- 为SCSI命令准备聚散列表
https://www.cnblogs.com/luxiaodai/p/9266317.html
Linux SCSI设备容量打印代码分析
https://blog.csdn.net/TSZ0000/article/details/88909445