hdt: fix conflict
[profile/ivi/syslinux.git] / com32 / hdt / hdt-menu-processor.c
1 /* ----------------------------------------------------------------------- *
2  *
3  *   Copyright 2009 Erwan Velu - All Rights Reserved
4  *
5  *   Permission is hereby granted, free of charge, to any person
6  *   obtaining a copy of this software and associated documentation
7  *   files (the "Software"), to deal in the Software without
8  *   restriction, including without limitation the rights to use,
9  *   copy, modify, merge, publish, distribute, sublicense, and/or
10  *   sell copies of the Software, and to permit persons to whom
11  *   the Software is furnished to do so, subject to the following
12  *   conditions:
13  *
14  *   The above copyright notice and this permission notice shall
15  *   be included in all copies or substantial portions of the Software.
16  *
17  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19  *   OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20  *   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21  *   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22  *   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23  *   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24  *   OTHER DEALINGS IN THE SOFTWARE.
25  *
26  * -----------------------------------------------------------------------
27  */
28
29 #include "hdt-menu.h"
30
31 /* Compute Processor menu */
32 void compute_processor(struct s_my_menu *menu, struct s_hardware *hardware)
33 {
34   char buffer[SUBMENULEN + 1];
35   char buffer1[SUBMENULEN + 1];
36   char statbuffer[STATLEN + 1];
37
38   menu->menu = add_menu(" Main Processor ", -1);
39   menu->items_count = 0;
40   set_menu_pos(SUBMENU_Y, SUBMENU_X);
41
42   snprintf(buffer, sizeof buffer, "Vendor    : %s", hardware->cpu.vendor);
43   snprintf(statbuffer, sizeof statbuffer, "Vendor: %s",
44      hardware->cpu.vendor);
45   add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
46   menu->items_count++;
47
48   snprintf(buffer, sizeof buffer, "Model     : %s", del_multi_spaces(hardware->cpu.model));
49   snprintf(statbuffer, sizeof statbuffer, "Model: %s",
50      del_multi_spaces(hardware->cpu.model));
51   add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
52   menu->items_count++;
53
54   snprintf(buffer, sizeof buffer, "Vendor ID : %d",
55      hardware->cpu.vendor_id);
56   snprintf(statbuffer, sizeof statbuffer, "Vendor ID: %d",
57      hardware->cpu.vendor_id);
58   add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
59   menu->items_count++;
60
61   snprintf(buffer, sizeof buffer, "Family ID : %d", hardware->cpu.family);
62   snprintf(statbuffer, sizeof statbuffer, "Family ID: %d",
63      hardware->cpu.family);
64   add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
65   menu->items_count++;
66
67   snprintf(buffer, sizeof buffer, "Model  ID : %d",
68      hardware->cpu.model_id);
69   snprintf(statbuffer, sizeof statbuffer, "Model  ID: %d",
70      hardware->cpu.model_id);
71   add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
72   menu->items_count++;
73
74   snprintf(buffer, sizeof buffer, "Stepping  : %d",
75      hardware->cpu.stepping);
76   snprintf(statbuffer, sizeof statbuffer, "Stepping: %d",
77      hardware->cpu.stepping);
78   add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
79   menu->items_count++;
80
81   if (hardware->is_dmi_valid) {
82     snprintf(buffer, sizeof buffer, "FSB       : %d",
83        hardware->dmi.processor.external_clock);
84     snprintf(statbuffer, sizeof statbuffer,
85        "Front Side Bus (MHz): %d",
86        hardware->dmi.processor.external_clock);
87     add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
88     menu->items_count++;
89
90     snprintf(buffer, sizeof buffer, "Cur. Speed: %d",
91        hardware->dmi.processor.current_speed);
92     snprintf(statbuffer, sizeof statbuffer,
93        "Current Speed (MHz): %d",
94        hardware->dmi.processor.current_speed);
95     add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
96     menu->items_count++;
97
98     snprintf(buffer, sizeof buffer, "Max Speed : %d",
99        hardware->dmi.processor.max_speed);
100     snprintf(statbuffer, sizeof statbuffer, "Max Speed (MHz): %d",
101        hardware->dmi.processor.max_speed);
102     add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
103     menu->items_count++;
104
105     snprintf(buffer, sizeof buffer, "Upgrade   : %s",
106        hardware->dmi.processor.upgrade);
107     snprintf(statbuffer, sizeof statbuffer, "Upgrade: %s",
108        hardware->dmi.processor.upgrade);
109     add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
110     menu->items_count++;
111   }
112
113   if (hardware->cpu.flags.smp) {
114     snprintf(buffer, sizeof buffer, "SMP       : Yes");
115     snprintf(statbuffer, sizeof statbuffer, "SMP: Yes");
116   } else {
117     snprintf(buffer, sizeof buffer, "SMP       : No");
118     snprintf(statbuffer, sizeof statbuffer, "SMP: No");
119   }
120   add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
121   menu->items_count++;
122
123   if (hardware->cpu.flags.lm) {
124     snprintf(buffer, sizeof buffer, "x86_64    : Yes");
125     snprintf(statbuffer, sizeof statbuffer,
126        "x86_64 compatible processor: Yes");
127   } else {
128     snprintf(buffer, sizeof buffer, "X86_64    : No");
129     snprintf(statbuffer, sizeof statbuffer,
130        "X86_64 compatible processor: No");
131   }
132   add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
133   menu->items_count++;
134
135   buffer1[0] = '\0';
136   if (hardware->cpu.flags.fpu)
137     strcat(buffer1, "fpu ");
138   if (hardware->cpu.flags.vme)
139     strcat(buffer1, "vme ");
140   if (hardware->cpu.flags.de)
141     strcat(buffer1, "de ");
142   if (hardware->cpu.flags.pse)
143     strcat(buffer1, "pse ");
144   if (hardware->cpu.flags.tsc)
145     strcat(buffer1, "tsc ");
146   if (hardware->cpu.flags.msr)
147     strcat(buffer1, "msr ");
148   if (hardware->cpu.flags.pae)
149     strcat(buffer1, "pae ");
150   snprintf(buffer, sizeof buffer, "Flags     : %s", buffer1);
151   snprintf(statbuffer, sizeof statbuffer, "Flags: %s", buffer1);
152   add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
153   menu->items_count++;
154
155   buffer1[0] = '\0';
156   if (hardware->cpu.flags.mce)
157     strcat(buffer1, "mce ");
158   if (hardware->cpu.flags.cx8)
159     strcat(buffer1, "cx8 ");
160   if (hardware->cpu.flags.apic)
161     strcat(buffer1, "apic ");
162   if (hardware->cpu.flags.sep)
163     strcat(buffer1, "sep ");
164   if (hardware->cpu.flags.mtrr)
165     strcat(buffer1, "mtrr ");
166   if (hardware->cpu.flags.pge)
167     strcat(buffer1, "pge ");
168   if (hardware->cpu.flags.mca)
169     strcat(buffer1, "mca ");
170   snprintf(buffer, sizeof buffer, "Flags     : %s", buffer1);
171   snprintf(statbuffer, sizeof statbuffer, "Flags: %s", buffer1);
172   add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
173   menu->items_count++;
174
175   buffer1[0] = '\0';
176   if (hardware->cpu.flags.cmov)
177     strcat(buffer1, "cmov ");
178   if (hardware->cpu.flags.pat)
179     strcat(buffer1, "pat ");
180   if (hardware->cpu.flags.pse_36)
181     strcat(buffer1, "pse_36 ");
182   if (hardware->cpu.flags.psn)
183     strcat(buffer1, "psn ");
184   if (hardware->cpu.flags.clflsh)
185     strcat(buffer1, "clflsh ");
186   snprintf(buffer, sizeof buffer, "Flags     : %s", buffer1);
187   snprintf(statbuffer, sizeof statbuffer, "Flags: %s", buffer1);
188   add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
189   menu->items_count++;
190
191   buffer1[0] = '\0';
192   if (hardware->cpu.flags.dts)
193     strcat(buffer1, "dts ");
194   if (hardware->cpu.flags.acpi)
195     strcat(buffer1, "acpi ");
196   if (hardware->cpu.flags.mmx)
197     strcat(buffer1, "mmx ");
198   if (hardware->cpu.flags.sse)
199     strcat(buffer1, "sse ");
200   snprintf(buffer, sizeof buffer, "Flags     : %s", buffer1);
201   snprintf(statbuffer, sizeof statbuffer, "Flags: %s", buffer1);
202   add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
203   menu->items_count++;
204
205   buffer1[0] = '\0';
206   if (hardware->cpu.flags.sse2)
207     strcat(buffer1, "sse2 ");
208   if (hardware->cpu.flags.ss)
209     strcat(buffer1, "ss ");
210   if (hardware->cpu.flags.htt)
211     strcat(buffer1, "ht ");
212   if (hardware->cpu.flags.acc)
213     strcat(buffer1, "acc ");
214   if (hardware->cpu.flags.syscall)
215     strcat(buffer1, "syscall ");
216   if (hardware->cpu.flags.mp)
217     strcat(buffer1, "mp ");
218   snprintf(buffer, sizeof buffer, "Flags     : %s", buffer1);
219   snprintf(statbuffer, sizeof statbuffer, "Flags: %s", buffer1);
220   add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
221   menu->items_count++;
222
223   buffer1[0] = '\0';
224   if (hardware->cpu.flags.nx)
225     strcat(buffer1, "nx ");
226   if (hardware->cpu.flags.mmxext)
227     strcat(buffer1, "mmxext ");
228   if (hardware->cpu.flags.lm)
229     strcat(buffer1, "lm ");
230   if (hardware->cpu.flags.nowext)
231     strcat(buffer1, "3dnowext ");
232   if (hardware->cpu.flags.now)
233     strcat(buffer1, "3dnow! ");
234   snprintf(buffer, sizeof buffer, "Flags     : %s", buffer1);
235   snprintf(statbuffer, sizeof statbuffer, "Flags: %s", buffer1);
236   add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
237   menu->items_count++;
238
239   printf("MENU: Processor menu done (%d items)\n", menu->items_count);
240 }