]>
Commit | Line | Data |
---|---|---|
93afd047 MT |
1 | #include <stdio.h> |
2 | #include <stdlib.h> | |
3 | #include <string.h> | |
4 | #include <ctype.h> | |
5 | #include <stdarg.h> | |
6 | ||
7 | #include "hd.h" | |
8 | #include "hd_int.h" | |
9 | #include "hdp.h" | |
10 | #include "hddb.h" | |
11 | #include "smbios.h" | |
12 | ||
13 | ||
14 | /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
15 | * This module provides a function that prints a hardware entry. | |
16 | * This is useful for debugging or to provide the user with some fancy info. | |
17 | * | |
18 | * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
19 | */ | |
20 | ||
21 | #ifndef LIBHD_TINY | |
22 | ||
23 | #define dump_line(x0, x1...) fprintf(f, "%*s" x0, ind, "", x1) | |
24 | #define dump_line_str(x0...) fprintf(f, "%*s%s", ind, "", x0) | |
25 | #define dump_line0(x0...) fprintf(f, x0) | |
26 | ||
27 | static int ind = 0; /* output indentation */ | |
28 | ||
29 | static void dump_normal(hd_data_t *, hd_t *, FILE *); | |
30 | static void dump_cpu(hd_data_t *, hd_t *, FILE *); | |
31 | static void dump_bios(hd_data_t *, hd_t *, FILE *); | |
32 | static void dump_prom(hd_data_t *, hd_t *, FILE *); | |
33 | static void dump_sys(hd_data_t *, hd_t *, FILE *); | |
34 | ||
35 | static char *dump_hid(hd_data_t *hd_data, hd_id_t *hid, int format, char *buf, int buf_size); | |
36 | static char *dump_hid2(hd_data_t *hd_data, hd_id_t *hid1, hd_id_t *hid2, char *buf, int buf_size); | |
37 | static char *print_dev_num(hd_dev_num_t *d); | |
38 | ||
39 | /* | |
40 | * Dump a hardware entry to FILE *f. | |
41 | */ | |
42 | void hd_dump_entry(hd_data_t *hd_data, hd_t *h, FILE *f) | |
43 | { | |
44 | char *s, *a0, *a1, *a2, *s1, *s2; | |
45 | char buf1[32], buf2[32]; | |
46 | hd_t *hd_tmp; | |
47 | int i, j; | |
48 | str_list_t *sl; | |
49 | ||
50 | #ifdef LIBHD_MEMCHECK | |
51 | { | |
52 | if(libhd_log) | |
53 | fprintf(libhd_log, "; %s\t%p\t%p\n", __FUNCTION__, CALLED_FROM(hd_dump_entry, hd_data), hd_data); | |
54 | } | |
55 | #endif | |
56 | ||
57 | if(!h) return; | |
58 | ||
59 | s = ""; | |
60 | if(h->is.agp) s = "(AGP)"; | |
61 | // pci_flag_pm: dump_line0(", supports PM"); | |
62 | if(h->is.isapnp) s = "(PnP)"; | |
63 | ||
64 | a0 = h->bus.name; | |
65 | a2 = NULL; | |
66 | a1 = h->sub_class.name ?: h->base_class.name; | |
67 | if(a1 && h->prog_if.name) { | |
68 | str_printf(&a2, 0, "%s (%s)", a1, h->prog_if.name); | |
69 | } | |
70 | else { | |
71 | a2 = new_str(a1 ?: "?"); | |
72 | } | |
73 | dump_line( | |
74 | "%02d: %s%s %02x.%x: %02x%02x %s\n", | |
75 | h->idx, a0 ? a0 : "?", s, h->slot, h->func, | |
76 | h->base_class.id, h->sub_class.id, a2 | |
77 | ); | |
78 | ||
79 | ind += 2; | |
80 | ||
81 | if((hd_data->debug & HD_DEB_CREATION)) { | |
82 | s = mod_name_by_idx(h->module); | |
83 | if(!s) sprintf(s = buf1, "%u", h->module); | |
84 | if(h->count) | |
85 | sprintf(buf2, ".%u", h->count); | |
86 | else | |
87 | *buf2 = 0; | |
88 | dump_line("[Created at %s.%u%s]\n", s, h->line, buf2); | |
89 | } | |
90 | ||
91 | if(hd_data->flags.dformat == 1) { | |
92 | dump_line("ClassName: \"%s\"\n", a2); | |
93 | dump_line("Bus: %d\n", h->slot >> 8); | |
94 | dump_line("Slot: %d\n", h->slot & 0xff); | |
95 | dump_line("Function: %d\n", h->func); | |
96 | } | |
97 | ||
98 | a2 = free_mem(a2); | |
99 | ||
100 | if((hd_data->debug & HD_DEB_CREATION) && h->unique_id) { | |
101 | dump_line("Unique ID: %s\n", h->unique_id); | |
102 | } | |
103 | ||
104 | if(hd_data->debug == -1u && h->old_unique_id) { | |
105 | dump_line("Old Unique ID: %s\n", h->old_unique_id); | |
106 | } | |
107 | ||
108 | if((hd_data->debug & HD_DEB_CREATION) && h->parent_id) { | |
109 | dump_line("Parent ID: %s\n", h->parent_id); | |
110 | } | |
111 | ||
112 | if(hd_data->debug == -1u && h->child_ids) { | |
113 | s = hd_join(", ", h->child_ids); | |
114 | dump_line("Child IDs: %s\n", s); | |
115 | s = free_mem(s); | |
116 | } | |
117 | ||
118 | if(h->sysfs_id) { | |
119 | dump_line("SysFS ID: %s\n", h->sysfs_id); | |
120 | } | |
121 | ||
122 | if(h->sysfs_bus_id) { | |
123 | dump_line("SysFS BusID: %s\n", h->sysfs_bus_id); | |
124 | } | |
125 | ||
126 | if(h->sysfs_device_link) { | |
127 | dump_line("SysFS Device Link: %s\n", h->sysfs_device_link); | |
128 | } | |
129 | ||
130 | if(h->hw_class && (s = hd_hw_item_name(h->hw_class))) { | |
131 | dump_line("Hardware Class: %s\n", s); | |
132 | } | |
133 | ||
134 | if(hd_data->debug == -1u) { | |
135 | for(i = j = 0; i < (int) hw_all; i++) { | |
136 | if(i != hw_unknown && hd_is_hw_class(h, i) && (s = hd_hw_item_name(i))) { | |
137 | if(!j) { | |
138 | dump_line("HW Class List: %s", s); | |
139 | } | |
140 | else { | |
141 | dump_line0(", %s", s); | |
142 | } | |
143 | j = 1; | |
144 | } | |
145 | } | |
146 | if(j) dump_line0("\n"); | |
147 | } | |
148 | ||
149 | if(h->base_class.id == bc_internal && h->sub_class.id == sc_int_cpu) { | |
150 | dump_cpu(hd_data, h, f); | |
151 | } | |
152 | else if(h->base_class.id == bc_internal && h->sub_class.id == sc_int_bios) { | |
153 | dump_bios(hd_data, h, f); | |
154 | } | |
155 | else if(h->base_class.id == bc_internal && h->sub_class.id == sc_int_prom) { | |
156 | dump_prom(hd_data, h, f); | |
157 | } | |
158 | else { | |
159 | dump_normal(hd_data, h, f); | |
160 | } | |
161 | ||
162 | s1 = s2 = NULL; | |
163 | if(h->is.notready) { | |
164 | if(h->base_class.id == bc_storage_device) { | |
165 | s1 = "no medium"; | |
166 | } | |
167 | else { | |
168 | s1 = "not configured"; | |
169 | } | |
170 | } | |
171 | if(h->is.softraiddisk) s2 = "soft raid"; | |
172 | if(!s1) { s1 = s2; s2 = NULL; } | |
173 | ||
174 | if(s1) { | |
175 | dump_line("Drive status: %s%s%s\n", s1, s2 ? ", " : "", s2 ?: ""); | |
176 | } | |
177 | ||
178 | if(h->extra_info) { | |
179 | dump_line_str("Extra Info: "); | |
180 | for(i = 0, sl = h->extra_info; sl; sl = sl->next) { | |
181 | dump_line0("%s%s", i ? ", " : "", sl->str); | |
182 | i = 1; | |
183 | } | |
184 | dump_line0("\n"); | |
185 | } | |
186 | ||
187 | if( | |
188 | hd_data->debug && ( | |
189 | h->status.configured || | |
190 | h->status.available || | |
191 | h->status.needed || | |
192 | h->status.active || | |
193 | h->status.invalid || | |
194 | h->is.manual | |
195 | ) | |
196 | ) { | |
197 | dump_line_str("Config Status: "); | |
198 | i = 0; | |
199 | ||
200 | if(h->status.invalid) { | |
201 | dump_line0("invalid"); | |
202 | i++; | |
203 | } | |
204 | ||
205 | if(h->is.manual) { | |
206 | dump_line0("%smanual", i ? ", " : ""); | |
207 | i++; | |
208 | } | |
209 | ||
210 | if(h->status.configured && (s = hd_status_value_name(h->status.configured))) { | |
211 | dump_line0("%scfg=%s", i ? ", " : "", s); | |
212 | i++; | |
213 | } | |
214 | ||
215 | if(h->status.available && (s = hd_status_value_name(h->status.available))) { | |
216 | dump_line0("%savail=%s", i ? ", " : "", s); | |
217 | i++; | |
218 | } | |
219 | ||
220 | if(h->status.needed && (s = hd_status_value_name(h->status.needed))) { | |
221 | dump_line0("%sneed=%s", i ? ", " : "", s); | |
222 | i++; | |
223 | } | |
224 | ||
225 | if(h->status.active && (s = hd_status_value_name(h->status.active))) { | |
226 | dump_line0("%sactive=%s", i ? ", " : "", s); | |
227 | i++; | |
228 | } | |
229 | ||
230 | dump_line0("\n"); | |
231 | } | |
232 | ||
233 | if(hd_data->debug == -1u && h->config_string) { | |
234 | dump_line("Configured as: \"%s\"\n", h->config_string); | |
235 | } | |
236 | ||
237 | if( | |
238 | h->attached_to && | |
239 | (hd_tmp = hd_get_device_by_idx(hd_data, h->attached_to)) | |
240 | ) { | |
241 | s = hd_tmp->sub_class.name ?: hd_tmp->base_class.name; | |
242 | dump_line("Attached to: #%u (%s)\n", h->attached_to, s ?: "?"); | |
243 | } | |
244 | ||
245 | if(h->detail && h->detail->ccw.type==hd_detail_ccw) | |
246 | { | |
247 | dump_line("LCSS: %x.%x\n",h->detail->ccw.data->lcss >> 8, h->detail->ccw.data->lcss & 0xf); | |
248 | dump_line("CU Model: 0x%x\n",h->detail->ccw.data->cu_model); | |
249 | dump_line("Device Model: 0x%x\n",h->detail->ccw.data->dev_model); | |
250 | } | |
251 | ||
252 | #if defined(__s390__) || defined(__s390x__) | |
253 | if(h->detail && h->detail->scsi.type==hd_detail_scsi) | |
254 | { | |
255 | if(h->detail->scsi.data->wwpn != (uint64_t)-1) | |
256 | dump_line("WWPN: 0x%llx\n",(unsigned long long)h->detail->scsi.data->wwpn); | |
257 | if(h->detail->scsi.data->wwpn != (uint64_t)-1) | |
258 | dump_line("FCP LUN: 0x%llx\n",(unsigned long long)h->detail->scsi.data->fcp_lun); | |
259 | dump_line("SCSI Host CCW ID: %s\n",h->detail->scsi.data->controller_id); | |
260 | } | |
261 | #endif | |
262 | ||
263 | if( | |
264 | h->base_class.id == bc_storage_device && | |
265 | h->sub_class.id == sc_sdev_cdrom && | |
266 | h->detail && | |
267 | h->detail->type == hd_detail_cdrom && | |
268 | h->detail->cdrom.data | |
269 | ) { | |
270 | cdrom_info_t *ci = h->detail->cdrom.data; | |
271 | ||
272 | if(ci->speed) { | |
273 | dump_line("Drive Speed: %u\n", ci->speed); | |
274 | } | |
275 | ||
276 | if(ci->iso9660.ok) { | |
277 | if(ci->iso9660.volume) dump_line("Volume ID: \"%s\"\n", ci->iso9660.volume); | |
278 | if(ci->iso9660.application) dump_line("Application: \"%s\"\n", ci->iso9660.application); | |
279 | if(ci->iso9660.publisher) dump_line("Publisher: \"%s\"\n", ci->iso9660.publisher); | |
280 | if(ci->iso9660.preparer) dump_line("Preparer: \"%s\"\n", ci->iso9660.preparer); | |
281 | if(ci->iso9660.creation_date) dump_line("Creation date: \"%s\"\n", ci->iso9660.creation_date); | |
282 | } | |
283 | #if 0 | |
284 | else { | |
285 | if(ci->cdrom) { | |
286 | dump_line_str("Drive status: non-ISO9660 cdrom\n"); | |
287 | } | |
288 | else { | |
289 | dump_line_str("Drive status: no cdrom found\n"); | |
290 | } | |
291 | } | |
292 | #endif | |
293 | if(ci->el_torito.ok) { | |
294 | dump_line( | |
295 | "El Torito info: platform %u, %sbootable\n", | |
296 | ci->el_torito.platform, | |
297 | ci->el_torito.bootable ? "" : "not " | |
298 | ); | |
299 | dump_line(" Boot Catalog: at sector 0x%04x\n", ci->el_torito.catalog); | |
300 | if(ci->el_torito.id_string) dump_line(" Id String: \"%s\"\n", ci->el_torito.id_string); | |
301 | if(ci->el_torito.label) dump_line(" Volume Label: \"%s\"\n", ci->el_torito.label); | |
302 | { | |
303 | static char *media[] = { | |
304 | "none", "1.2MB Floppy", "1.44MB Floppy", "2.88MB Floppy", "Hard Disk" | |
305 | }; | |
306 | dump_line( | |
307 | " Media: %s starting at sector 0x%04x\n", | |
308 | media[ci->el_torito.media_type < sizeof media / sizeof *media ? ci->el_torito.media_type : 0], | |
309 | ci->el_torito.start | |
310 | ); | |
311 | } | |
312 | if(ci->el_torito.geo.size) dump_line( | |
313 | " Geometry (CHS): %u/%u/%u (%u blocks)\n", | |
314 | ci->el_torito.geo.c, ci->el_torito.geo.h, ci->el_torito.geo.s, ci->el_torito.geo.size | |
315 | ); | |
316 | dump_line(" Load: %u bytes", ci->el_torito.load_count * 0x200); | |
317 | if(ci->el_torito.load_address) { | |
318 | dump_line0(" at 0x%04x\n", ci->el_torito.load_address); | |
319 | } | |
320 | else { | |
321 | dump_line0("\n"); | |
322 | } | |
323 | } | |
324 | } | |
325 | ||
326 | #if 0 | |
327 | if( | |
328 | h->base_class.id == bc_storage_device && | |
329 | h->sub_class.id == sc_sdev_floppy && | |
330 | h->detail && | |
331 | h->detail->type == hd_detail_floppy | |
332 | ) { | |
333 | floppy_info_t *fi = h->detail->floppy.data; | |
334 | ||
335 | if(fi) { | |
336 | dump_line_str("Drive status: floppy found\n"); | |
337 | } | |
338 | else { | |
339 | dump_line_str("Drive status: no floppy found\n"); | |
340 | } | |
341 | } | |
342 | #endif | |
343 | ||
344 | ind -= 2; | |
345 | ||
346 | if(h->next) dump_line_str("\n"); | |
347 | } | |
348 | ||
349 | ||
350 | /* | |
351 | * print 'normal' hardware entries | |
352 | */ | |
353 | void dump_normal(hd_data_t *hd_data, hd_t *h, FILE *f) | |
354 | { | |
355 | int i, j; | |
356 | char *s; | |
357 | uint64_t u64; | |
358 | hd_res_t *res; | |
359 | char buf[256], c0, c1; | |
360 | driver_info_t *di; | |
361 | str_list_t *sl, *sl1, *sl2; | |
362 | isdn_parm_t *ip; | |
363 | static char *geo_type_str[] = { "Physical", "Logical", "BIOS EDD", "BIOS Legacy" }; | |
364 | ||
365 | if(h->model) dump_line("Model: \"%s\"\n", h->model); | |
366 | ||
367 | s = NULL; | |
368 | switch(h->hotplug) { | |
369 | case hp_none: | |
370 | break; | |
371 | case hp_pcmcia: | |
372 | s = "PCMCIA"; | |
373 | break; | |
374 | case hp_cardbus: | |
375 | s = "CardBus"; | |
376 | break; | |
377 | case hp_pci: | |
378 | s = "PCI"; | |
379 | break; | |
380 | case hp_usb: | |
381 | s = "USB"; | |
382 | break; | |
383 | case hp_ieee1394: | |
384 | s = "IEEE1394 (FireWire)"; | |
385 | break; | |
386 | } | |
387 | ||
388 | if(s) { | |
389 | dump_line("Hotplug: %s\n", s); | |
390 | } | |
391 | ||
392 | if( | |
393 | (h->hotplug == hp_pcmcia || h->hotplug == hp_cardbus) && | |
394 | h->hotplug_slot | |
395 | ) { | |
396 | dump_line("Socket: %u\n", h->hotplug_slot - 1); | |
397 | } | |
398 | ||
399 | if(h->vendor.id || h->vendor.name || h->device.id || h->device.name) { | |
400 | if(h->vendor.id || h->vendor.name) { | |
401 | dump_line("Vendor: %s\n", dump_hid(hd_data, &h->vendor, 1, buf, sizeof buf)); | |
402 | } | |
403 | dump_line("Device: %s\n", dump_hid(hd_data, &h->device, 0, buf, sizeof buf)); | |
404 | } | |
405 | ||
406 | if(h->sub_vendor.id || h->sub_device.id || h->sub_device.name || h->sub_vendor.name) { | |
407 | if(h->sub_vendor.id || h->sub_vendor.name || h->sub_device.id) { | |
408 | dump_line("SubVendor: %s\n", dump_hid(hd_data, &h->sub_vendor, 1, buf, sizeof buf)); | |
409 | } | |
410 | dump_line("SubDevice: %s\n", dump_hid(hd_data, &h->sub_device, 0, buf, sizeof buf)); | |
411 | } | |
412 | ||
413 | if(h->revision.name) { | |
414 | dump_line("Revision: \"%s\"\n", h->revision.name); | |
415 | } | |
416 | else if(h->revision.id) { | |
417 | dump_line("Revision: 0x%02x\n", h->revision.id); | |
418 | } | |
419 | ||
420 | if(h->serial) { | |
421 | dump_line("Serial ID: \"%s\"\n", h->serial); | |
422 | } | |
423 | ||
424 | if(h->usb_guid) { | |
425 | dump_line("USB GUID: %s\n", h->usb_guid); | |
426 | } | |
427 | ||
428 | if(h->compat_vendor.id || h->compat_device.id) { | |
429 | dump_line( | |
430 | "Compatible to: %s\n", | |
431 | dump_hid2(hd_data, &h->compat_vendor, &h->compat_device, buf, sizeof buf) | |
432 | ); | |
433 | } | |
434 | ||
435 | if(h->base_class.id == bc_internal && h->sub_class.id == sc_int_sys) { | |
436 | dump_sys(hd_data, h, f); | |
437 | } | |
438 | ||
439 | if(h->drivers) { | |
440 | s = hd_join("\", \"", h->drivers); | |
441 | dump_line("Driver: \"%s\"\n", s); | |
442 | s = free_mem(s); | |
443 | } | |
444 | ||
445 | if(h->broken) { | |
446 | dump_line_str("Warning: might be broken\n"); | |
447 | } | |
448 | ||
449 | if(hd_data->flags.dformat == 1) { | |
450 | if(h->unix_dev_name) { | |
451 | dump_line("Device File: %s\n", h->unix_dev_name); | |
452 | } | |
453 | if(h->unix_dev_name2) { | |
454 | dump_line("Alternative Device File: %s\n", h->unix_dev_name2); | |
455 | } | |
456 | } | |
457 | else { | |
458 | s = h->unix_dev_name; | |
459 | if(!s) s = h->unix_dev_name2; | |
460 | if(s) { | |
461 | dump_line("Device File: %s", s); | |
462 | if(h->unix_dev_name2) { | |
463 | dump_line0(" (%s)", h->unix_dev_name2); | |
464 | } | |
465 | dump_line0("\n"); | |
466 | } | |
467 | ||
468 | } | |
469 | ||
470 | /* only if there are more than one */ | |
471 | if(h->unix_dev_names && h->unix_dev_names->next) { | |
472 | s = hd_join(", ", h->unix_dev_names); | |
473 | dump_line("Device Files: %s\n", s); | |
474 | s = free_mem(s); | |
475 | } | |
476 | ||
477 | if(h->unix_dev_num.type) { | |
478 | dump_line("Device Number: %s", print_dev_num(&h->unix_dev_num)); | |
479 | if(h->unix_dev_num2.type) { | |
480 | dump_line0(" (%s)", print_dev_num(&h->unix_dev_num2)); | |
481 | } | |
482 | dump_line0("\n"); | |
483 | } | |
484 | ||
485 | if(h->rom_id) { | |
486 | #if defined(__i386__) || defined (__x86_64__) | |
487 | dump_line("BIOS id: %s\n", h->rom_id); | |
488 | #endif | |
489 | #if defined(__PPC__) || defined(__sparc__) | |
490 | dump_line("PROM id: %s\n", h->rom_id); | |
491 | #endif | |
492 | #if defined(__s390__) || defined(__s390x__) | |
493 | dump_line("IUCV user: %s\n", h->rom_id); | |
494 | #endif | |
495 | } | |
496 | ||
497 | if(h->tag.ser_skip) { | |
498 | dump_line_str("Tags: ser_skip\n"); | |
499 | } | |
500 | ||
501 | if( | |
502 | h->is.zip || | |
503 | h->is.cdr || h->is.cdrw || h->is.dvd || | |
504 | h->is.dvdr || h->is.dvdram || h->is.pppoe || h->is.wlan | |
505 | ) { | |
506 | dump_line_str("Features:"); | |
507 | i = 0; | |
508 | if(h->is.zip) dump_line0("%s ZIP", i++ ? "," : ""); | |
509 | if(h->is.cdr) dump_line0("%s CD-R", i++ ? "," : ""); | |
510 | if(h->is.cdrw) dump_line0("%s CD-RW", i++ ? "," : ""); | |
511 | if(h->is.dvd) dump_line0("%s DVD", i++ ? "," : ""); | |
512 | if(h->is.dvdr) dump_line0("%s DVD-R", i++ ? "," : ""); | |
513 | if(h->is.dvdram) dump_line0("%s DVDRAM", i++ ? "," : ""); | |
514 | if(h->is.pppoe) dump_line0("%s PPPOE", i++ ? "," : ""); | |
515 | if(h->is.wlan) dump_line0("%s WLAN", i++ ? "," : ""); | |
516 | dump_line0("\n"); | |
517 | } | |
518 | ||
519 | for(res = h->res; res; res = res->next) { | |
520 | switch(res->any.type) { | |
521 | case res_phys_mem: | |
522 | u64 = res->phys_mem.range >> 10; | |
523 | c0 = 'M'; c1 = 'k'; | |
524 | if(u64 >> 20) { | |
525 | u64 >>= 10; | |
526 | c0 = 'G'; c1 = 'M'; | |
527 | } | |
528 | if((u64 & 0x3ff)) { | |
529 | dump_line("Memory Size: %"PRId64" %cB + %"PRId64" %cB\n", u64 >> 10, c0, u64 & 0x3ff, c1); | |
530 | } | |
531 | else { | |
532 | dump_line("Memory Size: %"PRId64" %cB\n", u64 >> 10, c0); | |
533 | } | |
534 | break; | |
535 | ||
536 | case res_mem: | |
537 | *(s = buf) = 0; | |
538 | strcat(buf, res->mem.access == acc_rw ? "rw" : res->mem.access == acc_ro ? "ro" : "wo"); | |
539 | strcat(buf, res->mem.prefetch == flag_yes ? ",prefetchable" : res->mem.prefetch == flag_no ? ",non-prefetchable" : ""); | |
540 | if(!res->mem.enabled) strcat(buf, ",disabled"); | |
541 | if(*s == ',') s++; | |
542 | if(res->mem.range) { | |
543 | dump_line( | |
544 | "Memory Range: 0x%08"PRIx64"-0x%08"PRIx64" (%s)\n", | |
545 | res->mem.base, res->mem.base + res->mem.range - 1, s | |
546 | ); | |
547 | } | |
548 | else { | |
549 | dump_line("Memory Range: 0x%08"PRIx64"-??? (%s)\n", res->mem.base, s); | |
550 | } | |
551 | break; | |
552 | ||
553 | case res_io: | |
554 | *(s = buf) = 0; | |
555 | strcat(buf, res->io.access == acc_rw ? "rw" : res->io.access == acc_ro ? "ro" : "wo"); | |
556 | if(!res->io.enabled) strcat(buf, ",disabled"); | |
557 | if(*s == ',') s++; | |
558 | if(res->io.range == 0) { | |
559 | dump_line("I/O Ports: 0x%02"PRIx64"-??? (%s)\n", res->io.base, s); | |
560 | } | |
561 | else if(res->io.range == 1) { | |
562 | dump_line("I/O Port: 0x%02"PRIx64" (%s)\n", res->io.base, s); | |
563 | } | |
564 | else { | |
565 | dump_line("I/O Ports: 0x%02"PRIx64"-0x%02"PRIx64" (%s)\n", res->io.base, res->io.base + res->io.range -1, s); | |
566 | } | |
567 | break; | |
568 | ||
569 | case res_irq: | |
570 | *(s = buf) = 0; | |
571 | switch(res->irq.triggered) { | |
572 | case 0: | |
573 | strcpy(s, "no events"); | |
574 | break; | |
575 | ||
576 | case 1: | |
577 | strcpy(s, "1 event"); | |
578 | break; | |
579 | ||
580 | default: | |
581 | sprintf(s, "%u events", res->irq.triggered); | |
582 | } | |
583 | if(!res->irq.enabled) { | |
584 | if(res->irq.triggered) | |
585 | strcat(s, ","); | |
586 | else | |
587 | *s = 0; | |
588 | strcat(s, "disabled"); | |
589 | } | |
590 | dump_line("IRQ: %u (%s)\n", res->irq.base, s); | |
591 | break; | |
592 | ||
593 | case res_dma: | |
594 | *(s = buf) = 0; | |
595 | if(!res->dma.enabled) strcpy(buf, " (disabled)"); | |
596 | dump_line("DMA: %u%s\n", res->dma.base, s); | |
597 | break; | |
598 | ||
599 | case res_monitor: | |
600 | dump_line( | |
601 | "Resolution: %ux%u@%uHz%s\n", | |
602 | res->monitor.width, res->monitor.height, res->monitor.vfreq, | |
603 | res->monitor.interlaced ? " (interlaced)" : "" | |
604 | ); | |
605 | break; | |
606 | ||
607 | case res_size: | |
608 | { | |
609 | char *s, b0[64], b1[64]; | |
610 | ||
611 | switch(res->size.unit) { | |
612 | case size_unit_cinch: | |
613 | s = "''"; | |
614 | snprintf(b0, sizeof b0 - 1, "%s", float2str(res->size.val1, 2)); | |
615 | snprintf(b1, sizeof b1 - 1, "%s", float2str(res->size.val2, 2)); | |
616 | break; | |
617 | ||
618 | default: | |
619 | switch(res->size.unit) { | |
620 | case size_unit_cm: | |
621 | s = "cm"; | |
622 | break; | |
623 | case size_unit_sectors: | |
624 | s = "sectors"; | |
625 | break; | |
626 | case size_unit_kbyte: | |
627 | s = "kByte"; | |
628 | break; | |
629 | default: | |
630 | s = "some unit"; | |
631 | } | |
632 | snprintf(b0, sizeof b0 - 1, "%"PRIu64, res->size.val1); | |
633 | snprintf(b1, sizeof b1 - 1, "%"PRIu64, res->size.val2); | |
634 | } | |
635 | if(!res->size.val2) | |
636 | dump_line("Size: %s %s\n", b0, s); | |
637 | else if(res->size.unit == size_unit_sectors) | |
638 | dump_line("Size: %s %s a %s bytes\n", b0, s, b1); | |
639 | else | |
640 | dump_line("Size: %sx%s %s\n", b0, b1, s); | |
641 | } | |
642 | break; | |
643 | ||
644 | case res_disk_geo: | |
645 | s = res->disk_geo.geotype < sizeof geo_type_str / sizeof *geo_type_str ? | |
646 | geo_type_str[res->disk_geo.geotype] : ""; | |
647 | dump_line( | |
648 | "Geometry (%s): CHS %u/%u/%u\n", s, | |
649 | res->disk_geo.cyls, res->disk_geo.heads, res->disk_geo.sectors | |
650 | ); | |
651 | if(res->disk_geo.size) { | |
652 | dump_line("Size (%s): %"PRIu64" sectors\n", s, res->disk_geo.size); | |
653 | } | |
654 | break; | |
655 | ||
656 | case res_cache: | |
657 | dump_line("Cache: %u kb\n", res->cache.size); | |
658 | break; | |
659 | ||
660 | case res_baud: | |
661 | if(res->baud.speed == 0 || res->baud.speed % 100) { | |
662 | dump_line("Speed: %u bps\n", res->baud.speed); | |
663 | } | |
664 | else if(res->baud.speed % 100000) { | |
665 | dump_line("Speed: %s kbps\n", float2str(res->baud.speed, 3)); | |
666 | } | |
667 | else { | |
668 | dump_line("Speed: %s Mbps\n", float2str(res->baud.speed, 6)); | |
669 | } | |
670 | if(res->baud.bits || res->baud.stopbits || res->baud.parity || res->baud.handshake) { | |
671 | int i = 0; | |
672 | ||
673 | dump_line_str("Config: "); | |
674 | if(res->baud.bits) { | |
675 | dump_line0("%u bits", res->baud.bits); | |
676 | i++; | |
677 | } | |
678 | if(res->baud.parity) { | |
679 | dump_line0("%sparity %c", i++ ? ", " : "", res->baud.parity); | |
680 | } | |
681 | if(res->baud.stopbits) { | |
682 | dump_line0("%s%u stopbits", i++ ? ", " : "", res->baud.stopbits); | |
683 | } | |
684 | if(res->baud.handshake) { | |
685 | dump_line0("%shandshake %c", i++ ? ", " : "", res->baud.handshake); | |
686 | } | |
687 | dump_line0("\n"); | |
688 | } | |
689 | break; | |
690 | ||
691 | case res_init_strings: | |
692 | if(res->init_strings.init1) dump_line("Init1: %s\n", res->init_strings.init1); | |
693 | if(res->init_strings.init2) dump_line("Init2: %s\n", res->init_strings.init2); | |
694 | break; | |
695 | ||
696 | case res_pppd_option: | |
697 | dump_line("PPPD Option: %s\n", res->pppd_option.option); | |
698 | break; | |
699 | ||
700 | case res_framebuffer: | |
701 | dump_line("Mode 0x%04x: %ux%u (+%u), %u bits\n", | |
702 | res->framebuffer.mode, | |
703 | res->framebuffer.width, | |
704 | res->framebuffer.height, | |
705 | res->framebuffer.bytes_p_line, | |
706 | res->framebuffer.colorbits | |
707 | ); | |
708 | break; | |
709 | ||
710 | case res_hwaddr: | |
711 | dump_line("HW Address: %s\n", res->hwaddr.addr); | |
712 | break; | |
713 | ||
714 | case res_link: | |
715 | dump_line("Link detected: %s\n", res->link.state ? "yes" : "no"); | |
716 | break; | |
717 | ||
718 | case res_wlan: | |
719 | if(res->wlan.channels) { | |
720 | str_list_t *ptr = res->wlan.channels; | |
721 | dump_line("WLAN channels: %s", ptr->str); | |
722 | while((ptr=ptr->next)) dump_line0(" %s", ptr->str); | |
723 | dump_line0("\n"); | |
724 | } | |
725 | if(res->wlan.frequencies) { | |
726 | str_list_t *ptr = res->wlan.frequencies; | |
727 | dump_line("WLAN frequencies: %s", ptr->str); | |
728 | while((ptr=ptr->next)) dump_line0(" %s", ptr->str); | |
729 | dump_line0("\n"); | |
730 | } | |
731 | if(res->wlan.bitrates) { | |
732 | str_list_t *ptr = res->wlan.bitrates; | |
733 | dump_line("WLAN bitrates: %s", ptr->str); | |
734 | while((ptr=ptr->next)) dump_line0(" %s", ptr->str); | |
735 | dump_line0("\n"); | |
736 | } | |
737 | if(res->wlan.enc_modes) { | |
738 | str_list_t *ptr = res->wlan.enc_modes; | |
739 | dump_line("WLAN encryption modes: %s", ptr->str); | |
740 | while((ptr=ptr->next)) dump_line0(" %s", ptr->str); | |
741 | dump_line0("\n"); | |
742 | } | |
743 | if(res->wlan.auth_modes) { | |
744 | str_list_t *ptr = res->wlan.auth_modes; | |
745 | dump_line("WLAN authentication modes: %s", ptr->str); | |
746 | while((ptr=ptr->next)) dump_line0(" %s", ptr->str); | |
747 | dump_line0("\n"); | |
748 | } | |
749 | break; | |
750 | ||
751 | ||
752 | default: | |
753 | dump_line("Unknown resource type %d\n", res->any.type); | |
754 | } | |
755 | } | |
756 | ||
757 | if((sl = h->requires)) { | |
758 | dump_line("Requires: %s", sl->str); | |
759 | for(sl = sl->next; sl; sl = sl->next) { | |
760 | dump_line0(", %s", sl->str); | |
761 | } | |
762 | dump_line0("\n"); | |
763 | } | |
764 | ||
765 | for(di = h->driver_info, i = 0; di; di = di->next, i++) { | |
766 | dump_line("Driver Info #%d:\n", i); | |
767 | ind += 2; | |
768 | switch(di->any.type) { | |
769 | case di_any: | |
770 | dump_line_str("Driver Info:"); | |
771 | for(sl = di->any.hddb0, j = 0; sl; sl = sl->next, j++) { | |
772 | dump_line0("%c%s", j ? ',' : ' ', sl->str); | |
773 | } | |
774 | dump_line0("\n"); | |
775 | break; | |
776 | ||
777 | case di_display: | |
778 | if(di->display.width) | |
779 | dump_line("Max. Resolution: %ux%u\n", di->display.width, di->display.height); | |
780 | if(di->display.min_vsync) | |
781 | dump_line("Vert. Sync Range: %u-%u Hz\n", di->display.min_vsync, di->display.max_vsync); | |
782 | if(di->display.min_hsync) | |
783 | dump_line("Hor. Sync Range: %u-%u kHz\n", di->display.min_hsync, di->display.max_hsync); | |
784 | if(di->display.bandwidth) | |
785 | dump_line("Bandwidth: %u MHz\n", di->display.bandwidth); | |
786 | break; | |
787 | ||
788 | case di_module: | |
789 | dump_line_str("Driver Status: "); | |
790 | for(sl1 = di->module.names; sl1; sl1 = sl1->next) { | |
791 | dump_line0("%s%c", sl1->str, sl1->next ? ',' : ' '); | |
792 | } | |
793 | dump_line0("%s %sactive\n", | |
794 | di->module.names->next ? "are" : "is", | |
795 | di->module.active ? "" : "not " | |
796 | ); | |
797 | ||
798 | dump_line_str("Driver Activation Cmd: \""); | |
799 | for(sl1 = di->module.names, sl2 = di->module.mod_args; sl1 && sl2; sl1 = sl1->next, sl2 = sl2->next) { | |
800 | dump_line0("%s %s%s%s%s", | |
801 | di->module.modprobe ? "modprobe" : "insmod", | |
802 | sl1->str, | |
803 | sl2->str ? " " : "", | |
804 | sl2->str ? sl2->str : "", | |
805 | (sl1->next && sl2->next) ? "; " : "" | |
806 | ); | |
807 | } | |
808 | ||
809 | dump_line0("\"\n"); | |
810 | ||
811 | if(di->module.conf) { | |
812 | char *s = di->module.conf; | |
813 | ||
814 | dump_line_str("Driver \"modules.conf\" Entry: \""); | |
815 | for(; *s; s++) { | |
816 | if(isprint(*s)) { | |
817 | dump_line0("%c", *s); | |
818 | } | |
819 | else { | |
820 | switch(*s) { | |
821 | case '\n': dump_line0("\\n"); break; | |
822 | case '\r': dump_line0("\\r"); break; | |
823 | case '\t': dump_line0("\t"); break; /* *no* typo! */ | |
824 | default: dump_line0("\\%03o", *s); | |
825 | } | |
826 | } | |
827 | } | |
828 | dump_line0("\"\n"); | |
829 | } | |
830 | break; | |
831 | ||
832 | case di_mouse: | |
833 | if(di->mouse.buttons >= 0) dump_line("Buttons: %d\n", di->mouse.buttons); | |
834 | if(di->mouse.wheels >= 0) dump_line("Wheels: %d\n", di->mouse.wheels); | |
835 | if(di->mouse.xf86) dump_line("XFree86 Protocol: %s\n", di->mouse.xf86); | |
836 | if(di->mouse.gpm) dump_line("GPM Protocol: %s\n", di->mouse.gpm); | |
837 | break; | |
838 | ||
839 | case di_x11: | |
840 | if(di->x11.server) { | |
841 | dump_line( | |
842 | "XFree86 v%s Server%s: %s\n", | |
843 | di->x11.xf86_ver, strcmp(di->x11.xf86_ver, "4") ? "" : " Module", di->x11.server | |
844 | ); | |
845 | } | |
846 | if(di->x11.x3d) dump_line_str("3D Support: yes\n"); | |
847 | if(di->x11.script) dump_line("3D Script: %s\n", di->x11.script); | |
848 | if(di->x11.colors.all) { | |
849 | dump_line_str("Color Depths: "); | |
850 | j = 0; | |
851 | if(di->x11.colors.c8) { dump_line0("8"); j++; } | |
852 | if(di->x11.colors.c15) { if(j) dump_line0(", "); dump_line0("15"); j++; } | |
853 | if(di->x11.colors.c16) { if(j) dump_line0(", "); dump_line0("16"); j++; } | |
854 | if(di->x11.colors.c24) { if(j) dump_line0(", "); dump_line0("24"); j++; } | |
855 | if(di->x11.colors.c32) { if(j) dump_line0(", "); dump_line0("32"); j++; } | |
856 | dump_line0("\n"); | |
857 | } | |
858 | if(di->x11.dacspeed) dump_line("Max. DAC Clock: %u MHz\n", di->x11.dacspeed); | |
859 | if(di->x11.extensions) { | |
860 | dump_line("Extensions: %s", di->x11.extensions->str); | |
861 | for(sl = di->x11.extensions->next; sl; sl = sl->next) { | |
862 | dump_line0(", %s", sl->str); | |
863 | } | |
864 | dump_line0("\n"); | |
865 | } | |
866 | if(di->x11.options) { | |
867 | dump_line("Options: %s", di->x11.options->str); | |
868 | for(sl = di->x11.options->next; sl; sl = sl->next) { | |
869 | dump_line0(", %s", sl->str); | |
870 | } | |
871 | dump_line0("\n"); | |
872 | } | |
873 | if(di->x11.raw) { | |
874 | dump_line("XF86Config Entry: %s", di->x11.raw->str); | |
875 | for(sl = di->x11.raw->next; sl; sl = sl->next) { | |
876 | dump_line0("\\n%s", sl->str); | |
877 | } | |
878 | dump_line0("\n"); | |
879 | } | |
880 | break; | |
881 | ||
882 | case di_isdn: | |
883 | dump_line( | |
884 | "I4L Type: %d/%d [%s]\n", | |
885 | di->isdn.i4l_type, di->isdn.i4l_subtype, di->isdn.i4l_name | |
886 | ); | |
887 | if((ip = di->isdn.params)) { | |
888 | int k, l; | |
889 | ||
890 | dump_line_str("Parameter:\n"); | |
891 | for(k = 0; ip; ip = ip->next, k++) { | |
892 | dump_line( | |
893 | " %d%s: (0x%x/%02x): %s = 0x%"PRIx64, | |
894 | k, ip->conflict ? "(conflict)" : ip->valid ? "" : "(invalid)", | |
895 | ip->type, ip->flags >> 8, ip->name, ip->value | |
896 | ); | |
897 | if(ip->alt_values) { | |
898 | for(l = 0; l < ip->alt_values; l++) { | |
899 | dump_line0( | |
900 | "%s%s0x%x", l ? "," : " [", | |
901 | ip->alt_value[l] == ip->def_value ? "*" : "", | |
902 | ip->alt_value[l] | |
903 | ); | |
904 | } | |
905 | dump_line0("]"); | |
906 | } | |
907 | dump_line0("\n"); | |
908 | } | |
909 | } | |
910 | break; | |
911 | ||
912 | case di_dsl: | |
913 | dump_line( | |
914 | "DSL Mode: %s\n", | |
915 | di->dsl.mode | |
916 | ); | |
917 | dump_line( | |
918 | "Driver: %s\n", | |
919 | di->dsl.name | |
920 | ); | |
921 | break; | |
922 | ||
923 | case di_kbd: | |
924 | if(di->kbd.XkbRules) dump_line("XkbRules: %s\n", di->kbd.XkbRules); | |
925 | if(di->kbd.XkbModel) dump_line("XkbModel: %s\n", di->kbd.XkbModel); | |
926 | if(di->kbd.XkbLayout) dump_line("XkbLayout: %s\n", di->kbd.XkbLayout); | |
927 | if(di->kbd.keymap) dump_line("keymap: %s\n", di->kbd.keymap); | |
928 | break; | |
929 | ||
930 | default: | |
931 | dump_line_str("Driver Status: unknown driver info format\n"); | |
932 | } | |
933 | ||
934 | if((hd_data->debug & HD_DEB_DRIVER_INFO)) { | |
935 | for(sl = di->any.hddb0, j = 0; sl; sl = sl->next, j++) { | |
936 | if(j) { | |
937 | dump_line0("|%s", sl->str); | |
938 | } | |
939 | else { | |
940 | dump_line("Driver DB0: %d, %s", di->any.type, sl->str); | |
941 | } | |
942 | } | |
943 | if(di->any.hddb0) dump_line0("\n"); | |
944 | ||
945 | for(sl = di->any.hddb1, j = 0; sl; sl = sl->next, j++) { | |
946 | if(!j) dump_line_str("Driver DB1: \""); | |
947 | dump_line0("%s\\n", sl->str); | |
948 | } | |
949 | if(di->any.hddb1) dump_line0("\"\n"); | |
950 | } | |
951 | ||
952 | ind -= 2; | |
953 | } | |
954 | } | |
955 | ||
956 | /* | |
957 | * print CPU entries | |
958 | */ | |
959 | void dump_cpu(hd_data_t *hd_data, hd_t *hd, FILE *f) | |
960 | { | |
961 | cpu_info_t *ct; | |
962 | str_list_t *sl; | |
963 | ||
964 | if(!hd->detail || hd->detail->type != hd_detail_cpu) return; | |
965 | if(!(ct = hd->detail->cpu.data)) return; | |
966 | ||
967 | dump_line0 (" Arch: "); | |
968 | switch (ct->architecture) { | |
969 | case arch_intel: | |
970 | dump_line0 ("Intel\n"); | |
971 | break; | |
972 | case arch_alpha: | |
973 | dump_line0 ("Alpha\n"); | |
974 | break; | |
975 | case arch_sparc: | |
976 | dump_line0 ("Sparc (32)\n"); | |
977 | break; | |
978 | case arch_sparc64: | |
979 | dump_line0 ("UltraSparc (64)\n"); | |
980 | break; | |
981 | case arch_ppc: | |
982 | dump_line0 ("PowerPC\n"); | |
983 | break; | |
984 | case arch_ppc64: | |
985 | dump_line0 ("PowerPC (64)\n"); | |
986 | break; | |
987 | case arch_68k: | |
988 | dump_line0 ("68k\n"); | |
989 | break; | |
990 | case arch_ia64: | |
991 | dump_line0 ("IA-64\n"); | |
992 | break; | |
993 | case arch_s390: | |
994 | dump_line0 ("S390\n"); | |
995 | break; | |
996 | case arch_s390x: | |
997 | dump_line0 ("S390x\n"); | |
998 | break; | |
999 | case arch_arm: | |
1000 | dump_line0 ("ARM\n"); | |
1001 | break; | |
1002 | case arch_mips: | |
1003 | dump_line0 ("MIPS\n"); | |
1004 | break; | |
1005 | case arch_x86_64: | |
1006 | dump_line0 ("X86-64\n"); | |
1007 | break; | |
1008 | default: | |
1009 | dump_line0 ("**UNKNWON**\n"); | |
1010 | break; | |
1011 | } | |
1012 | ||
1013 | if(ct->vend_name) dump_line("Vendor: \"%s\"\n", ct->vend_name); | |
1014 | ||
1015 | if(ct->model_name) | |
1016 | dump_line( | |
1017 | "Model: %u.%u.%u \"%s\"\n", | |
1018 | ct->family, ct->model, ct->stepping, ct->model_name | |
1019 | ); | |
1020 | ||
1021 | if(ct->platform) dump_line("Platform: \"%s\"\n", ct->platform); | |
1022 | ||
1023 | if(ct->features) { | |
1024 | dump_line("Features: %s", ct->features->str); | |
1025 | for(sl = ct->features->next; sl; sl = sl->next) { | |
1026 | dump_line0(",%s", sl->str); | |
1027 | } | |
1028 | dump_line0("\n"); | |
1029 | } | |
1030 | ||
1031 | if(ct->clock) dump_line("Clock: %u MHz\n", ct->clock); | |
1032 | ||
1033 | if(ct->cache) dump_line("Cache: %u kb\n", ct->cache); | |
1034 | if(ct->units) dump_line("Units/Processor: %u\n", ct->units); | |
1035 | } | |
1036 | ||
1037 | ||
1038 | /* | |
1039 | * print BIOS entries | |
1040 | */ | |
1041 | void dump_bios(hd_data_t *hd_data, hd_t *hd, FILE *f) | |
1042 | { | |
1043 | bios_info_t *bt; | |
1044 | ||
1045 | if(!hd->detail || hd->detail->type != hd_detail_bios) return; | |
1046 | if(!(bt = hd->detail->bios.data)) return; | |
1047 | ||
1048 | if(bt->vbe_ver) { | |
1049 | dump_line("VESA BIOS Version: %u.%u\n", bt->vbe_ver >> 8, bt->vbe_ver & 0xff); | |
1050 | } | |
1051 | ||
1052 | if(bt->vbe_video_mem) { | |
1053 | dump_line("Video Memory: %u kb\n", bt->vbe_video_mem >> 10); | |
1054 | } | |
1055 | ||
1056 | if(bt->vbe.ok && bt->vbe.current_mode) { | |
1057 | dump_line("Current VESA Mode: 0x%04x\n", bt->vbe.current_mode); | |
1058 | } | |
1059 | ||
1060 | if(bt->apm_supported) { | |
1061 | dump_line("APM Version: %u.%u\n", bt->apm_ver, bt->apm_subver); | |
1062 | dump_line("APM Status: %s\n", bt->apm_enabled ? "on" : "off"); | |
1063 | dump_line("APM BIOS Flags: 0x%x\n", bt->apm_bios_flags); | |
1064 | } | |
1065 | ||
1066 | if(bt->led.ok) { | |
1067 | dump_line_str("BIOS Keyboard LED Status:\n"); | |
1068 | dump_line(" Scroll Lock: %s\n", bt->led.scroll_lock ? "on" : "off"); | |
1069 | dump_line(" Num Lock: %s\n", bt->led.num_lock ? "on" : "off"); | |
1070 | dump_line(" Caps Lock: %s\n", bt->led.caps_lock ? "on" : "off"); | |
1071 | } | |
1072 | ||
1073 | if(bt->ser_port0) dump_line("Serial Port 0: 0x%x\n", bt->ser_port0); | |
1074 | if(bt->ser_port1) dump_line("Serial Port 1: 0x%x\n", bt->ser_port1); | |
1075 | if(bt->ser_port2) dump_line("Serial Port 2: 0x%x\n", bt->ser_port2); | |
1076 | if(bt->ser_port3) dump_line("Serial Port 3: 0x%x\n", bt->ser_port3); | |
1077 | ||
1078 | if(bt->par_port0) dump_line("Parallel Port 0: 0x%x\n", bt->par_port0); | |
1079 | if(bt->par_port1) dump_line("Parallel Port 1: 0x%x\n", bt->par_port1); | |
1080 | if(bt->par_port2) dump_line("Parallel Port 2: 0x%x\n", bt->par_port2); | |
1081 | ||
1082 | if(bt->low_mem_size) dump_line("Base Memory: %u kB\n", bt->low_mem_size >> 10); | |
1083 | ||
1084 | if(bt->is_pnp_bios) { | |
1085 | char *s = isa_id2str(bt->pnp_id); | |
1086 | dump_line("PnP BIOS: %s\n", s); | |
1087 | free_mem(s); | |
1088 | } | |
1089 | ||
1090 | if(bt->lba_support) { | |
1091 | dump_line_str("BIOS: extended read supported\n"); | |
1092 | } | |
1093 | ||
1094 | if(bt->smp.ok) { | |
1095 | dump_line("MP spec rev 1.%u info:\n", bt->smp.rev); | |
1096 | dump_line(" OEM id: \"%s\"\n", bt->smp.oem_id); | |
1097 | dump_line(" Product id: \"%s\"\n", bt->smp.prod_id); | |
1098 | dump_line(" %u CPUs (%u disabled)\n", bt->smp.cpus, bt->smp.cpus - bt->smp.cpus_en); | |
1099 | } | |
1100 | ||
1101 | if(bt->bios32.ok) { | |
1102 | dump_line("BIOS32 Service Directory Entry: 0x%05x\n", bt->bios32.entry); | |
1103 | } | |
1104 | ||
1105 | if(bt->smbios_ver) { | |
1106 | dump_line("SMBIOS Version: %u.%u\n", bt->smbios_ver >> 8, bt->smbios_ver & 0xff); | |
1107 | } | |
1108 | ||
1109 | smbios_dump(hd_data, f); | |
1110 | } | |
1111 | ||
1112 | ||
1113 | /* | |
1114 | * print PROM entries | |
1115 | */ | |
1116 | void dump_prom(hd_data_t *hd_data, hd_t *hd, FILE *f) | |
1117 | { | |
1118 | prom_info_t *pt; | |
1119 | char *s; | |
1120 | ||
1121 | if(!hd->detail || hd->detail->type != hd_detail_prom) return; | |
1122 | if(!(pt = hd->detail->prom.data)) return; | |
1123 | ||
1124 | if(pt->has_color) { | |
1125 | // ########################### | |
1126 | // s = hd_device_name(hd_data, MAKE_ID(TAG_SPECIAL, 0x0300), MAKE_ID(TAG_SPECIAL, pt->color)); | |
1127 | s = NULL; | |
1128 | if(s) | |
1129 | dump_line("Color: %s (0x%02x)\n", s, pt->color); | |
1130 | else | |
1131 | dump_line("Color: 0x%02x\n", pt->color); | |
1132 | } | |
1133 | } | |
1134 | ||
1135 | ||
1136 | /* | |
1137 | * print System entries | |
1138 | */ | |
1139 | void dump_sys(hd_data_t *hd_data, hd_t *hd, FILE *f) | |
1140 | { | |
1141 | sys_info_t *st; | |
1142 | ||
1143 | if(!hd->detail || hd->detail->type != hd_detail_sys) return; | |
1144 | if(!(st = hd->detail->sys.data)) return; | |
1145 | ||
1146 | if(st->system_type) { | |
1147 | dump_line("SystemType: \"%s\"\n", st->system_type); | |
1148 | } | |
1149 | if(st->generation) { | |
1150 | dump_line("Generation: \"%s\"\n", st->generation); | |
1151 | } | |
1152 | ||
1153 | if(st->lang) { | |
1154 | dump_line("Language: \"%s\"\n", st->lang); | |
1155 | } | |
1156 | } | |
1157 | ||
1158 | ||
1159 | char *dump_hid(hd_data_t *hd_data, hd_id_t *hid, int format, char *buf, int buf_size) | |
1160 | { | |
1161 | char *s; | |
1162 | int i; | |
1163 | unsigned t, id; | |
1164 | ||
1165 | *buf = 0; | |
1166 | ||
1167 | if(hid->id) { | |
1168 | t = ID_TAG(hid->id); | |
1169 | id = ID_VALUE(hid->id); | |
1170 | ||
1171 | if(format && t == TAG_EISA) { | |
1172 | snprintf(buf, buf_size - 1, "%s", eisa_vendor_str(id)); | |
1173 | } | |
1174 | else { | |
1175 | snprintf(buf, buf_size - 1, "%s0x%04x", hid_tag_name2(t), id); | |
1176 | } | |
1177 | } | |
1178 | ||
1179 | i = strlen(buf); | |
1180 | if(i) { | |
1181 | buf[i++] = ' '; | |
1182 | buf[i] = 0; | |
1183 | } | |
1184 | s = buf + i; | |
1185 | buf_size -= i; | |
1186 | ||
1187 | if(!buf_size) return buf; | |
1188 | ||
1189 | if(hid->name) { | |
1190 | snprintf(s, buf_size - 1, "\"%s\"", hid->name); | |
1191 | } | |
1192 | ||
1193 | return buf; | |
1194 | } | |
1195 | ||
1196 | char *dump_hid2(hd_data_t *hd_data, hd_id_t *hid1, hd_id_t *hid2, char *buf, int buf_size) | |
1197 | { | |
1198 | char *s; | |
1199 | int i; | |
1200 | unsigned t, id1, id2; | |
1201 | ||
1202 | *buf = 0; | |
1203 | ||
1204 | t = 0; | |
1205 | if(hid1->id) t = ID_TAG(hid1->id); | |
1206 | if(hid2->id) t = ID_TAG(hid2->id); | |
1207 | ||
1208 | id1 = ID_VALUE(hid1->id); | |
1209 | id2 = ID_VALUE(hid2->id); | |
1210 | ||
1211 | if(hid1->id || hid2->id) { | |
1212 | if(t == TAG_EISA) { | |
1213 | snprintf(buf, buf_size - 1, "%s 0x%04x", eisa_vendor_str(id1), id2); | |
1214 | } | |
1215 | else { | |
1216 | snprintf(buf, buf_size - 1, "%s0x%04x 0x%04x", hid_tag_name2(t), id1, id2); | |
1217 | } | |
1218 | } | |
1219 | ||
1220 | i = strlen(buf); | |
1221 | s = buf + i; | |
1222 | buf_size -= i; | |
1223 | ||
1224 | if(!buf_size) return buf; | |
1225 | ||
1226 | if(hid2->name) { | |
1227 | snprintf(s, buf_size - 1, " \"%s\"", hid2->name); | |
1228 | } | |
1229 | ||
1230 | return buf; | |
1231 | } | |
1232 | ||
1233 | ||
1234 | char *print_dev_num(hd_dev_num_t *d) | |
1235 | { | |
1236 | static char *buf = NULL; | |
1237 | ||
1238 | if(d->type) { | |
1239 | str_printf(&buf, 0, "%s %u:%u", | |
1240 | d->type == 'b' ? "block" : "char", | |
1241 | d->major, d->minor | |
1242 | ); | |
1243 | if(d->range > 1) { | |
1244 | str_printf(&buf, -1, "-%u:%u", | |
1245 | d->major, d->minor + d->range - 1 | |
1246 | ); | |
1247 | } | |
1248 | } | |
1249 | else { | |
1250 | str_printf(&buf, 0, "%s", ""); | |
1251 | } | |
1252 | ||
1253 | return buf; | |
1254 | } | |
1255 | ||
1256 | ||
1257 | #else /* ifndef LIBHD_TINY */ | |
1258 | ||
1259 | void hd_dump_entry(hd_data_t *hd_data, hd_t *h, FILE *f) { } | |
1260 | ||
1261 | #endif /* ifndef LIBHD_TINY */ | |
1262 |