blob: 68f51f5a674a528d6dd081cbb26e70780889e197 [file] [log] [blame]
Brad Bishop15ae2502019-06-18 21:44:24 -04001From 26742544bc9f136093b6be78259f4a891870aa3c Mon Sep 17 00:00:00 2001
Brad Bishop19323692019-04-05 15:28:33 -04002From: Dengke Du <dengke.du@windriver.com>
3Date: Wed, 21 Sep 2016 03:17:32 -0400
Brad Bishop15ae2502019-06-18 21:44:24 -04004Subject: [PATCH 2/2] lm-sensors: fix sensors-detect can't read the cpu
5 information on fsl-t4xxx
Brad Bishop19323692019-04-05 15:28:33 -04006
7This is because two reasons:
8
91. 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
132. 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
16So we need to add the ppc and arm support for this program:
17
181. add the ppc cpu information field 'cpu' in initialize_cpu_list function.
19
202. add the correspond case of ppc and arm when print cpu information in
21 print_cpu_info function.
22
23Upstream-Status: Pending
24
25Signed-off-by: Dengke Du <dengke.du@windriver.com>
26---
27 prog/detect/sensors-detect | 11 ++++++++++-
28 1 file changed, 10 insertions(+), 1 deletion(-)
29
30diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect
Brad Bishop15ae2502019-06-18 21:44:24 -040031index 68594cd7..efe2c1af 100755
Brad Bishop19323692019-04-05 15:28:33 -040032--- a/prog/detect/sensors-detect
33+++ b/prog/detect/sensors-detect
Brad Bishop15ae2502019-06-18 21:44:24 -040034@@ -3088,6 +3088,7 @@ sub kernel_version_at_least
Brad Bishop19323692019-04-05 15:28:33 -040035 # 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 Bishop15ae2502019-06-18 21:44:24 -040042@@ -3103,7 +3104,7 @@ sub initialize_cpu_list
Brad Bishop19323692019-04-05 15:28:33 -040043 };
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 Bishop15ae2502019-06-18 21:44:24 -040051@@ -3116,12 +3117,20 @@ sub initialize_cpu_list
Brad Bishop19323692019-04-05 15:28:33 -040052 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 Bishop15ae2502019-06-18 21:44:24 -0400732.21.0
Brad Bishop19323692019-04-05 15:28:33 -040074