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 21 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_infiniband, 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, bus_uisvirtpci 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 char *label; 01051 unsigned edid_len[6]; 01052 unsigned char edid_data[6][0x80]; 01053 } pci_t; 01054 01059 typedef enum pci_flags { 01060 pci_flag_ok, pci_flag_pm, pci_flag_agp 01061 } hd_pci_flags_t; 01062 01063 01068 typedef struct usb_s { 01069 struct usb_s *next; 01070 unsigned hd_idx; 01071 unsigned hd_base_idx; 01072 str_list_t *c, *d, *e, *i, *p, *s, *t; 01073 struct usb_s *cloned; 01074 int bus, dev_nr, lev, parent, port, count, conns, used_conns, ifdescr; 01075 unsigned speed; 01076 unsigned vendor, device, rev; 01077 char *manufact, *product, *serial; 01078 char *driver; 01079 memory_range_t raw_descr; 01080 int d_cls, d_sub, d_prot; 01081 int i_alt, i_cls, i_sub, i_prot; 01082 unsigned country; 01083 } usb_t; 01084 01085 01089 typedef struct { 01090 int len; 01091 int type; 01092 unsigned char *data; 01093 } isapnp_res_t; 01094 01098 typedef struct { 01099 int csn; 01100 int log_devs; 01101 unsigned char *serial; 01102 unsigned char *card_regs; 01103 unsigned char (*ldev_regs)[0xd0]; 01104 int res_len; 01105 unsigned broken:1; 01106 isapnp_res_t *res; 01107 } isapnp_card_t; 01108 01112 typedef struct { 01113 int read_port; 01114 int cards; 01115 isapnp_card_t *card; 01116 } isapnp_t; 01117 01121 typedef struct { 01122 isapnp_card_t *card; 01123 int dev; 01124 unsigned flags; 01125 unsigned ref:1; 01126 } isapnp_dev_t; 01127 01132 typedef enum isapnp_flags { 01133 isapnp_flag_act 01134 } hd_isapnp_flags_t; 01135 01136 01140 typedef struct scsi_s { 01141 struct scsi_s *next; 01142 unsigned deleted:1; 01143 unsigned generic:1; 01144 unsigned fake:1; 01145 unsigned wwpn_ok:1; 01146 unsigned fcp_lun_ok:1; 01147 char *dev_name; 01148 char *guessed_dev_name; 01149 int generic_dev; 01150 unsigned host, channel, id, lun; 01151 char *vendor, *model, *rev, *type_str, *serial; 01152 int type; 01153 unsigned inode_low; 01154 char *proc_dir, *driver; 01155 unsigned unique; 01156 char *info; 01157 unsigned lgeo_c, lgeo_h, lgeo_s; 01158 unsigned pgeo_c, pgeo_h, pgeo_s; 01159 uint64_t size; 01160 unsigned sec_size; 01161 unsigned cache; 01162 str_list_t *host_info; 01163 char *usb_guid; 01164 unsigned pci_info; 01165 unsigned pci_bus; 01166 unsigned pci_slot; 01167 unsigned pci_func; 01168 uint64_t wwpn; 01169 uint64_t fcp_lun; 01170 char *controller_id; 01171 } scsi_t; 01172 01173 01177 typedef struct devtree_s { 01178 struct devtree_s *next; 01179 struct devtree_s *parent; 01180 unsigned idx; 01181 char *path, *filename; 01182 unsigned pci:1; 01183 char *name, *model, *device_type, *compatible; 01184 char *ccin, *fru_number, *loc_code, *serial_number, *part_number; 01185 char *description; 01186 int class_code; 01187 int vendor_id, device_id, subvendor_id, subdevice_id; 01188 int revision_id, interrupt; 01189 unsigned char *edid; 01190 } devtree_t; 01191 01192 enum pmac_model { 01193 AAPL_3400, 01194 AAPL_3500, 01195 AAPL_7200, 01196 AAPL_7300, 01197 AAPL_7500, 01198 AAPL_8500, 01199 AAPL_9500, 01200 AAPL_Gossamer, 01201 AAPL_PowerBook1998, 01202 AAPL_PowerMac_G3, 01203 AAPL_ShinerESB, 01204 AAPL_e407, 01205 AAPL_e411, 01206 PowerBook1_1, 01207 PowerBook2_1, 01208 PowerBook2_2, 01209 PowerBook3_1, 01210 PowerBook3_2, 01211 PowerBook3_3, 01212 PowerBook3_4, 01213 PowerBook3_5, 01214 PowerBook4_1, 01215 PowerBook4_2, 01216 PowerBook4_3, 01217 PowerBook5_1, 01218 PowerBook5_2, 01219 PowerBook5_3, 01220 PowerBook5_4, 01221 PowerBook5_5, 01222 PowerBook5_6, 01223 PowerBook5_7, 01224 PowerBook5_8, 01225 PowerBook5_9, 01226 PowerBook6_1, 01227 PowerBook6_2, 01228 PowerBook6_3, 01229 PowerBook6_4, 01230 PowerBook6_5, 01231 PowerBook6_7, 01232 PowerBook6_8, 01233 PowerMac1_1, 01234 PowerMac1_2, 01235 PowerMac10_1, 01236 PowerMac11_2, 01237 PowerMac12_1, 01238 PowerMac2_1, 01239 PowerMac2_2, 01240 PowerMac3_1, 01241 PowerMac3_2, 01242 PowerMac3_3, 01243 PowerMac3_4, 01244 PowerMac3_5, 01245 PowerMac3_6, 01246 PowerMac4_1, 01247 PowerMac4_2, 01248 PowerMac4_4, 01249 PowerMac5_1, 01250 PowerMac6_1, 01251 PowerMac6_3, 01252 PowerMac6_4, 01253 PowerMac7_2, 01254 PowerMac7_3, 01255 PowerMac8_1, 01256 PowerMac9_1, 01257 RackMac1_1, 01258 RackMac1_2, 01259 RackMac3_1, 01260 iMac_1, 01261 }; 01265 struct pmac_mb_def { 01266 enum pmac_model model; 01267 const char *string; 01268 }; 01269 01273 typedef struct ccw_s { 01274 unsigned char lcss; 01275 unsigned char cu_model; 01276 unsigned char dev_model; 01277 } ccw_t; 01278 01282 typedef struct joystick_s { 01283 unsigned char buttons; 01284 unsigned char axes; 01285 } joystick_t; 01286 01290 typedef struct cdrom_info_s { 01291 struct cdrom_info_s *next; 01292 char *name; 01293 unsigned speed; 01294 unsigned cdr:1, cdrw:1, dvd:1, dvdr:1, dvdram:1; 01295 unsigned cdrom:1; 01296 struct { 01297 unsigned ok:1; 01298 char *volume, *publisher, *preparer, *application, *creation_date; 01299 } iso9660; 01300 struct { 01301 unsigned ok:1; 01302 unsigned platform; 01303 char *id_string; 01304 unsigned bootable:1; 01305 unsigned media_type; 01306 unsigned load_address; 01307 unsigned load_count; 01308 unsigned start; 01309 unsigned catalog; 01310 struct { 01311 unsigned c, h, s; 01312 unsigned size; 01313 } geo; 01314 char *label; 01315 } el_torito; 01316 01317 } cdrom_info_t; 01318 01319 01325 typedef struct { 01326 unsigned char block0[512]; 01327 } floppy_info_t; 01328 01329 01333 typedef struct { 01334 unsigned apm_supported:1; 01335 unsigned apm_enabled:1; 01336 unsigned apm_ver, apm_subver; 01337 unsigned apm_bios_flags; 01338 01339 unsigned vbe_ver; 01340 unsigned vbe_video_mem; 01341 01342 unsigned ser_port0, ser_port1, ser_port2, ser_port3; 01343 unsigned par_port0, par_port1, par_port2; 01344 01346 unsigned is_pnp_bios:1; 01347 unsigned pnp_id; 01348 unsigned lba_support:1; 01349 01350 unsigned low_mem_size; 01351 smp_info_t smp; 01352 vbe_info_t vbe; 01353 01354 unsigned smbios_ver; 01355 01356 struct { 01357 unsigned width; 01358 unsigned height; 01359 unsigned xsize; 01360 unsigned ysize; 01361 char *vendor; 01362 char *name; 01363 } lcd; 01364 01365 struct { 01366 char *vendor; 01367 char *type; 01368 unsigned bus; 01369 unsigned compat_vend; 01370 unsigned compat_dev; 01371 } mouse; 01372 01373 struct { 01374 unsigned ok:1; 01375 unsigned scroll_lock:1; 01376 unsigned num_lock:1; 01377 unsigned caps_lock:1; 01378 } led; 01379 01380 bios32_info_t bios32; 01381 01382 } bios_info_t; 01383 01384 01388 typedef struct { 01389 unsigned has_color:1; 01390 unsigned color; 01391 } prom_info_t; 01392 01393 01397 typedef struct { 01398 char *system_type; 01399 char *generation; 01400 char *vendor; 01401 char *model; 01402 char *serial; 01403 char *lang; 01404 char *formfactor; 01405 } sys_info_t; 01406 01407 01411 typedef struct { 01412 unsigned manu_year; 01413 unsigned manu_week; 01414 unsigned min_vsync, max_vsync; 01415 unsigned min_hsync, max_hsync; 01416 unsigned clock; 01417 unsigned width, height; 01418 unsigned width_mm, height_mm; 01419 unsigned hdisp, hsyncstart, hsyncend, htotal; 01420 unsigned vdisp, vsyncstart, vsyncend, vtotal; 01421 char hflag,vflag; 01422 char *vendor; 01423 char *name; 01424 char *serial; 01425 } monitor_info_t; 01426 01433 typedef enum cpu_arch { 01434 arch_unknown = 0, 01435 arch_intel, 01436 arch_alpha, 01437 arch_sparc, arch_sparc64, 01438 arch_ppc, arch_ppc64, 01439 arch_68k, 01440 arch_ia64, 01441 arch_s390, arch_s390x, 01442 arch_arm, 01443 arch_mips, 01444 arch_x86_64, 01445 arch_aarch64 01446 } hd_cpu_arch_t; 01447 01451 typedef enum boot_arch { 01452 boot_unknown = 0, 01453 boot_lilo, boot_milo, boot_aboot, boot_silo, boot_ppc, boot_elilo, boot_s390, 01454 boot_mips, boot_grub, boot_uboot, 01455 } hd_boot_arch_t; 01456 01457 01466 typedef struct { 01467 enum cpu_arch architecture; 01468 unsigned family; 01469 unsigned model; 01470 unsigned stepping; 01471 unsigned cache; 01472 unsigned clock; 01473 unsigned units; 01474 char *vend_name; 01475 char *model_name; 01476 char *platform; 01477 str_list_t *features; 01478 double bogo; 01479 } cpu_info_t; 01480 01481 01486 typedef struct { 01487 uint64_t sectors; 01488 struct { 01489 unsigned cyls, heads, sectors; 01490 } edd; 01491 struct { 01492 unsigned cyls, heads, sectors; 01493 } legacy; 01494 unsigned ext_fixed_disk:1; 01495 unsigned ext_lock_eject:1; 01496 unsigned ext_edd:1; 01497 unsigned ext_64bit:1; 01498 unsigned assigned:1; 01499 unsigned valid:1; 01500 unsigned ext_fibre:1; 01501 unsigned ext_net:1; 01502 char *sysfs_id; 01503 unsigned hd_idx; 01504 unsigned signature; 01505 } edd_info_t; 01506 01512 typedef struct { 01513 unsigned data_len, data_max; 01514 unsigned *data; 01515 unsigned names_len, names_max; 01516 char *names; 01517 } hddb_data_t; 01518 01522 typedef uint32_t hddb_entry_mask_t; 01523 01527 typedef struct hddb_list_s { 01528 hddb_entry_mask_t key_mask; 01529 hddb_entry_mask_t value_mask; 01530 unsigned key; 01531 unsigned value; 01532 } hddb_list_t; 01533 01537 typedef struct { 01538 unsigned list_len, list_max; 01539 hddb_list_t *list; 01540 unsigned ids_len, ids_max; 01541 unsigned *ids; 01542 unsigned strings_len, strings_max; 01543 char *strings; 01544 } hddb2_data_t; 01545 01546 01550 typedef enum modinfo_type_e { mi_none = 0, mi_pci, mi_other } modinfo_type_t; 01551 01555 typedef struct { 01556 char *module; 01557 char *alias; 01558 modinfo_type_t type; 01559 union { 01560 struct { 01561 struct { 01562 unsigned vendor:1; 01563 unsigned device:1; 01564 unsigned sub_vendor:1; 01565 unsigned sub_device:1; 01566 unsigned base_class:1; 01567 unsigned sub_class:1; 01568 unsigned prog_if:1; 01569 } has; 01570 unsigned vendor; 01571 unsigned device; 01572 unsigned sub_vendor; 01573 unsigned sub_device; 01574 unsigned base_class; 01575 unsigned sub_class; 01576 unsigned prog_if; 01577 } pci; 01578 01579 struct { 01580 struct { 01581 unsigned vendor:1; 01582 unsigned product:1; 01583 unsigned device_class:1; 01584 unsigned device_subclass:1; 01585 } has; 01586 unsigned vendor; 01587 unsigned product; 01588 unsigned device_class; 01589 unsigned device_subclass; 01590 } usb; 01591 }; 01592 } modinfo_t; 01593 01594 01598 typedef enum { 01599 p_invalid, p_string, p_int32, p_uint64, p_double, p_bool, p_list 01600 } hal_prop_type_t; 01601 01602 01606 typedef struct hal_prop_s { 01607 struct hal_prop_s *next; 01608 hal_prop_type_t type; 01609 char *key; 01610 union { 01611 char *str; 01612 int32_t int32; 01613 uint64_t uint64; 01614 double d; 01615 int b; 01616 str_list_t *list; 01617 } val; 01618 } hal_prop_t; 01619 01620 01624 typedef struct hal_device_s { 01625 struct hal_device_s *next, *parent; 01626 char *udi; 01627 unsigned used:1; 01628 hal_prop_t *prop; 01629 } hal_device_t; 01630 01634 typedef enum resource_types { 01635 res_any, res_phys_mem, res_mem, res_io, res_irq, res_dma, res_monitor, 01636 res_size, res_disk_geo, res_cache, res_baud, res_init_strings, res_pppd_option, 01637 res_framebuffer, res_hwaddr, res_link, res_wlan, res_fc 01638 } hd_resource_types_t; 01639 01640 01644 typedef enum size_units { 01645 size_unit_cm, size_unit_cinch, size_unit_byte, size_unit_sectors, 01646 size_unit_kbyte, size_unit_mbyte, size_unit_gbyte, size_unit_mm 01647 } hd_size_units_t; 01648 01652 typedef enum access_flags { 01653 acc_unknown, 01654 acc_ro, 01655 acc_wo, 01656 acc_rw 01657 } hd_access_flags_t; 01658 01659 01660 typedef enum yes_no_flag { 01661 flag_unknown, 01662 flag_no, 01663 flag_yes 01664 } hd_yes_no_flag_t; 01665 01666 01667 typedef enum geo_types { 01668 geo_physical = 0, 01669 geo_logical, 01670 geo_bios_edd, 01671 geo_bios_legacy 01672 } hd_geo_types_t; 01673 01674 01681 typedef struct { 01682 union u_hd_res_t *next; 01683 enum resource_types type; 01684 } res_any_t; 01685 01686 typedef struct { 01687 union u_hd_res_t *next; 01688 enum resource_types type; 01689 uint64_t base, range; 01690 unsigned 01691 enabled:1, 01692 access:2, 01693 prefetch:2; 01694 } res_mem_t; 01695 01696 typedef struct { 01697 union u_hd_res_t *next; 01698 enum resource_types type; 01699 uint64_t range; 01700 } res_phys_mem_t; 01701 01702 typedef struct { 01703 union u_hd_res_t *next; 01704 enum resource_types type; 01705 uint64_t base, range; 01706 unsigned 01707 enabled:1, 01708 access:2; 01709 } res_io_t; 01710 01711 typedef struct { 01712 union u_hd_res_t *next; 01713 enum resource_types type; 01714 unsigned base; 01715 unsigned triggered; 01716 unsigned enabled:1; 01717 } res_irq_t; 01718 01719 typedef struct { 01720 union u_hd_res_t *next; 01721 enum resource_types type; 01722 unsigned base; 01723 unsigned enabled:1; 01724 } res_dma_t; 01725 01726 typedef struct { 01727 union u_hd_res_t *next; 01728 enum resource_types type; 01729 enum size_units unit; 01730 uint64_t val1, val2; 01731 } res_size_t; 01732 01733 typedef struct { 01734 union u_hd_res_t *next; 01735 enum resource_types type; 01736 unsigned speed; 01737 unsigned bits, stopbits; 01738 char parity; 01739 char handshake; 01740 } res_baud_t; 01741 01742 typedef struct { 01743 union u_hd_res_t *next; 01744 enum resource_types type; 01745 unsigned size; 01746 } res_cache_t; 01747 01748 typedef struct { 01749 union u_hd_res_t *next; 01750 enum resource_types type; 01751 unsigned cyls, heads, sectors; 01752 uint64_t size; 01753 enum geo_types geotype; 01754 } res_disk_geo_t; 01755 01756 typedef struct { 01757 union u_hd_res_t *next; 01758 enum resource_types type; 01759 unsigned width, height; 01760 unsigned vfreq; 01761 unsigned interlaced:1; 01762 } res_monitor_t; 01763 01764 typedef struct { 01765 union u_hd_res_t *next; 01766 enum resource_types type; 01767 char *init1; 01768 char *init2; 01769 } res_init_strings_t; 01770 01771 typedef struct { 01772 union u_hd_res_t *next; 01773 enum resource_types type; 01774 char *option; 01775 } res_pppd_option_t; 01776 01777 typedef struct { 01778 union u_hd_res_t *next; 01779 enum resource_types type; 01780 unsigned width, height; 01781 unsigned bytes_p_line; 01782 unsigned colorbits; 01783 unsigned mode; 01784 } res_framebuffer_t; 01785 01786 typedef struct { 01787 union u_hd_res_t *next; 01788 enum resource_types type; 01789 char *addr; 01790 } res_hwaddr_t; 01791 01792 typedef struct { 01793 union u_hd_res_t *next; 01794 enum resource_types type; 01795 unsigned state:1; 01796 } res_link_t; 01797 01799 typedef struct { 01800 union u_hd_res_t *next; 01801 enum resource_types type; 01802 str_list_t *channels; 01803 str_list_t *frequencies; 01804 str_list_t *bitrates; 01805 str_list_t *auth_modes; 01806 str_list_t *enc_modes; 01807 } res_wlan_t; 01808 01809 typedef struct { 01810 union u_hd_res_t *next; 01811 enum resource_types type; 01812 unsigned wwpn_ok:1; 01813 unsigned fcp_lun_ok:1; 01814 unsigned port_id_ok:1; 01815 uint64_t wwpn; 01816 uint64_t fcp_lun; 01817 unsigned port_id; 01818 char *controller_id; 01819 } res_fc_t; 01820 01822 typedef union u_hd_res_t { 01823 union u_hd_res_t *next; 01824 res_any_t any; 01825 res_io_t io; 01826 res_mem_t mem; 01827 res_phys_mem_t phys_mem; 01828 res_irq_t irq; 01829 res_dma_t dma; 01830 res_size_t size; 01831 res_cache_t cache; 01832 res_baud_t baud; 01833 res_disk_geo_t disk_geo; 01834 res_monitor_t monitor; 01835 res_init_strings_t init_strings; 01836 res_pppd_option_t pppd_option; 01837 res_framebuffer_t framebuffer; 01838 res_hwaddr_t hwaddr; 01839 res_link_t link; 01840 res_wlan_t wlan; 01841 res_fc_t fc; 01842 } hd_res_t; 01843 01852 typedef struct { 01853 uint64_t addr, size; 01854 char *dev; 01855 unsigned tag; 01856 } misc_io_t; 01857 01858 typedef struct { 01859 unsigned channel; 01860 char *dev; 01861 unsigned tag; 01862 } misc_dma_t; 01863 01864 typedef struct { 01865 unsigned irq, events; 01866 int devs; 01867 char **dev; 01868 unsigned tag; 01869 } misc_irq_t; 01870 01871 typedef struct { 01872 unsigned io_len, dma_len, irq_len; 01873 misc_io_t *io; 01874 misc_dma_t *dma; 01875 misc_irq_t *irq; 01876 str_list_t *proc_io, *proc_dma, *proc_irq; 01877 } misc_t; 01878 01884 typedef struct s_serial_t { 01885 struct s_serial_t *next; 01886 char *name; 01887 char *device; 01888 unsigned line, port, irq, baud; 01889 } serial_t; 01890 01894 typedef struct s_ser_device_t { 01895 struct s_ser_device_t *next; 01896 unsigned hd_idx; 01897 char *dev_name; 01898 str_list_t *at_resp; 01899 int fd; 01900 struct termios tio; 01901 unsigned max_baud, cur_baud; 01902 unsigned is_mouse:1; 01903 unsigned is_modem:1; 01904 unsigned do_io:1; 01905 unsigned char buf[0x1000]; 01906 int buf_len; 01907 int garbage, non_pnp, pnp; 01908 unsigned char pnp_id[8]; 01909 char *serial, *class_name, *dev_id, *user_name, *vend, *init_string1, *init_string2, *pppd_option; 01910 unsigned pnp_rev; 01911 unsigned bits; 01912 } ser_device_t; 01913 01927 typedef struct isdn_parm_s { 01928 struct isdn_parm_s *next; 01929 char *name; 01930 unsigned valid:1; 01931 unsigned conflict:1; 01932 uint64_t value; 01933 unsigned type; 01934 unsigned flags; 01935 unsigned def_value; 01936 int alt_values; 01937 unsigned *alt_value; 01938 } isdn_parm_t; 01939 01941 typedef enum driver_info_type { 01942 di_any, di_display, di_module, di_mouse, di_x11, di_isdn, di_kbd, di_dsl 01943 } hd_driver_info_t; 01944 01946 typedef struct { 01947 union driver_info_u *next; 01948 enum driver_info_type type; 01949 str_list_t *hddb0, *hddb1; 01950 } driver_info_any_t; 01951 01953 typedef struct { 01954 union driver_info_u *next; 01955 enum driver_info_type type; 01956 str_list_t *hddb0, *hddb1; 01957 unsigned width, height; 01958 unsigned min_vsync, max_vsync; 01959 unsigned min_hsync, max_hsync; 01960 unsigned bandwidth; 01961 unsigned hdisp, hsyncstart, hsyncend, htotal; 01962 unsigned vdisp, vsyncstart, vsyncend, vtotal; 01963 char hflag,vflag; 01964 } driver_info_display_t; 01965 01967 typedef struct { 01968 union driver_info_u *next; 01969 enum driver_info_type type; 01970 str_list_t *hddb0, *hddb1; 01971 unsigned active:1; 01972 unsigned modprobe:1; 01973 str_list_t *names; 01974 str_list_t *mod_args; 01975 char *conf; 01976 } driver_info_module_t; 01977 01979 typedef struct { 01980 union driver_info_u *next; 01981 enum driver_info_type type; 01982 str_list_t *hddb0, *hddb1; 01983 char *xf86; 01984 char *gpm; 01985 int buttons; 01986 int wheels; 01987 } driver_info_mouse_t; 01988 01990 typedef struct { 01991 union driver_info_u *next; 01992 enum driver_info_type type; 01993 str_list_t *hddb0, *hddb1; 01994 char *server; 01995 char *xf86_ver; 01996 unsigned x3d:1; 01997 struct { 01998 unsigned all:5; 01999 unsigned c8:1, c15:1, c16:1, c24:1, c32:1; 02000 } colors; 02001 unsigned dacspeed; 02002 str_list_t *extensions; 02003 str_list_t *options; 02004 str_list_t *raw; 02005 char *script; 02006 } driver_info_x11_t; 02007 02009 typedef struct { 02010 union driver_info_u *next; 02011 enum driver_info_type type; 02012 str_list_t *hddb0, *hddb1; 02013 int i4l_type, i4l_subtype; 02014 char *i4l_name; 02015 isdn_parm_t *params; 02016 } driver_info_isdn_t; 02017 02019 typedef struct { 02020 union driver_info_u *next; 02021 enum driver_info_type type; 02022 str_list_t *hddb0, *hddb1; 02023 char *mode; 02024 char *name; 02025 } driver_info_dsl_t; 02026 02028 typedef struct { 02029 union driver_info_u *next; 02030 enum driver_info_type type; 02031 str_list_t *hddb0, *hddb1; 02032 char *XkbRules; 02033 char *XkbModel; 02034 char *XkbLayout; 02035 char *keymap; 02036 } driver_info_kbd_t; 02037 02038 /* 02039 * holds device driver info 02040 */ 02041 typedef union driver_info_u { 02042 union driver_info_u *next; 02043 driver_info_any_t any; 02044 driver_info_module_t module; 02045 driver_info_mouse_t mouse; 02046 driver_info_x11_t x11; 02047 driver_info_display_t display; 02048 driver_info_isdn_t isdn; 02049 driver_info_dsl_t dsl; 02050 driver_info_kbd_t kbd; 02051 } driver_info_t; 02052 02063 typedef enum hd_detail_type { 02064 hd_detail_pci, hd_detail_usb, hd_detail_isapnp, hd_detail_cdrom, 02065 hd_detail_floppy, hd_detail_bios, hd_detail_cpu, hd_detail_prom, 02066 hd_detail_monitor, hd_detail_sys, hd_detail_scsi, hd_detail_devtree, 02067 hd_detail_ccw, hd_detail_joystick 02068 } hd_detail_type_t; 02069 02070 typedef struct { 02071 enum hd_detail_type type; 02072 pci_t *data; 02073 } hd_detail_pci_t; 02074 02075 typedef struct { 02076 enum hd_detail_type type; 02077 usb_t *data; 02078 } hd_detail_usb_t; 02079 02080 typedef struct { 02081 enum hd_detail_type type; 02082 isapnp_dev_t *data; 02083 } hd_detail_isapnp_t; 02084 02085 typedef struct { 02086 enum hd_detail_type type; 02087 cdrom_info_t *data; 02088 } hd_detail_cdrom_t; 02089 02090 typedef struct { 02091 enum hd_detail_type type; 02092 floppy_info_t *data; 02093 } hd_detail_floppy_t; 02094 02095 typedef struct { 02096 enum hd_detail_type type; 02097 bios_info_t *data; 02098 } hd_detail_bios_t; 02099 02100 typedef struct { 02101 enum hd_detail_type type; 02102 cpu_info_t *data; 02103 } hd_detail_cpu_t; 02104 02105 typedef struct { 02106 enum hd_detail_type type; 02107 prom_info_t *data; 02108 } hd_detail_prom_t; 02109 02110 typedef struct hd_detail_monitor_s { 02111 enum hd_detail_type type; 02112 monitor_info_t *data; 02113 struct hd_detail_monitor_s *next; 02114 } hd_detail_monitor_t; 02115 02116 typedef struct { 02117 enum hd_detail_type type; 02118 sys_info_t *data; 02119 } hd_detail_sys_t; 02120 02121 typedef struct { 02122 enum hd_detail_type type; 02123 scsi_t *data; 02124 } hd_detail_scsi_t; 02125 02126 typedef struct { 02127 enum hd_detail_type type; 02128 devtree_t *data; 02129 } hd_detail_devtree_t; 02130 02131 typedef struct { 02132 enum hd_detail_type type; 02133 ccw_t *data; 02134 } hd_detail_ccw_t; 02135 02136 typedef struct { 02137 enum hd_detail_type type; 02138 joystick_t *data; 02139 } hd_detail_joystick_t; 02140 02141 typedef union { 02142 enum hd_detail_type type; 02143 hd_detail_pci_t pci; 02144 hd_detail_usb_t usb; 02145 hd_detail_isapnp_t isapnp; 02146 hd_detail_cdrom_t cdrom; 02147 hd_detail_floppy_t floppy; 02148 hd_detail_bios_t bios; 02149 hd_detail_cpu_t cpu; 02150 hd_detail_prom_t prom; 02151 hd_detail_monitor_t monitor; 02152 hd_detail_sys_t sys; 02153 hd_detail_scsi_t scsi; 02154 hd_detail_devtree_t devtree; 02155 hd_detail_ccw_t ccw; 02156 hd_detail_joystick_t joystick; 02157 } hd_detail_t; 02158 02171 typedef struct hd_manual_s { 02172 struct hd_manual_s *next; 02173 02174 char *unique_id; 02175 char *parent_id; 02176 char *child_ids; 02177 unsigned hw_class; 02178 char *model; 02179 02180 hd_status_t status; 02181 char *config_string; 02182 02183 /* More or less free-form key, value pairs. 02184 * key should not contain '=', however. 02185 */ 02186 str_list_t *key; 02187 str_list_t *value; 02188 } hd_manual_t; 02189 02190 02196 typedef struct s_hd_t { 02197 struct s_hd_t *next; 02203 unsigned idx; 02204 02210 unsigned broken:1; 02211 02215 hd_id_t bus; 02216 02221 unsigned slot; 02222 02226 unsigned func; 02227 02231 hd_id_t base_class; 02232 02236 hd_id_t sub_class; 02237 02241 hd_id_t prog_if; 02242 02249 hd_id_t vendor; 02250 02259 hd_id_t device; 02260 02267 hd_id_t sub_vendor; 02268 02275 hd_id_t sub_device; 02276 02282 hd_id_t revision; 02283 02287 char *serial; 02288 02293 hd_id_t compat_vendor; 02294 02299 hd_id_t compat_device; 02300 02305 hd_hw_item_t hw_class; 02306 02311 unsigned char hw_class_list[(hw_all + 7) / 8]; 02319 char *model; 02320 02326 unsigned attached_to; 02327 02331 char *sysfs_id; 02332 02336 char *sysfs_bus_id; 02337 02341 char *sysfs_device_link; 02342 02348 char *unix_dev_name; 02349 02353 hd_dev_num_t unix_dev_num; 02354 02361 str_list_t *unix_dev_names; 02362 02369 char *unix_dev_name2; 02370 02374 hd_dev_num_t unix_dev_num2; 02375 02382 char *rom_id; 02383 02387 char *udi; 02388 02392 char *parent_udi; 02393 02404 char *unique_id; 02405 02407 str_list_t *unique_ids; 02408 02412 unsigned module; 02413 02417 unsigned line; 02418 02422 unsigned count; 02423 02427 hd_res_t *res; 02428 02433 hd_detail_t *detail; 02434 02440 str_list_t *extra_info; 02441 02447 hd_status_t status; 02448 02455 char *config_string; 02456 02461 hd_hotplug_t hotplug; 02462 02467 unsigned hotplug_slot; 02468 02469 struct is_s { 02470 unsigned agp:1; 02471 unsigned isapnp:1; 02472 unsigned notready:1; 02473 unsigned manual:1; 02474 unsigned softraiddisk:1; 02475 unsigned zip:1; 02476 unsigned cdr:1; 02477 unsigned cdrw:1; 02478 unsigned dvd:1; 02479 unsigned dvdr:1; 02480 unsigned dvdrw:1; 02481 unsigned dvdrdl:1; 02482 unsigned dvdpr:1; 02483 unsigned dvdprw:1; 02484 unsigned dvdprdl:1; 02485 unsigned dvdprwdl:1; 02486 unsigned bd:1; 02487 unsigned bdr:1; 02488 unsigned bdre:1; 02489 unsigned hd:1; 02490 unsigned hdr:1; 02491 unsigned hdrw:1; 02492 unsigned dvdram:1; 02493 unsigned mo:1; 02494 unsigned mrw:1; 02495 unsigned mrww:1; 02496 unsigned pppoe:1; 02497 unsigned wlan:1; 02498 unsigned with_acpi:1; 02499 unsigned hotpluggable:1; 02500 unsigned dualport:1; 02501 unsigned fcoe:1; 02502 unsigned fcoe_offload:2; 02503 unsigned iscsi_offload:2; 02504 unsigned storage_only:2; 02505 } is; 02506 02507 struct tag_s { 02508 unsigned remove:1; 02509 unsigned freeit:1; 02510 unsigned fixed:1; 02511 unsigned skip_mouse:1; 02512 unsigned skip_modem:1; 02513 unsigned skip_braille:1; 02514 unsigned ser_device:2; 02515 } tag; 02516 02522 unsigned char *block0; 02523 02527 char *driver; 02528 02532 char *driver_module; 02533 02537 str_list_t *drivers; 02538 02542 str_list_t *driver_modules; 02543 02551 char *old_unique_id; 02552 02558 char *parent_id; 02559 02565 str_list_t *child_ids; 02566 02571 char *unique_id1; 02572 02579 char *usb_guid; 02580 02581 driver_info_t *driver_info; 02583 str_list_t *requires; 02585 hal_prop_t *hal_prop; 02587 hal_prop_t *persistent_prop; 02589 char *modalias; 02590 char *label; 02592 /* 02593 * These are used internally for memory management. 02594 * Do not even _think_ of modifying these! 02595 */ 02596 unsigned ref_cnt; 02597 struct s_hd_t *ref; 02598 } hd_t; 02599 02600 02604 typedef struct { 02610 hd_t *hd; 02611 02620 void (*progress)(char *pos, char *msg); 02621 02626 char *log; 02627 02635 unsigned debug; 02636 02642 struct flag_struct { 02643 unsigned internal:1; 02644 unsigned dformat:2; 02645 unsigned no_parport:1; 02646 unsigned iseries:1; 02647 unsigned list_all:1; 02648 unsigned fast:1; 02649 unsigned list_md:1; 02650 unsigned nofork:1; 02651 unsigned nosysfs:1; 02652 unsigned forked:1; 02653 unsigned cpuemu:1; 02654 unsigned udev:1; 02655 unsigned edd_used:1; 02656 unsigned keep_kmods:2; 02657 unsigned nobioscrc:1; 02658 unsigned biosvram:1; 02659 unsigned nowpa:1; 02660 unsigned pata:1; 02661 unsigned vbox:1; 02662 unsigned vmware:1; 02663 unsigned vmware_mouse:1; 02664 } flags; 02665 02666 02671 str_list_t *only; 02672 02673 /* 02674 * The following entries should *not* be accessed outside of libhd! 02675 */ 02676 unsigned char probe[(pr_all + 7) / 8]; 02677 unsigned char probe_set[(pr_all + 7) / 8]; 02678 unsigned char probe_clr[(pr_all + 7) / 8]; 02679 hal_prop_t *probe_val; 02680 unsigned last_idx; 02681 unsigned module; 02682 enum boot_arch boot; 02683 hd_t *old_hd; 02684 pci_t *pci; 02685 isapnp_t *isapnp; 02686 cdrom_info_t *cdrom; 02687 str_list_t *net; 02688 str_list_t *floppy; 02689 misc_t *misc; 02690 serial_t *serial; 02691 scsi_t *scsi; 02692 ser_device_t *ser_mouse; 02693 ser_device_t *ser_modem; 02694 str_list_t *cpu; 02695 str_list_t *klog; 02696 str_list_t *proc_usb; 02697 usb_t *usb; 02698 modinfo_t *modinfo_ext; 02699 modinfo_t *modinfo; 02700 hddb2_data_t *hddb2[2]; 02701 str_list_t *kmods; 02702 uint64_t used_irqs; 02703 uint64_t assigned_irqs; 02704 memory_range_t bios_rom; 02705 memory_range_t bios_ram; 02706 memory_range_t bios_ebda; 02707 unsigned display; 02708 unsigned color_code; 02709 char *cmd_line; 02710 str_list_t *xtra_hd; 02711 devtree_t *devtree; 02712 unsigned kernel_version; 02713 hd_t *manual; 02714 str_list_t *disks; 02715 str_list_t *partitions; 02716 str_list_t *cdroms; 02717 hd_smbios_t *smbios; 02718 struct { 02719 unsigned ok:1; 02720 unsigned size; 02721 unsigned used; 02722 void *data; 02723 int id; 02724 int updated; 02725 } shm; 02726 unsigned pci_config_type; 02727 hd_udevinfo_t *udevinfo; 02728 hd_sysfsdrv_t *sysfsdrv; 02729 uint64_t sysfsdrv_id; 02730 str_list_t *scanner_db; 02731 edd_info_t edd[0x80]; 02732 hal_device_t *hal; 02733 str_list_t *lsscsi; 02734 struct vm_s *vm; 02735 size_t log_size; 02736 size_t log_max; 02737 str_list_t *klog_raw; 02738 } hd_data_t; 02739 02740 02741 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 02742 * 02743 * libhd interface functions 02744 * 02745 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 02746 */ 02747 02748 /* implemented in hd.c */ 02749 02751 void hd_scan(hd_data_t *hd_data); 02752 02754 hd_data_t *hd_free_hd_data(hd_data_t *hd_data); 02755 02757 hd_t *hd_free_hd_list(hd_t *hd); 02758 02759 void hd_set_probe_feature(hd_data_t *hd_data, enum probe_feature feature); 02760 void hd_clear_probe_feature(hd_data_t *hd_data, enum probe_feature feature); 02761 int hd_probe_feature(hd_data_t *hd_data, enum probe_feature feature); 02762 void hd_set_probe_feature_hw(hd_data_t *hd_data, hd_hw_item_t item); 02763 02764 enum probe_feature hd_probe_feature_by_name(char *name); 02765 char *hd_probe_feature_by_value(enum probe_feature feature); 02766 02767 int hd_module_is_active(hd_data_t *hd_data, char *mod); 02768 02769 hd_t *hd_base_class_list(hd_data_t *hd_data, unsigned base_class); 02770 hd_t *hd_sub_class_list(hd_data_t *hd_data, unsigned base_class, unsigned sub_class); 02771 hd_t *hd_bus_list(hd_data_t *hd_data, unsigned bus); 02772 const char* hd_busid_to_hwcfg(int busid); 02773 hd_t *hd_list(hd_data_t *hd_data, hd_hw_item_t item, int rescan, hd_t *hd_old); 02774 hd_t *hd_list_with_status(hd_data_t *hd_data, hd_hw_item_t item, hd_status_t status); 02775 hd_t *hd_list2(hd_data_t *hd_data, hd_hw_item_t *items, int rescan); 02776 hd_t *hd_list_with_status2(hd_data_t *hd_data, hd_hw_item_t *items, hd_status_t status); 02777 02778 void hd_add_driver_data(hd_data_t *hd_data, hd_t *hd); 02779 02780 int hd_has_pcmcia(hd_data_t *hd_data); 02781 #if 0 02782 02786 int hd_apm_enabled(hd_data_t *hd_data); 02787 #endif 02788 int hd_usb_support(hd_data_t *hd_data); 02789 int hd_smp_support(hd_data_t *hd_data); 02790 int hd_mac_color(hd_data_t *hd_data); 02791 int hd_color(hd_data_t *hd_data); 02792 int hd_is_uml(hd_data_t *hd_data); 02793 int hd_is_xen(hd_data_t *hd_data); 02794 unsigned hd_display_adapter(hd_data_t *hd_data); 02795 unsigned hd_boot_disk(hd_data_t *hd_data, int *matches); 02796 enum cpu_arch hd_cpu_arch(hd_data_t *hd_data); 02797 enum boot_arch hd_boot_arch(hd_data_t *hd_data); 02798 02799 hd_t *hd_get_device_by_idx(hd_data_t *hd_data, unsigned idx); 02800 02801 void hd_set_hw_class(hd_t *hd, hd_hw_item_t hw_class); 02802 int hd_is_hw_class(hd_t *hd, hd_hw_item_t hw_class); 02803 02804 int hd_is_sgi_altix(hd_data_t *hd_data); 02805 02806 char *hd_version(void); 02807 02808 hal_prop_t *hd_free_hal_properties(hal_prop_t *prop); 02809 hal_prop_t *hd_read_properties(const char *udi); 02810 int hd_write_properties(const char *udi, hal_prop_t *prop); 02811 02812 int hd_change_status(const char *id, hd_status_t status, const char *config_string); 02813 int hd_change_config_status(hd_data_t *hd_data, const char *id, hd_status_t status, const char *config_string); 02814 int hd_read_mmap(hd_data_t *hd_data, char *name, unsigned char *buf, off_t start, unsigned size); 02815 02816 /* implemented in hddb.c */ 02817 02821 str_list_t *hddb_get_packages(hd_data_t *hd_data); 02822 void hddb_add_info(hd_data_t *hd_data, hd_t *hd); 02823 02824 void hddb_dump_raw(hddb2_data_t *hddb, FILE *f); 02825 void hddb_dump(hddb2_data_t *hddb, FILE *f); 02826 02827 02828 /* implemented in hdp.c */ 02829 void hd_dump_entry(hd_data_t *hd_data, hd_t *hd, FILE *f); 02830 02831 /* implemented in cdrom.c */ 02832 cdrom_info_t *hd_read_cdrom_info(hd_data_t *hd_data, hd_t *hd); 02833 02841 hd_manual_t *hd_manual_read_entry(hd_data_t *hd_data, const char *id); 02842 int hd_manual_write_entry(hd_data_t *hd_data, hd_manual_t *entry); 02843 hd_manual_t *hd_free_manual(hd_manual_t *manual); 02844 hd_t *hd_read_config(hd_data_t *hd_data, const char *id); 02845 int hd_write_config(hd_data_t *hd_data, hd_t *hd); 02846 char *hd_hw_item_name(hd_hw_item_t item); 02847 hd_hw_item_t hd_hw_item_type(char *name); 02848 char *hd_status_value_name(hd_status_value_t status); 02849 02860 #define CDBISDN_VERSION 0x0101 02861 02862 #ifndef PCI_ANY_ID 02863 #define PCI_ANY_ID 0xffff 02864 #endif 02865 02866 #define CDBISDN_P_NONE 0x0 02867 #define CDBISDN_P_IRQ 0x1 02868 #define CDBISDN_P_MEM 0x2 02869 #define CDBISDN_P_IO 0x3 02870 02872 typedef struct { 02873 char *name; 02874 char *shortname; 02875 int vnr; 02876 int refcnt; 02877 } cdb_isdn_vendor; 02878 02879 typedef struct { 02880 int handle; 02881 int vhandle; 02882 char *name; 02883 char *lname; 02884 char *Class; 02885 char *bus; 02886 int revision; 02887 int vendor; 02888 int device; 02889 int subvendor; 02891 int subdevice; 02893 unsigned int features; 02894 int line_cnt; 02895 int vario_cnt; 02896 int vario; 02897 } cdb_isdn_card; 02898 02899 typedef struct { 02900 int handle; 02901 int next_vario; 02902 int drvid; 02903 int typ; 02904 int subtyp; 02905 int smp; 02906 char *mod_name; 02907 char *para_str; 02908 char *mod_preload; 02909 char *cfg_prog; 02910 char *firmware; 02911 char *description; 02912 char *need_pkg; 02913 char *info; 02914 char *protocol; 02915 char *interface; 02916 char *io; 02917 char *irq; 02918 char *membase; 02919 char *features; 02920 int card_ref; 02921 char *name; 02922 } cdb_isdn_vario; 02923 02924 02925 extern cdb_isdn_vendor *hd_cdbisdn_get_vendor(int); 02926 extern cdb_isdn_card *hd_cdbisdn_get_card(int); 02927 extern cdb_isdn_vario *hd_cdbisdn_get_vario_from_type(int, int); 02928 extern cdb_isdn_card *hd_cdbisdn_get_card_from_type(int, int); 02929 extern cdb_isdn_card *hd_cdbisdn_get_card_from_id(int, int, int, int); 02930 extern cdb_isdn_vario *hd_cdbisdn_get_vario(int); 02931 extern int hd_cdbisdn_get_version(void); 02932 extern int hd_cdbisdn_get_db_version(void); 02933 extern char *hd_cdbisdn_get_db_date(void); 02934 02940 #ifdef __cplusplus 02941 } 02942 #endif 02943 02946 #endif /* _HD_H */