Subversion Repositories Kolibri OS

Rev

Rev 6082 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6082 Rev 6336
1
#ifndef __DMI_H__
1
#ifndef __DMI_H__
2
#define __DMI_H__
2
#define __DMI_H__
3
 
3
 
4
#include 
4
#include 
-
 
5
#include 
5
#include 
6
#include 
6
 
7
 
7
/* enum dmi_field is in mod_devicetable.h */
8
/* enum dmi_field is in mod_devicetable.h */
8
 
9
 
9
enum dmi_device_type {
10
enum dmi_device_type {
10
	DMI_DEV_TYPE_ANY = 0,
11
	DMI_DEV_TYPE_ANY = 0,
11
	DMI_DEV_TYPE_OTHER,
12
	DMI_DEV_TYPE_OTHER,
12
	DMI_DEV_TYPE_UNKNOWN,
13
	DMI_DEV_TYPE_UNKNOWN,
13
	DMI_DEV_TYPE_VIDEO,
14
	DMI_DEV_TYPE_VIDEO,
14
	DMI_DEV_TYPE_SCSI,
15
	DMI_DEV_TYPE_SCSI,
15
	DMI_DEV_TYPE_ETHERNET,
16
	DMI_DEV_TYPE_ETHERNET,
16
	DMI_DEV_TYPE_TOKENRING,
17
	DMI_DEV_TYPE_TOKENRING,
17
	DMI_DEV_TYPE_SOUND,
18
	DMI_DEV_TYPE_SOUND,
18
	DMI_DEV_TYPE_PATA,
19
	DMI_DEV_TYPE_PATA,
19
	DMI_DEV_TYPE_SATA,
20
	DMI_DEV_TYPE_SATA,
20
	DMI_DEV_TYPE_SAS,
21
	DMI_DEV_TYPE_SAS,
21
	DMI_DEV_TYPE_IPMI = -1,
22
	DMI_DEV_TYPE_IPMI = -1,
22
	DMI_DEV_TYPE_OEM_STRING = -2,
23
	DMI_DEV_TYPE_OEM_STRING = -2,
23
	DMI_DEV_TYPE_DEV_ONBOARD = -3,
24
	DMI_DEV_TYPE_DEV_ONBOARD = -3,
24
};
25
};
25
 
26
 
26
enum dmi_entry_type {
27
enum dmi_entry_type {
27
	DMI_ENTRY_BIOS = 0,
28
	DMI_ENTRY_BIO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UILTIN_POINTING_DEV,
49
	DMI_ENTRY_BUILTIN_POINTING_DEV,
49
	DMI_ENTRY_PORTABLE_BATTERY,
50
	DMI_ENTRY_PORTABLE_BATTERY,
50
	DMI_ENTRY_SYSTEM_RESET,
51
	DMI_ENTRY_SYSTEM_RESET,
51
	DMI_ENTRY_HW_SECURITY,
52
	DMI_ENTRY_HW_SECURITY,
52
	DMI_ENTRY_SYSTEM_POWER_CONTROLS,
53
	DMI_ENTRY_SYSTEM_POWER_CONTROLS,
53
	DMI_ENTRY_VOLTAGE_PROBE,
54
	DMI_ENTRY_VOLTAGE_PROBE,
54
	DMI_ENTRY_COOLING_DEV,
55
	DMI_ENTRY_COOLING_DEV,
55
	DMI_ENTRY_TEMP_PROBE,
56
	DMI_ENTRY_TEMP_PROBE,
56
	DMI_ENTRY_ELECTRICAL_CURRENT_PROBE,
57
	DMI_ENTRY_ELECTRICAL_CURRENT_PROBE,
57
	DMI_ENTRY_OOB_REMOTE_ACCESS,
58
	DMI_ENTRY_OOB_REMOTE_ACCESS,
58
	DMI_ENTRY_BIS_ENTRY,
59
	DMI_ENTRY_BIS_ENTRY,
59
	DMI_ENTRY_SYSTEM_BOOT,
60
	DMI_ENTRY_SYSTEM_BOOT,
60
	DMI_ENTRY_MGMT_DEV,
61
	DMI_ENTRY_MGMT_DEV,
61
	DMI_ENTRY_MGMT_DEV_COMPONENT,
62
	DMI_ENTRY_MGMT_DEV_COMPONENT,
62
	DMI_ENTRY_MGMT_DEV_THRES,
63
	DMI_ENTRY_MGMT_DEV_THRES,
63
	DMI_ENTRY_MEM_CHANNEL,
64
	DMI_ENTRY_MEM_CHANNEL,
64
	DMI_ENTRY_IPMI_DEV,
65
	DMI_ENTRY_IPMI_DEV,
65
	DMI_ENTRY_SYS_POWER_SUPPLY,
66
	DMI_ENTRY_SYS_POWER_SUPPLY,
66
	DMI_ENTRY_ADDITIONAL,
67
	DMI_ENTRY_ADDITIONAL,
67
	DMI_ENTRY_ONBOARD_DEV_EXT,
68
	DMI_ENTRY_ONBOARD_DEV_EXT,
68
	DMI_ENTRY_MGMT_CONTROLLER_HOST,
69
	DMI_ENTRY_MGMT_CONTROLLER_HOST,
69
	DMI_ENTRY_INACTIVE = 126,
70
	DMI_ENTRY_INACTIVE = 126,
70
	DMI_ENTRY_END_OF_TABLE = 127,
71
	DMI_ENTRY_END_OF_TABLE = 127,
71
};
72
};
72
 
73
 
73
struct dmi_header {
74
struct dmi_header {
74
	u8 type;
75
	u8 type;
75
	u8 length;
76
	u8 length;
76
	u16 handle;
77
	u16 handle;
77
} __packed;
78
} __packed;
78
 
79
 
79
struct dmi_device {
80
struct dmi_device {
80
	struct list_head list;
81
	struct list_head list;
81
	int type;
82
	int type;
82
	const char *name;
83
	const char *name;
83
	void *device_data;	/* Type specific data */
84
	void *device_data;	/* Type specific data */
84
};
85
};
85
 
86
 
86
#ifdef CONFIG_DMI
87
#ifdef CONFIG_DMI
87
 
88
 
88
struct dmi_dev_onboard {
89
struct dmi_dev_onboard {
89
	struct dmi_device dev;
90
	struct dmi_device dev;
90
	int instance;
91
	int instance;
91
	int segment;
92
	int segment;
92
	int bus;
93
	int bus;
93
	int devfn;
94
	int devfn;
94
};
95
};
-
 
96
 
95
 
97
extern struct kobject *dmi_kobj;
96
extern int dmi_check_system(const struct dmi_system_id *list);
98
extern int dmi_check_system(const struct dmi_system_id *list);
97
const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list);
99
const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list);
98
extern const char * dmi_get_system_info(int field);
100
extern const char * dmi_get_system_info(int field);
99
extern const struct dmi_device * dmi_find_device(int type, const char *name,
101
extern const struct dmi_device * dmi_find_device(int type, const char *name,
100
	const struct dmi_device *from);
102
	const struct dmi_device *from);
101
extern void dmi_scan_machine(void);
103
extern void dmi_scan_machine(void);
102
extern void dmi_memdev_walk(void);
104
extern void dmi_memdev_walk(void);
103
extern void dmi_set_dump_stack_arch_desc(void);
105
extern void dmi_set_dump_stack_arch_desc(void);
104
extern bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp);
106
extern bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp);
105
extern int dmi_name_in_vendors(const char *str);
107
extern int dmi_name_in_vendors(const char *str);
106
extern int dmi_name_in_serial(const char *str);
108
extern int dmi_name_in_serial(const char *str);
107
extern int dmi_available;
109
extern int dmi_available;
108
extern int dmi_walk(void (*decode)(const struct dmi_header *, void *),
110
extern int dmi_walk(void (*decode)(const struct dmi_header *, void *),
109
	void *private_data);
111
	void *private_data);
110
extern bool dmi_match(enum dmi_field f, const char *str);
112
extern bool dmi_match(enum dmi_field f, const char *str);
111
extern void dmi_memdev_name(u16 handle, const char **bank, const char **device);
113
extern void dmi_memdev_name(u16 handle, const char **bank, const char **device);
112
 
114
 
113
#else
115
#else
114
 
116
 
115
static inline int dmi_check_system(const struct dmi_system_id *list) { return 0; }
117
static inline int dmi_check_system(const struct dmi_system_id *list) { return 0; }
116
static inline const char * dmi_get_system_info(int field) { return NULL; }
118
static inline const char * dmi_get_system_info(int field) { return NULL; }
117
static inline const struct dmi_device * dmi_find_device(int type, const char *name,
119
static inline const struct dmi_device * dmi_find_device(int type, const char *name,
118
	const struct dmi_device *from) { return NULL; }
120
	const struct dmi_device *from) { return NULL; }
119
static inline void dmi_scan_machine(void) { return; }
121
static inline void dmi_scan_machine(void) { return; }
120
static inline void dmi_memdev_walk(void) { }
122
static inline void dmi_memdev_walk(void) { }
121
static inline void dmi_set_dump_stack_arch_desc(void) { }
123
static inline void dmi_set_dump_stack_arch_desc(void) { }
122
static inline bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp)
124
static inline bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp)
123
{
125
{
124
	if (yearp)
126
	if (yearp)
125
		*yearp = 0;
127
		*yearp = 0;
126
	if (monthp)
128
	if (monthp)
127
		*monthp = 0;
129
		*monthp = 0;
128
	if (dayp)
130
	if (dayp)
129
		*dayp = 0;
131
		*dayp = 0;
130
	return false;
132
	return false;
131
}
133
}
132
static inline int dmi_name_in_vendors(const char *s) { return 0; }
134
static inline int dmi_name_in_vendors(const char *s) { return 0; }
133
static inline int dmi_name_in_serial(const char *s) { return 0; }
135
static inline int dmi_name_in_serial(const char *s) { return 0; }
134
#define dmi_available 0
136
#define dmi_available 0
135
static inline int dmi_walk(void (*decode)(const struct dmi_header *, void *),
137
static inline int dmi_walk(void (*decode)(const struct dmi_header *, void *),
136
	void *private_data) { return -1; }
138
	void *private_data) { return -1; }
137
static inline bool dmi_match(enum dmi_field f, const char *str)
139
static inline bool dmi_match(enum dmi_field f, const char *str)
138
	{ return false; }
140
	{ return false; }
139
static inline void dmi_memdev_name(u16 handle, const char **bank,
141
static inline void dmi_memdev_name(u16 handle, const char **bank,
140
		const char **device) { }
142
		const char **device) { }
141
static inline const struct dmi_system_id *
143
static inline const struct dmi_system_id *
142
	dmi_first_match(const struct dmi_system_id *list) { return NULL; }
144
	dmi_first_match(const struct dmi_system_id *list) { return NULL; }
143
 
145
 
144
#endif
146
#endif
145
 
147
 
146
#endif	/* __DMI_H__ */
148
#endif	/* __DMI_H__ */