From owner-freebsd-drivers@freebsd.org Wed Dec 13 12:31:39 2017 Return-Path: Delivered-To: freebsd-drivers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3BE50E9CE42 for ; Wed, 13 Dec 2017 12:31:39 +0000 (UTC) (envelope-from florian.florensa@gmail.com) Received: from mail-qt0-x22b.google.com (mail-qt0-x22b.google.com [IPv6:2607:f8b0:400d:c0d::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EDB4E6EFD0 for ; Wed, 13 Dec 2017 12:31:38 +0000 (UTC) (envelope-from florian.florensa@gmail.com) Received: by mail-qt0-x22b.google.com with SMTP id f2so3421728qtj.4 for ; Wed, 13 Dec 2017 04:31:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=cTPLyRXcujZ68Zm9zJ/hGJ9vLFUj+xgRnUfNRJrejcg=; b=Zu475T8DrF7uEhesN8EQBjDLVfdVrVd9K2ZsTcaCo0ADhS3Jdd8DadXKfmJK1L5h5Y RYWT22emj0V4ofsT9MdupJvj/0cUM6VGEcNmWSuEFP+YfEMbbKv7oIVyHq4h899lH4a0 RBcgKlqs8CLmQYJpDCBuifqwxUup27JMiR/FWN+wsZa6Ce/9aYdL1kbyhgtWtUZHfrmT HcMUruLmZriKnmH9+nnFwSQfknvVMamVkZ9wLnu5i3mlrwwhBiiCEbDZ6CG/DdDyrSEv yJgEkSpTxigO4y9s90Zad0appH/u7z0knkpJkYErOnF5HzGUTgL318HUTMxcnMRgr/dJ 08HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=cTPLyRXcujZ68Zm9zJ/hGJ9vLFUj+xgRnUfNRJrejcg=; b=QKeIU0tpH02mr0oBE5MnHS+QNoXLBfxvXqjgif9rLhIEdMwzO+ixYcZvoycKBXZ2Xl 56DtxNRZPRLU0zwabFbNBR4k8bbzrIdBuB/k9tcnm38eqj6Et5PGKw+DlYCJuTevNn8H Bzz18WBIL805YGMmcyp7m/FurO7McJPAxV34DnzKDJ8gcYQ0eF6Ma+jT4oc5K2G67Sea ubdRNgajoxvREY+eUAkCMKuTFE0Ou8rRt6NTbtwQ9MXNk94NWROJMtFe9SOunwGfVRmJ NexJfM9ktZ0+fZ4Vcjc7Zfimh5mQRxyeDznO/yWJzwcAg8c2FDNZldDfv4+uUrH58guY /QVg== X-Gm-Message-State: AKGB3mLHFQufAUJD1GDZs3zlisWy/ZriSPExVEDZIUMsMHVN+qj6FEdJ 3tNm64ngADN0O5HckGxMdq4w0Aqp4dHaq8tRhgjZuO7W X-Google-Smtp-Source: ACJfBouT4nDywSpRwZ/Fu7sMOv+ZfaDuGXuwDOvN6CX7GLoewvncU1VunSGOReNhhHYSaheWLUZV5eooqb7a84w0QR0= X-Received: by 10.237.56.5 with SMTP id j5mr10952272qte.53.1513168297915; Wed, 13 Dec 2017 04:31:37 -0800 (PST) MIME-Version: 1.0 Received: by 10.200.25.42 with HTTP; Wed, 13 Dec 2017 04:31:37 -0800 (PST) From: Florian Florensa Date: Wed, 13 Dec 2017 13:31:37 +0100 Message-ID: Subject: Virtual HBA SIM To: freebsd-drivers@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Dec 2017 12:31:39 -0000 Hello everyone, I've been working on a FreeBSD sim that would emulate a SCSI HBA and a few attached SCSI devices. For now, i have been struggling with the device creation in the system. Here is what happens inside the code: the driver setup a new 'fake' device and call online_device with the needed parameter. Online device call the 'vhba_cam_init' which create the sim for the fake device (along with its devq, mtx, path and bus registering). Afterwords it setups a CCB with the func code XPT_GDEV_TYPE, call xpt_action, and finally xpt_async is called with code AC_FOUND_DEVICE. Here you can find the relevant code in a pastebin for readability: https://pastebin.com/e50bYHiQ Unfortunately the device never gets created, and I seem unable to understand either why it is not created, neither how I can fix it. If anyone can shed some lights on this, i would really appreciate it. Regards, Florian