From patchwork Tue Feb 6 21:13:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 1895909 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=kFDaNHu9; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:4601:e00::3; helo=am.mirrors.kernel.org; envelope-from=linux-ide+bounces-479-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [IPv6:2604:1380:4601:e00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TTwwy2TTCz23gb for ; Wed, 7 Feb 2024 08:14:26 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 967401F24570 for ; Tue, 6 Feb 2024 21:14:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3501F1B94B; Tue, 6 Feb 2024 21:14:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kFDaNHu9" X-Original-To: linux-ide@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E0A1F1B949 for ; Tue, 6 Feb 2024 21:14:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707254059; cv=none; b=eAgc6ux/avJKXMnyr0sRMfXXYObkZPOC+oQ4uU8J327+5rcaLEUSZesfAfHNcbso6XJxN8gB5LOvOlHJ9S3aUTcwoM+uknMI0QLHveOPKBEQmtWrMJXYhkhw5/tXuL9PaHkf3IzyXCnOR+wb2mWVaIBaLPIes4LQ5ociAWOr4XE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707254059; c=relaxed/simple; bh=9MGWFAs7sgQVDULmFL5uVDRT2VWDSFs6SCFgQwDALRI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kYU1nJh3xeeg58MV+T3GrmoeW582YV0dKkmEbYOWRFU+ihAv/FvHO2HU4/ro+yl3RY1gmrFK7hjeFsrlpPym+uap9MNmXiED9EJJ80oYId1oLxsmrvxCVB4HaTax39iMdovIBhe0Xen9bXOkXgJNxqpLF0klgi6rPVTucSckwHc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kFDaNHu9; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0660BC433C7; Tue, 6 Feb 2024 21:14:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707254058; bh=9MGWFAs7sgQVDULmFL5uVDRT2VWDSFs6SCFgQwDALRI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kFDaNHu95L/CAwG4plS4U+RznOGwTf68i1mFdSCU6V+ZeBW/uM5dVNSZl7l4PSGtE /vebB20AxXP5bPiZHXl9W93Go2bvZIMqItIXRR/41Ct+7/dBj8I/qwgTc4Xtvh6+HT QZNU/0xPqRkRJuiOxKfn1ufv1OW64gJSkh/JeTky7olnn3PF/81q7EUZU6emSFOx/P MPFV66Pzm+MNjxtfQG2JogxjPd8+L0JaDP0rjuXEFqq9sppDls5MJuCgdYkwuUJj/Y yGt3w5y5kKYS0WpuoUWQrLD8Mw6Mvca6ug1+zBXQaz5iSIfsCPm5gJ0v496OEYn60v ViAqm166WOqhw== From: Niklas Cassel To: Damien Le Moal , Niklas Cassel Cc: Werner Fischer , Daniel Drake , Mika Westerberg , Jian-Hong Pan , Dieter Mummenschanz , Mario Limonciello , linux-ide@vger.kernel.org Subject: [PATCH v2 1/5] ata: ahci: move marking of external port earlier Date: Tue, 6 Feb 2024 22:13:42 +0100 Message-ID: <20240206211352.1664816-2-cassel@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240206211352.1664816-1-cassel@kernel.org> References: <20240206211352.1664816-1-cassel@kernel.org> Precedence: bulk X-Mailing-List: linux-ide@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Move the marking of an external port earlier in the call chain. This is needed for further cleanups. No functional change intended. Reviewed-by: Damien Le Moal Signed-off-by: Niklas Cassel --- drivers/ata/ahci.c | 14 ++++++++++++++ drivers/ata/libahci.c | 7 ------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index da2e74fce2d9..aa58ce615e79 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c @@ -1642,6 +1642,18 @@ static int ahci_init_msi(struct pci_dev *pdev, unsigned int n_ports, return pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSIX); } +static void ahci_mark_external_port(struct ata_port *ap) +{ + struct ahci_host_priv *hpriv = ap->host->private_data; + void __iomem *port_mmio = ahci_port_base(ap); + u32 tmp; + + /* mark esata ports */ + tmp = readl(port_mmio + PORT_CMD); + if ((tmp & PORT_CMD_ESP) && (hpriv->cap & HOST_CAP_SXS)) + ap->pflags |= ATA_PFLAG_EXTERNAL; +} + static void ahci_update_initial_lpm_policy(struct ata_port *ap, struct ahci_host_priv *hpriv) { @@ -1934,6 +1946,8 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) if (ap->flags & ATA_FLAG_EM) ap->em_message_type = hpriv->em_msg_type; + ahci_mark_external_port(ap); + ahci_update_initial_lpm_policy(ap, hpriv); /* disabled/not-implemented port */ diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index 1a63200ea437..fca376f03c9e 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c @@ -1280,10 +1280,8 @@ static void ahci_port_init(struct device *dev, struct ata_port *ap, int port_no, void __iomem *mmio, void __iomem *port_mmio) { - struct ahci_host_priv *hpriv = ap->host->private_data; const char *emsg = NULL; int rc; - u32 tmp; /* make sure port is not active */ rc = ahci_deinit_port(ap, &emsg); @@ -1291,11 +1289,6 @@ static void ahci_port_init(struct device *dev, struct ata_port *ap, dev_warn(dev, "%s (%d)\n", emsg, rc); ahci_port_clear_pending_irq(ap); - - /* mark esata ports */ - tmp = readl(port_mmio + PORT_CMD); - if ((tmp & PORT_CMD_ESP) && (hpriv->cap & HOST_CAP_SXS)) - ap->pflags |= ATA_PFLAG_EXTERNAL; } void ahci_init_controller(struct ata_host *host)