From owner-svn-src-stable@FreeBSD.ORG Wed May 7 16:55:08 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B7FE2C7A; Wed, 7 May 2014 16:55:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8B0E2D2; Wed, 7 May 2014 16:55:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s47Gt83D074433; Wed, 7 May 2014 16:55:08 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s47Gt8MH074432; Wed, 7 May 2014 16:55:08 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201405071655.s47Gt8MH074432@svn.freebsd.org> From: Jim Harris Date: Wed, 7 May 2014 16:55:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r265569 - stable/10/sys/dev/nvme X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 May 2014 16:55:08 -0000 Author: jimharris Date: Wed May 7 16:55:08 2014 New Revision: 265569 URL: http://svnweb.freebsd.org/changeset/base/265569 Log: MFC r260382: For IDENTIFY passthrough commands to Chatham prototype controllers, copy the spoofed identify data into the user buffer rather than issuing the command to the controller, since Chatham IDENTIFY data is always spoofed. While here, fix a bug in the spoofed data for Chatham submission and completion queue entry sizes. Modified: stable/10/sys/dev/nvme/nvme_ctrlr.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- stable/10/sys/dev/nvme/nvme_ctrlr.c Wed May 7 16:53:42 2014 (r265568) +++ stable/10/sys/dev/nvme/nvme_ctrlr.c Wed May 7 16:55:08 2014 (r265569) @@ -181,8 +181,8 @@ nvme_chatham_populate_cdata(struct nvme_ cdata->lpa.ns_smart = 1; cdata->sqes.min = 6; cdata->sqes.max = 6; - cdata->sqes.min = 4; - cdata->sqes.max = 4; + cdata->cqes.min = 4; + cdata->cqes.max = 4; cdata->nn = 1; /* Chatham2 doesn't support DSM command */ @@ -1041,6 +1041,27 @@ nvme_ctrlr_ioctl(struct cdev *cdev, u_lo break; case NVME_PASSTHROUGH_CMD: pt = (struct nvme_pt_command *)arg; +#ifdef CHATHAM2 + /* + * Chatham IDENTIFY data is spoofed, so copy the spoofed data + * rather than issuing the command to the Chatham controller. + */ + if (pci_get_devid(ctrlr->dev) == CHATHAM_PCI_ID && + pt->cmd.opc == NVME_OPC_IDENTIFY) { + if (pt->cmd.cdw10 == 1) { + if (pt->len != sizeof(ctrlr->cdata)) + return (EINVAL); + return (copyout(&ctrlr->cdata, pt->buf, + pt->len)); + } else { + if (pt->len != sizeof(ctrlr->ns[0].data) || + pt->cmd.nsid != 1) + return (EINVAL); + return (copyout(&ctrlr->ns[0].data, pt->buf, + pt->len)); + } + } +#endif return (nvme_ctrlr_passthrough_cmd(ctrlr, pt, pt->cmd.nsid, 1 /* is_user_buffer */, 1 /* is_admin_cmd */)); default: