Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame^] | 1 | From 26742544bc9f136093b6be78259f4a891870aa3c Mon Sep 17 00:00:00 2001 |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 2 | From: Dengke Du <dengke.du@windriver.com> |
| 3 | Date: Wed, 21 Sep 2016 03:17:32 -0400 |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame^] | 4 | Subject: [PATCH 2/2] lm-sensors: fix sensors-detect can't read the cpu |
| 5 | information on fsl-t4xxx |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 6 | |
| 7 | This is because two reasons: |
| 8 | |
| 9 | 1. The sensors-detect program in lm-sensors depends on the file '/proc/cpuinfo', |
| 10 | different arch write different infomation to it. That program supports x86 |
| 11 | and x86-64 well, but weak on ppc and arm. |
| 12 | |
| 13 | 2. The sensors-detect program show the cpu information just design for intel's |
| 14 | cpu, when meets other arch, it can't output the correct information. |
| 15 | |
| 16 | So we need to add the ppc and arm support for this program: |
| 17 | |
| 18 | 1. add the ppc cpu information field 'cpu' in initialize_cpu_list function. |
| 19 | |
| 20 | 2. add the correspond case of ppc and arm when print cpu information in |
| 21 | print_cpu_info function. |
| 22 | |
| 23 | Upstream-Status: Pending |
| 24 | |
| 25 | Signed-off-by: Dengke Du <dengke.du@windriver.com> |
| 26 | --- |
| 27 | prog/detect/sensors-detect | 11 ++++++++++- |
| 28 | 1 file changed, 10 insertions(+), 1 deletion(-) |
| 29 | |
| 30 | diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame^] | 31 | index 68594cd7..efe2c1af 100755 |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 32 | --- a/prog/detect/sensors-detect |
| 33 | +++ b/prog/detect/sensors-detect |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame^] | 34 | @@ -3088,6 +3088,7 @@ sub kernel_version_at_least |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 35 | # model name and stepping, directly taken from /proc/cpuinfo. |
| 36 | use vars qw(@cpu); |
| 37 | |
| 38 | +# The added field 'cpu' is for support the ppc. |
| 39 | sub initialize_cpu_list |
| 40 | { |
| 41 | local $_; |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame^] | 42 | @@ -3103,7 +3104,7 @@ sub initialize_cpu_list |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 43 | }; |
| 44 | next; |
| 45 | } |
| 46 | - if (m/^(vendor_id|cpu family|model|model name|stepping|cpuid level)\s*:\s*(.+)$/) { |
| 47 | + if (m/^(vendor_id|cpu family|model|model name|stepping|cpuid level|cpu|revision)\s*:\s*(.+)$/) { |
| 48 | my $k = $1; |
| 49 | my $v = $2; |
| 50 | $v =~ s/\s+/ /g; # Merge multiple spaces |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame^] | 51 | @@ -3116,12 +3117,20 @@ sub initialize_cpu_list |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 52 | push @cpu, $entry if scalar keys(%{$entry}); # Last entry |
| 53 | } |
| 54 | |
| 55 | +# The field 'model name' is for ARM. |
| 56 | +# The field 'cpu' is for ppc. |
| 57 | sub print_cpu_info |
| 58 | { |
| 59 | my $cpu = $cpu[0]; |
| 60 | if ( $cpu->{'model name'} && $cpu->{'cpu family'} && $cpu->{model} && $cpu->{stepping} ) { |
| 61 | print "# Processor: $cpu->{'model name'} ($cpu->{'cpu family'}/$cpu->{model}/$cpu->{stepping})\n"; |
| 62 | } |
| 63 | + elsif ( $cpu->{'model name'} ) { |
| 64 | + print "# Processor: $cpu->{'model name'}\n"; |
| 65 | + } |
| 66 | + elsif ( $cpu->{'cpu'} && $cpu->{'revision'} ) { |
| 67 | + print "# Processor: $cpu->{'cpu'} $cpu->{'revision'}\n"; |
| 68 | + } |
| 69 | else { |
| 70 | print "# Processor: There isn't enough cpu info for this arch!!!\n"; |
| 71 | } |
| 72 | -- |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame^] | 73 | 2.21.0 |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 74 | |