Date: Sun, 4 Nov 2012 14:40:42 +0530 From: Jack <jacks.1785@gmail.com> To: freebsd-scsi@freebsd.org Subject: cam probe sequence Message-ID: <CACmXQA3_NDtwFqMACVeX6a56wKCVMPvoVKxXT1nzPNad9trCJA@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
Hello all, I'm trying to understand the probe sequence of a scsi device, say a scsi hard drive( with SPI/SAS/FC interface). I'm particularly interested in probe sequence of a device which is attached to the system _after_ FreeBSD has booted completely. (ie post-boot probing.) While going through the source of cam subsystem, a few questions arose in my understanding. ( The relevant files I found are cam/cam_xpt.c, cam/cam_periph.c and cam/scsi/scsi_xpt.c or cam/ata/ata_xpt.c in case of (S)ATA drives. ) As far as I could got till now, it seems that struct cam_et and struct cam_ed are _always_ created even _before_ the probing of device commences. But how does cam sub-system get to know that a device got attached to the system, so that it creates struct cam_et and struct cam_ed in advance, and _then_ probes the device. Is it something like a event notfication at hardware level that the HBA driver passes to cam sub-system which notifies cam sub-system that a device has recently been attached. If it is true, then does all SPI/SAS/FC/(S)ATA HBAs support such event notification -- something like a standard thing in SPI/SAS/FC/(S)ATA world. If it is not so, then does userland have to intiate a scan after device is attached, so that during scanning the cam-subsystem get to know that Oh! there is a device we are meeting first time. In other words, _until_ userland instructs cam subsystem to scan all the buses by XPT_SCAN_BUS ccb through CAMIOCOMMAND ioctl of /dev/xpt0, the struct cam_et and struct cam_ed will not get created. Is it so? But in this case also, does cam-subsystem creates struct cam_et and struct cam_ed before probing the device?. In case of SPI/SAS/FC hard drives the probe code is in cam/scsi/scsi_xpt.c While reading this source file it also seems to me that a struct cam_periph is also created as soon as struct cam_et and struct cam_ed are created. This also happens before probing of device commences. Is it the pass device that is created even before probing begins. Then after probing and determining the type of device - e.g. disk, cd-rom, etc, then the appropriate peripheral device(da, cd, etc. ) is created for the probed device. Is it so? It would be really helpful if someone could clear these things, specially from the instant the device -say a hard disk; is attached, to the instant the pass device and da device are created and probing of this hard disk commences or finishes. Regards -- Jack
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACmXQA3_NDtwFqMACVeX6a56wKCVMPvoVKxXT1nzPNad9trCJA>