From owner-freebsd-scsi@FreeBSD.ORG Sun Nov 4 09:10:43 2012 Return-Path: Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6E270DEC for ; Sun, 4 Nov 2012 09:10:43 +0000 (UTC) (envelope-from jacks.1785@gmail.com) Received: from mail-ie0-f182.google.com (mail-ie0-f182.google.com [209.85.223.182]) by mx1.freebsd.org (Postfix) with ESMTP id 343108FC18 for ; Sun, 4 Nov 2012 09:10:42 +0000 (UTC) Received: by mail-ie0-f182.google.com with SMTP id k10so8787009iea.13 for ; Sun, 04 Nov 2012 01:10:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=u4ebzBAIsU3ZCSt0QHct2r3P9s1lKVnWZq+Iy8Cpy/I=; b=vqj7pw5llaHTp1mYmeyAZiD+NbEokbmC5e+F3AvC8dgJPlaYogIjrCBAy0j9bQDN+a OOHSkZ48AxSY0ZEyAMhTZVnrYNJ5yNjtb7XvS/jHRLwFXU3F/9Kum55ZDrXhbI7BlB5R +uWU2ydLR1dXPXqRYXFYQrGK8L5nwsuyMKR0qgj+KFUqxvVHlb8/hPjcQQf1LgEtEimy 4E7NTnkZJHig8IlhJzZuxHzZzPYF5pHoEfpsC3le+vYrwRkVM0t/8l31iVV/ni9hRmO6 V0N+ngUO5aa4/2A3O13qeAG5AWrw96hKtbBmclQk6T6Kz/qoME34imwVbw51068hEqPM bW1g== MIME-Version: 1.0 Received: by 10.50.46.134 with SMTP id v6mr6430453igm.55.1352020242449; Sun, 04 Nov 2012 01:10:42 -0800 (PST) Received: by 10.64.11.166 with HTTP; Sun, 4 Nov 2012 01:10:42 -0800 (PST) Date: Sun, 4 Nov 2012 14:40:42 +0530 Message-ID: Subject: cam probe sequence From: Jack To: freebsd-scsi@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Nov 2012 09:10:43 -0000 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