From patchwork Mon Feb 19 20:47:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 1901134 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=NE6OCxEW; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=147.75.48.161; helo=sy.mirrors.kernel.org; envelope-from=linux-ide+bounces-590-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161]) (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 4TdvkN4ybvz1yP6 for ; Tue, 20 Feb 2024 07:47:56 +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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 07358B20EB3 for ; Mon, 19 Feb 2024 20:47:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 61382524BD; Mon, 19 Feb 2024 20:47:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NE6OCxEW" 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 20FE92C18E for ; Mon, 19 Feb 2024 20:47:50 +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=1708375671; cv=none; b=tMXAaIinreFJ4foJZvYc4rjw2QStm+OK5IRxyMu4rmP6AdxL6wNimXBlWdYvGRuBUVP7HBEQ6zO7VX80YrUmtNNqLHepMy4JtLqFqVElJa0xX1mP8nbm8h8QGVL3hzDFuqS8nmaeUmU5MCYsZxtHYK6el9Ulws/jhr37qevL+ks= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708375671; c=relaxed/simple; bh=hr3TQJcpeVBchiHfUMulkbtkqsPfXJJOMckcUvpJRak=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=fTmp3uEgBrB0BGCosuCfbuPSh0+N93IKbheYR7XZmJdiZqaXIhweTbNxdPDsT/4tkx/BYo/W1m7dsTtZBbJHQgHuNXJpueDnhExxSl2eORmMx0kZm/gDtwG7vt8xOSGHsrsD3jaNe3l0NUhPxLWyHcrWm1q9rn8iZ4QbwaODX28= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NE6OCxEW; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3955C433C7; Mon, 19 Feb 2024 20:47:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708375670; bh=hr3TQJcpeVBchiHfUMulkbtkqsPfXJJOMckcUvpJRak=; h=From:To:Cc:Subject:Date:From; b=NE6OCxEWmqzOgxocOcBxd8/h2B7RkU/1XmNKhBqCO4ClMK6uLm4LvhwtZ+G/fF4DT /95EDZbHK+4SureM8/FN/5Fb4U47ELrEomwXBmvnywffdZUF9sl71gtHfQVQksquP/ Nfust5ZH1iiYlKmxphA5p8b1hiEEnEmQXCiZWF4zEw9JhWQsyxM9udfC9Sen7yMMn/ ov+blO8i1zWM2f+IOnfR1PXq8xCdLvBe1AdvUWsnhVs+2nuIkBHwvFdJJQfSTMUWIK k0dhTGFINkjis7QbSPeZGioEo9aU4VIHHDgo9fpYb/Ti2ScocJgEh6/rxK/MuioiX7 6ShZCrQ/9/OxA== From: Niklas Cassel To: Damien Le Moal , Niklas Cassel Cc: Sergei Shtylyov , Andrey Melnikov , linux-ide@vger.kernel.org Subject: [PATCH v3] ahci: print the number of implemented ports Date: Mon, 19 Feb 2024 21:47:43 +0100 Message-ID: <20240219204744.1365567-1-cassel@kernel.org> X-Mailer: git-send-email 2.43.2 Precedence: bulk X-Mailing-List: linux-ide@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 We are currently printing the CAP.NP field. CAP.NP is a 0's based value indicating the maximum number of ports supported by the HBA silicon. Note that the number of ports indicated in this field may be more than the number of ports indicated in the PI (ports implemented) register. (See AHCI 1.3.1, section 3.1.1 - Offset 00h: CAP – HBA Capabilities.) PI (ports implemented) register is a field that has a bit set to '1' if that specific port is implemented. This register is allowed to have zeroes mixed with ones, i.e. a port in the middle is allowed to be unimplemented. (See AHCI 1.3.1, section 3.1.4 - Offset 0Ch: PI – Ports Implemented.) Since the number of ports implemented might be smaller than the maximum number of ports supported by the HBA silicon, print the number of implemented ports as well. While at it, clarify the properties being printed, and add a separator (,), as that is currently missing, making it very easy to get confused if the number before or after belongs to . before: ahci 0000:00:03.0: masking port_map 0x3f -> 0x2f ahci 0000:00:03.0: AHCI 0001.0000 32 slots 6 ports 1.5 Gbps 0x2f impl SATA mode ahci 0000:00:03.0: flags: 64bit ncq only after: ahci 0000:00:03.0: masking port_map 0x3f -> 0x2f ahci 0000:00:03.0: AHCI vers 0001.0000, 32 command slots, 1.5 Gbps, SATA mode ahci 0000:00:03.0: 5/6 ports implemented (port mask 0x2f) ahci 0000:00:03.0: flags: 64bit ncq only Suggested-by: Damien Le Moal Signed-off-by: Niklas Cassel Reviewed-by: Damien Le Moal --- Changes since V2: -Print both number of implemented ports and max number of ports. -Clarify the properties being printed. -Add a separator (,) between the printed properties. -Prints two lines instead of one, as it would otherwise be a very long line being printed. drivers/ata/libahci.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index fca376f03c9e..83431aae74d8 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c @@ -2620,8 +2620,8 @@ void ahci_print_info(struct ata_host *host, const char *scc_s) speed_s = "?"; dev_info(host->dev, - "AHCI %02x%02x.%02x%02x " - "%u slots %u ports %s Gbps 0x%x impl %s mode\n" + "AHCI vers %02x%02x.%02x%02x, " + "%u command slots, %s Gbps, %s mode\n" , (vers >> 24) & 0xff, @@ -2630,11 +2630,17 @@ void ahci_print_info(struct ata_host *host, const char *scc_s) vers & 0xff, ((cap >> 8) & 0x1f) + 1, - (cap & 0x1f) + 1, speed_s, - impl, scc_s); + dev_info(host->dev, + "%u/%u ports implemented (port mask 0x%x)\n" + , + + hweight32(impl), + (cap & 0x1f) + 1, + impl); + dev_info(host->dev, "flags: " "%s%s%s%s%s%s%s"