aboutsummaryrefslogtreecommitdiffstats
path: root/com32/gplinclude/dmi/dmi_processor.h
blob: 79ee43d4b74e805d25698344b07180c54ebc453b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/* ----------------------------------------------------------------------- *
 *
 *   Copyright 2006 Erwan Velu - All Rights Reserved
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
 *   Boston MA 02111-1307, USA; either version 2 of the License, or
 *   (at your option) any later version; incorporated herein by reference.
 *
 * ----------------------------------------------------------------------- */

#ifndef DMI_PROCESSOR_H
#define DMI_PROCESSOR_H

#include "stdbool.h"
#include "string.h"
#define PROCESSOR_SOCKET_DESIGNATION_SIZE		32
#define PROCESSOR_TYPE_SIZE		32
#define PROCESSOR_FAMILY_SIZE		32
#define PROCESSOR_MANUFACTURER_SIZE     64
#define PROCESSOR_VERSION_SIZE		32
#define PROCESSOR_VOLTAGE_SIZE		16
#define PROCESSOR_STATUS_SIZE		16
#define PROCESSOR_UPGRADE_SIZE		16
#define PROCESSOR_CACHE_SIZE		16
#define PROCESSOR_SERIAL_SIZE		32
#define PROCESSOR_ASSET_TAG_SIZE	32
#define PROCESSOR_PART_NUMBER_SIZE	32
#define PROCESSOR_ID_SIZE		32

#define PROCESSOR_FLAGS_ELEMENTS	32
/* Intel AP-485 revision 28, table 5 */
extern const char *cpu_flags_strings[PROCESSOR_FLAGS_ELEMENTS];

/* this struct have PROCESSOR_FLAGS_ELEMENTS */
/* each bool is associated to the relevant message above */
typedef struct {
bool fpu;
bool vme;
bool de;
bool pse;
bool tsc;
bool msr;
bool pae;
bool mce;
bool cx8;
bool apic;
bool null_10;
bool sep;
bool mtrr;
bool pge;
bool mca;
bool cmov;
bool pat;
bool pse_36;
bool psn;
bool clfsh;
bool null_20;
bool ds;
bool acpi;
bool mmx;
bool fxsr;
bool sse;
bool sse2;
bool ss;
bool htt;
bool tm;
bool null_30;
bool pbe;
}  __attribute__((__packed__)) s_dmi_cpu_flags;

typedef struct {
uint8_t type;
uint8_t family;
uint8_t model;
uint8_t stepping;
uint8_t minor_stepping;
} __attribute__((__packed__)) s_signature;

typedef struct {
char socket_designation[PROCESSOR_SOCKET_DESIGNATION_SIZE];
char type[PROCESSOR_TYPE_SIZE];
char family[PROCESSOR_FAMILY_SIZE];
char manufacturer[PROCESSOR_MANUFACTURER_SIZE];
char version[PROCESSOR_VERSION_SIZE];
float voltage;
uint16_t  external_clock;
uint16_t  max_speed;
uint16_t  current_speed;
char status[PROCESSOR_STATUS_SIZE];
char upgrade[PROCESSOR_UPGRADE_SIZE];
char cache1[PROCESSOR_CACHE_SIZE];
char cache2[PROCESSOR_CACHE_SIZE];
char cache3[PROCESSOR_CACHE_SIZE];
char serial[PROCESSOR_SERIAL_SIZE];
char asset_tag[PROCESSOR_ASSET_TAG_SIZE];
char part_number[PROCESSOR_PART_NUMBER_SIZE];
char id[PROCESSOR_ID_SIZE];
s_dmi_cpu_flags cpu_flags;
s_signature signature;
/* The filled field have to be set to true when the dmitable implement that item */
bool filled;
} s_processor;

const char *dmi_processor_type(uint8_t code);
const char *dmi_processor_family(uint8_t code, char *manufacturer);
const char *dmi_processor_status(uint8_t code);
const char *dmi_processor_upgrade(uint8_t code);
void dmi_processor_cache(uint16_t code, const char *level, uint16_t ver, char *cache);
#endif