• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* ----------------------------------------------------------------------- *
2  *
3  *   Copyright 2006 Erwan Velu - All Rights Reserved
4  *
5  *   This program is free software; you can redistribute it and/or modify
6  *   it under the terms of the GNU General Public License as published by
7  *   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
8  *   Boston MA 02111-1307, USA; either version 2 of the License, or
9  *   (at your option) any later version; incorporated herein by reference.
10  *
11  * ----------------------------------------------------------------------- */
12 
13 #ifndef DMI_PROCESSOR_H
14 #define DMI_PROCESSOR_H
15 
16 #include "stdbool.h"
17 #include "string.h"
18 #define PROCESSOR_SOCKET_DESIGNATION_SIZE		65
19 #define PROCESSOR_TYPE_SIZE		32
20 #define PROCESSOR_FAMILY_SIZE		32
21 #define PROCESSOR_MANUFACTURER_SIZE     65
22 #define PROCESSOR_VERSION_SIZE		65
23 #define PROCESSOR_VOLTAGE_SIZE		16
24 #define PROCESSOR_STATUS_SIZE		16
25 #define PROCESSOR_UPGRADE_SIZE		16
26 #define PROCESSOR_CACHE_SIZE		16
27 #define PROCESSOR_SERIAL_SIZE		65
28 #define PROCESSOR_ASSET_TAG_SIZE	65
29 #define PROCESSOR_PART_NUMBER_SIZE	65
30 #define PROCESSOR_ID_SIZE		32
31 
32 #define PROCESSOR_FLAGS_ELEMENTS	32
33 /* Intel AP-485 revision 28, table 5 */
34 extern const char *cpu_flags_strings[PROCESSOR_FLAGS_ELEMENTS];
35 
36 /* this struct have PROCESSOR_FLAGS_ELEMENTS */
37 /* each bool is associated to the relevant message above */
38 typedef struct {
39     bool fpu;
40     bool vme;
41     bool de;
42     bool pse;
43     bool tsc;
44     bool msr;
45     bool pae;
46     bool mce;
47     bool cx8;
48     bool apic;
49     bool null_10;
50     bool sep;
51     bool mtrr;
52     bool pge;
53     bool mca;
54     bool cmov;
55     bool pat;
56     bool pse_36;
57     bool psn;
58     bool clfsh;
59     bool null_20;
60     bool ds;
61     bool acpi;
62     bool mmx;
63     bool fxsr;
64     bool sse;
65     bool sse2;
66     bool ss;
67     bool htt;
68     bool tm;
69     bool null_30;
70     bool pbe;
71 } __attribute__ ((__packed__)) s_dmi_cpu_flags;
72 
73 typedef struct {
74     uint8_t type;
75     uint8_t family;
76     uint8_t model;
77     uint8_t stepping;
78     uint8_t minor_stepping;
79 } __attribute__ ((__packed__)) s_signature;
80 
81 typedef struct {
82     char socket_designation[PROCESSOR_SOCKET_DESIGNATION_SIZE];
83     char type[PROCESSOR_TYPE_SIZE];
84     char family[PROCESSOR_FAMILY_SIZE];
85     char manufacturer[PROCESSOR_MANUFACTURER_SIZE];
86     char version[PROCESSOR_VERSION_SIZE];
87     uint16_t voltage_mv;
88     uint16_t external_clock;
89     uint16_t max_speed;
90     uint16_t current_speed;
91     char status[PROCESSOR_STATUS_SIZE];
92     char upgrade[PROCESSOR_UPGRADE_SIZE];
93     char cache1[PROCESSOR_CACHE_SIZE];
94     char cache2[PROCESSOR_CACHE_SIZE];
95     char cache3[PROCESSOR_CACHE_SIZE];
96     char serial[PROCESSOR_SERIAL_SIZE];
97     char asset_tag[PROCESSOR_ASSET_TAG_SIZE];
98     char part_number[PROCESSOR_PART_NUMBER_SIZE];
99     char id[PROCESSOR_ID_SIZE];
100     uint16_t core_count;
101     uint16_t core_enabled;
102     uint16_t thread_count;
103     s_dmi_cpu_flags cpu_flags;
104     s_signature signature;
105 /* The filled field have to be set to true when the dmitable implement that item */
106     bool filled;
107 } s_processor;
108 
109 const char *dmi_processor_type(uint8_t code);
110 const char *dmi_processor_family(uint8_t code, char *manufacturer);
111 const char *dmi_processor_status(uint8_t code);
112 const char *dmi_processor_upgrade(uint8_t code);
113 void dmi_processor_cache(uint16_t code, const char *level, uint16_t ver,
114 			 char *cache);
115 #endif
116