From owner-freebsd-current@FreeBSD.ORG Tue Nov 22 15:47:43 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C71B51065686 for ; Tue, 22 Nov 2011 15:47:43 +0000 (UTC) (envelope-from nmisaghian@sandvine.com) Received: from mail1.sandvine.com (Mail1.sandvine.com [64.7.137.134]) by mx1.freebsd.org (Postfix) with ESMTP id 5E3C88FC19 for ; Tue, 22 Nov 2011 15:47:42 +0000 (UTC) Received: from WTL-EXCH-3.sandvine.com (192.168.196.36) by WTL-EXCH-2.sandvine.com (192.168.196.32) with Microsoft SMTP Server (TLS) id 14.0.694.0; Tue, 22 Nov 2011 10:47:41 -0500 Received: from WTL-EXCH-1.sandvine.com ([fe80::f523:8e57:71d7:5206]) by wtl-exch-3.sandvine.com ([::1]) with mapi id 14.01.0218.012; Tue, 22 Nov 2011 10:47:41 -0500 From: Nima Misaghian To: Pegasus Mc Cleaft , "freebsd-current@freebsd.org" Thread-Topic: Adding disk firmware programming capability to camcontrol Thread-Index: AQHMlbNjRU3luhlSCEi1qnlaSVQugpW2UR6AgALaLEA= Date: Tue, 22 Nov 2011 15:47:41 +0000 Message-ID: <0A3573FC36A1BE41AAA3DFF287C7968453400CEB@wtl-exch-1.sandvine.com> References: <20111028200227.GA50663@sandvine.com> <201111201454.49863.ken@mthelicon.com> In-Reply-To: <201111201454.49863.ken@mthelicon.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-originating-ip: [192.168.200.101] Content-Type: multipart/mixed; boundary="_002_0A3573FC36A1BE41AAA3DFF287C7968453400CEBwtlexch1sandvin_" MIME-Version: 1.0 Cc: "andre@albsmeier.net" Subject: RE: Adding disk firmware programming capability to camcontrol X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Nov 2011 15:47:44 -0000 --_002_0A3573FC36A1BE41AAA3DFF287C7968453400CEBwtlexch1sandvin_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, Sorry for the late reply. As I mentioned in the man page, the fwdownload co= mmand currently only supports SCSI disks. "fwdownload: Program firmware of the named <> device using the image = file provided." We have added firmware download command to atacontrol at work, for which I = have attached a patch against 8.2 to this email. The format of the command is similar to the camcontrol counterpart: atacontrol fwdownload But ultimately we would like to add the support to program ATA/SATA disks t= o camcontrol as well. Nima Misaghian nmisaghian@sandvine.com > -----Original Message----- > From: owner-freebsd-current@freebsd.org [mailto:owner-freebsd- > current@freebsd.org] On Behalf Of Pegasus Mc Cleaft > Sent: Sunday, November 20, 2011 9:55 AM > To: freebsd-current@freebsd.org > Cc: andre@albsmeier.net; Nima Misaghian > Subject: Re: Adding disk firmware programming capability to camcontrol >=20 > Hi Nima, >=20 > I have tried your latest patch against current, but I am having > difficulty > getting it to work. I was wondering, is this feature limited to SCSI > drives? > I have been trying it against my SATA drives but it looks like it is > failing > on issuing a TUR. >=20 > IE: >=20 > feathers# camcontrol fwdownload ada5 -f JP0NB3MA.BD -s -v > Running in simulation mode > camcontrol: Device is not ready > (pass5:ahcich4:0:0:0): TEST UNIT READY. CDB: 0 0 0 0 0 0 > (pass5:ahcich4:0:0:0): CAM status: CCB request was invalid > Firmware download failed >=20 >=20 > I have tried issuing a TUR to all my drives to see if it was controller > or > drive specific, but all of them return the same error (The drives are > Seagate, > Hitachi and WD). >=20 > What am I doing wrong? >=20 > Ta > Peg > _______________________________________________ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current- > unsubscribe@freebsd.org" --_002_0A3573FC36A1BE41AAA3DFF287C7968453400CEBwtlexch1sandvin_ Content-Type: application/octet-stream; name="atacontrol.diff" Content-Description: atacontrol.diff Content-Disposition: attachment; filename="atacontrol.diff"; size=5495; creation-date="Tue, 22 Nov 2011 15:40:04 GMT"; modification-date="Tue, 22 Nov 2011 15:40:04 GMT" Content-Transfer-Encoding: base64 LS0tIC9ob21lL25taXNhZ2hpYW4vYXRhX3BhdGNoL2F0YWNvbnRyb2wub2xkCTIwMTEtMTEtMjIg MTA6Mzg6NDQuOTAwMzA3NzAwIC0wNTAwCisrKyAvaG9tZS9ubWlzYWdoaWFuL2F0YV9wYXRjaC9h dGFjb250cm9sLm5ldwkyMDExLTExLTIyIDEwOjM5OjEzLjA5MTgxOTkwMCAtMDUwMApAQCAtMSw0 ICsxLDUgQEAKIC8qLQorICogQ29weXJpZ2h0IChjKSAyMDExIFNhbmR2aW5lIEluY29ycG9yYXRl ZC4gQWxsIHJpZ2h0cyByZXNlcnZlZC4KICAqIENvcHlyaWdodCAoYykgMjAwMCAtIDIwMDYgU/hy ZW4gU2NobWlkdCA8c29zQEZyZWVCU0Qub3JnPgogICogQWxsIHJpZ2h0cyByZXNlcnZlZC4KICAq CkBAIC0yNywxMSArMjgsMTMgQEAKICAqLwogCiAjaW5jbHVkZSA8c3lzL3R5cGVzLmg+CisjaW5j bHVkZSA8c3lzL3N0YXQuaD4KICNpbmNsdWRlIDxzeXMvYXRhLmg+CiAKICNpbmNsdWRlIDxlcnIu aD4KICNpbmNsdWRlIDxlcnJuby5oPgogI2luY2x1ZGUgPGZjbnRsLmg+CisjaW5jbHVkZSA8aW50 dHlwZXMuaD4KICNpbmNsdWRlIDxzdGRpbnQuaD4KICNpbmNsdWRlIDxzdGRpby5oPgogI2luY2x1 ZGUgPHN0ZGxpYi5oPgpAQCAtMzksNiArNDIsOSBAQAogI2luY2x1ZGUgPHN5c2V4aXRzLmg+CiAj aW5jbHVkZSA8dW5pc3RkLmg+CiAKKyNkZWZpbmUJTUFYX0ZXX0lNQUdFX1NJWkUJKDB4RkZGRiAq IDUxMikKKyNkZWZpbmUJRE9XTkxPQURfRldfVElNRU9VVAkyMA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4iKTsKKwkJLyogCisJCSAqIENhbGwgR2V0 IFBhcmFtIHRvIHVwZGF0ZSBmaXJtd2FyZSByZXZpc2lvbgorCQkgKiBudW1iZXIgaW4gQVRBIGRy aXZlciBjYWNoZQorCQkgKi8KKwkJaWYgKGlvY3RsKGZkLCBJT0NBVEFHUEFSTSwgJnBhcmFtcykg PCAwKQorCQkJd2FybngoImlvY3RsKElPQ0FUQUdQQVJNKSBmYWlsZWQiKTsKKwl9IGVsc2Ugewor CQl3YXJueCgiRmlybXdhcmUgZG93bmxvYWQgZmFpbGVkLiIpOworCQlnb3RvIGJhaWxvdXQxOwor CX0KKwlmcmVlKGJ1Zik7CisJY2xvc2UoZndfZmQpOworCXJldHVybiAoMCk7CitiYWlsb3V0MToK KwlmcmVlKGJ1Zik7CitiYWlsb3V0OgorCWNsb3NlKGZ3X2ZkKTsKKyAgICAgICAgcmV0dXJuICgx KTsKK30KKwogc3RhdGljIHZvaWQKIGluZm9fcHJpbnQoaW50IGZkLCBpbnQgY2hhbm5lbCwgaW50 IHByY2hhbikKIHsKQEAgLTQxMCw2ICs1NTMsMTQgQEAKIAkJZXhpdChFWF9PSyk7CiAJfQogCisJ aWYgKCFzdHJjbXAoYXJndlsxXSwgImZ3ZG93bmxvYWQiKSAmJiBhcmdjID09IDQpIHsKKwkJaW50 IGVycm9yOworCisJCWZkID0gb3Blbl9kZXYoYXJndlsyXSwgT19SRE9OTFkpOworCQllcnJvciA9 IGF0YV9md19kb3dubG9hZChmZCwgYXJndlszXSk7CisJCWV4aXQoZXJyb3IpOworCX0KKwogCWlm ICgoZmQgPSBvcGVuKCIvZGV2L2F0YSIsIE9fUkRXUikpIDwgMCkKIAkJZXJyKDEsICJjb250cm9s IGRldmljZSBub3QgZm91bmQiKTsKIAo= --_002_0A3573FC36A1BE41AAA3DFF287C7968453400CEBwtlexch1sandvin_--