Message ID | 20220225181209.12642-1-pali@kernel.org |
---|---|
State | New |
Headers | show |
Series | lspci: Decode PCIe 6.0 Slot Power Limit values | expand |
On Fri, Feb 25, 2022 at 07:12:09PM +0100, Pali Rohár wrote: > When the Slot Power Limit Scale field equals 00b (1.0x) and Slot > Power Limit Value exceeds EFh, the following alternative encodings > are used: Looks good to me. Thanks!
Hi! > When the Slot Power Limit Scale field equals 00b (1.0x) and Slot > Power Limit Value exceeds EFh, the following alternative encodings > are used: [...] Thanks, applied. Martin
diff --git a/ls-caps.c b/ls-caps.c index b0caa50943d6..0b6c97b3ed75 100644 --- a/ls-caps.c +++ b/ls-caps.c @@ -659,18 +659,16 @@ static int exp_downstream_port(int type) static void show_power_limit(int value, int scale) { static const float scales[4] = { 1.0, 0.1, 0.01, 0.001 }; - static const int scale0_values[3] = { 250, 275, 300 }; - if (scale == 0 && value >= 0xF0) + if (scale == 0 && value == 0xFF) { - /* F3h to FFh = Reserved for Slot Power Limit values above 300 W */ - if (value >= 0xF3) - { - printf(">300W"); - return; - } - value = scale0_values[value - 0xF0]; + printf(">600W"); + return; } + + if (scale == 0 && value >= 0xF0 && value <= 0xFE) + value = 250 + 25 * (value - 0xF0); + printf("%gW", value * scales[scale]); }