Skip to content

Commit 13ec409

Browse files
committed
ahci: print the number of implemented ports
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 <property> belongs to <property>. 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 <[email protected]> Reviewed-by: Damien Le Moal <[email protected]> Signed-off-by: Niklas Cassel <[email protected]>
1 parent a783b2a commit 13ec409

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

drivers/ata/libahci.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2620,8 +2620,8 @@ void ahci_print_info(struct ata_host *host, const char *scc_s)
26202620
speed_s = "?";
26212621

26222622
dev_info(host->dev,
2623-
"AHCI %02x%02x.%02x%02x "
2624-
"%u slots %u ports %s Gbps 0x%x impl %s mode\n"
2623+
"AHCI vers %02x%02x.%02x%02x, "
2624+
"%u command slots, %s Gbps, %s mode\n"
26252625
,
26262626

26272627
(vers >> 24) & 0xff,
@@ -2630,11 +2630,17 @@ void ahci_print_info(struct ata_host *host, const char *scc_s)
26302630
vers & 0xff,
26312631

26322632
((cap >> 8) & 0x1f) + 1,
2633-
(cap & 0x1f) + 1,
26342633
speed_s,
2635-
impl,
26362634
scc_s);
26372635

2636+
dev_info(host->dev,
2637+
"%u/%u ports implemented (port mask 0x%x)\n"
2638+
,
2639+
2640+
hweight32(impl),
2641+
(cap & 0x1f) + 1,
2642+
impl);
2643+
26382644
dev_info(host->dev,
26392645
"flags: "
26402646
"%s%s%s%s%s%s%s"

0 commit comments

Comments
 (0)