SCSI学习

本文深入解析SCSI驱动架构,从上层的抽象设备管理到中间层API接口,再到底层控制器的具体实现。详细介绍了SCSI主机分配、主机注册及扫描过程,并提供了关键函数调用流程。适合对SCSI驱动感兴趣的开发者阅读。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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.youkuaiyun.com/yunsongice/article/details/6171286
作者的疯狂内核系列有机会好好学习一下

linux驱动子系统–SCSI
https://blog.youkuaiyun.com/u011955950/article/details/14229239

SCSI驱动框架分析
https://blog.youkuaiyun.com/xuao20060793/article/details/46530213

kernel 3.10内核源码分析–IO–SCSI错误处理机制
http://blog.chinaunix.net/uid-14528823-id-4924157.html

Linux存储IO栈(4)-- SCSI子系统之概述 文章不错
https://blog.youkuaiyun.com/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.youkuaiyun.com/TSZ0000/article/details/88909445

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值