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 16 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 00065 #define HARDWARE_DIR "/var/lib/hardware" 00066 00081 #define TAG_PCI 1 00082 #define TAG_EISA 2 00083 #define TAG_USB 3 00084 #define TAG_SPECIAL 4 00085 #define TAG_PCMCIA 5 00090 #define ID_VALUE(id) ((id) & 0xffff) 00091 00095 #define ID_TAG(id) (((id) >> 16) & 0xf) 00096 00100 #define MAKE_ID(tag, id_val) ((tag << 16) | (id_val)) 00101 00107 typedef enum probe_feature { 00108 pr_memory = 1, pr_pci, pr_isapnp, pr_net, pr_floppy, pr_misc, 00109 pr_misc_serial, pr_misc_par, pr_misc_floppy, pr_serial, pr_cpu, pr_bios, 00110 pr_monitor, pr_mouse, pr_scsi, pr_usb, pr_usb_mods, pr_adb, pr_modem, 00111 pr_modem_usb, pr_parallel, pr_parallel_lp, pr_parallel_zip, pr_isa, 00112 pr_isa_isdn, pr_isdn, pr_kbd, pr_prom, pr_sbus, pr_int, pr_braille, 00113 pr_braille_alva, pr_braille_fhp, pr_braille_ht, pr_ignx11, pr_sys, 00114 pr_bios_vbe, pr_isapnp_old, pr_isapnp_new, pr_isapnp_mod, pr_braille_baum, 00115 pr_manual, pr_fb, pr_veth, pr_pppoe, pr_scan, pr_pcmcia, pr_fork, 00116 pr_parallel_imm, pr_s390, pr_cpuemu, pr_sysfs, pr_s390disks, pr_udev, 00117 pr_block, pr_block_cdrom, pr_block_part, pr_edd, pr_edd_mod, pr_bios_ddc, 00118 pr_bios_fb, pr_bios_mode, pr_input, pr_block_mods, pr_bios_vesa, 00119 pr_cpuemu_debug, pr_scsi_noserial, pr_wlan, pr_bios_crc, pr_hal, 00120 pr_bios_vram, pr_bios_acpi, pr_bios_ddc_ports, pr_modules_pata, 00121 pr_net_eeprom, pr_x86emu, 00122 pr_max, pr_lxrc, pr_default, 00123 pr_all 00124 } hd_probe_feature_t; 00125 00134 typedef enum hw_item { 00135 hw_none = 0, hw_sys, hw_cpu, hw_keyboard, hw_braille, hw_mouse, 00136 hw_joystick, hw_printer, hw_scanner, hw_chipcard, hw_monitor, hw_tv, 00137 hw_display, hw_framebuffer, hw_camera, hw_sound, hw_storage_ctrl, 00138 hw_network_ctrl, hw_isdn, hw_modem, hw_network, hw_disk, hw_partition, 00139 hw_cdrom, hw_floppy, hw_manual, hw_usb_ctrl, hw_usb, hw_bios, hw_pci, 00140 hw_isapnp, hw_bridge, hw_hub, hw_scsi, hw_ide, hw_memory, hw_dvb, 00141 hw_pcmcia, hw_pcmcia_ctrl, hw_ieee1394, hw_ieee1394_ctrl, hw_hotplug, 00142 hw_hotplug_ctrl, hw_zip, hw_pppoe, hw_wlan, hw_redasd, hw_dsl, hw_block, 00143 hw_tape, hw_vbe, hw_bluetooth, hw_fingerprint, 00145 hw_unknown, hw_all 00146 } hd_hw_item_t; 00147 00155 typedef enum base_classes { 00156 // these *must* match standard PCI class numbers 00157 bc_none, bc_storage, bc_network, bc_display, bc_multimedia, 00158 bc_memory, bc_bridge, bc_comm, bc_system, bc_input, bc_docking, 00159 bc_processor, bc_serial, bc_wireless, bc_i2o, bc_other = 0xff, 00160 00161 // add our own classes here (starting at 0x100 as PCI values are 8 bit) 00162 bc_monitor = 0x100, bc_internal, bc_modem, bc_isdn, bc_ps2, bc_mouse, 00163 bc_storage_device, bc_network_interface, bc_keyboard, bc_printer, 00164 bc_hub, bc_braille, bc_scanner, bc_joystick, bc_chipcard, bc_camera, 00165 bc_framebuffer, bc_dvb, bc_tv, bc_partition, bc_dsl, bc_bluetooth, bc_fingerprint 00166 } hd_base_classes_t; 00167 00169 typedef enum sc_monitor { 00170 sc_mon_other, sc_mon_crt, sc_mon_lcd 00171 } hd_sc_monitor_t; 00172 00174 typedef enum sc_storage { 00175 sc_sto_scsi, sc_sto_ide, sc_sto_floppy, sc_sto_ipi, sc_sto_raid, 00176 sc_sto_other = 0x80 00177 } hd_sc_storage_t; 00178 00180 typedef enum sc_display { 00181 sc_dis_vga, sc_dis_xga, sc_dis_other = 0x80 00182 } hd_sc_display_t; 00183 00185 typedef enum sc_framebuffer { 00186 sc_fb_vesa = 1 00187 } hd_sc_framebuffer_t; 00188 00190 typedef enum sc_bridge { 00191 sc_bridge_host, sc_bridge_isa, sc_bridge_eisa, sc_bridge_mc, 00192 sc_bridge_pci, sc_bridge_pcmcia, sc_bridge_nubus, sc_bridge_cardbus, 00193 sc_bridge_other = 0x80 00194 } hd_sc_bridge_t; 00195 00197 typedef enum sc_comm { 00198 sc_com_ser, sc_com_par, sc_com_multi, sc_com_modem, sc_com_other = 0x80 00199 } hd_sc_comm_t; 00200 00202 typedef enum sc_system { 00203 sc_sys_pic, sc_sys_dma, sc_sys_timer, sc_sys_rtc, sc_sys_other = 0x80 00204 } hd_sc_system_t; 00205 00207 typedef enum sc_input { 00208 sc_inp_keyb, sc_inp_digit, sc_inp_mouse, sc_inp_other = 0x80 00209 } hd_sc_input_t; 00210 00212 typedef enum sc_serial { 00213 sc_ser_fire, sc_ser_access, sc_ser_ssa, sc_ser_usb, sc_ser_fiber, 00214 sc_ser_smbus, sc_ser_other = 0x80 00215 } hd_sc_serial_t; 00216 00218 typedef enum sc_internal { 00219 sc_int_none, sc_int_isapnp_if, sc_int_main_mem, sc_int_cpu, sc_int_fpu, 00220 sc_int_bios, sc_int_prom, sc_int_sys 00221 } hd_sc_internal_t; 00222 00224 typedef enum sc_mouse { 00225 sc_mou_ps2, sc_mou_ser, sc_mou_bus, sc_mou_usb, sc_mou_sun, 00226 sc_mou_other = 0x80 00227 } hd_sc_mouse_t; 00228 00230 typedef enum sc_std { 00231 sc_sdev_disk, sc_sdev_tape, sc_sdev_cdrom, sc_sdev_floppy, sc_sdev_scanner, 00232 sc_sdev_other = 0x80 00233 } hd_sc_std_t; 00234 00236 typedef enum sc_net_if { 00237 sc_nif_loopback, sc_nif_ethernet, sc_nif_tokenring, sc_nif_fddi, 00238 sc_nif_ctc, sc_nif_iucv, sc_nif_hsi, sc_nif_qeth, 00239 sc_nif_escon, sc_nif_myrinet, sc_nif_wlan, sc_nif_xp, 00240 sc_nif_usb, sc_nif_other = 0x80, sc_nif_sit 00241 } hd_sc_net_if_t; 00242 00244 typedef enum sc_multimedia { 00245 sc_multi_video, sc_multi_audio, sc_multi_other 00246 } hd_sc_multimedia_t; 00247 00249 typedef enum sc_keyboard { 00250 sc_keyboard_kbd, sc_keyboard_console 00251 } hd_sc_keyboard_t; 00252 00254 typedef enum sc_hub { 00255 sc_hub_other, sc_hub_usb 00256 } hd_sc_hub_t; 00257 00259 typedef enum sc_camera { 00260 sc_camera_webcam, sc_camera_digital 00261 } hd_sc_camera_t; 00262 00264 typedef enum sc_modem { 00265 sc_mod_at, sc_mod_win1, sc_mod_win2, sc_mod_win3, sc_mod_win4 00266 } hd_sc_modem_t; 00267 00269 typedef enum sc_dsl { 00270 sc_dsl_unknown, sc_dsl_pppoe, sc_dsl_capi, sc_dsl_capiisdn 00271 } hd_sc_dsl_t; 00272 00274 typedef enum pif_usb_e { 00275 pif_usb_uhci = 0, pif_usb_ohci = 0x10, pif_usb_ehci = 0x20, 00276 pif_usb_other = 0x80, pif_usb_device = 0xfe 00277 } hd_pif_usb_t; 00278 00280 typedef enum pif_cdrom { 00281 pif_cdrom, pif_cdr, pif_cdrw, pif_dvd, pif_dvdr, pif_dvdram 00282 } hd_pif_cdrom_t ; 00283 00285 typedef enum pif_s390disk { 00286 pif_scsi, pif_dasd, pif_dasd_fba 00287 } hd_pif_s390disk_t; 00288 00290 typedef enum bus_types { 00291 bus_none, bus_isa, bus_eisa, bus_mc, bus_pci, bus_pcmcia, bus_nubus, 00292 bus_cardbus, bus_other, 00293 00295 bus_ps2 = 0x80, bus_serial, bus_parallel, bus_floppy, bus_scsi, bus_ide, bus_usb, 00296 bus_adb, bus_raid, bus_sbus, bus_i2o, bus_vio, bus_ccw, bus_iucv, bus_ps3_system_bus, 00297 bus_virtio, bus_ibmebus 00298 } hd_bus_types_t; 00299 00308 typedef struct { 00312 unsigned invalid:1; 00313 00323 unsigned reconfig:3; 00324 00330 unsigned configured:3; 00331 00342 unsigned available:3; 00343 00351 unsigned needed:3; 00352 00359 unsigned available_orig:3; 00360 00364 unsigned active:3; 00365 } hd_status_t; 00366 00368 typedef enum { 00369 status_no = 1, status_yes, status_unknown, status_new 00370 } hd_status_value_t; 00371 00375 typedef enum { 00376 hp_none, 00377 hp_pcmcia, 00378 hp_cardbus, 00379 hp_pci, 00380 hp_usb, 00381 hp_ieee1394 00382 } hd_hotplug_t; 00383 00394 typedef struct { 00395 unsigned id; 00396 char *name; 00397 } hd_id_t; 00398 00399 00404 typedef struct s_str_list_t { 00405 struct s_str_list_t *next; 00406 char *str; 00407 } str_list_t; 00408 00409 00413 typedef struct { 00414 unsigned char bitmap[16]; 00415 unsigned bits; 00416 unsigned not_empty:1; 00417 str_list_t *str; 00418 } hd_bitmap_t; 00419 00436 typedef struct { 00437 unsigned start, size; 00438 unsigned char *data; 00439 } memory_range_t; 00440 00441 00445 typedef struct { 00446 unsigned ok:1; 00447 unsigned rev; 00448 unsigned mpfp; 00449 unsigned mpconfig_ok:1; 00450 unsigned mpconfig; 00451 unsigned mpconfig_size; 00452 unsigned char feature[5]; 00453 char oem_id[9]; 00454 char prod_id[13]; 00455 unsigned cpus, cpus_en; 00456 } smp_info_t; 00457 00458 00462 typedef struct vbe_mode_info_s { 00463 unsigned number; 00464 unsigned attributes; 00465 unsigned width, height; 00466 unsigned bytes_p_line; 00467 unsigned pixel_size; 00468 unsigned fb_start; 00469 unsigned win_A_start; 00470 unsigned win_A_attr; 00471 unsigned win_B_start; 00472 unsigned win_B_attr; 00473 unsigned win_size; 00474 unsigned win_gran; 00475 unsigned pixel_clock; 00476 } vbe_mode_info_t; 00477 00483 typedef struct { 00484 unsigned ok:1; 00485 unsigned version; 00486 unsigned oem_version; 00487 unsigned memory; 00488 unsigned fb_start; 00489 char *oem_name; 00490 char *vendor_name; 00491 char *product_name; 00492 char *product_revision; 00493 unsigned modes; 00494 vbe_mode_info_t *mode; 00495 unsigned current_mode; 00496 unsigned ddc_ports; 00497 unsigned char ddc_port[4][0x80]; 00498 } vbe_info_t; 00499 00500 00504 typedef struct { 00505 unsigned id; 00506 unsigned char slot; 00507 unsigned char bus; 00508 unsigned char devfn; 00509 unsigned char misc; 00510 } cpq_ctlorder_t; 00511 00512 00513 typedef struct { 00514 unsigned ok:1; 00515 unsigned entry; 00516 unsigned compaq:1; 00517 cpq_ctlorder_t cpq_ctrl[32]; 00518 } bios32_info_t; 00519 00529 typedef enum { 00530 sm_biosinfo, sm_sysinfo, sm_boardinfo, sm_chassis, 00531 sm_processor, sm_memctrl, sm_memmodule, sm_cache, 00532 sm_connect, sm_slot, sm_onboard, sm_oem, 00533 sm_config, sm_lang, sm_group, sm_eventlog, 00534 sm_memarray, sm_memdevice, sm_memerror, sm_memarraymap, 00535 sm_memdevicemap, sm_mouse, sm_battery, sm_reset, 00536 sm_secure, sm_power, sm_voltage, sm_cool, 00537 sm_temperature, sm_current, sm_outofband, sm_bis, 00538 sm_boot, sm_mem64error, sm_mandev, sm_mandevcomp, 00539 sm_mdtd, sm_inactive = 126, sm_end = 127 00540 } hd_smbios_type_t; 00541 00542 00544 typedef struct { 00545 union u_hd_smbios_t *next; 00546 hd_smbios_type_t type; 00547 int data_len; 00548 unsigned char *data; 00549 str_list_t *strings; 00550 int handle; 00551 } smbios_any_t; 00552 00553 00555 typedef struct { 00556 union u_hd_smbios_t *next; 00557 hd_smbios_type_t type; 00558 int data_len; 00559 unsigned char *data; 00560 str_list_t *strings; 00561 int handle; 00562 char *vendor; 00563 char *version; 00564 char *date; 00565 hd_bitmap_t feature; 00566 unsigned start; 00567 unsigned rom_size; 00568 } smbios_biosinfo_t; 00569 00570 00572 typedef struct { 00573 union u_hd_smbios_t *next; 00574 hd_smbios_type_t type; 00575 int data_len; 00576 unsigned char *data; 00577 str_list_t *strings; 00578 int handle; 00579 char *manuf; 00580 char *product; 00581 char *version; 00582 char *serial; 00583 unsigned char uuid[16]; 00584 hd_id_t wake_up; 00585 } smbios_sysinfo_t; 00586 00587 00589 typedef struct { 00590 union u_hd_smbios_t *next; 00591 hd_smbios_type_t type; 00592 int data_len; 00593 unsigned char *data; 00594 str_list_t *strings; 00595 int handle; 00596 char *manuf; 00597 char *product; 00598 char *version; 00599 char *serial; 00600 char *asset; 00601 hd_id_t board_type; 00602 hd_bitmap_t feature; 00603 char *location; 00604 int chassis; 00605 int objects_len; 00606 int *objects; 00607 } smbios_boardinfo_t; 00608 00609 00611 typedef struct { 00612 union u_hd_smbios_t *next; 00613 hd_smbios_type_t type; 00614 int data_len; 00615 unsigned char *data; 00616 str_list_t *strings; 00617 int handle; 00618 char *manuf; 00619 char *version; 00620 char *serial; 00621 char *asset; 00622 hd_id_t ch_type; 00623 unsigned lock; 00624 hd_id_t bootup; 00625 hd_id_t power; 00626 hd_id_t thermal; 00627 hd_id_t security; 00628 unsigned oem; 00629 } smbios_chassis_t; 00630 00631 00633 typedef struct { 00634 union u_hd_smbios_t *next; 00635 hd_smbios_type_t type; 00636 int data_len; 00637 unsigned char *data; 00638 str_list_t *strings; 00639 int handle; 00640 char *socket; 00641 hd_id_t upgrade; 00642 char *manuf; 00643 char *version; 00644 char *serial; 00645 char *asset; 00646 char *part; 00647 hd_id_t pr_type; 00648 hd_id_t family; 00649 uint64_t cpu_id; 00650 unsigned voltage; 00651 unsigned ext_clock; 00652 unsigned max_speed; 00653 unsigned current_speed; 00654 unsigned sock_status; 00655 hd_id_t cpu_status; 00656 int l1_cache; 00657 int l2_cache; 00658 int l3_cache; 00659 } smbios_processor_t; 00660 00661 00663 typedef struct { 00664 union u_hd_smbios_t *next; 00665 hd_smbios_type_t type; 00666 int data_len; 00667 unsigned char *data; 00668 str_list_t *strings; 00669 int handle; 00670 char *socket; 00671 unsigned max_size; 00672 unsigned current_size; 00673 unsigned speed; 00674 hd_id_t mode; 00675 unsigned state; 00676 hd_id_t location; 00677 unsigned socketed; 00678 unsigned level; 00679 hd_id_t ecc; 00680 hd_id_t cache_type; 00681 hd_id_t assoc; 00682 hd_bitmap_t supp_sram; 00683 hd_bitmap_t sram; 00684 } smbios_cache_t; 00685 00686 00688 typedef struct { 00689 union u_hd_smbios_t *next; 00690 hd_smbios_type_t type; 00691 int data_len; 00692 unsigned char *data; 00693 str_list_t *strings; 00694 int handle; 00695 hd_id_t port_type; 00696 char *i_des; 00697 hd_id_t i_type; 00698 char *x_des; 00699 hd_id_t x_type; 00700 } smbios_connect_t; 00701 00702 00704 typedef struct { 00705 union u_hd_smbios_t *next; 00706 hd_smbios_type_t type; 00707 int data_len; 00708 unsigned char *data; 00709 str_list_t *strings; 00710 int handle; 00711 char *desig; 00712 hd_id_t slot_type; 00713 hd_id_t bus_width; 00714 hd_id_t usage; 00715 hd_id_t length; 00716 unsigned id; 00717 hd_bitmap_t feature; 00718 } smbios_slot_t; 00719 00720 00722 typedef struct { 00723 union u_hd_smbios_t *next; 00724 hd_smbios_type_t type; 00725 int data_len; 00726 unsigned char *data; 00727 str_list_t *strings; 00728 int handle; 00729 unsigned dev_len; 00730 struct { 00731 char *name; 00732 hd_id_t type; 00733 unsigned status; 00734 } *dev; 00735 } smbios_onboard_t; 00736 00737 00739 typedef struct { 00740 union u_hd_smbios_t *next; 00741 hd_smbios_type_t type; 00742 int data_len; 00743 unsigned char *data; 00744 str_list_t *strings; 00745 int handle; 00746 str_list_t *oem_strings; 00747 } smbios_oem_t; 00748 00749 00751 typedef struct { 00752 union u_hd_smbios_t *next; 00753 hd_smbios_type_t type; 00754 int data_len; 00755 unsigned char *data; 00756 str_list_t *strings; 00757 int handle; 00758 str_list_t *options; 00759 } smbios_config_t; 00760 00761 00763 typedef struct { 00764 union u_hd_smbios_t *next; 00765 hd_smbios_type_t type; 00766 int data_len; 00767 unsigned char *data; 00768 str_list_t *strings; 00769 int handle; 00770 char *current; 00771 } smbios_lang_t; 00772 00773 00775 typedef struct { 00776 union u_hd_smbios_t *next; 00777 hd_smbios_type_t type; 00778 int data_len; 00779 unsigned char *data; 00780 str_list_t *strings; 00781 int handle; 00782 char *name; 00783 int items_len; 00784 int *item_handles; 00785 } smbios_group_t; 00786 00787 00789 typedef struct { 00790 union u_hd_smbios_t *next; 00791 hd_smbios_type_t type; 00792 int data_len; 00793 unsigned char *data; 00794 str_list_t *strings; 00795 int handle; 00796 hd_id_t location; 00797 hd_id_t use; 00798 hd_id_t ecc; 00799 unsigned max_size; 00800 int error_handle; 00801 unsigned slots; 00802 } smbios_memarray_t; 00803 00804 00806 typedef struct { 00807 union u_hd_smbios_t *next; 00808 hd_smbios_type_t type; 00809 int data_len; 00810 unsigned char *data; 00811 str_list_t *strings; 00812 int handle; 00813 char *location; 00814 char *bank; 00815 char *manuf; 00816 char *serial; 00817 char *asset; 00818 char *part; 00819 int array_handle; 00820 int error_handle; 00821 unsigned width; 00822 unsigned eccbits; 00823 unsigned size; 00824 hd_id_t form; 00825 unsigned set; 00826 hd_id_t mem_type; 00827 hd_bitmap_t type_detail; 00828 unsigned speed; 00829 } smbios_memdevice_t; 00830 00831 00833 typedef struct { 00834 union u_hd_smbios_t *next; 00835 hd_smbios_type_t type; 00836 int data_len; 00837 unsigned char *data; 00838 str_list_t *strings; 00839 int handle; 00840 hd_id_t err_type; 00841 hd_id_t granularity; 00842 hd_id_t operation; 00843 unsigned syndrome; 00844 unsigned array_addr; 00845 unsigned device_addr; 00846 unsigned range; 00847 } smbios_memerror_t; 00848 00849 00851 typedef struct { 00852 union u_hd_smbios_t *next; 00853 hd_smbios_type_t type; 00854 int data_len; 00855 unsigned char *data; 00856 str_list_t *strings; 00857 int handle; 00858 int array_handle; 00859 uint64_t start_addr; 00860 uint64_t end_addr; 00861 unsigned part_width; 00862 } smbios_memarraymap_t; 00863 00864 00866 typedef struct { 00867 union u_hd_smbios_t *next; 00868 hd_smbios_type_t type; 00869 int data_len; 00870 unsigned char *data; 00871 str_list_t *strings; 00872 int handle; 00873 int memdevice_handle; 00874 int arraymap_handle; 00875 uint64_t start_addr; 00876 uint64_t end_addr; 00877 unsigned row_pos; 00878 unsigned interleave_pos; 00879 unsigned interleave_depth; 00880 } smbios_memdevicemap_t; 00881 00882 00884 typedef struct { 00885 union u_hd_smbios_t *next; 00886 hd_smbios_type_t type; 00887 int data_len; 00888 unsigned char *data; 00889 str_list_t *strings; 00890 int handle; 00891 hd_id_t mtype; 00892 hd_id_t interface; 00893 unsigned buttons; 00894 } smbios_mouse_t; 00895 00896 00898 typedef struct { 00899 union u_hd_smbios_t *next; 00900 hd_smbios_type_t type; 00901 int data_len; 00902 unsigned char *data; 00903 str_list_t *strings; 00904 int handle; 00905 hd_id_t power; 00906 hd_id_t keyboard; 00907 hd_id_t admin; 00908 hd_id_t reset; 00909 } smbios_secure_t; 00910 00911 00913 typedef struct { 00914 union u_hd_smbios_t *next; 00915 hd_smbios_type_t type; 00916 int data_len; 00917 unsigned char *data; 00918 str_list_t *strings; 00919 int handle; 00920 unsigned month; 00921 unsigned day; 00922 unsigned hour; 00923 unsigned minute; 00924 unsigned second; 00925 } smbios_power_t; 00926 00927 00929 typedef struct { 00930 union u_hd_smbios_t *next; 00931 hd_smbios_type_t type; 00932 int data_len; 00933 unsigned char *data; 00934 str_list_t *strings; 00935 int handle; 00936 hd_id_t err_type; 00937 hd_id_t granularity; 00938 hd_id_t operation; 00939 unsigned syndrome; 00940 uint64_t array_addr; 00941 uint64_t device_addr; 00942 unsigned range; 00943 } smbios_mem64error_t; 00944 00945 00947 typedef union u_hd_smbios_t { 00948 union u_hd_smbios_t *next; 00949 smbios_any_t any; 00950 smbios_biosinfo_t biosinfo; 00951 smbios_sysinfo_t sysinfo; 00952 smbios_boardinfo_t boardinfo; 00953 smbios_chassis_t chassis; 00954 smbios_processor_t processor; 00955 smbios_cache_t cache; 00956 smbios_connect_t connect; 00957 smbios_slot_t slot; 00958 smbios_onboard_t onboard; 00959 smbios_oem_t oem; 00960 smbios_config_t config; 00961 smbios_lang_t lang; 00962 smbios_group_t group; 00963 smbios_memarray_t memarray; 00964 smbios_memdevice_t memdevice; 00965 smbios_memerror_t memerror; 00966 smbios_memarraymap_t memarraymap; 00967 smbios_memdevicemap_t memdevicemap; 00968 smbios_mouse_t mouse; 00969 smbios_secure_t secure; 00970 smbios_power_t power; 00971 smbios_mem64error_t mem64error; 00972 } hd_smbios_t; 00973 00981 typedef struct s_udevinfo_t { 00982 struct s_udevinfo_t *next; 00983 char *sysfs; 00984 char *name; 00985 str_list_t *links; 00986 } hd_udevinfo_t; 00987 00988 00992 typedef struct s_sysfsdrv_t { 00993 struct s_sysfsdrv_t *next; 00994 char *driver; 00995 char *device; 00996 char *module; 00997 } hd_sysfsdrv_t; 00998 00999 01005 typedef struct { 01006 int type; 01007 unsigned major, minor, range; 01008 } hd_dev_num_t; 01009 01010 01025 typedef struct s_pci_t { 01026 struct s_pci_t *next; 01027 unsigned data_len; 01028 unsigned data_ext_len; 01029 unsigned char data[256]; 01030 char *log; 01031 unsigned flags, 01032 cmd, 01033 hdr_type, 01034 secondary_bus; 01035 unsigned bus, 01036 slot, func; 01037 unsigned base_class, sub_class, prog_if; 01038 unsigned dev, vend, sub_dev, sub_vend, rev; 01039 unsigned irq; 01040 uint64_t base_addr[7]; 01041 uint64_t base_len[7]; 01042 unsigned addr_flags[7]; 01043 uint64_t rom_base_addr; 01044 uint64_t rom_base_len; 01045 char *sysfs_id; 01046 char *sysfs_bus_id; 01047 char *modalias; 01048 unsigned edid_len[4]; 01049 unsigned char edid_data[4][0x80]; 01050 } pci_t; 01051 01056 typedef enum pci_flags { 01057 pci_flag_ok, pci_flag_pm, pci_flag_agp 01058 } hd_pci_flags_t; 01059 01060 01065 typedef struct usb_s { 01066 struct usb_s *next; 01067 unsigned hd_idx; 01068 unsigned hd_base_idx; 01069 str_list_t *c, *d, *e, *i, *p, *s, *t; 01070 struct usb_s *cloned; 01071 int bus, dev_nr, lev, parent, port, count, conns, used_conns, ifdescr; 01072 unsigned speed; 01073 unsigned vendor, device, rev; 01074 char *manufact, *product, *serial; 01075 char *driver; 01076 memory_range_t raw_descr; 01077 int d_cls, d_sub, d_prot; 01078 int i_alt, i_cls, i_sub, i_prot; 01079 unsigned country; 01080 } usb_t; 01081 01082 01086 typedef struct { 01087 int len; 01088 int type; 01089 unsigned char *data; 01090 } isapnp_res_t; 01091 01095 typedef struct { 01096 int csn; 01097 int log_devs; 01098 unsigned char *serial; 01099 unsigned char *card_regs; 01100 unsigned char (*ldev_regs)[0xd0]; 01101 int res_len; 01102 unsigned broken:1; 01103 isapnp_res_t *res; 01104 } isapnp_card_t; 01105 01109 typedef struct { 01110 int read_port; 01111 int cards; 01112 isapnp_card_t *card; 01113 } isapnp_t; 01114 01118 typedef struct { 01119 isapnp_card_t *card; 01120 int dev; 01121 unsigned flags; 01122 unsigned ref:1; 01123 } isapnp_dev_t; 01124 01129 typedef enum isapnp_flags { 01130 isapnp_flag_act 01131 } hd_isapnp_flags_t; 01132 01133 01137 typedef struct scsi_s { 01138 struct scsi_s *next; 01139 unsigned deleted:1; 01140 unsigned generic:1; 01141 unsigned fake:1; 01142 unsigned wwpn_ok:1; 01143 unsigned fcp_lun_ok:1; 01144 char *dev_name; 01145 char *guessed_dev_name; 01146 int generic_dev; 01147 unsigned host, channel, id, lun; 01148 char *vendor, *model, *rev, *type_str, *serial; 01149 int type; 01150 unsigned inode_low; 01151 char *proc_dir, *driver; 01152 unsigned unique; 01153 char *info; 01154 unsigned lgeo_c, lgeo_h, lgeo_s; 01155 unsigned pgeo_c, pgeo_h, pgeo_s; 01156 uint64_t size; 01157 unsigned sec_size; 01158 unsigned cache; 01159 str_list_t *host_info; 01160 char *usb_guid; 01161 unsigned pci_info; 01162 unsigned pci_bus; 01163 unsigned pci_slot; 01164 unsigned pci_func; 01165 uint64_t wwpn; 01166 uint64_t fcp_lun; 01167 char *controller_id; 01168 } scsi_t; 01169 01170 01174 typedef struct devtree_s { 01175 struct devtree_s *next; 01176 struct devtree_s *parent; 01177 unsigned idx; 01178 char *path, *filename; 01179 unsigned pci:1; 01180 char *name, *model, *device_type, *compatible; 01181 int class_code; 01182 int vendor_id, device_id, subvendor_id, subdevice_id; 01183 int revision_id, interrupt; 01184 unsigned char *edid; 01185 } devtree_t; 01186 01187 enum pmac_model { 01188 AAPL_3400, 01189 AAPL_3500, 01190 AAPL_7200, 01191 AAPL_7300, 01192 AAPL_7500, 01193 AAPL_8500, 01194 AAPL_9500, 01195 AAPL_Gossamer, 01196 AAPL_PowerBook1998, 01197 AAPL_PowerMac_G3, 01198 AAPL_ShinerESB, 01199 AAPL_e407, 01200 AAPL_e411, 01201 PowerBook1_1, 01202 PowerBook2_1, 01203 PowerBook2_2, 01204 PowerBook3_1, 01205 PowerBook3_2, 01206 PowerBook3_3, 01207 PowerBook3_4, 01208 PowerBook3_5, 01209 PowerBook4_1, 01210 PowerBook4_2, 01211 PowerBook4_3, 01212 PowerBook5_1, 01213 PowerBook5_2, 01214 PowerBook5_3, 01215 PowerBook5_4, 01216 PowerBook5_5, 01217 PowerBook5_6, 01218 PowerBook5_7, 01219 PowerBook5_8, 01220 PowerBook5_9, 01221 PowerBook6_1, 01222 PowerBook6_2, 01223 PowerBook6_3, 01224 PowerBook6_4, 01225 PowerBook6_5, 01226 PowerBook6_7, 01227 PowerBook6_8, 01228 PowerMac1_1, 01229 PowerMac1_2, 01230 PowerMac10_1, 01231 PowerMac11_2, 01232 PowerMac12_1, 01233 PowerMac2_1, 01234 PowerMac2_2, 01235 PowerMac3_1, 01236 PowerMac3_2, 01237 PowerMac3_3, 01238 PowerMac3_4, 01239 PowerMac3_5, 01240 PowerMac3_6, 01241 PowerMac4_1, 01242 PowerMac4_2, 01243 PowerMac4_4, 01244 PowerMac5_1, 01245 PowerMac6_1, 01246 PowerMac6_3, 01247 PowerMac6_4, 01248 PowerMac7_2, 01249 PowerMac7_3, 01250 PowerMac8_1, 01251 PowerMac9_1, 01252 RackMac1_1, 01253 RackMac1_2, 01254 RackMac3_1, 01255 iMac_1, 01256 }; 01260 struct pmac_mb_def { 01261 enum pmac_model model; 01262 const char *string; 01263 }; 01264 01268 typedef struct ccw_s { 01269 unsigned char lcss; 01270 unsigned char cu_model; 01271 unsigned char dev_model; 01272 } ccw_t; 01273 01274 01278 typedef struct cdrom_info_s { 01279 struct cdrom_info_s *next; 01280 char *name; 01281 unsigned speed; 01282 unsigned cdr:1, cdrw:1, dvd:1, dvdr:1, dvdram:1; 01283 unsigned cdrom:1; 01284 struct { 01285 unsigned ok:1; 01286 char *volume, *publisher, *preparer, *application, *creation_date; 01287 } iso9660; 01288 struct { 01289 unsigned ok:1; 01290 unsigned platform; 01291 char *id_string; 01292 unsigned bootable:1; 01293 unsigned media_type; 01294 unsigned load_address; 01295 unsigned load_count; 01296 unsigned start; 01297 unsigned catalog; 01298 struct { 01299 unsigned c, h, s; 01300 unsigned size; 01301 } geo; 01302 char *label; 01303 } el_torito; 01304 01305 } cdrom_info_t; 01306 01307 01313 typedef struct { 01314 unsigned char block0[512]; 01315 } floppy_info_t; 01316 01317 01321 typedef struct { 01322 unsigned apm_supported:1; 01323 unsigned apm_enabled:1; 01324 unsigned apm_ver, apm_subver; 01325 unsigned apm_bios_flags; 01326 01327 unsigned vbe_ver; 01328 unsigned vbe_video_mem; 01329 01330 unsigned ser_port0, ser_port1, ser_port2, ser_port3; 01331 unsigned par_port0, par_port1, par_port2; 01332 01334 unsigned is_pnp_bios:1; 01335 unsigned pnp_id; 01336 unsigned lba_support:1; 01337 01338 unsigned low_mem_size; 01339 smp_info_t smp; 01340 vbe_info_t vbe; 01341 01342 unsigned smbios_ver; 01343 01344 struct { 01345 unsigned width; 01346 unsigned height; 01347 unsigned xsize; 01348 unsigned ysize; 01349 char *vendor; 01350 char *name; 01351 } lcd; 01352 01353 struct { 01354 char *vendor; 01355 char *type; 01356 unsigned bus; 01357 unsigned compat_vend; 01358 unsigned compat_dev; 01359 } mouse; 01360 01361 struct { 01362 unsigned ok:1; 01363 unsigned scroll_lock:1; 01364 unsigned num_lock:1; 01365 unsigned caps_lock:1; 01366 } led; 01367 01368 bios32_info_t bios32; 01369 01370 } bios_info_t; 01371 01372 01376 typedef struct { 01377 unsigned has_color:1; 01378 unsigned color; 01379 } prom_info_t; 01380 01381 01385 typedef struct { 01386 char *system_type; 01387 char *generation; 01388 char *vendor; 01389 char *model; 01390 char *serial; 01391 char *lang; 01392 char *formfactor; 01393 } sys_info_t; 01394 01395 01399 typedef struct { 01400 unsigned manu_year; 01401 unsigned min_vsync, max_vsync; 01402 unsigned min_hsync, max_hsync; 01403 unsigned clock; 01404 unsigned width, height; 01405 unsigned width_mm, height_mm; 01406 unsigned hdisp, hsyncstart, hsyncend, htotal; 01407 unsigned vdisp, vsyncstart, vsyncend, vtotal; 01408 char hflag,vflag; 01409 char *vendor; 01410 char *name; 01411 char *serial; 01412 } monitor_info_t; 01413 01420 typedef enum cpu_arch { 01421 arch_unknown = 0, 01422 arch_intel, 01423 arch_alpha, 01424 arch_sparc, arch_sparc64, 01425 arch_ppc, arch_ppc64, 01426 arch_68k, 01427 arch_ia64, 01428 arch_s390, arch_s390x, 01429 arch_arm, 01430 arch_mips, 01431 arch_x86_64 01432 } hd_cpu_arch_t; 01433 01437 typedef enum boot_arch { 01438 boot_unknown = 0, 01439 boot_lilo, boot_milo, boot_aboot, boot_silo, boot_ppc, boot_elilo, boot_s390, 01440 boot_mips, boot_grub 01441 } hd_boot_arch_t; 01442 01443 01452 typedef struct { 01453 enum cpu_arch architecture; 01454 unsigned family; 01455 unsigned model; 01456 unsigned stepping; 01457 unsigned cache; 01458 unsigned clock; 01459 unsigned units; 01460 char *vend_name; 01461 char *model_name; 01462 char *platform; 01463 str_list_t *features; 01464 double bogo; 01465 } cpu_info_t; 01466 01467 01472 typedef struct { 01473 uint64_t sectors; 01474 struct { 01475 unsigned cyls, heads, sectors; 01476 } edd; 01477 struct { 01478 unsigned cyls, heads, sectors; 01479 } legacy; 01480 unsigned ext_fixed_disk:1; 01481 unsigned ext_lock_eject:1; 01482 unsigned ext_edd:1; 01483 unsigned ext_64bit:1; 01484 unsigned assigned:1; 01485 unsigned valid:1; 01486 char *sysfs_id; 01487 unsigned hd_idx; 01488 unsigned signature; 01489 } edd_info_t; 01490 01496 typedef struct { 01497 unsigned data_len, data_max; 01498 unsigned *data; 01499 unsigned names_len, names_max; 01500 char *names; 01501 } hddb_data_t; 01502 01506 typedef uint32_t hddb_entry_mask_t; 01507 01511 typedef struct hddb_list_s { 01512 hddb_entry_mask_t key_mask; 01513 hddb_entry_mask_t value_mask; 01514 unsigned key; 01515 unsigned value; 01516 } hddb_list_t; 01517 01521 typedef struct { 01522 unsigned list_len, list_max; 01523 hddb_list_t *list; 01524 unsigned ids_len, ids_max; 01525 unsigned *ids; 01526 unsigned strings_len, strings_max; 01527 char *strings; 01528 } hddb2_data_t; 01529 01530 01534 typedef enum modinfo_type_e { mi_none = 0, mi_pci, mi_other } modinfo_type_t; 01535 01539 typedef struct { 01540 char *module; 01541 char *alias; 01542 modinfo_type_t type; 01543 union { 01544 struct { 01545 struct { 01546 unsigned vendor:1; 01547 unsigned device:1; 01548 unsigned sub_vendor:1; 01549 unsigned sub_device:1; 01550 unsigned base_class:1; 01551 unsigned sub_class:1; 01552 unsigned prog_if:1; 01553 } has; 01554 unsigned vendor; 01555 unsigned device; 01556 unsigned sub_vendor; 01557 unsigned sub_device; 01558 unsigned base_class; 01559 unsigned sub_class; 01560 unsigned prog_if; 01561 } pci; 01562 01563 struct { 01564 struct { 01565 unsigned vendor:1; 01566 unsigned product:1; 01567 unsigned device_class:1; 01568 unsigned device_subclass:1; 01569 } has; 01570 unsigned vendor; 01571 unsigned product; 01572 unsigned device_class; 01573 unsigned device_subclass; 01574 } usb; 01575 }; 01576 } modinfo_t; 01577 01578 01582 typedef enum { 01583 p_invalid, p_string, p_int32, p_uint64, p_double, p_bool, p_list 01584 } hal_prop_type_t; 01585 01586 01590 typedef struct hal_prop_s { 01591 struct hal_prop_s *next; 01592 hal_prop_type_t type; 01593 char *key; 01594 union { 01595 char *str; 01596 int32_t int32; 01597 uint64_t uint64; 01598 double d; 01599 int b; 01600 str_list_t *list; 01601 } val; 01602 } hal_prop_t; 01603 01604 01608 typedef struct hal_device_s { 01609 struct hal_device_s *next, *parent; 01610 char *udi; 01611 unsigned used:1; 01612 hal_prop_t *prop; 01613 } hal_device_t; 01614 01615 01619 typedef enum resource_types { 01620 res_any, res_phys_mem, res_mem, res_io, res_irq, res_dma, res_monitor, 01621 res_size, res_disk_geo, res_cache, res_baud, res_init_strings, res_pppd_option, 01622 res_framebuffer, res_hwaddr, res_link, res_wlan, res_fc 01623 } hd_resource_types_t; 01624 01625 01629 typedef enum size_units { 01630 size_unit_cm, size_unit_cinch, size_unit_byte, size_unit_sectors, 01631 size_unit_kbyte, size_unit_mbyte, size_unit_gbyte, size_unit_mm 01632 } hd_size_units_t; 01633 01637 typedef enum access_flags { 01638 acc_unknown, 01639 acc_ro, 01640 acc_wo, 01641 acc_rw 01642 } hd_access_flags_t; 01643 01644 01645 typedef enum yes_no_flag { 01646 flag_unknown, 01647 flag_no, 01648 flag_yes 01649 } hd_yes_no_flag_t; 01650 01651 01652 typedef enum geo_types { 01653 geo_physical = 0, 01654 geo_logical, 01655 geo_bios_edd, 01656 geo_bios_legacy 01657 } hd_geo_types_t; 01658 01659 01666 typedef struct { 01667 union u_hd_res_t *next; 01668 enum resource_types type; 01669 } res_any_t; 01670 01671 typedef struct { 01672 union u_hd_res_t *next; 01673 enum resource_types type; 01674 uint64_t base, range; 01675 unsigned 01676 enabled:1, 01677 access:2, 01678 prefetch:2; 01679 } res_mem_t; 01680 01681 typedef struct { 01682 union u_hd_res_t *next; 01683 enum resource_types type; 01684 uint64_t range; 01685 } res_phys_mem_t; 01686 01687 typedef struct { 01688 union u_hd_res_t *next; 01689 enum resource_types type; 01690 uint64_t base, range; 01691 unsigned 01692 enabled:1, 01693 access:2; 01694 } res_io_t; 01695 01696 typedef struct { 01697 union u_hd_res_t *next; 01698 enum resource_types type; 01699 unsigned base; 01700 unsigned triggered; 01701 unsigned enabled:1; 01702 } res_irq_t; 01703 01704 typedef struct { 01705 union u_hd_res_t *next; 01706 enum resource_types type; 01707 unsigned base; 01708 unsigned enabled:1; 01709 } res_dma_t; 01710 01711 typedef struct { 01712 union u_hd_res_t *next; 01713 enum resource_types type; 01714 enum size_units unit; 01715 uint64_t val1, val2; 01716 } res_size_t; 01717 01718 typedef struct { 01719 union u_hd_res_t *next; 01720 enum resource_types type; 01721 unsigned speed; 01722 unsigned bits, stopbits; 01723 char parity; 01724 char handshake; 01725 } res_baud_t; 01726 01727 typedef struct { 01728 union u_hd_res_t *next; 01729 enum resource_types type; 01730 unsigned size; 01731 } res_cache_t; 01732 01733 typedef struct { 01734 union u_hd_res_t *next; 01735 enum resource_types type; 01736 unsigned cyls, heads, sectors; 01737 uint64_t size; 01738 enum geo_types geotype; 01739 } res_disk_geo_t; 01740 01741 typedef struct { 01742 union u_hd_res_t *next; 01743 enum resource_types type; 01744 unsigned width, height; 01745 unsigned vfreq; 01746 unsigned interlaced:1; 01747 } res_monitor_t; 01748 01749 typedef struct { 01750 union u_hd_res_t *next; 01751 enum resource_types type; 01752 char *init1; 01753 char *init2; 01754 } res_init_strings_t; 01755 01756 typedef struct { 01757 union u_hd_res_t *next; 01758 enum resource_types type; 01759 char *option; 01760 } res_pppd_option_t; 01761 01762 typedef struct { 01763 union u_hd_res_t *next; 01764 enum resource_types type; 01765 unsigned width, height; 01766 unsigned bytes_p_line; 01767 unsigned colorbits; 01768 unsigned mode; 01769 } res_framebuffer_t; 01770 01771 typedef struct { 01772 union u_hd_res_t *next; 01773 enum resource_types type; 01774 char *addr; 01775 } res_hwaddr_t; 01776 01777 typedef struct { 01778 union u_hd_res_t *next; 01779 enum resource_types type; 01780 unsigned state:1; 01781 } res_link_t; 01782 01784 typedef struct { 01785 union u_hd_res_t *next; 01786 enum resource_types type; 01787 str_list_t *channels; 01788 str_list_t *frequencies; 01789 str_list_t *bitrates; 01790 str_list_t *auth_modes; 01791 str_list_t *enc_modes; 01792 } res_wlan_t; 01793 01794 typedef struct { 01795 union u_hd_res_t *next; 01796 enum resource_types type; 01797 unsigned wwpn_ok:1; 01798 unsigned fcp_lun_ok:1; 01799 unsigned port_id_ok:1; 01800 uint64_t wwpn; 01801 uint64_t fcp_lun; 01802 unsigned port_id; 01803 char *controller_id; 01804 } res_fc_t; 01805 01807 typedef union u_hd_res_t { 01808 union u_hd_res_t *next; 01809 res_any_t any; 01810 res_io_t io; 01811 res_mem_t mem; 01812 res_phys_mem_t phys_mem; 01813 res_irq_t irq; 01814 res_dma_t dma; 01815 res_size_t size; 01816 res_cache_t cache; 01817 res_baud_t baud; 01818 res_disk_geo_t disk_geo; 01819 res_monitor_t monitor; 01820 res_init_strings_t init_strings; 01821 res_pppd_option_t pppd_option; 01822 res_framebuffer_t framebuffer; 01823 res_hwaddr_t hwaddr; 01824 res_link_t link; 01825 res_wlan_t wlan; 01826 res_fc_t fc; 01827 } hd_res_t; 01828 01837 typedef struct { 01838 uint64_t addr, size; 01839 char *dev; 01840 unsigned tag; 01841 } misc_io_t; 01842 01843 typedef struct { 01844 unsigned channel; 01845 char *dev; 01846 unsigned tag; 01847 } misc_dma_t; 01848 01849 typedef struct { 01850 unsigned irq, events; 01851 int devs; 01852 char **dev; 01853 unsigned tag; 01854 } misc_irq_t; 01855 01856 typedef struct { 01857 unsigned io_len, dma_len, irq_len; 01858 misc_io_t *io; 01859 misc_dma_t *dma; 01860 misc_irq_t *irq; 01861 str_list_t *proc_io, *proc_dma, *proc_irq; 01862 } misc_t; 01863 01869 typedef struct s_serial_t { 01870 struct s_serial_t *next; 01871 char *name; 01872 char *device; 01873 unsigned line, port, irq, baud; 01874 } serial_t; 01875 01879 typedef struct s_ser_device_t { 01880 struct s_ser_device_t *next; 01881 unsigned hd_idx; 01882 char *dev_name; 01883 str_list_t *at_resp; 01884 int fd; 01885 struct termios tio; 01886 unsigned max_baud, cur_baud; 01887 unsigned is_mouse:1; 01888 unsigned is_modem:1; 01889 unsigned do_io:1; 01890 unsigned char buf[0x1000]; 01891 int buf_len; 01892 int garbage, non_pnp, pnp; 01893 unsigned char pnp_id[8]; 01894 char *serial, *class_name, *dev_id, *user_name, *vend, *init_string1, *init_string2, *pppd_option; 01895 unsigned pnp_rev; 01896 unsigned bits; 01897 } ser_device_t; 01898 01912 typedef struct isdn_parm_s { 01913 struct isdn_parm_s *next; 01914 char *name; 01915 unsigned valid:1; 01916 unsigned conflict:1; 01917 uint64_t value; 01918 unsigned type; 01919 unsigned flags; 01920 unsigned def_value; 01921 int alt_values; 01922 unsigned *alt_value; 01923 } isdn_parm_t; 01924 01926 typedef enum driver_info_type { 01927 di_any, di_display, di_module, di_mouse, di_x11, di_isdn, di_kbd, di_dsl 01928 } hd_driver_info_t; 01929 01931 typedef struct { 01932 union driver_info_u *next; 01933 enum driver_info_type type; 01934 str_list_t *hddb0, *hddb1; 01935 } driver_info_any_t; 01936 01938 typedef struct { 01939 union driver_info_u *next; 01940 enum driver_info_type type; 01941 str_list_t *hddb0, *hddb1; 01942 unsigned width, height; 01943 unsigned min_vsync, max_vsync; 01944 unsigned min_hsync, max_hsync; 01945 unsigned bandwidth; 01946 unsigned hdisp, hsyncstart, hsyncend, htotal; 01947 unsigned vdisp, vsyncstart, vsyncend, vtotal; 01948 char hflag,vflag; 01949 } driver_info_display_t; 01950 01952 typedef struct { 01953 union driver_info_u *next; 01954 enum driver_info_type type; 01955 str_list_t *hddb0, *hddb1; 01956 unsigned active:1; 01957 unsigned modprobe:1; 01958 str_list_t *names; 01959 str_list_t *mod_args; 01960 char *conf; 01961 } driver_info_module_t; 01962 01964 typedef struct { 01965 union driver_info_u *next; 01966 enum driver_info_type type; 01967 str_list_t *hddb0, *hddb1; 01968 char *xf86; 01969 char *gpm; 01970 int buttons; 01971 int wheels; 01972 } driver_info_mouse_t; 01973 01975 typedef struct { 01976 union driver_info_u *next; 01977 enum driver_info_type type; 01978 str_list_t *hddb0, *hddb1; 01979 char *server; 01980 char *xf86_ver; 01981 unsigned x3d:1; 01982 struct { 01983 unsigned all:5; 01984 unsigned c8:1, c15:1, c16:1, c24:1, c32:1; 01985 } colors; 01986 unsigned dacspeed; 01987 str_list_t *extensions; 01988 str_list_t *options; 01989 str_list_t *raw; 01990 char *script; 01991 } driver_info_x11_t; 01992 01994 typedef struct { 01995 union driver_info_u *next; 01996 enum driver_info_type type; 01997 str_list_t *hddb0, *hddb1; 01998 int i4l_type, i4l_subtype; 01999 char *i4l_name; 02000 isdn_parm_t *params; 02001 } driver_info_isdn_t; 02002 02004 typedef struct { 02005 union driver_info_u *next; 02006 enum driver_info_type type; 02007 str_list_t *hddb0, *hddb1; 02008 char *mode; 02009 char *name; 02010 } driver_info_dsl_t; 02011 02013 typedef struct { 02014 union driver_info_u *next; 02015 enum driver_info_type type; 02016 str_list_t *hddb0, *hddb1; 02017 char *XkbRules; 02018 char *XkbModel; 02019 char *XkbLayout; 02020 char *keymap; 02021 } driver_info_kbd_t; 02022 02023 /* 02024 * holds device driver info 02025 */ 02026 typedef union driver_info_u { 02027 union driver_info_u *next; 02028 driver_info_any_t any; 02029 driver_info_module_t module; 02030 driver_info_mouse_t mouse; 02031 driver_info_x11_t x11; 02032 driver_info_display_t display; 02033 driver_info_isdn_t isdn; 02034 driver_info_dsl_t dsl; 02035 driver_info_kbd_t kbd; 02036 } driver_info_t; 02037 02048 typedef enum hd_detail_type { 02049 hd_detail_pci, hd_detail_usb, hd_detail_isapnp, hd_detail_cdrom, 02050 hd_detail_floppy, hd_detail_bios, hd_detail_cpu, hd_detail_prom, 02051 hd_detail_monitor, hd_detail_sys, hd_detail_scsi, hd_detail_devtree, 02052 hd_detail_ccw 02053 } hd_detail_type_t; 02054 02055 typedef struct { 02056 enum hd_detail_type type; 02057 pci_t *data; 02058 } hd_detail_pci_t; 02059 02060 typedef struct { 02061 enum hd_detail_type type; 02062 usb_t *data; 02063 } hd_detail_usb_t; 02064 02065 typedef struct { 02066 enum hd_detail_type type; 02067 isapnp_dev_t *data; 02068 } hd_detail_isapnp_t; 02069 02070 typedef struct { 02071 enum hd_detail_type type; 02072 cdrom_info_t *data; 02073 } hd_detail_cdrom_t; 02074 02075 typedef struct { 02076 enum hd_detail_type type; 02077 floppy_info_t *data; 02078 } hd_detail_floppy_t; 02079 02080 typedef struct { 02081 enum hd_detail_type type; 02082 bios_info_t *data; 02083 } hd_detail_bios_t; 02084 02085 typedef struct { 02086 enum hd_detail_type type; 02087 cpu_info_t *data; 02088 } hd_detail_cpu_t; 02089 02090 typedef struct { 02091 enum hd_detail_type type; 02092 prom_info_t *data; 02093 } hd_detail_prom_t; 02094 02095 typedef struct hd_detail_monitor_s { 02096 enum hd_detail_type type; 02097 monitor_info_t *data; 02098 struct hd_detail_monitor_s *next; 02099 } hd_detail_monitor_t; 02100 02101 typedef struct { 02102 enum hd_detail_type type; 02103 sys_info_t *data; 02104 } hd_detail_sys_t; 02105 02106 typedef struct { 02107 enum hd_detail_type type; 02108 scsi_t *data; 02109 } hd_detail_scsi_t; 02110 02111 typedef struct { 02112 enum hd_detail_type type; 02113 devtree_t *data; 02114 } hd_detail_devtree_t; 02115 02116 typedef struct { 02117 enum hd_detail_type type; 02118 ccw_t *data; 02119 } hd_detail_ccw_t; 02120 02121 typedef union { 02122 enum hd_detail_type type; 02123 hd_detail_pci_t pci; 02124 hd_detail_usb_t usb; 02125 hd_detail_isapnp_t isapnp; 02126 hd_detail_cdrom_t cdrom; 02127 hd_detail_floppy_t floppy; 02128 hd_detail_bios_t bios; 02129 hd_detail_cpu_t cpu; 02130 hd_detail_prom_t prom; 02131 hd_detail_monitor_t monitor; 02132 hd_detail_sys_t sys; 02133 hd_detail_scsi_t scsi; 02134 hd_detail_devtree_t devtree; 02135 hd_detail_ccw_t ccw; 02136 } hd_detail_t; 02137 02150 typedef struct hd_manual_s { 02151 struct hd_manual_s *next; 02152 02153 char *unique_id; 02154 char *parent_id; 02155 char *child_ids; 02156 unsigned hw_class; 02157 char *model; 02158 02159 hd_status_t status; 02160 char *config_string; 02161 02162 /* More or less free-form key, value pairs. 02163 * key should not contain '=', however. 02164 */ 02165 str_list_t *key; 02166 str_list_t *value; 02167 } hd_manual_t; 02168 02169 02175 typedef struct s_hd_t { 02176 struct s_hd_t *next; 02182 unsigned idx; 02183 02189 unsigned broken:1; 02190 02194 hd_id_t bus; 02195 02200 unsigned slot; 02201 02205 unsigned func; 02206 02210 hd_id_t base_class; 02211 02215 hd_id_t sub_class; 02216 02220 hd_id_t prog_if; 02221 02228 hd_id_t vendor; 02229 02238 hd_id_t device; 02239 02246 hd_id_t sub_vendor; 02247 02254 hd_id_t sub_device; 02255 02261 hd_id_t revision; 02262 02266 char *serial; 02267 02272 hd_id_t compat_vendor; 02273 02278 hd_id_t compat_device; 02279 02284 hd_hw_item_t hw_class; 02285 02290 unsigned char hw_class_list[(hw_all + 7) / 8]; 02298 char *model; 02299 02305 unsigned attached_to; 02306 02310 char *sysfs_id; 02311 02315 char *sysfs_bus_id; 02316 02320 char *sysfs_device_link; 02321 02327 char *unix_dev_name; 02328 02332 hd_dev_num_t unix_dev_num; 02333 02340 str_list_t *unix_dev_names; 02341 02348 char *unix_dev_name2; 02349 02353 hd_dev_num_t unix_dev_num2; 02354 02361 char *rom_id; 02362 02366 char *udi; 02367 02371 char *parent_udi; 02372 02383 char *unique_id; 02384 02386 str_list_t *unique_ids; 02387 02391 unsigned module; 02392 02396 unsigned line; 02397 02401 unsigned count; 02402 02406 hd_res_t *res; 02407 02412 hd_detail_t *detail; 02413 02419 str_list_t *extra_info; 02420 02426 hd_status_t status; 02427 02434 char *config_string; 02435 02440 hd_hotplug_t hotplug; 02441 02446 unsigned hotplug_slot; 02447 02448 struct is_s { 02449 unsigned agp:1; 02450 unsigned isapnp:1; 02451 unsigned notready:1; 02452 unsigned manual:1; 02453 unsigned softraiddisk:1; 02454 unsigned zip:1; 02455 unsigned cdr:1; 02456 unsigned cdrw:1; 02457 unsigned dvd:1; 02458 unsigned dvdr:1; 02459 unsigned dvdrw:1; 02460 unsigned dvdpr:1; 02461 unsigned dvdprw:1; 02462 unsigned dvdprdl:1; 02463 unsigned dvdram:1; 02464 unsigned pppoe:1; 02465 unsigned wlan:1; 02466 unsigned with_acpi:1; 02467 unsigned hotpluggable:1; 02468 unsigned dualport:1; 02469 } is; 02470 02471 struct tag_s { 02472 unsigned remove:1; 02473 unsigned freeit:1; 02474 unsigned fixed:1; 02475 unsigned skip_mouse:1; 02476 unsigned skip_modem:1; 02477 unsigned skip_braille:1; 02478 unsigned ser_device:2; 02479 } tag; 02480 02486 unsigned char *block0; 02487 02491 char *driver; 02492 02496 char *driver_module; 02497 02501 str_list_t *drivers; 02502 02506 str_list_t *driver_modules; 02507 02515 char *old_unique_id; 02516 02522 char *parent_id; 02523 02529 str_list_t *child_ids; 02530 02535 char *unique_id1; 02536 02543 char *usb_guid; 02544 02545 driver_info_t *driver_info; 02547 str_list_t *requires; 02549 hal_prop_t *hal_prop; 02551 hal_prop_t *persistent_prop; 02553 char *modalias; 02555 /* 02556 * These are used internally for memory management. 02557 * Do not even _think_ of modifying these! 02558 */ 02559 unsigned ref_cnt; 02560 struct s_hd_t *ref; 02561 } hd_t; 02562 02563 02567 typedef struct { 02573 hd_t *hd; 02574 02583 void (*progress)(char *pos, char *msg); 02584 02589 char *log; 02590 02598 unsigned debug; 02599 02605 struct flag_struct { 02606 unsigned internal:1; 02607 unsigned dformat:2; 02608 unsigned no_parport:1; 02609 unsigned iseries:1; 02610 unsigned list_all:1; 02611 unsigned fast:1; 02612 unsigned list_md:1; 02613 unsigned nofork:1; 02614 unsigned nosysfs:1; 02615 unsigned forked:1; 02616 unsigned cpuemu:1; 02617 unsigned udev:1; 02618 unsigned edd_used:1; 02619 unsigned keep_kmods:2; 02620 unsigned nobioscrc:1; 02621 unsigned biosvram:1; 02622 unsigned nowpa:1; 02623 unsigned pata:1; 02624 unsigned vbox:1; 02625 unsigned vmware:1; 02626 unsigned vmware_mouse:1; 02627 } flags; 02628 02629 02634 str_list_t *only; 02635 02636 /* 02637 * The following entries should *not* be accessed outside of libhd! 02638 */ 02639 unsigned char probe[(pr_all + 7) / 8]; 02640 unsigned char probe_set[(pr_all + 7) / 8]; 02641 unsigned char probe_clr[(pr_all + 7) / 8]; 02642 hal_prop_t *probe_val; 02643 unsigned last_idx; 02644 unsigned module; 02645 enum boot_arch boot; 02646 hd_t *old_hd; 02647 pci_t *pci; 02648 isapnp_t *isapnp; 02649 cdrom_info_t *cdrom; 02650 str_list_t *net; 02651 str_list_t *floppy; 02652 misc_t *misc; 02653 serial_t *serial; 02654 scsi_t *scsi; 02655 ser_device_t *ser_mouse; 02656 ser_device_t *ser_modem; 02657 str_list_t *cpu; 02658 str_list_t *klog; 02659 str_list_t *proc_usb; 02660 usb_t *usb; 02661 modinfo_t *modinfo_ext; 02662 modinfo_t *modinfo; 02663 hddb2_data_t *hddb2[2]; 02664 str_list_t *kmods; 02665 uint64_t used_irqs; 02666 uint64_t assigned_irqs; 02667 memory_range_t bios_rom; 02668 memory_range_t bios_ram; 02669 memory_range_t bios_ebda; 02670 unsigned display; 02671 unsigned color_code; 02672 char *cmd_line; 02673 str_list_t *xtra_hd; 02674 devtree_t *devtree; 02675 unsigned kernel_version; 02676 hd_t *manual; 02677 str_list_t *disks; 02678 str_list_t *partitions; 02679 str_list_t *cdroms; 02680 hd_smbios_t *smbios; 02681 struct { 02682 unsigned ok:1; 02683 unsigned size; 02684 unsigned used; 02685 void *data; 02686 int id; 02687 int updated; 02688 } shm; 02689 unsigned pci_config_type; 02690 hd_udevinfo_t *udevinfo; 02691 hd_sysfsdrv_t *sysfsdrv; 02692 uint64_t sysfsdrv_id; 02693 str_list_t *scanner_db; 02694 edd_info_t edd[0x80]; 02695 hal_device_t *hal; 02696 str_list_t *lsscsi; 02697 } hd_data_t; 02698 02699 02700 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 02701 * 02702 * libhd interface functions 02703 * 02704 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 02705 */ 02706 02707 /* implemented in hd.c */ 02708 02710 void hd_scan(hd_data_t *hd_data); 02711 02713 hd_data_t *hd_free_hd_data(hd_data_t *hd_data); 02714 02716 hd_t *hd_free_hd_list(hd_t *hd); 02717 02718 void hd_set_probe_feature(hd_data_t *hd_data, enum probe_feature feature); 02719 void hd_clear_probe_feature(hd_data_t *hd_data, enum probe_feature feature); 02720 int hd_probe_feature(hd_data_t *hd_data, enum probe_feature feature); 02721 void hd_set_probe_feature_hw(hd_data_t *hd_data, hd_hw_item_t item); 02722 02723 enum probe_feature hd_probe_feature_by_name(char *name); 02724 char *hd_probe_feature_by_value(enum probe_feature feature); 02725 02726 int hd_module_is_active(hd_data_t *hd_data, char *mod); 02727 02728 hd_t *hd_base_class_list(hd_data_t *hd_data, unsigned base_class); 02729 hd_t *hd_sub_class_list(hd_data_t *hd_data, unsigned base_class, unsigned sub_class); 02730 hd_t *hd_bus_list(hd_data_t *hd_data, unsigned bus); 02731 const char* hd_busid_to_hwcfg(int busid); 02732 hd_t *hd_list(hd_data_t *hd_data, hd_hw_item_t item, int rescan, hd_t *hd_old); 02733 hd_t *hd_list_with_status(hd_data_t *hd_data, hd_hw_item_t item, hd_status_t status); 02734 hd_t *hd_list2(hd_data_t *hd_data, hd_hw_item_t *items, int rescan); 02735 hd_t *hd_list_with_status2(hd_data_t *hd_data, hd_hw_item_t *items, hd_status_t status); 02736 02737 void hd_add_driver_data(hd_data_t *hd_data, hd_t *hd); 02738 02739 int hd_has_pcmcia(hd_data_t *hd_data); 02740 #if 0 02741 02745 int hd_apm_enabled(hd_data_t *hd_data); 02746 #endif 02747 int hd_usb_support(hd_data_t *hd_data); 02748 int hd_smp_support(hd_data_t *hd_data); 02749 int hd_mac_color(hd_data_t *hd_data); 02750 int hd_color(hd_data_t *hd_data); 02751 int hd_is_uml(hd_data_t *hd_data); 02752 int hd_is_xen(hd_data_t *hd_data); 02753 unsigned hd_display_adapter(hd_data_t *hd_data); 02754 unsigned hd_boot_disk(hd_data_t *hd_data, int *matches); 02755 enum cpu_arch hd_cpu_arch(hd_data_t *hd_data); 02756 enum boot_arch hd_boot_arch(hd_data_t *hd_data); 02757 02758 hd_t *hd_get_device_by_idx(hd_data_t *hd_data, unsigned idx); 02759 02760 void hd_set_hw_class(hd_t *hd, hd_hw_item_t hw_class); 02761 int hd_is_hw_class(hd_t *hd, hd_hw_item_t hw_class); 02762 02763 int hd_is_sgi_altix(hd_data_t *hd_data); 02764 02765 char *hd_version(void); 02766 02767 hal_prop_t *hd_free_hal_properties(hal_prop_t *prop); 02768 hal_prop_t *hd_read_properties(const char *udi); 02769 int hd_write_properties(const char *udi, hal_prop_t *prop); 02770 02771 int hd_change_status(const char *id, hd_status_t status, const char *config_string); 02772 int hd_change_config_status(hd_data_t *hd_data, const char *id, hd_status_t status, const char *config_string); 02773 int hd_read_mmap(hd_data_t *hd_data, char *name, unsigned char *buf, off_t start, unsigned size); 02774 02775 /* implemented in hddb.c */ 02776 02780 str_list_t *hddb_get_packages(hd_data_t *hd_data); 02781 void hddb_add_info(hd_data_t *hd_data, hd_t *hd); 02782 02783 void hddb_dump_raw(hddb2_data_t *hddb, FILE *f); 02784 void hddb_dump(hddb2_data_t *hddb, FILE *f); 02785 02786 02787 /* implemented in hdp.c */ 02788 void hd_dump_entry(hd_data_t *hd_data, hd_t *hd, FILE *f); 02789 02790 /* implemented in cdrom.c */ 02791 cdrom_info_t *hd_read_cdrom_info(hd_data_t *hd_data, hd_t *hd); 02792 02800 hd_manual_t *hd_manual_read_entry(hd_data_t *hd_data, const char *id); 02801 int hd_manual_write_entry(hd_data_t *hd_data, hd_manual_t *entry); 02802 hd_manual_t *hd_free_manual(hd_manual_t *manual); 02803 hd_t *hd_read_config(hd_data_t *hd_data, const char *id); 02804 int hd_write_config(hd_data_t *hd_data, hd_t *hd); 02805 char *hd_hw_item_name(hd_hw_item_t item); 02806 hd_hw_item_t hd_hw_item_type(char *name); 02807 char *hd_status_value_name(hd_status_value_t status); 02808 02819 #define CDBISDN_VERSION 0x0101 02820 02821 #ifndef PCI_ANY_ID 02822 #define PCI_ANY_ID 0xffff 02823 #endif 02824 02825 #define CDBISDN_P_NONE 0x0 02826 #define CDBISDN_P_IRQ 0x1 02827 #define CDBISDN_P_MEM 0x2 02828 #define CDBISDN_P_IO 0x3 02829 02831 typedef struct { 02832 char *name; 02833 char *shortname; 02834 int vnr; 02835 int refcnt; 02836 } cdb_isdn_vendor; 02837 02838 typedef struct { 02839 int handle; 02840 int vhandle; 02841 char *name; 02842 char *lname; 02843 char *Class; 02844 char *bus; 02845 int revision; 02846 int vendor; 02847 int device; 02848 int subvendor; 02850 int subdevice; 02852 unsigned int features; 02853 int line_cnt; 02854 int vario_cnt; 02855 int vario; 02856 } cdb_isdn_card; 02857 02858 typedef struct { 02859 int handle; 02860 int next_vario; 02861 int drvid; 02862 int typ; 02863 int subtyp; 02864 int smp; 02865 char *mod_name; 02866 char *para_str; 02867 char *mod_preload; 02868 char *cfg_prog; 02869 char *firmware; 02870 char *description; 02871 char *need_pkg; 02872 char *info; 02873 char *protocol; 02874 char *interface; 02875 char *io; 02876 char *irq; 02877 char *membase; 02878 char *features; 02879 int card_ref; 02880 char *name; 02881 } cdb_isdn_vario; 02882 02883 02884 extern cdb_isdn_vendor *hd_cdbisdn_get_vendor(int); 02885 extern cdb_isdn_card *hd_cdbisdn_get_card(int); 02886 extern cdb_isdn_vario *hd_cdbisdn_get_vario_from_type(int, int); 02887 extern cdb_isdn_card *hd_cdbisdn_get_card_from_type(int, int); 02888 extern cdb_isdn_card *hd_cdbisdn_get_card_from_id(int, int, int, int); 02889 extern cdb_isdn_vario *hd_cdbisdn_get_vario(int); 02890 extern int hd_cdbisdn_get_version(void); 02891 extern int hd_cdbisdn_get_db_version(void); 02892 extern char *hd_cdbisdn_get_db_date(void); 02893 02899 #ifdef __cplusplus 02900 } 02901 #endif 02902 02905 #endif /* _HD_H */