|
libhd
5.0
|
00001 #ifndef _HD_H 00002 #define _HD_H 00003 00009 #ifdef __cplusplus 00010 extern "C" { 00011 #endif 00012 00013 00014 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 00015 * 00016 * libhd data structures 00017 * 00018 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 00019 */ 00020 00022 #define HD_VERSION 19 00023 00031 #define HD_DEB_SHOW_LOG (1 << 0) 00032 #define HD_DEB_PROGRESS (1 << 1) 00033 #define HD_DEB_CREATION (1 << 2) 00034 #define HD_DEB_DRIVER_INFO (1 << 3) 00035 #define HD_DEB_PCI (1 << 4) 00036 #define HD_DEB_ISAPNP (1 << 5) 00037 #define HD_DEB_CDROM (1 << 6) 00038 #define HD_DEB_NET (1 << 7) 00039 #define HD_DEB_FLOPPY (1 << 8) 00040 #define HD_DEB_MISC (1 << 9) 00041 #define HD_DEB_SERIAL (1 << 10) 00042 #define HD_DEB_MONITOR (1 << 11) 00043 #define HD_DEB_CPU (1 << 12) 00044 #define HD_DEB_BIOS (1 << 13) 00045 #define HD_DEB_MOUSE (1 << 14) 00046 #define HD_DEB_IDE (1 << 15) 00047 #define HD_DEB_SCSI (1 << 16) 00048 #define HD_DEB_USB (1 << 17) 00049 #define HD_DEB_ADB (1 << 18) 00050 #define HD_DEB_MODEM (1 << 19) 00051 #define HD_DEB_PARALLEL (1 << 20) 00052 #define HD_DEB_ISA (1 << 21) 00053 #define HD_DEB_BOOT (1 << 22) 00054 #define HD_DEB_HDDB (1 << 23) 00055 00057 #include <stdio.h> 00058 #include <inttypes.h> 00059 #include <termios.h> 00060 #include <sys/types.h> 00061 00062 //typedef struct vm_s vm_t; 00063 00067 #define HARDWARE_DIR "/var/lib/hardware" 00068 00083 #define TAG_PCI 1 00084 #define TAG_EISA 2 00085 #define TAG_USB 3 00086 #define TAG_SPECIAL 4 00087 #define TAG_PCMCIA 5 00092 #define ID_VALUE(id) ((id) & 0xffff) 00093 00097 #define ID_TAG(id) (((id) >> 16) & 0xf) 00098 00102 #define MAKE_ID(tag, id_val) ((tag << 16) | (id_val)) 00103 00109 typedef enum probe_feature { 00110 pr_memory = 1, pr_pci, pr_isapnp, pr_net, pr_floppy, pr_misc, 00111 pr_misc_serial, pr_misc_par, pr_misc_floppy, pr_serial, pr_cpu, pr_bios, 00112 pr_monitor, pr_mouse, pr_scsi, pr_usb, pr_usb_mods, pr_adb, pr_modem, 00113 pr_modem_usb, pr_parallel, pr_parallel_lp, pr_parallel_zip, pr_isa, 00114 pr_isa_isdn, pr_isdn, pr_kbd, pr_prom, pr_sbus, pr_int, pr_braille, 00115 pr_braille_alva, pr_braille_fhp, pr_braille_ht, pr_ignx11, pr_sys, 00116 pr_bios_vbe, pr_isapnp_old, pr_isapnp_new, pr_isapnp_mod, pr_braille_baum, 00117 pr_manual, pr_fb, pr_veth, pr_pppoe, pr_scan, pr_pcmcia, pr_fork, 00118 pr_parallel_imm, pr_s390, pr_cpuemu, pr_sysfs, pr_s390disks, pr_udev, 00119 pr_block, pr_block_cdrom, pr_block_part, pr_edd, pr_edd_mod, pr_bios_ddc, 00120 pr_bios_fb, pr_bios_mode, pr_input, pr_block_mods, pr_bios_vesa, 00121 pr_cpuemu_debug, pr_scsi_noserial, pr_wlan, pr_bios_crc, pr_hal, 00122 pr_bios_vram, pr_bios_acpi, pr_bios_ddc_ports, pr_modules_pata, 00123 pr_net_eeprom, pr_x86emu, 00124 pr_max, pr_lxrc, pr_default, 00125 pr_all 00126 } hd_probe_feature_t; 00127 00136 typedef enum hw_item { 00137 hw_none = 0, hw_sys, hw_cpu, hw_keyboard, hw_braille, hw_mouse, 00138 hw_joystick, hw_printer, hw_scanner, hw_chipcard, hw_monitor, hw_tv, 00139 hw_display, hw_framebuffer, hw_camera, hw_sound, hw_storage_ctrl, 00140 hw_network_ctrl, hw_isdn, hw_modem, hw_network, hw_disk, hw_partition, 00141 hw_cdrom, hw_floppy, hw_manual, hw_usb_ctrl, hw_usb, hw_bios, hw_pci, 00142 hw_isapnp, hw_bridge, hw_hub, hw_scsi, hw_ide, hw_memory, hw_dvb, 00143 hw_pcmcia, hw_pcmcia_ctrl, hw_ieee1394, hw_ieee1394_ctrl, hw_hotplug, 00144 hw_hotplug_ctrl, hw_zip, hw_pppoe, hw_wlan, hw_redasd, hw_dsl, hw_block, 00145 hw_tape, hw_vbe, hw_bluetooth, hw_fingerprint, 00147 hw_unknown, hw_all 00148 } hd_hw_item_t; 00149 00157 typedef enum base_classes { 00158 // these *must* match standard PCI class numbers 00159 bc_none, bc_storage, bc_network, bc_display, bc_multimedia, 00160 bc_memory, bc_bridge, bc_comm, bc_system, bc_input, bc_docking, 00161 bc_processor, bc_serial, bc_wireless, bc_i2o, bc_other = 0xff, 00162 00163 // add our own classes here (starting at 0x100 as PCI values are 8 bit) 00164 bc_monitor = 0x100, bc_internal, bc_modem, bc_isdn, bc_ps2, bc_mouse, 00165 bc_storage_device, bc_network_interface, bc_keyboard, bc_printer, 00166 bc_hub, bc_braille, bc_scanner, bc_joystick, bc_chipcard, bc_camera, 00167 bc_framebuffer, bc_dvb, bc_tv, bc_partition, bc_dsl, bc_bluetooth, bc_fingerprint 00168 } hd_base_classes_t; 00169 00171 typedef enum sc_monitor { 00172 sc_mon_other, sc_mon_crt, sc_mon_lcd 00173 } hd_sc_monitor_t; 00174 00176 typedef enum sc_storage { 00177 sc_sto_scsi, sc_sto_ide, sc_sto_floppy, sc_sto_ipi, sc_sto_raid, 00178 sc_sto_other = 0x80 00179 } hd_sc_storage_t; 00180 00182 typedef enum sc_display { 00183 sc_dis_vga, sc_dis_xga, sc_dis_other = 0x80 00184 } hd_sc_display_t; 00185 00187 typedef enum sc_framebuffer { 00188 sc_fb_vesa = 1 00189 } hd_sc_framebuffer_t; 00190 00192 typedef enum sc_bridge { 00193 sc_bridge_host, sc_bridge_isa, sc_bridge_eisa, sc_bridge_mc, 00194 sc_bridge_pci, sc_bridge_pcmcia, sc_bridge_nubus, sc_bridge_cardbus, 00195 sc_bridge_other = 0x80 00196 } hd_sc_bridge_t; 00197 00199 typedef enum sc_comm { 00200 sc_com_ser, sc_com_par, sc_com_multi, sc_com_modem, sc_com_other = 0x80 00201 } hd_sc_comm_t; 00202 00204 typedef enum sc_system { 00205 sc_sys_pic, sc_sys_dma, sc_sys_timer, sc_sys_rtc, sc_sys_other = 0x80 00206 } hd_sc_system_t; 00207 00209 typedef enum sc_input { 00210 sc_inp_keyb, sc_inp_digit, sc_inp_mouse, sc_inp_other = 0x80 00211 } hd_sc_input_t; 00212 00214 typedef enum sc_serial { 00215 sc_ser_fire, sc_ser_access, sc_ser_ssa, sc_ser_usb, sc_ser_fiber, 00216 sc_ser_smbus, sc_ser_other = 0x80 00217 } hd_sc_serial_t; 00218 00220 typedef enum sc_internal { 00221 sc_int_none, sc_int_isapnp_if, sc_int_main_mem, sc_int_cpu, sc_int_fpu, 00222 sc_int_bios, sc_int_prom, sc_int_sys 00223 } hd_sc_internal_t; 00224 00226 typedef enum sc_mouse { 00227 sc_mou_ps2, sc_mou_ser, sc_mou_bus, sc_mou_usb, sc_mou_sun, 00228 sc_mou_other = 0x80 00229 } hd_sc_mouse_t; 00230 00232 typedef enum sc_std { 00233 sc_sdev_disk, sc_sdev_tape, sc_sdev_cdrom, sc_sdev_floppy, sc_sdev_scanner, 00234 sc_sdev_other = 0x80 00235 } hd_sc_std_t; 00236 00238 typedef enum sc_net_if { 00239 sc_nif_loopback, sc_nif_ethernet, sc_nif_tokenring, sc_nif_fddi, 00240 sc_nif_ctc, sc_nif_iucv, sc_nif_hsi, sc_nif_qeth, 00241 sc_nif_escon, sc_nif_myrinet, sc_nif_wlan, sc_nif_xp, 00242 sc_nif_usb, sc_nif_other = 0x80, sc_nif_sit 00243 } hd_sc_net_if_t; 00244 00246 typedef enum sc_multimedia { 00247 sc_multi_video, sc_multi_audio, sc_multi_other 00248 } hd_sc_multimedia_t; 00249 00251 typedef enum sc_keyboard { 00252 sc_keyboard_kbd, sc_keyboard_console 00253 } hd_sc_keyboard_t; 00254 00256 typedef enum sc_hub { 00257 sc_hub_other, sc_hub_usb 00258 } hd_sc_hub_t; 00259 00261 typedef enum sc_camera { 00262 sc_camera_webcam, sc_camera_digital 00263 } hd_sc_camera_t; 00264 00266 typedef enum sc_modem { 00267 sc_mod_at, sc_mod_win1, sc_mod_win2, sc_mod_win3, sc_mod_win4 00268 } hd_sc_modem_t; 00269 00271 typedef enum sc_dsl { 00272 sc_dsl_unknown, sc_dsl_pppoe, sc_dsl_capi, sc_dsl_capiisdn 00273 } hd_sc_dsl_t; 00274 00276 typedef enum pif_usb_e { 00277 pif_usb_uhci = 0, pif_usb_ohci = 0x10, pif_usb_ehci = 0x20, 00278 pif_usb_other = 0x80, pif_usb_device = 0xfe 00279 } hd_pif_usb_t; 00280 00282 typedef enum pif_cdrom { 00283 pif_cdrom, pif_cdr, pif_cdrw, pif_dvd, pif_dvdr, pif_dvdram 00284 } hd_pif_cdrom_t ; 00285 00287 typedef enum pif_s390disk { 00288 pif_scsi, pif_dasd, pif_dasd_fba 00289 } hd_pif_s390disk_t; 00290 00292 typedef enum bus_types { 00293 bus_none, bus_isa, bus_eisa, bus_mc, bus_pci, bus_pcmcia, bus_nubus, 00294 bus_cardbus, bus_other, 00295 00297 bus_ps2 = 0x80, bus_serial, bus_parallel, bus_floppy, bus_scsi, bus_ide, bus_usb, 00298 bus_adb, bus_raid, bus_sbus, bus_i2o, bus_vio, bus_ccw, bus_iucv, bus_ps3_system_bus, 00299 bus_virtio, bus_ibmebus, bus_gameport 00300 } hd_bus_types_t; 00301 00310 typedef struct { 00314 unsigned invalid:1; 00315 00325 unsigned reconfig:3; 00326 00332 unsigned configured:3; 00333 00344 unsigned available:3; 00345 00353 unsigned needed:3; 00354 00361 unsigned available_orig:3; 00362 00366 unsigned active:3; 00367 } hd_status_t; 00368 00370 typedef enum { 00371 status_no = 1, status_yes, status_unknown, status_new 00372 } hd_status_value_t; 00373 00377 typedef enum { 00378 hp_none, 00379 hp_pcmcia, 00380 hp_cardbus, 00381 hp_pci, 00382 hp_usb, 00383 hp_ieee1394 00384 } hd_hotplug_t; 00385 00396 typedef struct { 00397 unsigned id; 00398 char *name; 00399 } hd_id_t; 00400 00401 00406 typedef struct s_str_list_t { 00407 struct s_str_list_t *next; 00408 char *str; 00409 } str_list_t; 00410 00411 00415 typedef struct { 00416 unsigned char bitmap[16]; 00417 unsigned bits; 00418 unsigned not_empty:1; 00419 str_list_t *str; 00420 } hd_bitmap_t; 00421 00438 typedef struct { 00439 unsigned start, size; 00440 unsigned char *data; 00441 } memory_range_t; 00442 00443 00447 typedef struct { 00448 unsigned ok:1; 00449 unsigned rev; 00450 unsigned mpfp; 00451 unsigned mpconfig_ok:1; 00452 unsigned mpconfig; 00453 unsigned mpconfig_size; 00454 unsigned char feature[5]; 00455 char oem_id[9]; 00456 char prod_id[13]; 00457 unsigned cpus, cpus_en; 00458 } smp_info_t; 00459 00460 00464 typedef struct vbe_mode_info_s { 00465 unsigned number; 00466 unsigned attributes; 00467 unsigned width, height; 00468 unsigned bytes_p_line; 00469 unsigned pixel_size; 00470 unsigned fb_start; 00471 unsigned win_A_start; 00472 unsigned win_A_attr; 00473 unsigned win_B_start; 00474 unsigned win_B_attr; 00475 unsigned win_size; 00476 unsigned win_gran; 00477 unsigned pixel_clock; 00478 } vbe_mode_info_t; 00479 00485 typedef struct { 00486 unsigned ok:1; 00487 unsigned version; 00488 unsigned oem_version; 00489 unsigned memory; 00490 unsigned fb_start; 00491 char *oem_name; 00492 char *vendor_name; 00493 char *product_name; 00494 char *product_revision; 00495 unsigned modes; 00496 vbe_mode_info_t *mode; 00497 unsigned current_mode; 00498 unsigned ddc_ports; 00499 unsigned char ddc_port[4][0x80]; 00500 } vbe_info_t; 00501 00502 00506 typedef struct { 00507 unsigned id; 00508 unsigned char slot; 00509 unsigned char bus; 00510 unsigned char devfn; 00511 unsigned char misc; 00512 } cpq_ctlorder_t; 00513 00514 00515 typedef struct { 00516 unsigned ok:1; 00517 unsigned entry; 00518 unsigned compaq:1; 00519 cpq_ctlorder_t cpq_ctrl[32]; 00520 } bios32_info_t; 00521 00531 typedef enum { 00532 sm_biosinfo, sm_sysinfo, sm_boardinfo, sm_chassis, 00533 sm_processor, sm_memctrl, sm_memmodule, sm_cache, 00534 sm_connect, sm_slot, sm_onboard, sm_oem, 00535 sm_config, sm_lang, sm_group, sm_eventlog, 00536 sm_memarray, sm_memdevice, sm_memerror, sm_memarraymap, 00537 sm_memdevicemap, sm_mouse, sm_battery, sm_reset, 00538 sm_secure, sm_power, sm_voltage, sm_cool, 00539 sm_temperature, sm_current, sm_outofband, sm_bis, 00540 sm_boot, sm_mem64error, sm_mandev, sm_mandevcomp, 00541 sm_mdtd, sm_inactive = 126, sm_end = 127 00542 } hd_smbios_type_t; 00543 00544 00546 typedef struct { 00547 union u_hd_smbios_t *next; 00548 hd_smbios_type_t type; 00549 int data_len; 00550 unsigned char *data; 00551 str_list_t *strings; 00552 int handle; 00553 } smbios_any_t; 00554 00555 00557 typedef struct { 00558 union u_hd_smbios_t *next; 00559 hd_smbios_type_t type; 00560 int data_len; 00561 unsigned char *data; 00562 str_list_t *strings; 00563 int handle; 00564 char *vendor; 00565 char *version; 00566 char *date; 00567 hd_bitmap_t feature; 00568 unsigned start; 00569 unsigned rom_size; 00570 } smbios_biosinfo_t; 00571 00572 00574 typedef struct { 00575 union u_hd_smbios_t *next; 00576 hd_smbios_type_t type; 00577 int data_len; 00578 unsigned char *data; 00579 str_list_t *strings; 00580 int handle; 00581 char *manuf; 00582 char *product; 00583 char *version; 00584 char *serial; 00585 unsigned char uuid[16]; 00586 hd_id_t wake_up; 00587 } smbios_sysinfo_t; 00588 00589 00591 typedef struct { 00592 union u_hd_smbios_t *next; 00593 hd_smbios_type_t type; 00594 int data_len; 00595 unsigned char *data; 00596 str_list_t *strings; 00597 int handle; 00598 char *manuf; 00599 char *product; 00600 char *version; 00601 char *serial; 00602 char *asset; 00603 hd_id_t board_type; 00604 hd_bitmap_t feature; 00605 char *location; 00606 int chassis; 00607 int objects_len; 00608 int *objects; 00609 } smbios_boardinfo_t; 00610 00611 00613 typedef struct { 00614 union u_hd_smbios_t *next; 00615 hd_smbios_type_t type; 00616 int data_len; 00617 unsigned char *data; 00618 str_list_t *strings; 00619 int handle; 00620 char *manuf; 00621 char *version; 00622 char *serial; 00623 char *asset; 00624 hd_id_t ch_type; 00625 unsigned lock; 00626 hd_id_t bootup; 00627 hd_id_t power; 00628 hd_id_t thermal; 00629 hd_id_t security; 00630 unsigned oem; 00631 } smbios_chassis_t; 00632 00633 00635 typedef struct { 00636 union u_hd_smbios_t *next; 00637 hd_smbios_type_t type; 00638 int data_len; 00639 unsigned char *data; 00640 str_list_t *strings; 00641 int handle; 00642 char *socket; 00643 hd_id_t upgrade; 00644 char *manuf; 00645 char *version; 00646 char *serial; 00647 char *asset; 00648 char *part; 00649 hd_id_t pr_type; 00650 hd_id_t family; 00651 uint64_t cpu_id; 00652 unsigned voltage; 00653 unsigned ext_clock; 00654 unsigned max_speed; 00655 unsigned current_speed; 00656 unsigned sock_status; 00657 hd_id_t cpu_status; 00658 int l1_cache; 00659 int l2_cache; 00660 int l3_cache; 00661 } smbios_processor_t; 00662 00663 00665 typedef struct { 00666 union u_hd_smbios_t *next; 00667 hd_smbios_type_t type; 00668 int data_len; 00669 unsigned char *data; 00670 str_list_t *strings; 00671 int handle; 00672 char *socket; 00673 unsigned max_size; 00674 unsigned current_size; 00675 unsigned speed; 00676 hd_id_t mode; 00677 unsigned state; 00678 hd_id_t location; 00679 unsigned socketed; 00680 unsigned level; 00681 hd_id_t ecc; 00682 hd_id_t cache_type; 00683 hd_id_t assoc; 00684 hd_bitmap_t supp_sram; 00685 hd_bitmap_t sram; 00686 } smbios_cache_t; 00687 00688 00690 typedef struct { 00691 union u_hd_smbios_t *next; 00692 hd_smbios_type_t type; 00693 int data_len; 00694 unsigned char *data; 00695 str_list_t *strings; 00696 int handle; 00697 hd_id_t port_type; 00698 char *i_des; 00699 hd_id_t i_type; 00700 char *x_des; 00701 hd_id_t x_type; 00702 } smbios_connect_t; 00703 00704 00706 typedef struct { 00707 union u_hd_smbios_t *next; 00708 hd_smbios_type_t type; 00709 int data_len; 00710 unsigned char *data; 00711 str_list_t *strings; 00712 int handle; 00713 char *desig; 00714 hd_id_t slot_type; 00715 hd_id_t bus_width; 00716 hd_id_t usage; 00717 hd_id_t length; 00718 unsigned id; 00719 hd_bitmap_t feature; 00720 } smbios_slot_t; 00721 00722 00724 typedef struct { 00725 union u_hd_smbios_t *next; 00726 hd_smbios_type_t type; 00727 int data_len; 00728 unsigned char *data; 00729 str_list_t *strings; 00730 int handle; 00731 unsigned dev_len; 00732 struct { 00733 char *name; 00734 hd_id_t type; 00735 unsigned status; 00736 } *dev; 00737 } smbios_onboard_t; 00738 00739 00741 typedef struct { 00742 union u_hd_smbios_t *next; 00743 hd_smbios_type_t type; 00744 int data_len; 00745 unsigned char *data; 00746 str_list_t *strings; 00747 int handle; 00748 str_list_t *oem_strings; 00749 } smbios_oem_t; 00750 00751 00753 typedef struct { 00754 union u_hd_smbios_t *next; 00755 hd_smbios_type_t type; 00756 int data_len; 00757 unsigned char *data; 00758 str_list_t *strings; 00759 int handle; 00760 str_list_t *options; 00761 } smbios_config_t; 00762 00763 00765 typedef struct { 00766 union u_hd_smbios_t *next; 00767 hd_smbios_type_t type; 00768 int data_len; 00769 unsigned char *data; 00770 str_list_t *strings; 00771 int handle; 00772 char *current; 00773 } smbios_lang_t; 00774 00775 00777 typedef struct { 00778 union u_hd_smbios_t *next; 00779 hd_smbios_type_t type; 00780 int data_len; 00781 unsigned char *data; 00782 str_list_t *strings; 00783 int handle; 00784 char *name; 00785 int items_len; 00786 int *item_handles; 00787 } smbios_group_t; 00788 00789 00791 typedef struct { 00792 union u_hd_smbios_t *next; 00793 hd_smbios_type_t type; 00794 int data_len; 00795 unsigned char *data; 00796 str_list_t *strings; 00797 int handle; 00798 hd_id_t location; 00799 hd_id_t use; 00800 hd_id_t ecc; 00801 unsigned max_size; 00802 int error_handle; 00803 unsigned slots; 00804 } smbios_memarray_t; 00805 00806 00808 typedef struct { 00809 union u_hd_smbios_t *next; 00810 hd_smbios_type_t type; 00811 int data_len; 00812 unsigned char *data; 00813 str_list_t *strings; 00814 int handle; 00815 char *location; 00816 char *bank; 00817 char *manuf; 00818 char *serial; 00819 char *asset; 00820 char *part; 00821 int array_handle; 00822 int error_handle; 00823 unsigned width; 00824 unsigned eccbits; 00825 unsigned size; 00826 hd_id_t form; 00827 unsigned set; 00828 hd_id_t mem_type; 00829 hd_bitmap_t type_detail; 00830 unsigned speed; 00831 } smbios_memdevice_t; 00832 00833 00835 typedef struct { 00836 union u_hd_smbios_t *next; 00837 hd_smbios_type_t type; 00838 int data_len; 00839 unsigned char *data; 00840 str_list_t *strings; 00841 int handle; 00842 hd_id_t err_type; 00843 hd_id_t granularity; 00844 hd_id_t operation; 00845 unsigned syndrome; 00846 unsigned array_addr; 00847 unsigned device_addr; 00848 unsigned range; 00849 } smbios_memerror_t; 00850 00851 00853 typedef struct { 00854 union u_hd_smbios_t *next; 00855 hd_smbios_type_t type; 00856 int data_len; 00857 unsigned char *data; 00858 str_list_t *strings; 00859 int handle; 00860 int array_handle; 00861 uint64_t start_addr; 00862 uint64_t end_addr; 00863 unsigned part_width; 00864 } smbios_memarraymap_t; 00865 00866 00868 typedef struct { 00869 union u_hd_smbios_t *next; 00870 hd_smbios_type_t type; 00871 int data_len; 00872 unsigned char *data; 00873 str_list_t *strings; 00874 int handle; 00875 int memdevice_handle; 00876 int arraymap_handle; 00877 uint64_t start_addr; 00878 uint64_t end_addr; 00879 unsigned row_pos; 00880 unsigned interleave_pos; 00881 unsigned interleave_depth; 00882 } smbios_memdevicemap_t; 00883 00884 00886 typedef struct { 00887 union u_hd_smbios_t *next; 00888 hd_smbios_type_t type; 00889 int data_len; 00890 unsigned char *data; 00891 str_list_t *strings; 00892 int handle; 00893 hd_id_t mtype; 00894 hd_id_t interface; 00895 unsigned buttons; 00896 } smbios_mouse_t; 00897 00898 00900 typedef struct { 00901 union u_hd_smbios_t *next; 00902 hd_smbios_type_t type; 00903 int data_len; 00904 unsigned char *data; 00905 str_list_t *strings; 00906 int handle; 00907 hd_id_t power; 00908 hd_id_t keyboard; 00909 hd_id_t admin; 00910 hd_id_t reset; 00911 } smbios_secure_t; 00912 00913 00915 typedef struct { 00916 union u_hd_smbios_t *next; 00917 hd_smbios_type_t type; 00918 int data_len; 00919 unsigned char *data; 00920 str_list_t *strings; 00921 int handle; 00922 unsigned month; 00923 unsigned day; 00924 unsigned hour; 00925 unsigned minute; 00926 unsigned second; 00927 } smbios_power_t; 00928 00929 00931 typedef struct { 00932 union u_hd_smbios_t *next; 00933 hd_smbios_type_t type; 00934 int data_len; 00935 unsigned char *data; 00936 str_list_t *strings; 00937 int handle; 00938 hd_id_t err_type; 00939 hd_id_t granularity; 00940 hd_id_t operation; 00941 unsigned syndrome; 00942 uint64_t array_addr; 00943 uint64_t device_addr; 00944 unsigned range; 00945 } smbios_mem64error_t; 00946 00947 00949 typedef union u_hd_smbios_t { 00950 union u_hd_smbios_t *next; 00951 smbios_any_t any; 00952 smbios_biosinfo_t biosinfo; 00953 smbios_sysinfo_t sysinfo; 00954 smbios_boardinfo_t boardinfo; 00955 smbios_chassis_t chassis; 00956 smbios_processor_t processor; 00957 smbios_cache_t cache; 00958 smbios_connect_t connect; 00959 smbios_slot_t slot; 00960 smbios_onboard_t onboard; 00961 smbios_oem_t oem; 00962 smbios_config_t config; 00963 smbios_lang_t lang; 00964 smbios_group_t group; 00965 smbios_memarray_t memarray; 00966 smbios_memdevice_t memdevice; 00967 smbios_memerror_t memerror; 00968 smbios_memarraymap_t memarraymap; 00969 smbios_memdevicemap_t memdevicemap; 00970 smbios_mouse_t mouse; 00971 smbios_secure_t secure; 00972 smbios_power_t power; 00973 smbios_mem64error_t mem64error; 00974 } hd_smbios_t; 00975 00983 typedef struct s_udevinfo_t { 00984 struct s_udevinfo_t *next; 00985 char *sysfs; 00986 char *name; 00987 str_list_t *links; 00988 } hd_udevinfo_t; 00989 00990 00994 typedef struct s_sysfsdrv_t { 00995 struct s_sysfsdrv_t *next; 00996 char *driver; 00997 char *device; 00998 char *module; 00999 } hd_sysfsdrv_t; 01000 01001 01007 typedef struct { 01008 int type; 01009 unsigned major, minor, range; 01010 } hd_dev_num_t; 01011 01012 01027 typedef struct s_pci_t { 01028 struct s_pci_t *next; 01029 unsigned data_len; 01030 unsigned data_ext_len; 01031 unsigned char data[256]; 01032 char *log; 01033 unsigned flags, 01034 cmd, 01035 hdr_type, 01036 secondary_bus; 01037 unsigned bus, 01038 slot, func; 01039 unsigned base_class, sub_class, prog_if; 01040 unsigned dev, vend, sub_dev, sub_vend, rev; 01041 unsigned irq; 01042 uint64_t base_addr[7]; 01043 uint64_t base_len[7]; 01044 unsigned addr_flags[7]; 01045 uint64_t rom_base_addr; 01046 uint64_t rom_base_len; 01047 char *sysfs_id; 01048 char *sysfs_bus_id; 01049 char *modalias; 01050 unsigned edid_len[4]; 01051 unsigned char edid_data[4][0x80]; 01052 } pci_t; 01053 01058 typedef enum pci_flags { 01059 pci_flag_ok, pci_flag_pm, pci_flag_agp 01060 } hd_pci_flags_t; 01061 01062 01067 typedef struct usb_s { 01068 struct usb_s *next; 01069 unsigned hd_idx; 01070 unsigned hd_base_idx; 01071 str_list_t *c, *d, *e, *i, *p, *s, *t; 01072 struct usb_s *cloned; 01073 int bus, dev_nr, lev, parent, port, count, conns, used_conns, ifdescr; 01074 unsigned speed; 01075 unsigned vendor, device, rev; 01076 char *manufact, *product, *serial; 01077 char *driver; 01078 memory_range_t raw_descr; 01079 int d_cls, d_sub, d_prot; 01080 int i_alt, i_cls, i_sub, i_prot; 01081 unsigned country; 01082 } usb_t; 01083 01084 01088 typedef struct { 01089 int len; 01090 int type; 01091 unsigned char *data; 01092 } isapnp_res_t; 01093 01097 typedef struct { 01098 int csn; 01099 int log_devs; 01100 unsigned char *serial; 01101 unsigned char *card_regs; 01102 unsigned char (*ldev_regs)[0xd0]; 01103 int res_len; 01104 unsigned broken:1; 01105 isapnp_res_t *res; 01106 } isapnp_card_t; 01107 01111 typedef struct { 01112 int read_port; 01113 int cards; 01114 isapnp_card_t *card; 01115 } isapnp_t; 01116 01120 typedef struct { 01121 isapnp_card_t *card; 01122 int dev; 01123 unsigned flags; 01124 unsigned ref:1; 01125 } isapnp_dev_t; 01126 01131 typedef enum isapnp_flags { 01132 isapnp_flag_act 01133 } hd_isapnp_flags_t; 01134 01135 01139 typedef struct scsi_s { 01140 struct scsi_s *next; 01141 unsigned deleted:1; 01142 unsigned generic:1; 01143 unsigned fake:1; 01144 unsigned wwpn_ok:1; 01145 unsigned fcp_lun_ok:1; 01146 char *dev_name; 01147 char *guessed_dev_name; 01148 int generic_dev; 01149 unsigned host, channel, id, lun; 01150 char *vendor, *model, *rev, *type_str, *serial; 01151 int type; 01152 unsigned inode_low; 01153 char *proc_dir, *driver; 01154 unsigned unique; 01155 char *info; 01156 unsigned lgeo_c, lgeo_h, lgeo_s; 01157 unsigned pgeo_c, pgeo_h, pgeo_s; 01158 uint64_t size; 01159 unsigned sec_size; 01160 unsigned cache; 01161 str_list_t *host_info; 01162 char *usb_guid; 01163 unsigned pci_info; 01164 unsigned pci_bus; 01165 unsigned pci_slot; 01166 unsigned pci_func; 01167 uint64_t wwpn; 01168 uint64_t fcp_lun; 01169 char *controller_id; 01170 } scsi_t; 01171 01172 01176 typedef struct devtree_s { 01177 struct devtree_s *next; 01178 struct devtree_s *parent; 01179 unsigned idx; 01180 char *path, *filename; 01181 unsigned pci:1; 01182 char *name, *model, *device_type, *compatible; 01183 int class_code; 01184 int vendor_id, device_id, subvendor_id, subdevice_id; 01185 int revision_id, interrupt; 01186 unsigned char *edid; 01187 } devtree_t; 01188 01189 enum pmac_model { 01190 AAPL_3400, 01191 AAPL_3500, 01192 AAPL_7200, 01193 AAPL_7300, 01194 AAPL_7500, 01195 AAPL_8500, 01196 AAPL_9500, 01197 AAPL_Gossamer, 01198 AAPL_PowerBook1998, 01199 AAPL_PowerMac_G3, 01200 AAPL_ShinerESB, 01201 AAPL_e407, 01202 AAPL_e411, 01203 PowerBook1_1, 01204 PowerBook2_1, 01205 PowerBook2_2, 01206 PowerBook3_1, 01207 PowerBook3_2, 01208 PowerBook3_3, 01209 PowerBook3_4, 01210 PowerBook3_5, 01211 PowerBook4_1, 01212 PowerBook4_2, 01213 PowerBook4_3, 01214 PowerBook5_1, 01215 PowerBook5_2, 01216 PowerBook5_3, 01217 PowerBook5_4, 01218 PowerBook5_5, 01219 PowerBook5_6, 01220 PowerBook5_7, 01221 PowerBook5_8, 01222 PowerBook5_9, 01223 PowerBook6_1, 01224 PowerBook6_2, 01225 PowerBook6_3, 01226 PowerBook6_4, 01227 PowerBook6_5, 01228 PowerBook6_7, 01229 PowerBook6_8, 01230 PowerMac1_1, 01231 PowerMac1_2, 01232 PowerMac10_1, 01233 PowerMac11_2, 01234 PowerMac12_1, 01235 PowerMac2_1, 01236 PowerMac2_2, 01237 PowerMac3_1, 01238 PowerMac3_2, 01239 PowerMac3_3, 01240 PowerMac3_4, 01241 PowerMac3_5, 01242 PowerMac3_6, 01243 PowerMac4_1, 01244 PowerMac4_2, 01245 PowerMac4_4, 01246 PowerMac5_1, 01247 PowerMac6_1, 01248 PowerMac6_3, 01249 PowerMac6_4, 01250 PowerMac7_2, 01251 PowerMac7_3, 01252 PowerMac8_1, 01253 PowerMac9_1, 01254 RackMac1_1, 01255 RackMac1_2, 01256 RackMac3_1, 01257 iMac_1, 01258 }; 01262 struct pmac_mb_def { 01263 enum pmac_model model; 01264 const char *string; 01265 }; 01266 01270 typedef struct ccw_s { 01271 unsigned char lcss; 01272 unsigned char cu_model; 01273 unsigned char dev_model; 01274 } ccw_t; 01275 01279 typedef struct joystick_s { 01280 unsigned char buttons; 01281 unsigned char axes; 01282 } joystick_t; 01283 01287 typedef struct cdrom_info_s { 01288 struct cdrom_info_s *next; 01289 char *name; 01290 unsigned speed; 01291 unsigned cdr:1, cdrw:1, dvd:1, dvdr:1, dvdram:1; 01292 unsigned cdrom:1; 01293 struct { 01294 unsigned ok:1; 01295 char *volume, *publisher, *preparer, *application, *creation_date; 01296 } iso9660; 01297 struct { 01298 unsigned ok:1; 01299 unsigned platform; 01300 char *id_string; 01301 unsigned bootable:1; 01302 unsigned media_type; 01303 unsigned load_address; 01304 unsigned load_count; 01305 unsigned start; 01306 unsigned catalog; 01307 struct { 01308 unsigned c, h, s; 01309 unsigned size; 01310 } geo; 01311 char *label; 01312 } el_torito; 01313 01314 } cdrom_info_t; 01315 01316 01322 typedef struct { 01323 unsigned char block0[512]; 01324 } floppy_info_t; 01325 01326 01330 typedef struct { 01331 unsigned apm_supported:1; 01332 unsigned apm_enabled:1; 01333 unsigned apm_ver, apm_subver; 01334 unsigned apm_bios_flags; 01335 01336 unsigned vbe_ver; 01337 unsigned vbe_video_mem; 01338 01339 unsigned ser_port0, ser_port1, ser_port2, ser_port3; 01340 unsigned par_port0, par_port1, par_port2; 01341 01343 unsigned is_pnp_bios:1; 01344 unsigned pnp_id; 01345 unsigned lba_support:1; 01346 01347 unsigned low_mem_size; 01348 smp_info_t smp; 01349 vbe_info_t vbe; 01350 01351 unsigned smbios_ver; 01352 01353 struct { 01354 unsigned width; 01355 unsigned height; 01356 unsigned xsize; 01357 unsigned ysize; 01358 char *vendor; 01359 char *name; 01360 } lcd; 01361 01362 struct { 01363 char *vendor; 01364 char *type; 01365 unsigned bus; 01366 unsigned compat_vend; 01367 unsigned compat_dev; 01368 } mouse; 01369 01370 struct { 01371 unsigned ok:1; 01372 unsigned scroll_lock:1; 01373 unsigned num_lock:1; 01374 unsigned caps_lock:1; 01375 } led; 01376 01377 bios32_info_t bios32; 01378 01379 } bios_info_t; 01380 01381 01385 typedef struct { 01386 unsigned has_color:1; 01387 unsigned color; 01388 } prom_info_t; 01389 01390 01394 typedef struct { 01395 char *system_type; 01396 char *generation; 01397 char *vendor; 01398 char *model; 01399 char *serial; 01400 char *lang; 01401 char *formfactor; 01402 } sys_info_t; 01403 01404 01408 typedef struct { 01409 unsigned manu_year; 01410 unsigned min_vsync, max_vsync; 01411 unsigned min_hsync, max_hsync; 01412 unsigned clock; 01413 unsigned width, height; 01414 unsigned width_mm, height_mm; 01415 unsigned hdisp, hsyncstart, hsyncend, htotal; 01416 unsigned vdisp, vsyncstart, vsyncend, vtotal; 01417 char hflag,vflag; 01418 char *vendor; 01419 char *name; 01420 char *serial; 01421 } monitor_info_t; 01422 01429 typedef enum cpu_arch { 01430 arch_unknown = 0, 01431 arch_intel, 01432 arch_alpha, 01433 arch_sparc, arch_sparc64, 01434 arch_ppc, arch_ppc64, 01435 arch_68k, 01436 arch_ia64, 01437 arch_s390, arch_s390x, 01438 arch_arm, 01439 arch_mips, 01440 arch_x86_64 01441 } hd_cpu_arch_t; 01442 01446 typedef enum boot_arch { 01447 boot_unknown = 0, 01448 boot_lilo, boot_milo, boot_aboot, boot_silo, boot_ppc, boot_elilo, boot_s390, 01449 boot_mips, boot_grub, boot_uboot, 01450 } hd_boot_arch_t; 01451 01452 01461 typedef struct { 01462 enum cpu_arch architecture; 01463 unsigned family; 01464 unsigned model; 01465 unsigned stepping; 01466 unsigned cache; 01467 unsigned clock; 01468 unsigned units; 01469 char *vend_name; 01470 char *model_name; 01471 char *platform; 01472 str_list_t *features; 01473 double bogo; 01474 } cpu_info_t; 01475 01476 01481 typedef struct { 01482 uint64_t sectors; 01483 struct { 01484 unsigned cyls, heads, sectors; 01485 } edd; 01486 struct { 01487 unsigned cyls, heads, sectors; 01488 } legacy; 01489 unsigned ext_fixed_disk:1; 01490 unsigned ext_lock_eject:1; 01491 unsigned ext_edd:1; 01492 unsigned ext_64bit:1; 01493 unsigned assigned:1; 01494 unsigned valid:1; 01495 unsigned ext_fibre:1; 01496 unsigned ext_net:1; 01497 char *sysfs_id; 01498 unsigned hd_idx; 01499 unsigned signature; 01500 } edd_info_t; 01501 01507 typedef struct { 01508 unsigned data_len, data_max; 01509 unsigned *data; 01510 unsigned names_len, names_max; 01511 char *names; 01512 } hddb_data_t; 01513 01517 typedef uint32_t hddb_entry_mask_t; 01518 01522 typedef struct hddb_list_s { 01523 hddb_entry_mask_t key_mask; 01524 hddb_entry_mask_t value_mask; 01525 unsigned key; 01526 unsigned value; 01527 } hddb_list_t; 01528 01532 typedef struct { 01533 unsigned list_len, list_max; 01534 hddb_list_t *list; 01535 unsigned ids_len, ids_max; 01536 unsigned *ids; 01537 unsigned strings_len, strings_max; 01538 char *strings; 01539 } hddb2_data_t; 01540 01541 01545 typedef enum modinfo_type_e { mi_none = 0, mi_pci, mi_other } modinfo_type_t; 01546 01550 typedef struct { 01551 char *module; 01552 char *alias; 01553 modinfo_type_t type; 01554 union { 01555 struct { 01556 struct { 01557 unsigned vendor:1; 01558 unsigned device:1; 01559 unsigned sub_vendor:1; 01560 unsigned sub_device:1; 01561 unsigned base_class:1; 01562 unsigned sub_class:1; 01563 unsigned prog_if:1; 01564 } has; 01565 unsigned vendor; 01566 unsigned device; 01567 unsigned sub_vendor; 01568 unsigned sub_device; 01569 unsigned base_class; 01570 unsigned sub_class; 01571 unsigned prog_if; 01572 } pci; 01573 01574 struct { 01575 struct { 01576 unsigned vendor:1; 01577 unsigned product:1; 01578 unsigned device_class:1; 01579 unsigned device_subclass:1; 01580 } has; 01581 unsigned vendor; 01582 unsigned product; 01583 unsigned device_class; 01584 unsigned device_subclass; 01585 } usb; 01586 }; 01587 } modinfo_t; 01588 01589 01593 typedef enum { 01594 p_invalid, p_string, p_int32, p_uint64, p_double, p_bool, p_list 01595 } hal_prop_type_t; 01596 01597 01601 typedef struct hal_prop_s { 01602 struct hal_prop_s *next; 01603 hal_prop_type_t type; 01604 char *key; 01605 union { 01606 char *str; 01607 int32_t int32; 01608 uint64_t uint64; 01609 double d; 01610 int b; 01611 str_list_t *list; 01612 } val; 01613 } hal_prop_t; 01614 01615 01619 typedef struct hal_device_s { 01620 struct hal_device_s *next, *parent; 01621 char *udi; 01622 unsigned used:1; 01623 hal_prop_t *prop; 01624 } hal_device_t; 01625 01629 typedef enum resource_types { 01630 res_any, res_phys_mem, res_mem, res_io, res_irq, res_dma, res_monitor, 01631 res_size, res_disk_geo, res_cache, res_baud, res_init_strings, res_pppd_option, 01632 res_framebuffer, res_hwaddr, res_link, res_wlan, res_fc 01633 } hd_resource_types_t; 01634 01635 01639 typedef enum size_units { 01640 size_unit_cm, size_unit_cinch, size_unit_byte, size_unit_sectors, 01641 size_unit_kbyte, size_unit_mbyte, size_unit_gbyte, size_unit_mm 01642 } hd_size_units_t; 01643 01647 typedef enum access_flags { 01648 acc_unknown, 01649 acc_ro, 01650 acc_wo, 01651 acc_rw 01652 } hd_access_flags_t; 01653 01654 01655 typedef enum yes_no_flag { 01656 flag_unknown, 01657 flag_no, 01658 flag_yes 01659 } hd_yes_no_flag_t; 01660 01661 01662 typedef enum geo_types { 01663 geo_physical = 0, 01664 geo_logical, 01665 geo_bios_edd, 01666 geo_bios_legacy 01667 } hd_geo_types_t; 01668 01669 01676 typedef struct { 01677 union u_hd_res_t *next; 01678 enum resource_types type; 01679 } res_any_t; 01680 01681 typedef struct { 01682 union u_hd_res_t *next; 01683 enum resource_types type; 01684 uint64_t base, range; 01685 unsigned 01686 enabled:1, 01687 access:2, 01688 prefetch:2; 01689 } res_mem_t; 01690 01691 typedef struct { 01692 union u_hd_res_t *next; 01693 enum resource_types type; 01694 uint64_t range; 01695 } res_phys_mem_t; 01696 01697 typedef struct { 01698 union u_hd_res_t *next; 01699 enum resource_types type; 01700 uint64_t base, range; 01701 unsigned 01702 enabled:1, 01703 access:2; 01704 } res_io_t; 01705 01706 typedef struct { 01707 union u_hd_res_t *next; 01708 enum resource_types type; 01709 unsigned base; 01710 unsigned triggered; 01711 unsigned enabled:1; 01712 } res_irq_t; 01713 01714 typedef struct { 01715 union u_hd_res_t *next; 01716 enum resource_types type; 01717 unsigned base; 01718 unsigned enabled:1; 01719 } res_dma_t; 01720 01721 typedef struct { 01722 union u_hd_res_t *next; 01723 enum resource_types type; 01724 enum size_units unit; 01725 uint64_t val1, val2; 01726 } res_size_t; 01727 01728 typedef struct { 01729 union u_hd_res_t *next; 01730 enum resource_types type; 01731 unsigned speed; 01732 unsigned bits, stopbits; 01733 char parity; 01734 char handshake; 01735 } res_baud_t; 01736 01737 typedef struct { 01738 union u_hd_res_t *next; 01739 enum resource_types type; 01740 unsigned size; 01741 } res_cache_t; 01742 01743 typedef struct { 01744 union u_hd_res_t *next; 01745 enum resource_types type; 01746 unsigned cyls, heads, sectors; 01747 uint64_t size; 01748 enum geo_types geotype; 01749 } res_disk_geo_t; 01750 01751 typedef struct { 01752 union u_hd_res_t *next; 01753 enum resource_types type; 01754 unsigned width, height; 01755 unsigned vfreq; 01756 unsigned interlaced:1; 01757 } res_monitor_t; 01758 01759 typedef struct { 01760 union u_hd_res_t *next; 01761 enum resource_types type; 01762 char *init1; 01763 char *init2; 01764 } res_init_strings_t; 01765 01766 typedef struct { 01767 union u_hd_res_t *next; 01768 enum resource_types type; 01769 char *option; 01770 } res_pppd_option_t; 01771 01772 typedef struct { 01773 union u_hd_res_t *next; 01774 enum resource_types type; 01775 unsigned width, height; 01776 unsigned bytes_p_line; 01777 unsigned colorbits; 01778 unsigned mode; 01779 } res_framebuffer_t; 01780 01781 typedef struct { 01782 union u_hd_res_t *next; 01783 enum resource_types type; 01784 char *addr; 01785 } res_hwaddr_t; 01786 01787 typedef struct { 01788 union u_hd_res_t *next; 01789 enum resource_types type; 01790 unsigned state:1; 01791 } res_link_t; 01792 01794 typedef struct { 01795 union u_hd_res_t *next; 01796 enum resource_types type; 01797 str_list_t *channels; 01798 str_list_t *frequencies; 01799 str_list_t *bitrates; 01800 str_list_t *auth_modes; 01801 str_list_t *enc_modes; 01802 } res_wlan_t; 01803 01804 typedef struct { 01805 union u_hd_res_t *next; 01806 enum resource_types type; 01807 unsigned wwpn_ok:1; 01808 unsigned fcp_lun_ok:1; 01809 unsigned port_id_ok:1; 01810 uint64_t wwpn; 01811 uint64_t fcp_lun; 01812 unsigned port_id; 01813 char *controller_id; 01814 } res_fc_t; 01815 01817 typedef union u_hd_res_t { 01818 union u_hd_res_t *next; 01819 res_any_t any; 01820 res_io_t io; 01821 res_mem_t mem; 01822 res_phys_mem_t phys_mem; 01823 res_irq_t irq; 01824 res_dma_t dma; 01825 res_size_t size; 01826 res_cache_t cache; 01827 res_baud_t baud; 01828 res_disk_geo_t disk_geo; 01829 res_monitor_t monitor; 01830 res_init_strings_t init_strings; 01831 res_pppd_option_t pppd_option; 01832 res_framebuffer_t framebuffer; 01833 res_hwaddr_t hwaddr; 01834 res_link_t link; 01835 res_wlan_t wlan; 01836 res_fc_t fc; 01837 } hd_res_t; 01838 01847 typedef struct { 01848 uint64_t addr, size; 01849 char *dev; 01850 unsigned tag; 01851 } misc_io_t; 01852 01853 typedef struct { 01854 unsigned channel; 01855 char *dev; 01856 unsigned tag; 01857 } misc_dma_t; 01858 01859 typedef struct { 01860 unsigned irq, events; 01861 int devs; 01862 char **dev; 01863 unsigned tag; 01864 } misc_irq_t; 01865 01866 typedef struct { 01867 unsigned io_len, dma_len, irq_len; 01868 misc_io_t *io; 01869 misc_dma_t *dma; 01870 misc_irq_t *irq; 01871 str_list_t *proc_io, *proc_dma, *proc_irq; 01872 } misc_t; 01873 01879 typedef struct s_serial_t { 01880 struct s_serial_t *next; 01881 char *name; 01882 char *device; 01883 unsigned line, port, irq, baud; 01884 } serial_t; 01885 01889 typedef struct s_ser_device_t { 01890 struct s_ser_device_t *next; 01891 unsigned hd_idx; 01892 char *dev_name; 01893 str_list_t *at_resp; 01894 int fd; 01895 struct termios tio; 01896 unsigned max_baud, cur_baud; 01897 unsigned is_mouse:1; 01898 unsigned is_modem:1; 01899 unsigned do_io:1; 01900 unsigned char buf[0x1000]; 01901 int buf_len; 01902 int garbage, non_pnp, pnp; 01903 unsigned char pnp_id[8]; 01904 char *serial, *class_name, *dev_id, *user_name, *vend, *init_string1, *init_string2, *pppd_option; 01905 unsigned pnp_rev; 01906 unsigned bits; 01907 } ser_device_t; 01908 01922 typedef struct isdn_parm_s { 01923 struct isdn_parm_s *next; 01924 char *name; 01925 unsigned valid:1; 01926 unsigned conflict:1; 01927 uint64_t value; 01928 unsigned type; 01929 unsigned flags; 01930 unsigned def_value; 01931 int alt_values; 01932 unsigned *alt_value; 01933 } isdn_parm_t; 01934 01936 typedef enum driver_info_type { 01937 di_any, di_display, di_module, di_mouse, di_x11, di_isdn, di_kbd, di_dsl 01938 } hd_driver_info_t; 01939 01941 typedef struct { 01942 union driver_info_u *next; 01943 enum driver_info_type type; 01944 str_list_t *hddb0, *hddb1; 01945 } driver_info_any_t; 01946 01948 typedef struct { 01949 union driver_info_u *next; 01950 enum driver_info_type type; 01951 str_list_t *hddb0, *hddb1; 01952 unsigned width, height; 01953 unsigned min_vsync, max_vsync; 01954 unsigned min_hsync, max_hsync; 01955 unsigned bandwidth; 01956 unsigned hdisp, hsyncstart, hsyncend, htotal; 01957 unsigned vdisp, vsyncstart, vsyncend, vtotal; 01958 char hflag,vflag; 01959 } driver_info_display_t; 01960 01962 typedef struct { 01963 union driver_info_u *next; 01964 enum driver_info_type type; 01965 str_list_t *hddb0, *hddb1; 01966 unsigned active:1; 01967 unsigned modprobe:1; 01968 str_list_t *names; 01969 str_list_t *mod_args; 01970 char *conf; 01971 } driver_info_module_t; 01972 01974 typedef struct { 01975 union driver_info_u *next; 01976 enum driver_info_type type; 01977 str_list_t *hddb0, *hddb1; 01978 char *xf86; 01979 char *gpm; 01980 int buttons; 01981 int wheels; 01982 } driver_info_mouse_t; 01983 01985 typedef struct { 01986 union driver_info_u *next; 01987 enum driver_info_type type; 01988 str_list_t *hddb0, *hddb1; 01989 char *server; 01990 char *xf86_ver; 01991 unsigned x3d:1; 01992 struct { 01993 unsigned all:5; 01994 unsigned c8:1, c15:1, c16:1, c24:1, c32:1; 01995 } colors; 01996 unsigned dacspeed; 01997 str_list_t *extensions; 01998 str_list_t *options; 01999 str_list_t *raw; 02000 char *script; 02001 } driver_info_x11_t; 02002 02004 typedef struct { 02005 union driver_info_u *next; 02006 enum driver_info_type type; 02007 str_list_t *hddb0, *hddb1; 02008 int i4l_type, i4l_subtype; 02009 char *i4l_name; 02010 isdn_parm_t *params; 02011 } driver_info_isdn_t; 02012 02014 typedef struct { 02015 union driver_info_u *next; 02016 enum driver_info_type type; 02017 str_list_t *hddb0, *hddb1; 02018 char *mode; 02019 char *name; 02020 } driver_info_dsl_t; 02021 02023 typedef struct { 02024 union driver_info_u *next; 02025 enum driver_info_type type; 02026 str_list_t *hddb0, *hddb1; 02027 char *XkbRules; 02028 char *XkbModel; 02029 char *XkbLayout; 02030 char *keymap; 02031 } driver_info_kbd_t; 02032 02033 /* 02034 * holds device driver info 02035 */ 02036 typedef union driver_info_u { 02037 union driver_info_u *next; 02038 driver_info_any_t any; 02039 driver_info_module_t module; 02040 driver_info_mouse_t mouse; 02041 driver_info_x11_t x11; 02042 driver_info_display_t display; 02043 driver_info_isdn_t isdn; 02044 driver_info_dsl_t dsl; 02045 driver_info_kbd_t kbd; 02046 } driver_info_t; 02047 02058 typedef enum hd_detail_type { 02059 hd_detail_pci, hd_detail_usb, hd_detail_isapnp, hd_detail_cdrom, 02060 hd_detail_floppy, hd_detail_bios, hd_detail_cpu, hd_detail_prom, 02061 hd_detail_monitor, hd_detail_sys, hd_detail_scsi, hd_detail_devtree, 02062 hd_detail_ccw, hd_detail_joystick 02063 } hd_detail_type_t; 02064 02065 typedef struct { 02066 enum hd_detail_type type; 02067 pci_t *data; 02068 } hd_detail_pci_t; 02069 02070 typedef struct { 02071 enum hd_detail_type type; 02072 usb_t *data; 02073 } hd_detail_usb_t; 02074 02075 typedef struct { 02076 enum hd_detail_type type; 02077 isapnp_dev_t *data; 02078 } hd_detail_isapnp_t; 02079 02080 typedef struct { 02081 enum hd_detail_type type; 02082 cdrom_info_t *data; 02083 } hd_detail_cdrom_t; 02084 02085 typedef struct { 02086 enum hd_detail_type type; 02087 floppy_info_t *data; 02088 } hd_detail_floppy_t; 02089 02090 typedef struct { 02091 enum hd_detail_type type; 02092 bios_info_t *data; 02093 } hd_detail_bios_t; 02094 02095 typedef struct { 02096 enum hd_detail_type type; 02097 cpu_info_t *data; 02098 } hd_detail_cpu_t; 02099 02100 typedef struct { 02101 enum hd_detail_type type; 02102 prom_info_t *data; 02103 } hd_detail_prom_t; 02104 02105 typedef struct hd_detail_monitor_s { 02106 enum hd_detail_type type; 02107 monitor_info_t *data; 02108 struct hd_detail_monitor_s *next; 02109 } hd_detail_monitor_t; 02110 02111 typedef struct { 02112 enum hd_detail_type type; 02113 sys_info_t *data; 02114 } hd_detail_sys_t; 02115 02116 typedef struct { 02117 enum hd_detail_type type; 02118 scsi_t *data; 02119 } hd_detail_scsi_t; 02120 02121 typedef struct { 02122 enum hd_detail_type type; 02123 devtree_t *data; 02124 } hd_detail_devtree_t; 02125 02126 typedef struct { 02127 enum hd_detail_type type; 02128 ccw_t *data; 02129 } hd_detail_ccw_t; 02130 02131 typedef struct { 02132 enum hd_detail_type type; 02133 joystick_t *data; 02134 } hd_detail_joystick_t; 02135 02136 typedef union { 02137 enum hd_detail_type type; 02138 hd_detail_pci_t pci; 02139 hd_detail_usb_t usb; 02140 hd_detail_isapnp_t isapnp; 02141 hd_detail_cdrom_t cdrom; 02142 hd_detail_floppy_t floppy; 02143 hd_detail_bios_t bios; 02144 hd_detail_cpu_t cpu; 02145 hd_detail_prom_t prom; 02146 hd_detail_monitor_t monitor; 02147 hd_detail_sys_t sys; 02148 hd_detail_scsi_t scsi; 02149 hd_detail_devtree_t devtree; 02150 hd_detail_ccw_t ccw; 02151 hd_detail_joystick_t joystick; 02152 } hd_detail_t; 02153 02166 typedef struct hd_manual_s { 02167 struct hd_manual_s *next; 02168 02169 char *unique_id; 02170 char *parent_id; 02171 char *child_ids; 02172 unsigned hw_class; 02173 char *model; 02174 02175 hd_status_t status; 02176 char *config_string; 02177 02178 /* More or less free-form key, value pairs. 02179 * key should not contain '=', however. 02180 */ 02181 str_list_t *key; 02182 str_list_t *value; 02183 } hd_manual_t; 02184 02185 02191 typedef struct s_hd_t { 02192 struct s_hd_t *next; 02198 unsigned idx; 02199 02205 unsigned broken:1; 02206 02210 hd_id_t bus; 02211 02216 unsigned slot; 02217 02221 unsigned func; 02222 02226 hd_id_t base_class; 02227 02231 hd_id_t sub_class; 02232 02236 hd_id_t prog_if; 02237 02244 hd_id_t vendor; 02245 02254 hd_id_t device; 02255 02262 hd_id_t sub_vendor; 02263 02270 hd_id_t sub_device; 02271 02277 hd_id_t revision; 02278 02282 char *serial; 02283 02288 hd_id_t compat_vendor; 02289 02294 hd_id_t compat_device; 02295 02300 hd_hw_item_t hw_class; 02301 02306 unsigned char hw_class_list[(hw_all + 7) / 8]; 02314 char *model; 02315 02321 unsigned attached_to; 02322 02326 char *sysfs_id; 02327 02331 char *sysfs_bus_id; 02332 02336 char *sysfs_device_link; 02337 02343 char *unix_dev_name; 02344 02348 hd_dev_num_t unix_dev_num; 02349 02356 str_list_t *unix_dev_names; 02357 02364 char *unix_dev_name2; 02365 02369 hd_dev_num_t unix_dev_num2; 02370 02377 char *rom_id; 02378 02382 char *udi; 02383 02387 char *parent_udi; 02388 02399 char *unique_id; 02400 02402 str_list_t *unique_ids; 02403 02407 unsigned module; 02408 02412 unsigned line; 02413 02417 unsigned count; 02418 02422 hd_res_t *res; 02423 02428 hd_detail_t *detail; 02429 02435 str_list_t *extra_info; 02436 02442 hd_status_t status; 02443 02450 char *config_string; 02451 02456 hd_hotplug_t hotplug; 02457 02462 unsigned hotplug_slot; 02463 02464 struct is_s { 02465 unsigned agp:1; 02466 unsigned isapnp:1; 02467 unsigned notready:1; 02468 unsigned manual:1; 02469 unsigned softraiddisk:1; 02470 unsigned zip:1; 02471 unsigned cdr:1; 02472 unsigned cdrw:1; 02473 unsigned dvd:1; 02474 unsigned dvdr:1; 02475 unsigned dvdrw:1; 02476 unsigned dvdrdl:1; 02477 unsigned dvdpr:1; 02478 unsigned dvdprw:1; 02479 unsigned dvdprdl:1; 02480 unsigned dvdprwdl:1; 02481 unsigned bd:1; 02482 unsigned bdr:1; 02483 unsigned bdre:1; 02484 unsigned hd:1; 02485 unsigned hdr:1; 02486 unsigned hdrw:1; 02487 unsigned dvdram:1; 02488 unsigned mo:1; 02489 unsigned mrw:1; 02490 unsigned mrww:1; 02491 unsigned pppoe:1; 02492 unsigned wlan:1; 02493 unsigned with_acpi:1; 02494 unsigned hotpluggable:1; 02495 unsigned dualport:1; 02496 unsigned fcoe:1; 02497 } is; 02498 02499 struct tag_s { 02500 unsigned remove:1; 02501 unsigned freeit:1; 02502 unsigned fixed:1; 02503 unsigned skip_mouse:1; 02504 unsigned skip_modem:1; 02505 unsigned skip_braille:1; 02506 unsigned ser_device:2; 02507 } tag; 02508 02514 unsigned char *block0; 02515 02519 char *driver; 02520 02524 char *driver_module; 02525 02529 str_list_t *drivers; 02530 02534 str_list_t *driver_modules; 02535 02543 char *old_unique_id; 02544 02550 char *parent_id; 02551 02557 str_list_t *child_ids; 02558 02563 char *unique_id1; 02564 02571 char *usb_guid; 02572 02573 driver_info_t *driver_info; 02575 str_list_t *requires; 02577 hal_prop_t *hal_prop; 02579 hal_prop_t *persistent_prop; 02581 char *modalias; 02583 /* 02584 * These are used internally for memory management. 02585 * Do not even _think_ of modifying these! 02586 */ 02587 unsigned ref_cnt; 02588 struct s_hd_t *ref; 02589 } hd_t; 02590 02591 02595 typedef struct { 02601 hd_t *hd; 02602 02611 void (*progress)(char *pos, char *msg); 02612 02617 char *log; 02618 02626 unsigned debug; 02627 02633 struct flag_struct { 02634 unsigned internal:1; 02635 unsigned dformat:2; 02636 unsigned no_parport:1; 02637 unsigned iseries:1; 02638 unsigned list_all:1; 02639 unsigned fast:1; 02640 unsigned list_md:1; 02641 unsigned nofork:1; 02642 unsigned nosysfs:1; 02643 unsigned forked:1; 02644 unsigned cpuemu:1; 02645 unsigned udev:1; 02646 unsigned edd_used:1; 02647 unsigned keep_kmods:2; 02648 unsigned nobioscrc:1; 02649 unsigned biosvram:1; 02650 unsigned nowpa:1; 02651 unsigned pata:1; 02652 unsigned vbox:1; 02653 unsigned vmware:1; 02654 unsigned vmware_mouse:1; 02655 } flags; 02656 02657 02662 str_list_t *only; 02663 02664 /* 02665 * The following entries should *not* be accessed outside of libhd! 02666 */ 02667 unsigned char probe[(pr_all + 7) / 8]; 02668 unsigned char probe_set[(pr_all + 7) / 8]; 02669 unsigned char probe_clr[(pr_all + 7) / 8]; 02670 hal_prop_t *probe_val; 02671 unsigned last_idx; 02672 unsigned module; 02673 enum boot_arch boot; 02674 hd_t *old_hd; 02675 pci_t *pci; 02676 isapnp_t *isapnp; 02677 cdrom_info_t *cdrom; 02678 str_list_t *net; 02679 str_list_t *floppy; 02680 misc_t *misc; 02681 serial_t *serial; 02682 scsi_t *scsi; 02683 ser_device_t *ser_mouse; 02684 ser_device_t *ser_modem; 02685 str_list_t *cpu; 02686 str_list_t *klog; 02687 str_list_t *proc_usb; 02688 usb_t *usb; 02689 modinfo_t *modinfo_ext; 02690 modinfo_t *modinfo; 02691 hddb2_data_t *hddb2[2]; 02692 str_list_t *kmods; 02693 uint64_t used_irqs; 02694 uint64_t assigned_irqs; 02695 memory_range_t bios_rom; 02696 memory_range_t bios_ram; 02697 memory_range_t bios_ebda; 02698 unsigned display; 02699 unsigned color_code; 02700 char *cmd_line; 02701 str_list_t *xtra_hd; 02702 devtree_t *devtree; 02703 unsigned kernel_version; 02704 hd_t *manual; 02705 str_list_t *disks; 02706 str_list_t *partitions; 02707 str_list_t *cdroms; 02708 hd_smbios_t *smbios; 02709 struct { 02710 unsigned ok:1; 02711 unsigned size; 02712 unsigned used; 02713 void *data; 02714 int id; 02715 int updated; 02716 } shm; 02717 unsigned pci_config_type; 02718 hd_udevinfo_t *udevinfo; 02719 hd_sysfsdrv_t *sysfsdrv; 02720 uint64_t sysfsdrv_id; 02721 str_list_t *scanner_db; 02722 edd_info_t edd[0x80]; 02723 hal_device_t *hal; 02724 str_list_t *lsscsi; 02725 struct vm_s *vm; 02726 size_t log_size; 02727 size_t log_max; 02728 str_list_t *klog_raw; 02729 } hd_data_t; 02730 02731 02732 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 02733 * 02734 * libhd interface functions 02735 * 02736 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 02737 */ 02738 02739 /* implemented in hd.c */ 02740 02742 void hd_scan(hd_data_t *hd_data); 02743 02745 hd_data_t *hd_free_hd_data(hd_data_t *hd_data); 02746 02748 hd_t *hd_free_hd_list(hd_t *hd); 02749 02750 void hd_set_probe_feature(hd_data_t *hd_data, enum probe_feature feature); 02751 void hd_clear_probe_feature(hd_data_t *hd_data, enum probe_feature feature); 02752 int hd_probe_feature(hd_data_t *hd_data, enum probe_feature feature); 02753 void hd_set_probe_feature_hw(hd_data_t *hd_data, hd_hw_item_t item); 02754 02755 enum probe_feature hd_probe_feature_by_name(char *name); 02756 char *hd_probe_feature_by_value(enum probe_feature feature); 02757 02758 int hd_module_is_active(hd_data_t *hd_data, char *mod); 02759 02760 hd_t *hd_base_class_list(hd_data_t *hd_data, unsigned base_class); 02761 hd_t *hd_sub_class_list(hd_data_t *hd_data, unsigned base_class, unsigned sub_class); 02762 hd_t *hd_bus_list(hd_data_t *hd_data, unsigned bus); 02763 const char* hd_busid_to_hwcfg(int busid); 02764 hd_t *hd_list(hd_data_t *hd_data, hd_hw_item_t item, int rescan, hd_t *hd_old); 02765 hd_t *hd_list_with_status(hd_data_t *hd_data, hd_hw_item_t item, hd_status_t status); 02766 hd_t *hd_list2(hd_data_t *hd_data, hd_hw_item_t *items, int rescan); 02767 hd_t *hd_list_with_status2(hd_data_t *hd_data, hd_hw_item_t *items, hd_status_t status); 02768 02769 void hd_add_driver_data(hd_data_t *hd_data, hd_t *hd); 02770 02771 int hd_has_pcmcia(hd_data_t *hd_data); 02772 #if 0 02773 02777 int hd_apm_enabled(hd_data_t *hd_data); 02778 #endif 02779 int hd_usb_support(hd_data_t *hd_data); 02780 int hd_smp_support(hd_data_t *hd_data); 02781 int hd_mac_color(hd_data_t *hd_data); 02782 int hd_color(hd_data_t *hd_data); 02783 int hd_is_uml(hd_data_t *hd_data); 02784 int hd_is_xen(hd_data_t *hd_data); 02785 unsigned hd_display_adapter(hd_data_t *hd_data); 02786 unsigned hd_boot_disk(hd_data_t *hd_data, int *matches); 02787 enum cpu_arch hd_cpu_arch(hd_data_t *hd_data); 02788 enum boot_arch hd_boot_arch(hd_data_t *hd_data); 02789 02790 hd_t *hd_get_device_by_idx(hd_data_t *hd_data, unsigned idx); 02791 02792 void hd_set_hw_class(hd_t *hd, hd_hw_item_t hw_class); 02793 int hd_is_hw_class(hd_t *hd, hd_hw_item_t hw_class); 02794 02795 int hd_is_sgi_altix(hd_data_t *hd_data); 02796 02797 char *hd_version(void); 02798 02799 hal_prop_t *hd_free_hal_properties(hal_prop_t *prop); 02800 hal_prop_t *hd_read_properties(const char *udi); 02801 int hd_write_properties(const char *udi, hal_prop_t *prop); 02802 02803 int hd_change_status(const char *id, hd_status_t status, const char *config_string); 02804 int hd_change_config_status(hd_data_t *hd_data, const char *id, hd_status_t status, const char *config_string); 02805 int hd_read_mmap(hd_data_t *hd_data, char *name, unsigned char *buf, off_t start, unsigned size); 02806 02807 /* implemented in hddb.c */ 02808 02812 str_list_t *hddb_get_packages(hd_data_t *hd_data); 02813 void hddb_add_info(hd_data_t *hd_data, hd_t *hd); 02814 02815 void hddb_dump_raw(hddb2_data_t *hddb, FILE *f); 02816 void hddb_dump(hddb2_data_t *hddb, FILE *f); 02817 02818 02819 /* implemented in hdp.c */ 02820 void hd_dump_entry(hd_data_t *hd_data, hd_t *hd, FILE *f); 02821 02822 /* implemented in cdrom.c */ 02823 cdrom_info_t *hd_read_cdrom_info(hd_data_t *hd_data, hd_t *hd); 02824 02832 hd_manual_t *hd_manual_read_entry(hd_data_t *hd_data, const char *id); 02833 int hd_manual_write_entry(hd_data_t *hd_data, hd_manual_t *entry); 02834 hd_manual_t *hd_free_manual(hd_manual_t *manual); 02835 hd_t *hd_read_config(hd_data_t *hd_data, const char *id); 02836 int hd_write_config(hd_data_t *hd_data, hd_t *hd); 02837 char *hd_hw_item_name(hd_hw_item_t item); 02838 hd_hw_item_t hd_hw_item_type(char *name); 02839 char *hd_status_value_name(hd_status_value_t status); 02840 02851 #define CDBISDN_VERSION 0x0101 02852 02853 #ifndef PCI_ANY_ID 02854 #define PCI_ANY_ID 0xffff 02855 #endif 02856 02857 #define CDBISDN_P_NONE 0x0 02858 #define CDBISDN_P_IRQ 0x1 02859 #define CDBISDN_P_MEM 0x2 02860 #define CDBISDN_P_IO 0x3 02861 02863 typedef struct { 02864 char *name; 02865 char *shortname; 02866 int vnr; 02867 int refcnt; 02868 } cdb_isdn_vendor; 02869 02870 typedef struct { 02871 int handle; 02872 int vhandle; 02873 char *name; 02874 char *lname; 02875 char *Class; 02876 char *bus; 02877 int revision; 02878 int vendor; 02879 int device; 02880 int subvendor; 02882 int subdevice; 02884 unsigned int features; 02885 int line_cnt; 02886 int vario_cnt; 02887 int vario; 02888 } cdb_isdn_card; 02889 02890 typedef struct { 02891 int handle; 02892 int next_vario; 02893 int drvid; 02894 int typ; 02895 int subtyp; 02896 int smp; 02897 char *mod_name; 02898 char *para_str; 02899 char *mod_preload; 02900 char *cfg_prog; 02901 char *firmware; 02902 char *description; 02903 char *need_pkg; 02904 char *info; 02905 char *protocol; 02906 char *interface; 02907 char *io; 02908 char *irq; 02909 char *membase; 02910 char *features; 02911 int card_ref; 02912 char *name; 02913 } cdb_isdn_vario; 02914 02915 02916 extern cdb_isdn_vendor *hd_cdbisdn_get_vendor(int); 02917 extern cdb_isdn_card *hd_cdbisdn_get_card(int); 02918 extern cdb_isdn_vario *hd_cdbisdn_get_vario_from_type(int, int); 02919 extern cdb_isdn_card *hd_cdbisdn_get_card_from_type(int, int); 02920 extern cdb_isdn_card *hd_cdbisdn_get_card_from_id(int, int, int, int); 02921 extern cdb_isdn_vario *hd_cdbisdn_get_vario(int); 02922 extern int hd_cdbisdn_get_version(void); 02923 extern int hd_cdbisdn_get_db_version(void); 02924 extern char *hd_cdbisdn_get_db_date(void); 02925 02931 #ifdef __cplusplus 02932 } 02933 #endif 02934 02937 #endif /* _HD_H */