From owner-freebsd-arm@freebsd.org Wed Nov 18 22:50:13 2015 Return-Path: Delivered-To: freebsd-arm@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 4F5DAA32443 for ; Wed, 18 Nov 2015 22:50:13 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from mail-pa0-x22d.google.com (mail-pa0-x22d.google.com [IPv6:2607:f8b0:400e:c03::22d]) (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 1C5711AE9 for ; Wed, 18 Nov 2015 22:50:12 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: by pacdm15 with SMTP id dm15so58607456pac.3 for ; Wed, 18 Nov 2015 14:50:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=sender:subject:mime-version:content-type:from:in-reply-to:date:cc :message-id:references:to; bh=6uHxrZrauHu7OM91xS3O/68vfS6KE1jWZ3O4sGd3vTI=; b=YYvO14tpjCueujW9ghT6a8rWz4AD1llB61TDEC5lET4xLveCppYuGZKrFPbX4S44Yw Fj9yB8WebhBrXY3hBI19CLE0AngH0sqgm6y3a486gYmP2VyUF8Wrxgbz00mrfdeaTEhA h9dHf877cL+0iNvFurASuITD59hBo0gNs+Nby86OwdIQlQdAfU6PIonrejQCxMoO1MhK th+wf1rPDAPhJ2DfqAdZZVV7cDOAGzEMx/RrHoE0Otcz9NU4qA1234WWHIzNAZTz2a+F GplYi2Zq5up6R2kc6Eh7xFxEScizcaV5KwibWz329TiA+mLvj4prr00qNfVPro8cDuMj 4eCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:mime-version:content-type:from :in-reply-to:date:cc:message-id:references:to; bh=6uHxrZrauHu7OM91xS3O/68vfS6KE1jWZ3O4sGd3vTI=; b=iQnPerCmHmfW6gmFSCsNINgBIMfIDxuFupxYiEZpbNaHTboJAwVJzO2LBi8AnOnoF6 ERFPMJLIMjqv+XrAXs0SvRZXKXq7DAcjdMdVXta+1Bro7fDzEj7su90SkbZA8I2kOFX2 9pWGW8yYH2eeJ+aKUWQKV+di23c67gkYDiyJp+Wqa+CJDgnMTkPCTwYjAhpkytJJ3y5t CW7CTJuYvM8wCgczzF/6Uhd2S0A/rIRsX7zrQubATCBWhJ5Kb0vuqT5YBQZMF7De0xdN 5d9yOjF593ACiQqdaFhTfP/twhP82I2f51tKRWO1RDm3PN+bfolqckzZYRy6Guk2Hql9 xKpQ== X-Gm-Message-State: ALoCoQkngsnWB0S5Qf7dFxcHFccXWpw1BQyRIwTyTT+V+zTjN0cdLGhrOomq1fNCFk4PSTFao0ob X-Received: by 10.68.204.226 with SMTP id lb2mr5647609pbc.151.1447887011849; Wed, 18 Nov 2015 14:50:11 -0800 (PST) Received: from [100.127.144.114] ([69.53.245.31]) by smtp.gmail.com with ESMTPSA id hy1sm6193189pbb.63.2015.11.18.14.50.10 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 18 Nov 2015 14:50:10 -0800 (PST) Sender: Warner Losh Subject: Re: Hummingboard SATA Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Content-Type: multipart/signed; boundary="Apple-Mail=_8E1AD222-552C-488D-92B8-87FB637F0ED7"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail 2.5.2 From: Warner Losh In-Reply-To: Date: Wed, 18 Nov 2015 15:50:07 -0700 Cc: freebsd-arm Message-Id: <59E5D040-0DE5-469F-A913-5514C534C690@bsdimp.com> References: To: Russell Haley X-Mailer: Apple Mail (2.2104) X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Nov 2015 22:50:13 -0000 --Apple-Mail=_8E1AD222-552C-488D-92B8-87FB637F0ED7 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Nov 14, 2015, at 11:16 PM, Russell Haley = wrote: >=20 > Hi Warner, >=20 > I am looking over the CAM code and it's relationship with ahci. There = are also bits of information about CAM around: a chapter in the Kong = book, a chapter in the developers handbook. >=20 > The file ahci.c, line 660 - ahci_ch_attach() - this seems to be where = the magic happens to attach the ahci driver to the CAM system. = Specifically line 754 "cam_sim_alloc()=E2=80=9D. Yes. That creates the SIM. SIM used to mean SCSI Interface Module in the = original CAM spec. Any more, it just means any device that can chat with = devices attached via the appropriate transport. The SIM has a number of busess connected to it. Each bus is a transport. = A transport (xpt in the code) shuffles protocol messages from the periph = devices using the SIM to send / receive them over the XPT. When the SIM is instantiated, CAM automatically resets the bus and = enumerates it, with the help of the SIM. For SCSI-like things, this is = where ID scans are done, LUN scans, etc. For ATA, this is where ports = are scanned, port expanders recognized, etc. So as part of this scan, it is discovered that a SATA device exists on a = given port, and an ada device is created. > What I am not seeing is the relationship to the ata_da.c code. I = noticed that my drive wasn't listed in the ata_da.c, ada_quirk_table. I = don't know anything about quirks but imagine that this is an optional = item? Yes. The Quirk table is for those devices that lie to the system in some = way and that lie needs to be sorted out through work arounds in the = code. > I think I am done reviewing the code for now and will move back to ddb = and figure out how to examine the kernel checking for devices (read: no = idea what I am doing). If anyone has any pointers on how to hook into = the probe or attach methods using the debugger, or even any good = scripts, I'd be grateful. I usually just set breakpoints for the specific device I=E2=80=99m = interested in, though device_probe_and_attach is also good. Warner > Thanks, >=20 > Russ >=20 >=20 >=20 > On Wed, Nov 11, 2015 at 9:39 PM, Warner Losh wrote: >=20 >=20 > On Wed, Nov 11, 2015 at 10:22 PM, Russell Haley = wrote: > Hello again, >=20 > I have started looking at SATA support in FreeBSD by first reading the = man > pages and then examining the code. The Joseph Kong book is helping > considerably to understand the structures. >=20 > I see that there are three drivers in play: ahci, ada and ata. Man > indicates that ahci takes precedence in driver selection. *Is that the > driver for Arm and the Hummingboard?* >=20 > ata is out of the picture now. It never really was used on arm. >=20 > ahci is likely the driver you want, though I'm not sure what a = Hummingboard > is. A quick google search suggests it is a imx6 board. That's good = news > because FreeBSD has an attachment. >=20 > ahci is what's call a CAM SIM. This means that it will create the ata = xpt (handled > in sys/cam/ata/ata_xpt.c). The XPT then enumerates the transport and = finds the > sata drives, which wind up getting assigned the ada PERIPH driver = (handled by > sys/cam/ata/ata_da.c). >=20 > Chances are very good you have a problem with the ahci driver and/or > how that driver is connected / sets up the iMX6 SoC sata hardware. >=20 > What I can't seem to find is any direction on getting a debugger = hooked up > to driver code. Do I use gdb somehow, or do I use the kernel debugger? = I'm > going back over the Developers handbook again. >=20 > I'd start with ddb. >=20 > I also don't understand how to boot with the -d option. When is this > entered? I have used the sysctl to enter the debugger and poked around > but it doesn't mean much yet. >=20 > sysctl debug.kdb.enter=3D1 >=20 > I don't think that the -d option is implemented on arm. Most of the = ARM > kernel config files have ALT_BREAK_TO_DEBUGGER defined, which means > you'll need to send ~ ^B (that's hit return, hit the tilde key, = hit control B). > That will get you to the ddb prompt (db>). man 8 ddb for instructions = on > how to use it. >=20 > Warner >=20 --Apple-Mail=_8E1AD222-552C-488D-92B8-87FB637F0ED7 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJWTQCgAAoJEGwc0Sh9sBEAYRgQAKszJtJrwTQf0C4YlP/3zf3R oHbOlnsn6vrNyjBVV1T0zIVaAfSZMinMbTPUGtnEcWpPXK7w3R/xinaYcZM55jqd yJEsLr10WwHvpIhc1PNJNQsbK+85gEhRtg2IJ1CHBnAsD5DXwCpRNi6CyYT0R3ls VQUYf7Gb47x40kBQ0VrXnj4WJq2R7qZJUkaaPkBO2ogIz7KGDTTVzlWuCfQrm4Oo xWsMXhmBcfOhTPNZ8tY0SZ4ST/7MjouwMujcdzcKZWwQUSiMEulSQXuYjR2dX0mu gAmsY2pBnDCXKEZjmt67oNwaD3DvbtoKQv1kxItlmQwhmy5AvMvYeWZFMmB3vHju BPP49ix6iMHhN2gjiBGI+sgVWtHNNh65mFzktqiqvmXpO0Azpvjedh396mmbp+dE JOxrTnc6u0ta5uUoFws1mDO+KsFIKlAWpTs7WWqCmNZY/Wg1b8gssa0jqHg09h8M AAK9dYbxV+2B6VVFwcVBTsdZHA0xvlZdQ9r5VcSVZ4ysan7fV9HavoApEFqfV1mt FG6oqhnqhH+3FE2sq1YcOO0bqDij3pVhMnDNfIen3hw5u9jhaGvgMNBqSe00rdis KBJXIYJg+QsfWm7qmCwC9mrPKreeDa1GYShzpdd4x7DZMB+Jw1GWNA4vFrXGXY3K tOfuCstIwO3o/TSN/5X+ =D8Vs -----END PGP SIGNATURE----- --Apple-Mail=_8E1AD222-552C-488D-92B8-87FB637F0ED7--