SCSI学习

来源:互联网 发布:php 分页偏移量 编辑:程序博客网 时间:2024/05/22 04:45

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
作者的疯狂内核系列有机会好好学习一下

原创粉丝点击