This repository has been archived by the owner on Feb 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy path70-more-smbios.patch
302 lines (272 loc) · 9.71 KB
/
70-more-smbios.patch
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
--- qemu-kvm-0.12.5/roms/seabios-mac/src/smbios.h.vanilla 2011-02-23 13:47:01.000000000 +0000
+++ qemu-kvm-0.12.5/roms/seabios-mac/src/smbios.h 2011-02-23 13:47:15.000000000 +0000
@@ -60,6 +60,22 @@
u8 family_str;
} PACKED;
+/* SMBIOS type 2 - Base Board */
+struct smbios_type_2 {
+ struct smbios_structure_header header;
+ u8 manufacturer_str;
+ u8 product_str;
+ u8 version_str;
+ u8 serial_number_str;
+ u8 asset_tag_number_str;
+ u8 feature_flags;
+ u8 location_str;
+ u16 chassis_handle;
+ u8 board_type;
+ u8 contained_element_count;
+ // contained elements follow
+} PACKED;
+
/* SMBIOS type 3 - System Enclosure (v2.3) */
struct smbios_type_3 {
struct smbios_structure_header header;
@@ -97,6 +113,28 @@
u16 l1_cache_handle;
u16 l2_cache_handle;
u16 l3_cache_handle;
+ u8 serial_str;
+ u8 asset_tag_str;
+ u8 part_no_str;
+ u8 core_count;
+ u8 core_enabled;
+ u8 thread_count;
+ u16 processor_characteristics;
+} PACKED;
+
+/* SMBIOS type 7 - Cache Information (v2.0) */
+struct smbios_type_7 {
+ struct smbios_structure_header header;
+ u8 socket_designation_str;
+ u16 cache_config;
+ u16 max_cache_size;
+ u16 installed_cache_size;
+ u16 supported_sram_type;
+ u16 current_sram_type;
+ u8 cache_speed;
+ u8 error_correction;
+ u8 system_cache_type;
+ u8 associativity;
} PACKED;
/* SMBIOS type 16 - Physical Memory Array
@@ -128,6 +166,12 @@
u8 bank_locator_str;
u8 memory_type;
u16 type_detail;
+ u16 speed;
+ u8 manufactor_str;
+ u8 serial_str;
+ u8 asset_tag_str;
+ u8 part_no_str;
+ u8 attributes;
} PACKED;
/* SMBIOS type 19 - Memory Array Mapped Address */
--- qemu-kvm-0.14.0/roms/seabios-mac/src/smbios.c.orig 2011-01-27 02:05:12.000000000 +0000
+++ qemu-kvm-0.14.0/roms/seabios-mac/src/smbios.c 2011-02-23 15:12:40.360000272 +0000
@@ -29,7 +29,7 @@
memcpy(ep->anchor_string, "_SM_", 4);
ep->length = 0x1f;
ep->smbios_major_version = 2;
- ep->smbios_minor_version = 4;
+ ep->smbios_minor_version = 5;
ep->max_structure_size = max_structure_size;
ep->entry_point_revision = 0;
memset(ep->formatted_area, 0, 5);
@@ -38,7 +38,7 @@
ep->structure_table_length = structure_table_length;
ep->structure_table_address = (u32)finaltable;
ep->number_of_structures = number_of_structures;
- ep->smbios_bcd_revision = 0x24;
+ ep->smbios_bcd_revision = 0x25;
ep->checksum -= checksum(ep, 0x10);
@@ -97,8 +97,8 @@
p->header.length = sizeof(struct smbios_type_0);
p->header.handle = 0;
- load_str_field_with_default(0, vendor_str, CONFIG_APPNAME);
- load_str_field_with_default(0, bios_version_str, CONFIG_APPNAME);
+ load_str_field_with_default(0, vendor_str, "Apple Inc.");
+ load_str_field_with_default(0, bios_version_str, "IM81.88Z.00C1.B00.0802091538");
p->bios_starting_address_segment = 0xe800;
@@ -110,8 +110,10 @@
bios_characteristics),
&p->bios_characteristics)) {
memset(p->bios_characteristics, 0, 8);
- /* BIOS characteristics not supported */
- p->bios_characteristics[0] = 0x08;
+ p->bios_characteristics[0] = 0x80;
+ p->bios_characteristics[1] = 0x98;
+ p->bios_characteristics[2] = 0x09;
+ p->bios_characteristics[3] = 0x78;
}
if (!qemu_cfg_smbios_load_field(0, offsetof(struct smbios_type_0,
@@ -146,10 +148,10 @@
p->header.length = sizeof(struct smbios_type_1);
p->header.handle = 0x100;
- load_str_field_with_default(1, manufacturer_str, CONFIG_APPNAME);
- load_str_field_with_default(1, product_name_str, CONFIG_APPNAME);
- load_str_field_or_skip(1, version_str);
- load_str_field_or_skip(1, serial_number_str);
+ load_str_field_with_default(1, manufacturer_str, "Apple Inc.");
+ load_str_field_with_default(1, product_name_str, "iMac8,1");
+ load_str_field_with_default(1, version_str, "1.0");
+ load_str_field_with_default(1, serial_number_str, "SystemSerial#");
if (!qemu_cfg_smbios_load_field(1, offsetof(struct smbios_type_1,
uuid), &p->uuid)) {
@@ -158,8 +160,8 @@
set_field_with_default(1, wake_up_type, 0x06); /* power switch */
- load_str_field_or_skip(1, sku_number_str);
- load_str_field_or_skip(1, family_str);
+ load_str_field_with_default(1, sku_number_str, "SKU#");
+ load_str_field_with_default(1, family_str, "Mac");
*end = 0;
end++;
@@ -171,6 +173,44 @@
return end;
}
+/* Type 2 -- Base Board */
+static void *
+smbios_init_type_2(void *start)
+{
+ struct smbios_type_2 *p = (struct smbios_type_2 *)start;
+
+ p->header.type = 2;
+ p->header.length = sizeof(struct smbios_type_2);
+ p->header.handle = 0x300;
+
+ p->manufacturer_str = 1;
+ p->product_str = 2;
+ p->version_str = 3;
+ p->serial_number_str = 4;
+ p->asset_tag_number_str = 0;
+ p->feature_flags = 1; /* Motherboard */
+ p->location_str = 0;
+ p->chassis_handle = 0x301;
+ p->board_type = 0x0a; /* Motherboard */
+ p->contained_element_count = 0;
+
+ start += sizeof(struct smbios_type_2);
+ memcpy((char *)start, "Apple Inc.", sizeof("Apple Inc."));
+ start += sizeof("Apple Inc.");
+
+ memcpy((char *)start, "Mac-F227BEC8", sizeof("Mac-F227BEC8"));
+ start += sizeof("Mac-F227BEC8");
+
+ memcpy((char *)start, "VERSION", sizeof("VERSION"));
+ start += sizeof("VERSION");
+
+ memcpy((char *)start, "BoardSerial#", sizeof("BoardSerial#"));
+ start += sizeof("BoardSerial#");
+
+ *((u8 *)start) = 0;
+ return start + 1;
+}
+
/* Type 3 -- System Enclosure */
static void *
smbios_init_type_3(void *start)
@@ -182,13 +222,13 @@
p->header.type = 3;
p->header.length = sizeof(struct smbios_type_3);
- p->header.handle = 0x300;
+ p->header.handle = 0x301;
load_str_field_with_default(3, manufacturer_str, CONFIG_APPNAME);
set_field_with_default(3, type, 0x01); /* other */
- load_str_field_or_skip(3, version_str);
- load_str_field_or_skip(3, serial_number_str);
+ load_str_field_with_default(3, version_str, "VERSION");
+ load_str_field_with_default(3, serial_number_str, "ChassisSerial#");
load_str_field_or_skip(3, asset_tag_number_str);
set_field_with_default(3, boot_up_state, 0x03); /* safe */
@@ -252,7 +292,7 @@
load_str_field_or_skip(4, processor_version_str);
set_field_with_default(4, voltage, 0);
- set_field_with_default(4, external_clock, 0);
+ set_field_with_default(4, external_clock, 800);
set_field_with_default(4, max_speed, 2000);
set_field_with_default(4, current_speed, 2000);
@@ -261,9 +301,16 @@
set_field_with_default(4, processor_upgrade, 0x01); /* other */
/* cache information structure not provided */
- p->l1_cache_handle = 0xffff;
- p->l2_cache_handle = 0xffff;
- p->l3_cache_handle = 0xffff;
+ p->l1_cache_handle = 0x600 + cpu_number * 2;
+ p->l2_cache_handle = 0x600 + cpu_number * 2 + 1;
+ p->l3_cache_handle = 0xffff; /* cache information structure not provided */
+
+ p->asset_tag_str = 0;
+ p->part_no_str = 0;
+ p->core_count = 2;
+ p->core_enabled = 2;
+ p->thread_count = 2;
+ p->processor_characteristics = 0;
*end = 0;
end++;
@@ -275,6 +322,35 @@
return end;
}
+static void *
+smbios_init_type_7(void *start, unsigned int cpu_number, unsigned int level)
+{
+ struct smbios_type_7 *p = (struct smbios_type_7 *)start;
+
+ p->header.type = 7;
+ p->header.length = sizeof(struct smbios_type_7);
+ p->header.handle = 0x600 + cpu_number * 2 + level - 1;
+
+ p->socket_designation_str = 1;
+ p->cache_config = 0x80 & (level - 1); /* enabled + level */
+ p->max_cache_size = p->installed_cache_size =
+ level == 1 ? 64 : 512; /* 1k granularity */
+ p->supported_sram_type = p->current_sram_type =
+ 0x08 & 0x10 & 0x80; /* Burst, Pipeline Burst, Asynchronous */
+ p->cache_speed = 0; /* in ns, 0 for unknown */
+ p->error_correction = 0x05; /* Single-bit ECC */
+ p->system_cache_type = 0x05; /* Unified */
+ p->associativity = 0x06; /* Fully Associative */
+
+ start += sizeof(struct smbios_type_7);
+
+ snprintf((char*)start, 9, "L%d Cache", level);
+ start += 9;
+
+ *((u8 *)start) = 0;
+ return start + 1;
+}
+
/* Type 16 -- Physical Memory Array */
static void *
smbios_init_type_16(void *start, u32 memory_size_mb, int nr_mem_devs)
@@ -315,6 +391,8 @@
p->header.length = sizeof(struct smbios_type_17);
p->header.handle = 0x1100 + instance;
+ p->speed = 667;
+ p->attributes = 0;
p->physical_memory_array_handle = 0x1000;
set_field_with_default(17, total_width, 64);
set_field_with_default(17, data_width, 64);
@@ -335,7 +413,10 @@
end += strlen(name) + 1;
p->device_locator_str = ++str_index;
- load_str_field_or_skip(17, bank_locator_str);
+ load_str_field_with_default(17, bank_locator_str, "Bank 0");
+ load_str_field_with_default(17, manufactor_str, "Manufactor");
+ load_str_field_with_default(17, serial_str, "MemSerial#");
+
set_field_with_default(17, memory_type, 0x07); /* RAM */
set_field_with_default(17, type_detail, 0);
@@ -463,11 +544,15 @@
add_struct(0, p);
add_struct(1, p);
+ add_struct(2, p);
add_struct(3, p);
int cpu_num;
- for (cpu_num = 1; cpu_num <= MaxCountCPUs; cpu_num++)
+ for (cpu_num = 1; cpu_num <= MaxCountCPUs; cpu_num++) {
add_struct(4, p, cpu_num);
+ add_struct(7, p, cpu_num, 1); /* L1 & L2 cache */
+ add_struct(7, p, cpu_num, 2);
+ }
int ram_mb = (RamSize + RamSizeOver4G) >> 20;
int nr_mem_devs = (ram_mb + 0x3fff) >> 14;