From patchwork Mon Oct 12 15:20:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 54786 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by patches.linaro.org (Postfix) with ESMTPS id A292B23001 for ; Mon, 12 Oct 2015 15:07:54 +0000 (UTC) Received: by wicid10 with SMTP id id10sf11120336wic.2 for ; Mon, 12 Oct 2015 08:07:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-type:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe; bh=ZNl6mnC7pAD3u60Uvchh/5M1QzxxiYwQzvGg/hKUc0w=; b=Hi8N0T0wUIsqLCtrrdEPKIUNE0i/PbXFmSuVhGfU8qoK3DMMQE5bZQIsZpTcjYVH/L WuVDyE8W6rdaxxYmT46WJSu4DhloO0BRj+qJuATtrJCCXY/7HA8QmGdDxgvKCLOAbIE/ +VMxzcX0OMaguFjeYMAgxOyqUeUe2H/ZqU+ooGITU5gsE1uYiw/vVfPiiGgu65YZfBc8 3fGKCFCQRfqXHeygoJoeChtYY+H+bYuNQQr973FTFjETtrAJht5AI52xvD9mwwiST62y jJmnE5cRVffXyeM1wwHw+TsRtCGZ+W+bqGHcJdnfMxA+LwmxTgZKGX+CGCJmO7iU29ME cOqg== X-Gm-Message-State: ALoCoQlFm72DbK11TaQyp/T84ULpC9bZ32TIZuLJK0bEldnadiQOGPycIVIC7719shfGDdutkydW X-Received: by 10.112.158.202 with SMTP id ww10mr5829745lbb.13.1444662473962; Mon, 12 Oct 2015 08:07:53 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.89.207 with SMTP id n198ls491648lfb.54.gmail; Mon, 12 Oct 2015 08:07:53 -0700 (PDT) X-Received: by 10.112.158.38 with SMTP id wr6mr12926055lbb.25.1444662473759; Mon, 12 Oct 2015 08:07:53 -0700 (PDT) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com. [209.85.217.174]) by mx.google.com with ESMTPS id q189si11528209lfd.98.2015.10.12.08.07.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Oct 2015 08:07:53 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) client-ip=209.85.217.174; Received: by lbwr8 with SMTP id r8so144509641lbw.2 for ; Mon, 12 Oct 2015 08:07:53 -0700 (PDT) X-Received: by 10.25.207.82 with SMTP id f79mr8481255lfg.73.1444662473305; Mon, 12 Oct 2015 08:07:53 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1600585lbq; Mon, 12 Oct 2015 08:07:52 -0700 (PDT) X-Received: by 10.50.142.36 with SMTP id rt4mr3718303igb.7.1444662472200; Mon, 12 Oct 2015 08:07:52 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l4si8680502igx.52.2015.10.12.08.07.51; Mon, 12 Oct 2015 08:07:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751951AbbJLPHu (ORCPT + 7 others); Mon, 12 Oct 2015 11:07:50 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:12478 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751529AbbJLPHt (ORCPT ); Mon, 12 Oct 2015 11:07:49 -0400 Received: from 172.24.1.51 (EHLO szxeml432-hub.china.huawei.com) ([172.24.1.51]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CUB61510; Mon, 12 Oct 2015 23:05:10 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by szxeml432-hub.china.huawei.com (10.82.67.209) with Microsoft SMTP Server id 14.3.235.1; Mon, 12 Oct 2015 23:05:01 +0800 From: John Garry To: CC: , , , , , , , , , John Garry Subject: [PATCH 06/25] scsi: hisi_sas: add slot init code Date: Mon, 12 Oct 2015 23:20:18 +0800 Message-ID: <1444663237-238302-7-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1444663237-238302-1-git-send-email-john.garry@huawei.com> References: <1444663237-238302-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: devicetree-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: devicetree@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.garry@huawei.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Add functionality to init slot indexing. Slot indexing is for the host to track which slots (or tags) are free and which are used. Signed-off-by: John Garry --- drivers/scsi/hisi_sas/Makefile | 2 +- drivers/scsi/hisi_sas/hisi_sas.h | 2 ++ drivers/scsi/hisi_sas/hisi_sas_init.c | 2 ++ drivers/scsi/hisi_sas/hisi_sas_main.c | 28 ++++++++++++++++++++++++++++ 4 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 drivers/scsi/hisi_sas/hisi_sas_main.c diff --git a/drivers/scsi/hisi_sas/Makefile b/drivers/scsi/hisi_sas/Makefile index 63c3c4d..33f30e8 100644 --- a/drivers/scsi/hisi_sas/Makefile +++ b/drivers/scsi/hisi_sas/Makefile @@ -1,2 +1,2 @@ obj-$(CONFIG_SCSI_HISI_SAS) += hisi_sas.o -hisi_sas-y+= hisi_sas_init.o +hisi_sas-y+= hisi_sas_init.o hisi_sas_main.o diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h index 2c15036..929c513 100644 --- a/drivers/scsi/hisi_sas/hisi_sas.h +++ b/drivers/scsi/hisi_sas/hisi_sas.h @@ -257,4 +257,6 @@ union hisi_sas_command_table { struct hisi_sas_command_table_smp smp; struct hisi_sas_command_table_stp stp; }; + +void hisi_sas_slot_index_init(struct hisi_hba *hisi_hba); #endif diff --git a/drivers/scsi/hisi_sas/hisi_sas_init.c b/drivers/scsi/hisi_sas/hisi_sas_init.c index 0116782..38b9ed2 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_init.c +++ b/drivers/scsi/hisi_sas/hisi_sas_init.c @@ -131,6 +131,8 @@ static int hisi_sas_alloc(struct hisi_hba *hisi_hba, struct Scsi_Host *shost) goto err_out; memset(hisi_hba->sata_breakpoint, 0, s); + hisi_sas_slot_index_init(hisi_hba); + return 0; err_out: return -ENOMEM; diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c new file mode 100644 index 0000000..721412e --- /dev/null +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2015 Linaro Ltd. + * Copyright (c) 2015 Hisilicon Limited. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + */ + +#include "hisi_sas.h" + + +static void hisi_sas_slot_index_clear(struct hisi_hba *hisi_hba, int slot_idx) +{ + void *bitmap = hisi_hba->slot_index_tags; + + clear_bit(slot_idx, bitmap); +} + +void hisi_sas_slot_index_init(struct hisi_hba *hisi_hba) +{ + int i; + + for (i = 0; i < hisi_hba->slot_index_count; ++i) + hisi_sas_slot_index_clear(hisi_hba, i); +}