hd.h

Go to the documentation of this file.
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      13
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,
00121   pr_max, pr_lxrc, pr_default, 
00122   pr_all                
00123 } hd_probe_feature_t;
00124 
00133 typedef enum hw_item {
00134   hw_none = 0, hw_sys, hw_cpu, hw_keyboard, hw_braille, hw_mouse,
00135   hw_joystick, hw_printer, hw_scanner, hw_chipcard, hw_monitor, hw_tv,
00136   hw_display, hw_framebuffer, hw_camera, hw_sound, hw_storage_ctrl,
00137   hw_network_ctrl, hw_isdn, hw_modem, hw_network, hw_disk, hw_partition,
00138   hw_cdrom, hw_floppy, hw_manual, hw_usb_ctrl, hw_usb, hw_bios, hw_pci,
00139   hw_isapnp, hw_bridge, hw_hub, hw_scsi, hw_ide, hw_memory, hw_dvb,
00140   hw_pcmcia, hw_pcmcia_ctrl, hw_ieee1394, hw_ieee1394_ctrl, hw_hotplug,
00141   hw_hotplug_ctrl, hw_zip, hw_pppoe, hw_wlan, hw_redasd, hw_dsl, hw_block,
00142   hw_tape, hw_vbe, hw_bluetooth,
00144   hw_unknown, hw_all                            
00145 } hd_hw_item_t;
00146 
00154 typedef enum base_classes {
00155   // these *must* match standard PCI class numbers
00156   bc_none, bc_storage, bc_network, bc_display, bc_multimedia,
00157   bc_memory, bc_bridge, bc_comm, bc_system, bc_input, bc_docking,
00158   bc_processor, bc_serial, bc_wireless, bc_i2o, bc_other = 0xff,
00159 
00160   // add our own classes here (starting at 0x100 as PCI values are 8 bit)
00161   bc_monitor = 0x100, bc_internal, bc_modem, bc_isdn, bc_ps2, bc_mouse,
00162   bc_storage_device, bc_network_interface, bc_keyboard, bc_printer,
00163   bc_hub, bc_braille, bc_scanner, bc_joystick, bc_chipcard, bc_camera,
00164   bc_framebuffer, bc_dvb, bc_tv, bc_partition, bc_dsl, bc_bluetooth
00165 } hd_base_classes_t;
00166 
00168 typedef enum sc_monitor {
00169   sc_mon_other, sc_mon_crt, sc_mon_lcd
00170 } hd_sc_monitor_t;
00171 
00173 typedef enum sc_storage {
00174   sc_sto_scsi, sc_sto_ide, sc_sto_floppy, sc_sto_ipi, sc_sto_raid,
00175   sc_sto_other = 0x80
00176 } hd_sc_storage_t;
00177 
00179 typedef enum sc_display {
00180   sc_dis_vga, sc_dis_xga, sc_dis_other = 0x80
00181 } hd_sc_display_t;
00182 
00184 typedef enum sc_framebuffer {
00185   sc_fb_vesa = 1
00186 } hd_sc_framebuffer_t;
00187 
00189 typedef enum sc_bridge { 
00190   sc_bridge_host, sc_bridge_isa, sc_bridge_eisa, sc_bridge_mc,
00191   sc_bridge_pci, sc_bridge_pcmcia, sc_bridge_nubus, sc_bridge_cardbus,
00192   sc_bridge_other = 0x80
00193 } hd_sc_bridge_t;
00194 
00196 typedef enum sc_comm { 
00197   sc_com_ser, sc_com_par, sc_com_multi, sc_com_modem, sc_com_other = 0x80
00198 } hd_sc_comm_t;
00199 
00201 typedef enum sc_system {
00202   sc_sys_pic, sc_sys_dma, sc_sys_timer, sc_sys_rtc, sc_sys_other = 0x80
00203 } hd_sc_system_t;
00204 
00206 typedef enum sc_input {
00207   sc_inp_keyb, sc_inp_digit, sc_inp_mouse, sc_inp_other = 0x80
00208 } hd_sc_input_t;
00209 
00211 typedef enum sc_serial {
00212   sc_ser_fire, sc_ser_access, sc_ser_ssa, sc_ser_usb, sc_ser_fiber,
00213   sc_ser_smbus, sc_ser_other = 0x80
00214 } hd_sc_serial_t;
00215 
00217 typedef enum sc_internal {
00218   sc_int_none, sc_int_isapnp_if, sc_int_main_mem, sc_int_cpu, sc_int_fpu,
00219   sc_int_bios, sc_int_prom, sc_int_sys
00220 } hd_sc_internal_t;
00221 
00223 typedef enum sc_mouse {
00224   sc_mou_ps2, sc_mou_ser, sc_mou_bus, sc_mou_usb, sc_mou_sun,
00225   sc_mou_other = 0x80
00226 } hd_sc_mouse_t;
00227 
00229 typedef enum sc_std {
00230   sc_sdev_disk, sc_sdev_tape, sc_sdev_cdrom, sc_sdev_floppy, sc_sdev_scanner,
00231   sc_sdev_other = 0x80
00232 } hd_sc_std_t;
00233 
00235 typedef enum sc_net_if {
00236   sc_nif_loopback, sc_nif_ethernet, sc_nif_tokenring, sc_nif_fddi,
00237   sc_nif_ctc, sc_nif_iucv, sc_nif_hsi, sc_nif_qeth,
00238   sc_nif_escon, sc_nif_myrinet, sc_nif_wlan, sc_nif_xp,
00239   sc_nif_usb, sc_nif_other = 0x80, sc_nif_sit
00240 } hd_sc_net_if_t;
00241 
00243 typedef enum sc_multimedia {
00244   sc_multi_video, sc_multi_audio, sc_multi_other
00245 } hd_sc_multimedia_t;
00246 
00248 typedef enum sc_keyboard {
00249   sc_keyboard_kbd, sc_keyboard_console
00250 } hd_sc_keyboard_t;
00251 
00253 typedef enum sc_hub {
00254   sc_hub_other, sc_hub_usb
00255 } hd_sc_hub_t;
00256 
00258 typedef enum sc_camera {
00259   sc_camera_webcam, sc_camera_digital
00260 } hd_sc_camera_t;
00261 
00263 typedef enum sc_modem {
00264   sc_mod_at, sc_mod_win1, sc_mod_win2, sc_mod_win3, sc_mod_win4
00265 } hd_sc_modem_t;
00266 
00268 typedef enum sc_dsl {
00269   sc_dsl_unknown, sc_dsl_pppoe, sc_dsl_capi, sc_dsl_capiisdn
00270 } hd_sc_dsl_t;
00271 
00273 typedef enum pif_usb_e {
00274   pif_usb_uhci = 0, pif_usb_ohci = 0x10, pif_usb_ehci = 0x20,
00275   pif_usb_other = 0x80, pif_usb_device = 0xfe
00276 } hd_pif_usb_t;
00277 
00279 typedef enum pif_cdrom {
00280   pif_cdrom, pif_cdr, pif_cdrw, pif_dvd, pif_dvdr, pif_dvdram
00281 } hd_pif_cdrom_t ;
00282 
00284 typedef enum pif_s390disk {
00285   pif_scsi, pif_dasd, pif_dasd_fba
00286 } hd_pif_s390disk_t;
00287 
00289 typedef enum bus_types {
00290   bus_none, bus_isa, bus_eisa, bus_mc, bus_pci, bus_pcmcia, bus_nubus,
00291   bus_cardbus, bus_other,
00292 
00294   bus_ps2 = 0x80, bus_serial, bus_parallel, bus_floppy, bus_scsi, bus_ide, bus_usb,
00295   bus_adb, bus_raid, bus_sbus, bus_i2o, bus_vio, bus_ccw, bus_iucv
00296 } hd_bus_types_t;
00297 
00306 typedef struct {
00310   unsigned invalid:1;
00311 
00321   unsigned reconfig:3;
00322 
00328   unsigned configured:3;
00329 
00340   unsigned available:3;
00341 
00349   unsigned needed:3;
00350 
00357   unsigned available_orig:3;
00358 
00362   unsigned active:3;
00363 } hd_status_t;
00364 
00366 typedef enum {
00367   status_no = 1, status_yes, status_unknown, status_new
00368 } hd_status_value_t;
00369 
00373 typedef enum {
00374   hp_none,      
00375   hp_pcmcia,    
00376   hp_cardbus,   
00377   hp_pci,       
00378   hp_usb,       
00379   hp_ieee1394   
00380 } hd_hotplug_t;
00381 
00392 typedef struct {
00393   unsigned id;          
00394   char *name;           
00395 } hd_id_t;
00396 
00397 
00402 typedef struct s_str_list_t {
00403   struct s_str_list_t *next;    
00404   char *str;                    
00405 } str_list_t;
00406 
00407 
00411 typedef struct {
00412   unsigned char bitmap[16];     
00413   unsigned bits;                
00414   unsigned not_empty:1;         
00415   str_list_t *str;              
00416 } hd_bitmap_t;
00417 
00434 typedef struct {
00435   unsigned start, size;         
00436   unsigned char *data;          
00437 } memory_range_t;
00438 
00439 
00443 typedef struct {
00444   unsigned ok:1;                
00445   unsigned rev;                 
00446   unsigned mpfp;                
00447   unsigned mpconfig_ok:1;       
00448   unsigned mpconfig;            
00449   unsigned mpconfig_size;       
00450   unsigned char feature[5];     
00451   char oem_id[9];               
00452   char prod_id[13];             
00453   unsigned cpus, cpus_en;       
00454 } smp_info_t;
00455 
00456 
00460 typedef struct vbe_mode_info_s {
00461   unsigned number;              
00462   unsigned attributes;          
00463   unsigned width, height;       
00464   unsigned bytes_p_line;        
00465   unsigned pixel_size;          
00466   unsigned fb_start;            
00467   unsigned win_A_start;         
00468   unsigned win_A_attr;          
00469   unsigned win_B_start;         
00470   unsigned win_B_attr;          
00471   unsigned win_size;            
00472   unsigned win_gran;            
00473   unsigned pixel_clock;         
00474 } vbe_mode_info_t;
00475 
00481 typedef struct {
00482   unsigned ok:1;                
00483   unsigned version;             
00484   unsigned oem_version;         
00485   unsigned memory;              
00486   unsigned fb_start;            
00487   char *oem_name;               
00488   char *vendor_name;            
00489   char *product_name;           
00490   char *product_revision;       
00491   unsigned modes;               
00492   vbe_mode_info_t *mode;        
00493   unsigned current_mode;        
00494   unsigned char ddc_port[2][0x80];      
00495 } vbe_info_t;
00496 
00497 
00501 typedef struct {
00502     unsigned id;
00503     unsigned char slot;
00504     unsigned char bus;
00505     unsigned char devfn;
00506     unsigned char misc;
00507 } cpq_ctlorder_t; 
00508 
00509 
00510 typedef struct {
00511   unsigned ok:1;                
00512   unsigned entry;               
00513   unsigned compaq:1;            
00514   cpq_ctlorder_t cpq_ctrl[32];  
00515 } bios32_info_t;
00516 
00526 typedef enum {
00527   sm_biosinfo, sm_sysinfo, sm_boardinfo, sm_chassis,
00528   sm_processor, sm_memctrl, sm_memmodule, sm_cache,
00529   sm_connect, sm_slot, sm_onboard, sm_oem,
00530   sm_config, sm_lang, sm_group, sm_eventlog,
00531   sm_memarray, sm_memdevice, sm_memerror, sm_memarraymap,
00532   sm_memdevicemap, sm_mouse, sm_battery, sm_reset,
00533   sm_secure, sm_power, sm_voltage, sm_cool,
00534   sm_temperature, sm_current, sm_outofband, sm_bis,
00535   sm_boot, sm_mem64error, sm_mandev, sm_mandevcomp,
00536   sm_mdtd, sm_inactive = 126, sm_end = 127
00537 } hd_smbios_type_t;
00538 
00539 
00541 typedef struct {
00542   union u_hd_smbios_t *next;    
00543   hd_smbios_type_t type;        
00544   int data_len;                 
00545   unsigned char *data;          
00546   str_list_t *strings;          
00547   int handle;                   
00548 } smbios_any_t;
00549 
00550 
00552 typedef struct {
00553   union u_hd_smbios_t *next;
00554   hd_smbios_type_t type;
00555   int data_len;
00556   unsigned char *data;
00557   str_list_t *strings;
00558   int handle;
00559   char *vendor;                 
00560   char *version;                
00561   char *date;                   
00562   hd_bitmap_t feature;          
00563   unsigned start;               
00564   unsigned rom_size;            
00565 } smbios_biosinfo_t;
00566 
00567 
00569 typedef struct {
00570   union u_hd_smbios_t *next;
00571   hd_smbios_type_t type;
00572   int data_len;
00573   unsigned char *data;
00574   str_list_t *strings;
00575   int handle;
00576   char *manuf;                  
00577   char *product;                
00578   char *version;                
00579   char *serial;                 
00580   unsigned char uuid[16];       
00581   hd_id_t wake_up;              
00582 } smbios_sysinfo_t;
00583 
00584 
00586 typedef struct {
00587   union u_hd_smbios_t *next;
00588   hd_smbios_type_t type;
00589   int data_len;
00590   unsigned char *data;
00591   str_list_t *strings;
00592   int handle;
00593   char *manuf;                  
00594   char *product;                
00595   char *version;                
00596   char *serial;                 
00597   char *asset;                  
00598   hd_id_t board_type;           
00599   hd_bitmap_t feature;          
00600   char *location;               
00601   int chassis;                  
00602   int objects_len;              
00603   int *objects;                 
00604 } smbios_boardinfo_t;
00605 
00606 
00608 typedef struct {
00609   union u_hd_smbios_t *next;
00610   hd_smbios_type_t type;
00611   int data_len;
00612   unsigned char *data;
00613   str_list_t *strings;
00614   int handle;
00615   char *manuf;                  
00616   char *version;                
00617   char *serial;                 
00618   char *asset;                  
00619   hd_id_t ch_type;              
00620   unsigned lock;                
00621   hd_id_t bootup;               
00622   hd_id_t power;                
00623   hd_id_t thermal;              
00624   hd_id_t security;             
00625   unsigned oem;                 
00626 } smbios_chassis_t;
00627 
00628 
00630 typedef struct {
00631   union u_hd_smbios_t *next;
00632   hd_smbios_type_t type;
00633   int data_len;
00634   unsigned char *data;
00635   str_list_t *strings;
00636   int handle;
00637   char *socket;                 
00638   hd_id_t upgrade;              
00639   char *manuf;                  
00640   char *version;                
00641   char *serial;                 
00642   char *asset;                  
00643   char *part;                   
00644   hd_id_t pr_type;              
00645   hd_id_t family;               
00646   uint64_t cpu_id;              
00647   unsigned voltage;             
00648   unsigned ext_clock;           
00649   unsigned max_speed;           
00650   unsigned current_speed;       
00651   unsigned sock_status;         
00652   hd_id_t cpu_status;           
00653   int l1_cache;                 
00654   int l2_cache;                 
00655   int l3_cache;                 
00656 } smbios_processor_t;
00657 
00658 
00660 typedef struct {
00661   union u_hd_smbios_t *next;
00662   hd_smbios_type_t type;
00663   int data_len;
00664   unsigned char *data;
00665   str_list_t *strings;
00666   int handle;
00667   char *socket;                 
00668   unsigned max_size;            
00669   unsigned current_size;        
00670   unsigned speed;               
00671   hd_id_t mode;                 
00672   unsigned state;               
00673   hd_id_t location;             
00674   unsigned socketed;            
00675   unsigned level;               
00676   hd_id_t ecc;                  
00677   hd_id_t cache_type;           
00678   hd_id_t assoc;                
00679   hd_bitmap_t supp_sram;        
00680   hd_bitmap_t sram;             
00681 } smbios_cache_t;
00682 
00683 
00685 typedef struct {
00686   union u_hd_smbios_t *next;
00687   hd_smbios_type_t type;
00688   int data_len;
00689   unsigned char *data;
00690   str_list_t *strings;
00691   int handle;
00692   hd_id_t port_type;            
00693   char *i_des;                  
00694   hd_id_t i_type;               
00695   char *x_des;                  
00696   hd_id_t x_type;               
00697 } smbios_connect_t;
00698 
00699 
00701 typedef struct {
00702   union u_hd_smbios_t *next;
00703   hd_smbios_type_t type;
00704   int data_len;
00705   unsigned char *data;
00706   str_list_t *strings;
00707   int handle;
00708   char *desig;                  
00709   hd_id_t slot_type;            
00710   hd_id_t bus_width;            
00711   hd_id_t usage;                
00712   hd_id_t length;               
00713   unsigned id;                  
00714   hd_bitmap_t feature;          
00715 } smbios_slot_t;
00716 
00717 
00719 typedef struct {
00720   union u_hd_smbios_t *next;
00721   hd_smbios_type_t type;
00722   int data_len;
00723   unsigned char *data;
00724   str_list_t *strings;
00725   int handle;
00726   unsigned dev_len;             
00727   struct {
00728     char *name;                 
00729     hd_id_t type;               
00730     unsigned status;            
00731   } *dev;                       
00732 } smbios_onboard_t;
00733 
00734 
00736 typedef struct {
00737   union u_hd_smbios_t *next;
00738   hd_smbios_type_t type;
00739   int data_len;
00740   unsigned char *data;
00741   str_list_t *strings;
00742   int handle;
00743   str_list_t *oem_strings;      
00744 } smbios_oem_t;
00745 
00746 
00748 typedef struct {
00749   union u_hd_smbios_t *next;
00750   hd_smbios_type_t type;
00751   int data_len;
00752   unsigned char *data;
00753   str_list_t *strings;
00754   int handle;
00755   str_list_t *options;          
00756 } smbios_config_t;
00757 
00758 
00760 typedef struct {
00761   union u_hd_smbios_t *next;
00762   hd_smbios_type_t type;
00763   int data_len;
00764   unsigned char *data;
00765   str_list_t *strings;          
00766   int handle;
00767   char *current;                
00768 } smbios_lang_t;
00769 
00770 
00772 typedef struct {
00773   union u_hd_smbios_t *next;
00774   hd_smbios_type_t type;
00775   int data_len;
00776   unsigned char *data;
00777   str_list_t *strings;
00778   int handle;
00779   char *name;                   
00780   int items_len;                
00781   int *item_handles;            
00782 } smbios_group_t;
00783 
00784 
00786 typedef struct {
00787   union u_hd_smbios_t *next;
00788   hd_smbios_type_t type;
00789   int data_len;
00790   unsigned char *data;
00791   str_list_t *strings;
00792   int handle;
00793   hd_id_t location;             
00794   hd_id_t use;                  
00795   hd_id_t ecc;                  
00796   unsigned max_size;            
00797   int error_handle;             
00798   unsigned slots;               
00799 } smbios_memarray_t;
00800 
00801 
00803 typedef struct {
00804   union u_hd_smbios_t *next;
00805   hd_smbios_type_t type;
00806   int data_len;
00807   unsigned char *data;
00808   str_list_t *strings;
00809   int handle;
00810   char *location;               
00811   char *bank;                   
00812   char *manuf;                  
00813   char *serial;                 
00814   char *asset;                  
00815   char *part;                   
00816   int array_handle;             
00817   int error_handle;             
00818   unsigned width;               
00819   unsigned eccbits;             
00820   unsigned size;                
00821   hd_id_t form;                 
00822   unsigned set;                 
00823   hd_id_t mem_type;             
00824   hd_bitmap_t type_detail;      
00825   unsigned speed;               
00826 } smbios_memdevice_t;
00827 
00828 
00830 typedef struct {
00831   union u_hd_smbios_t *next;
00832   hd_smbios_type_t type;
00833   int data_len;
00834   unsigned char *data;
00835   str_list_t *strings;
00836   int handle;
00837   hd_id_t err_type;             
00838   hd_id_t granularity;          
00839   hd_id_t operation;            
00840   unsigned syndrome;            
00841   unsigned array_addr;          
00842   unsigned device_addr;         
00843   unsigned range;               
00844 } smbios_memerror_t;
00845 
00846 
00848 typedef struct {
00849   union u_hd_smbios_t *next;
00850   hd_smbios_type_t type;
00851   int data_len;
00852   unsigned char *data;
00853   str_list_t *strings;
00854   int handle;
00855   int array_handle;             
00856   uint64_t start_addr;          
00857   uint64_t end_addr;            
00858   unsigned part_width;          
00859 } smbios_memarraymap_t;
00860 
00861 
00863 typedef struct {
00864   union u_hd_smbios_t *next;
00865   hd_smbios_type_t type;
00866   int data_len;
00867   unsigned char *data;
00868   str_list_t *strings;
00869   int handle;
00870   int memdevice_handle;         
00871   int arraymap_handle;          
00872   uint64_t start_addr;          
00873   uint64_t end_addr;            
00874   unsigned row_pos;             
00875   unsigned interleave_pos;      
00876   unsigned interleave_depth;    
00877 } smbios_memdevicemap_t;
00878 
00879 
00881 typedef struct {
00882   union u_hd_smbios_t *next;
00883   hd_smbios_type_t type;
00884   int data_len;
00885   unsigned char *data;
00886   str_list_t *strings;
00887   int handle;
00888   hd_id_t mtype;                
00889   hd_id_t interface;            
00890   unsigned buttons;             
00891 } smbios_mouse_t;
00892 
00893 
00895 typedef struct {
00896   union u_hd_smbios_t *next;
00897   hd_smbios_type_t type;
00898   int data_len;
00899   unsigned char *data;
00900   str_list_t *strings;
00901   int handle;
00902   hd_id_t power;                
00903   hd_id_t keyboard;             
00904   hd_id_t admin;                
00905   hd_id_t reset;                
00906 } smbios_secure_t;
00907 
00908 
00910 typedef struct {
00911   union u_hd_smbios_t *next;
00912   hd_smbios_type_t type;
00913   int data_len;
00914   unsigned char *data;
00915   str_list_t *strings;
00916   int handle;
00917   unsigned month;               
00918   unsigned day;                 
00919   unsigned hour;                
00920   unsigned minute;              
00921   unsigned second;              
00922 } smbios_power_t;
00923 
00924 
00926 typedef struct {
00927   union u_hd_smbios_t *next;
00928   hd_smbios_type_t type;
00929   int data_len;
00930   unsigned char *data;
00931   str_list_t *strings;
00932   int handle;
00933   hd_id_t err_type;             
00934   hd_id_t granularity;          
00935   hd_id_t operation;            
00936   unsigned syndrome;            
00937   uint64_t array_addr;          
00938   uint64_t device_addr;         
00939   unsigned range;               
00940 } smbios_mem64error_t;
00941 
00942 
00944 typedef union u_hd_smbios_t {
00945   union u_hd_smbios_t *next;  
00946   smbios_any_t any;
00947   smbios_biosinfo_t biosinfo;
00948   smbios_sysinfo_t sysinfo;
00949   smbios_boardinfo_t boardinfo;
00950   smbios_chassis_t chassis;
00951   smbios_processor_t processor;
00952   smbios_cache_t cache;
00953   smbios_connect_t connect;
00954   smbios_slot_t slot;
00955   smbios_onboard_t onboard;
00956   smbios_oem_t oem;
00957   smbios_config_t config;
00958   smbios_lang_t lang;
00959   smbios_group_t group;
00960   smbios_memarray_t memarray;
00961   smbios_memdevice_t memdevice;
00962   smbios_memerror_t memerror;
00963   smbios_memarraymap_t memarraymap;
00964   smbios_memdevicemap_t memdevicemap;
00965   smbios_mouse_t mouse;
00966   smbios_secure_t secure;
00967   smbios_power_t power;
00968   smbios_mem64error_t mem64error;
00969 } hd_smbios_t;
00970 
00978 typedef struct s_udevinfo_t {
00979   struct s_udevinfo_t *next;
00980   char *sysfs;
00981   char *name;
00982   str_list_t *links;
00983 } hd_udevinfo_t;
00984 
00985 
00989 typedef struct s_sysfsdrv_t {
00990   struct s_sysfsdrv_t *next;
00991   char *driver;
00992   char *device;
00993   char *module;
00994 } hd_sysfsdrv_t;
00995 
00996 
01002 typedef struct {
01003   int type;
01004   unsigned major, minor, range;
01005 } hd_dev_num_t;
01006 
01007 
01022 typedef struct s_pci_t {
01023   struct s_pci_t *next;                         
01024   unsigned data_len;                            
01025   unsigned data_ext_len;                        
01026   unsigned char data[256];                      
01027   char *log;                                    
01028   unsigned flags,                               
01029            cmd,                                 
01030            hdr_type,                            
01031            secondary_bus;                       
01032   unsigned bus,                                 
01033            slot, func;                          
01034   unsigned base_class, sub_class, prog_if;      
01035   unsigned dev, vend, sub_dev, sub_vend, rev;   
01036   unsigned irq;                                 
01037   uint64_t base_addr[7];                        
01038   uint64_t base_len[7];                         
01039   unsigned addr_flags[7];                       
01040   uint64_t rom_base_addr;                       
01041   uint64_t rom_base_len;                        
01042   char *sysfs_id;                               
01043   char *sysfs_bus_id;                           
01044   char *modalias;                               
01045   unsigned edid_len;                            
01046   unsigned char edid[0x80];                     
01047 } pci_t;
01048 
01053 typedef enum pci_flags {
01054   pci_flag_ok, pci_flag_pm, pci_flag_agp
01055 } hd_pci_flags_t;
01056 
01057 
01062 typedef struct usb_s {
01063   struct usb_s *next;
01064   unsigned hd_idx;
01065   unsigned hd_base_idx;
01066   str_list_t *c, *d, *e, *i, *p, *s, *t;
01067   struct usb_s *cloned;
01068   int bus, dev_nr, lev, parent, port, count, conns, used_conns, ifdescr;
01069   unsigned speed;
01070   unsigned vendor, device, rev;
01071   char *manufact, *product, *serial;
01072   char *driver;
01073   memory_range_t raw_descr;
01074   int d_cls, d_sub, d_prot;
01075   int i_alt, i_cls, i_sub, i_prot;
01076   unsigned country;
01077 } usb_t;
01078 
01079 
01083 typedef struct {
01084   int len;
01085   int type;
01086   unsigned char *data;
01087 } isapnp_res_t;
01088 
01092 typedef struct {
01093   int csn;
01094   int log_devs;
01095   unsigned char *serial;
01096   unsigned char *card_regs;
01097   unsigned char (*ldev_regs)[0xd0];
01098   int res_len;
01099   unsigned broken:1;            
01100   isapnp_res_t *res;
01101 } isapnp_card_t;
01102 
01106 typedef struct {
01107   int read_port;
01108   int cards;
01109   isapnp_card_t *card;
01110 } isapnp_t;
01111 
01115 typedef struct {
01116   isapnp_card_t *card;
01117   int dev;
01118   unsigned flags;               
01119   unsigned ref:1;               
01120 } isapnp_dev_t;
01121 
01126 typedef enum isapnp_flags {
01127   isapnp_flag_act
01128 } hd_isapnp_flags_t;
01129 
01130 
01134 typedef struct scsi_s {
01135   struct scsi_s *next;
01136   unsigned deleted:1;
01137   unsigned generic:1;
01138   unsigned fake:1;
01139   char *dev_name;
01140   char *guessed_dev_name;
01141   int generic_dev;
01142   unsigned host, channel, id, lun;
01143   char *vendor, *model, *rev, *type_str, *serial;
01144   int type;
01145   unsigned inode_low;
01146   char *proc_dir, *driver;
01147   unsigned unique;
01148   char *info;
01149   unsigned lgeo_c, lgeo_h, lgeo_s;
01150   unsigned pgeo_c, pgeo_h, pgeo_s;
01151   uint64_t size;
01152   unsigned sec_size;
01153   unsigned cache;
01154   str_list_t *host_info;
01155   char *usb_guid;
01156   unsigned pci_info;
01157   unsigned pci_bus;
01158   unsigned pci_slot;
01159   unsigned pci_func;
01160   uint64_t wwpn;
01161   uint64_t fcp_lun;
01162   char *controller_id;
01163 } scsi_t;
01164 
01165 
01169 typedef struct devtree_s {
01170   struct devtree_s *next;
01171   struct devtree_s *parent;
01172   unsigned idx;
01173   char *path, *filename;
01174   unsigned pci:1;
01175   char *name, *model, *device_type, *compatible;
01176   int class_code;                       
01177   int vendor_id, device_id, subvendor_id, subdevice_id;
01178   int revision_id, interrupt;
01179   unsigned char *edid;                  
01180 } devtree_t;
01181 
01182 
01186 typedef struct ccw_s {
01187   unsigned char lcss;
01188   unsigned char cu_model;
01189   unsigned char dev_model;
01190 } ccw_t;
01191 
01192 
01196 typedef struct cdrom_info_s {
01197   struct cdrom_info_s *next;
01198   char *name;
01199   unsigned speed;
01200   unsigned cdr:1, cdrw:1, dvd:1, dvdr:1, dvdram:1;
01201   unsigned cdrom:1;             
01202   struct {
01203     unsigned ok:1;
01204     char *volume, *publisher, *preparer, *application, *creation_date;
01205   } iso9660;
01206   struct {
01207     unsigned ok:1;
01208     unsigned platform;
01209     char *id_string;
01210     unsigned bootable:1;
01211     unsigned media_type;        
01212     unsigned load_address;
01213     unsigned load_count;        
01214     unsigned start;             
01215     unsigned catalog;           
01216     struct {
01217       unsigned c, h, s;
01218       unsigned size;
01219     } geo;
01220     char *label;
01221   } el_torito;
01222 
01223 } cdrom_info_t;
01224 
01225 
01231 typedef struct {
01232   unsigned char block0[512];
01233 } floppy_info_t;
01234 
01235 
01239 typedef struct {
01240   unsigned apm_supported:1;
01241   unsigned apm_enabled:1;
01242   unsigned apm_ver, apm_subver;
01243   unsigned apm_bios_flags;
01244 
01245   unsigned vbe_ver;
01246   unsigned vbe_video_mem;
01247 
01248   unsigned ser_port0, ser_port1, ser_port2, ser_port3;
01249   unsigned par_port0, par_port1, par_port2;
01250 
01252   unsigned is_pnp_bios:1;
01253   unsigned pnp_id;
01254   unsigned lba_support:1;
01255 
01256   unsigned low_mem_size;
01257   smp_info_t smp;
01258   vbe_info_t vbe;
01259 
01260   unsigned smbios_ver;
01261 
01262   struct {
01263     unsigned width;
01264     unsigned height;
01265     unsigned xsize;
01266     unsigned ysize;
01267     char *vendor;
01268     char *name;
01269   } lcd;
01270 
01271   struct {
01272     char *vendor;
01273     char *type;
01274     unsigned bus;
01275     unsigned compat_vend;
01276     unsigned compat_dev;
01277   } mouse;
01278 
01279   struct {
01280     unsigned ok:1;
01281     unsigned scroll_lock:1;
01282     unsigned num_lock:1;
01283     unsigned caps_lock:1;
01284   } led;
01285 
01286   bios32_info_t bios32;
01287 
01288 } bios_info_t;
01289 
01290 
01294 typedef struct {
01295   unsigned has_color:1;
01296   unsigned color;
01297 } prom_info_t;
01298 
01299 
01303 typedef struct {
01304   char *system_type;
01305   char *generation;
01306   char *vendor;
01307   char *model;
01308   char *serial;
01309   char *lang;
01310   char *formfactor;
01311 } sys_info_t;
01312 
01313 
01317 typedef struct {
01318   unsigned manu_year;
01319   unsigned min_vsync, max_vsync;        
01320   unsigned min_hsync, max_hsync;        
01321   unsigned clock;                       
01322   unsigned width, height;               
01323   unsigned width_mm, height_mm;         
01324   unsigned hdisp, hsyncstart, hsyncend, htotal; 
01325   unsigned vdisp, vsyncstart, vsyncend, vtotal; 
01326   char hflag,vflag; 
01327   char *vendor;
01328   char *name;
01329   char *serial;
01330 } monitor_info_t;
01331 
01338 typedef enum cpu_arch {
01339   arch_unknown = 0,
01340   arch_intel,
01341   arch_alpha,
01342   arch_sparc, arch_sparc64,
01343   arch_ppc, arch_ppc64,
01344   arch_68k,
01345   arch_ia64,
01346   arch_s390, arch_s390x,
01347   arch_arm,
01348   arch_mips,
01349   arch_x86_64
01350 } hd_cpu_arch_t;
01351 
01355 typedef enum boot_arch {
01356   boot_unknown = 0,
01357   boot_lilo, boot_milo, boot_aboot, boot_silo, boot_ppc, boot_elilo, boot_s390,
01358   boot_mips, boot_grub
01359 } hd_boot_arch_t;
01360 
01361 
01370 typedef struct {
01371   enum cpu_arch architecture;
01372   unsigned family;              
01373   unsigned model;               
01374   unsigned stepping;
01375   unsigned cache;
01376   unsigned clock;
01377   unsigned units;               
01378   char *vend_name;              
01379   char *model_name;             
01380   char *platform;               
01381   str_list_t *features;         
01382 } cpu_info_t;
01383 
01384 
01389 typedef struct {
01390   uint64_t sectors;
01391   struct {
01392     unsigned cyls, heads, sectors;
01393   } edd;
01394   struct {
01395     unsigned cyls, heads, sectors;
01396   } legacy;
01397   unsigned ext_fixed_disk:1;
01398   unsigned ext_lock_eject:1;
01399   unsigned ext_edd:1;
01400   unsigned ext_64bit:1;
01401   unsigned assigned:1;
01402   char *sysfs_id;
01403   unsigned hd_idx;
01404 } edd_info_t;
01405 
01411 typedef struct {
01412   unsigned data_len, data_max;
01413   unsigned *data;
01414   unsigned names_len, names_max;
01415   char *names;
01416 } hddb_data_t;
01417 
01421 typedef uint32_t hddb_entry_mask_t;
01422 
01426 typedef struct hddb_list_s {   
01427   hddb_entry_mask_t key_mask;
01428   hddb_entry_mask_t value_mask;
01429   unsigned key;
01430   unsigned value;
01431 } hddb_list_t;
01432 
01436 typedef struct {
01437   unsigned list_len, list_max;
01438   hddb_list_t *list;
01439   unsigned ids_len, ids_max;
01440   unsigned *ids;
01441   unsigned strings_len, strings_max;
01442   char *strings;
01443 } hddb2_data_t;
01444 
01445 
01449 typedef enum modinfo_type_e { mi_none = 0, mi_pci, mi_other } modinfo_type_t;
01450 
01454 typedef struct {
01455   char *module;
01456   char *alias;
01457   modinfo_type_t type;
01458   union {
01459     struct {
01460       struct {
01461         unsigned vendor:1;
01462         unsigned device:1;
01463         unsigned sub_vendor:1;
01464         unsigned sub_device:1;
01465         unsigned base_class:1;
01466         unsigned sub_class:1;
01467         unsigned prog_if:1;
01468       } has;
01469       unsigned vendor;
01470       unsigned device;
01471       unsigned sub_vendor;
01472       unsigned sub_device;
01473       unsigned base_class;
01474       unsigned sub_class;
01475       unsigned prog_if;
01476     } pci;
01477 
01478     struct {
01479       struct {
01480         unsigned vendor:1;
01481         unsigned product:1;
01482         unsigned device_class:1;
01483         unsigned device_subclass:1;
01484       } has;
01485       unsigned vendor;
01486       unsigned product;
01487       unsigned device_class;
01488       unsigned device_subclass;
01489     } usb;
01490   };
01491 } modinfo_t;
01492 
01493 
01497 typedef enum {
01498   p_invalid, p_string, p_int32, p_uint64, p_double, p_bool, p_list
01499 } hal_prop_type_t;
01500 
01501 
01505 typedef struct hal_prop_s {
01506   struct hal_prop_s *next;
01507   hal_prop_type_t type;
01508   char *key;
01509   union {
01510     char *str;
01511     int32_t int32;
01512     uint64_t uint64;
01513     double d;     
01514     int b;
01515     str_list_t *list;
01516   } val;  
01517 } hal_prop_t;
01518 
01519 
01523 typedef struct hal_device_s {
01524   struct hal_device_s *next, *parent;
01525   char *udi;
01526   unsigned used:1;
01527   hal_prop_t *prop;
01528 } hal_device_t;
01529 
01530 
01534 typedef enum resource_types {
01535   res_any, res_phys_mem, res_mem, res_io, res_irq, res_dma, res_monitor,
01536   res_size, res_disk_geo, res_cache, res_baud, res_init_strings, res_pppd_option,
01537   res_framebuffer, res_hwaddr, res_link, res_wlan
01538 } hd_resource_types_t;
01539 
01540 
01544 typedef enum size_units {
01545   size_unit_cm, size_unit_cinch, size_unit_byte, size_unit_sectors,
01546   size_unit_kbyte, size_unit_mbyte, size_unit_gbyte, size_unit_mm
01547 } hd_size_units_t;
01548 
01552 typedef enum access_flags {
01553   acc_unknown,          
01554   acc_ro,               
01555   acc_wo,               
01556   acc_rw                
01557 } hd_access_flags_t;
01558 
01559 
01560 typedef enum yes_no_flag {
01561   flag_unknown,         
01562   flag_no,              
01563   flag_yes              
01564 } hd_yes_no_flag_t;
01565 
01566 
01567 typedef enum geo_types {
01568   geo_physical = 0, 
01569   geo_logical, 
01570   geo_bios_edd, 
01571   geo_bios_legacy
01572 } hd_geo_types_t;
01573 
01574 
01581 typedef struct {
01582   union u_hd_res_t *next;
01583   enum resource_types type;
01584 } res_any_t;
01585 
01586 typedef struct {
01587   union u_hd_res_t *next;
01588   enum resource_types type;
01589   uint64_t base, range;
01590   unsigned
01591     enabled:1,                  
01592     access:2,                   
01593     prefetch:2;                 
01594 } res_mem_t;
01595 
01596 typedef struct {
01597   union u_hd_res_t *next;
01598   enum resource_types type;
01599   uint64_t range;
01600 } res_phys_mem_t;
01601 
01602 typedef struct {
01603   union u_hd_res_t *next;
01604   enum resource_types type;
01605   uint64_t base, range;
01606   unsigned
01607     enabled:1,                          
01608     access:2;                           
01609 } res_io_t;
01610 
01611 typedef struct {
01612   union u_hd_res_t *next;
01613   enum resource_types type;
01614   unsigned base;
01615   unsigned triggered;                   
01616   unsigned enabled:1;                   
01617 } res_irq_t;
01618 
01619 typedef struct {
01620   union u_hd_res_t *next;
01621   enum resource_types type;
01622   unsigned base;
01623   unsigned enabled:1;                   
01624 } res_dma_t;
01625 
01626 typedef struct {
01627   union u_hd_res_t *next;
01628   enum resource_types type;
01629   enum size_units unit;
01630   uint64_t val1, val2;                  
01631 } res_size_t;
01632 
01633 typedef struct {
01634   union u_hd_res_t *next;
01635   enum resource_types type;
01636   unsigned speed;
01637   unsigned bits, stopbits;
01638   char parity;                          
01639   char handshake;                       
01640 } res_baud_t;
01641 
01642 typedef struct {
01643   union u_hd_res_t *next;
01644   enum resource_types type;
01645   unsigned size;                        
01646 } res_cache_t;
01647 
01648 typedef struct {
01649   union u_hd_res_t *next;
01650   enum resource_types type;
01651   unsigned cyls, heads, sectors;
01652   uint64_t size;
01653   enum geo_types geotype;               
01654 } res_disk_geo_t;
01655 
01656 typedef struct {
01657   union u_hd_res_t *next;
01658   enum resource_types type;
01659   unsigned width, height;               
01660   unsigned vfreq;                       
01661   unsigned interlaced:1;                
01662 } res_monitor_t;
01663 
01664 typedef struct {
01665   union u_hd_res_t *next;
01666   enum resource_types type;
01667   char *init1;
01668   char *init2;
01669 } res_init_strings_t;
01670 
01671 typedef struct {
01672   union u_hd_res_t *next;
01673   enum resource_types type;
01674   char *option;
01675 } res_pppd_option_t;
01676 
01677 typedef struct {
01678   union u_hd_res_t *next;
01679   enum resource_types type;
01680   unsigned width, height;               
01681   unsigned bytes_p_line;                
01682   unsigned colorbits;                   
01683   unsigned mode;                        
01684 } res_framebuffer_t;
01685 
01686 typedef struct {
01687   union u_hd_res_t *next;
01688   enum resource_types type;
01689   char *addr;
01690 } res_hwaddr_t;
01691 
01692 typedef struct {
01693   union u_hd_res_t *next;
01694   enum resource_types type;
01695   unsigned state:1;                     
01696 } res_link_t;
01697 
01699 typedef struct {
01700   union u_hd_res_t *next;
01701   enum resource_types type;
01702   str_list_t *channels;
01703   str_list_t *frequencies; 
01704   str_list_t *bitrates;    
01705   str_list_t *auth_modes;  
01706   str_list_t *enc_modes;   
01707 } res_wlan_t;
01708 
01710 typedef union u_hd_res_t {
01711   union u_hd_res_t *next;  
01712   res_any_t any;
01713   res_io_t io;
01714   res_mem_t mem;
01715   res_phys_mem_t phys_mem;
01716   res_irq_t irq;
01717   res_dma_t dma;
01718   res_size_t size;
01719   res_cache_t cache;
01720   res_baud_t baud;
01721   res_disk_geo_t disk_geo;
01722   res_monitor_t monitor;
01723   res_init_strings_t init_strings;
01724   res_pppd_option_t pppd_option;
01725   res_framebuffer_t framebuffer;
01726   res_hwaddr_t hwaddr;
01727   res_link_t link;
01728   res_wlan_t wlan;
01729 } hd_res_t;
01730 
01739 typedef struct {
01740   uint64_t addr, size;
01741   char *dev;
01742   unsigned tag;
01743 } misc_io_t;
01744 
01745 typedef struct {
01746   unsigned channel;
01747   char *dev;
01748   unsigned tag;
01749 } misc_dma_t;
01750 
01751 typedef struct {
01752   unsigned irq, events;
01753   int devs;
01754   char **dev;
01755   unsigned tag;
01756 } misc_irq_t;
01757 
01758 typedef struct {
01759   unsigned io_len, dma_len, irq_len;
01760   misc_io_t *io;
01761   misc_dma_t *dma;
01762   misc_irq_t *irq;
01763   str_list_t *proc_io, *proc_dma, *proc_irq;
01764 } misc_t;
01765 
01771 typedef struct s_serial_t {
01772   struct s_serial_t *next;
01773   char *name;
01774   char *device;
01775   unsigned line, port, irq, baud;
01776 } serial_t;
01777 
01781 typedef struct s_ser_device_t {
01782   struct s_ser_device_t *next;
01783   unsigned hd_idx;
01784   char *dev_name;
01785   str_list_t *at_resp;
01786   int fd;
01787   struct termios tio;
01788   unsigned max_baud, cur_baud;
01789   unsigned is_mouse:1;
01790   unsigned is_modem:1;
01791   unsigned do_io:1;
01792   unsigned char buf[0x1000];
01793   int buf_len;
01794   int garbage, non_pnp, pnp;
01795   unsigned char pnp_id[8];
01796   char *serial, *class_name, *dev_id, *user_name, *vend, *init_string1, *init_string2, *pppd_option;
01797   unsigned pnp_rev;
01798   unsigned bits;
01799 } ser_device_t;
01800 
01814 typedef struct isdn_parm_s {
01815   struct isdn_parm_s *next;
01816   char *name;                           
01817   unsigned valid:1;                     
01818   unsigned conflict:1;                  
01819   uint64_t value;                       
01820   unsigned type;                        
01821   unsigned flags;                       
01822   unsigned def_value;                   
01823   int alt_values;                       
01824   unsigned *alt_value;                  
01825 } isdn_parm_t;
01826 
01828 typedef enum driver_info_type {
01829   di_any, di_display, di_module, di_mouse, di_x11, di_isdn, di_kbd, di_dsl
01830 } hd_driver_info_t;
01831 
01833 typedef struct {
01834   union driver_info_u *next;
01835   enum driver_info_type type;           
01836   str_list_t *hddb0, *hddb1;            
01837 } driver_info_any_t;
01838 
01840 typedef struct {
01841   union driver_info_u *next;
01842   enum driver_info_type type;           
01843   str_list_t *hddb0, *hddb1;            
01844   unsigned width, height;               
01845   unsigned min_vsync, max_vsync;        
01846   unsigned min_hsync, max_hsync;        
01847   unsigned bandwidth;                   
01848   unsigned hdisp, hsyncstart, hsyncend, htotal; 
01849   unsigned vdisp, vsyncstart, vsyncend, vtotal; 
01850   char hflag,vflag; 
01851 } driver_info_display_t;
01852 
01854 typedef struct {
01855   union driver_info_u *next;
01856   enum driver_info_type type;           
01857   str_list_t *hddb0, *hddb1;            
01858   unsigned active:1;                    
01859   unsigned modprobe:1;                  
01860   str_list_t *names;                    
01861   str_list_t *mod_args;                 
01862   char *conf;                           
01863 } driver_info_module_t;
01864 
01866 typedef struct {
01867   union driver_info_u *next;
01868   enum driver_info_type type;           
01869   str_list_t *hddb0, *hddb1;            
01870   char *xf86;                           
01871   char *gpm;                            
01872   int buttons;                          
01873   int wheels;                           
01874 } driver_info_mouse_t;
01875 
01877 typedef struct {
01878   union driver_info_u *next;
01879   enum driver_info_type type;           
01880   str_list_t *hddb0, *hddb1;            
01881   char *server;                         
01882   char *xf86_ver;                       
01883   unsigned x3d:1;                       
01884   struct {
01885     unsigned all:5;                     
01886     unsigned c8:1, c15:1, c16:1, c24:1, c32:1;
01887   } colors;                             
01888   unsigned dacspeed;                    
01889   str_list_t *extensions;               
01890   str_list_t *options;                  
01891   str_list_t *raw;                      
01892   char *script;                         
01893 } driver_info_x11_t;
01894 
01896 typedef struct {
01897   union driver_info_u *next;
01898   enum driver_info_type type;           
01899   str_list_t *hddb0, *hddb1;            
01900   int i4l_type, i4l_subtype;            
01901   char *i4l_name;                       
01902   isdn_parm_t *params;                  
01903 } driver_info_isdn_t;
01904 
01906 typedef struct {
01907   union driver_info_u *next;
01908   enum driver_info_type type;           
01909   str_list_t *hddb0, *hddb1;            
01910   char *mode;                           
01911   char *name;                           
01912 } driver_info_dsl_t;
01913 
01915 typedef struct {
01916   union driver_info_u *next;
01917   enum driver_info_type type;           
01918   str_list_t *hddb0, *hddb1;            
01919   char *XkbRules;                       
01920   char *XkbModel;
01921   char *XkbLayout;
01922   char *keymap;                         
01923 } driver_info_kbd_t;
01924 
01925 /*
01926  * holds device driver info
01927  */
01928 typedef union driver_info_u {
01929   union driver_info_u *next;
01930   driver_info_any_t any;
01931   driver_info_module_t module;
01932   driver_info_mouse_t mouse;
01933   driver_info_x11_t x11;
01934   driver_info_display_t display;
01935   driver_info_isdn_t isdn;
01936   driver_info_dsl_t dsl;
01937   driver_info_kbd_t kbd;
01938 } driver_info_t;
01939 
01950 typedef enum hd_detail_type {
01951   hd_detail_pci, hd_detail_usb, hd_detail_isapnp, hd_detail_cdrom,
01952   hd_detail_floppy, hd_detail_bios, hd_detail_cpu, hd_detail_prom,
01953   hd_detail_monitor, hd_detail_sys, hd_detail_scsi, hd_detail_devtree,
01954   hd_detail_ccw
01955 } hd_detail_type_t;
01956 
01957 typedef struct {
01958   enum hd_detail_type type;
01959   pci_t *data;
01960 } hd_detail_pci_t;
01961 
01962 typedef struct {
01963   enum hd_detail_type type;
01964   usb_t *data;
01965 } hd_detail_usb_t;
01966 
01967 typedef struct {
01968   enum hd_detail_type type;
01969   isapnp_dev_t *data;
01970 } hd_detail_isapnp_t;
01971 
01972 typedef struct {
01973   enum hd_detail_type type;
01974   cdrom_info_t *data;
01975 } hd_detail_cdrom_t;
01976 
01977 typedef struct {
01978   enum hd_detail_type type;
01979   floppy_info_t *data;
01980 } hd_detail_floppy_t;
01981 
01982 typedef struct {
01983   enum hd_detail_type type;
01984   bios_info_t *data;
01985 } hd_detail_bios_t;
01986 
01987 typedef struct {
01988   enum hd_detail_type type;
01989   cpu_info_t *data;
01990 } hd_detail_cpu_t;
01991 
01992 typedef struct {
01993   enum hd_detail_type type;
01994   prom_info_t *data;
01995 } hd_detail_prom_t;
01996 
01997 typedef struct {
01998   enum hd_detail_type type;
01999   monitor_info_t *data;
02000 } hd_detail_monitor_t;
02001 
02002 typedef struct {
02003   enum hd_detail_type type;
02004   sys_info_t *data;
02005 } hd_detail_sys_t;
02006 
02007 typedef struct {
02008   enum hd_detail_type type;
02009   scsi_t *data;
02010 } hd_detail_scsi_t;
02011 
02012 typedef struct {
02013   enum hd_detail_type type;
02014   devtree_t *data;
02015 } hd_detail_devtree_t;
02016 
02017 typedef struct {
02018   enum hd_detail_type type;
02019   ccw_t *data;
02020 } hd_detail_ccw_t;
02021 
02022 typedef union {
02023   enum hd_detail_type type;
02024   hd_detail_pci_t pci;
02025   hd_detail_usb_t usb;
02026   hd_detail_isapnp_t isapnp;
02027   hd_detail_cdrom_t cdrom;
02028   hd_detail_floppy_t floppy;
02029   hd_detail_bios_t bios;
02030   hd_detail_cpu_t cpu;
02031   hd_detail_prom_t prom;
02032   hd_detail_monitor_t monitor;
02033   hd_detail_sys_t sys;
02034   hd_detail_scsi_t scsi;
02035   hd_detail_devtree_t devtree;
02036   hd_detail_ccw_t ccw;
02037 } hd_detail_t;
02038 
02051 typedef struct hd_manual_s {
02052   struct hd_manual_s *next;
02053 
02054   char *unique_id;
02055   char *parent_id;
02056   char *child_ids;
02057   unsigned hw_class;
02058   char *model;
02059 
02060   hd_status_t status;
02061   char *config_string;
02062 
02063   /* More or less free-form key, value pairs.
02064    * key should not contain '=', however.
02065    */
02066   str_list_t *key;
02067   str_list_t *value;
02068 } hd_manual_t;
02069 
02070 
02076 typedef struct s_hd_t {
02077   struct s_hd_t *next;          
02083   unsigned idx;
02084 
02090   unsigned broken:1;
02091 
02095   hd_id_t bus;
02096 
02101   unsigned slot;
02102 
02106   unsigned func;
02107 
02111   hd_id_t base_class;
02112 
02116   hd_id_t sub_class;
02117 
02121   hd_id_t prog_if;
02122 
02129   hd_id_t vendor;
02130 
02139   hd_id_t device;
02140 
02147   hd_id_t sub_vendor;
02148 
02155   hd_id_t sub_device;
02156 
02162   hd_id_t revision;
02163 
02167   char *serial;
02168 
02173   hd_id_t compat_vendor;
02174 
02179   hd_id_t compat_device;
02180 
02185   hd_hw_item_t hw_class;
02186 
02191   unsigned char hw_class_list[(hw_all + 7) / 8];        
02199   char *model;
02200 
02206   unsigned attached_to;
02207 
02211   char *sysfs_id;
02212 
02216   char *sysfs_bus_id;
02217 
02221   char *sysfs_device_link;
02222 
02228   char *unix_dev_name;
02229 
02233   hd_dev_num_t unix_dev_num;
02234 
02241   str_list_t *unix_dev_names;
02242 
02249   char *unix_dev_name2;
02250 
02254   hd_dev_num_t unix_dev_num2;
02255 
02262   char *rom_id;
02263 
02267   char *udi;
02268 
02272   char *parent_udi;
02273 
02284   char *unique_id;
02285 
02287   str_list_t *unique_ids;
02288 
02292   unsigned module;
02293 
02297   unsigned line;
02298 
02302   unsigned count;
02303 
02307   hd_res_t *res;
02308 
02313   hd_detail_t *detail;
02314 
02320   str_list_t *extra_info;
02321 
02327   hd_status_t status;
02328 
02335   char *config_string;
02336 
02341   hd_hotplug_t hotplug;
02342 
02347   unsigned hotplug_slot;
02348 
02349   struct is_s {
02350     unsigned agp:1;             
02351     unsigned isapnp:1;          
02352     unsigned notready:1;        
02353     unsigned manual:1;          
02354     unsigned softraiddisk:1;    
02355     unsigned zip:1;             
02356     unsigned cdr:1;             
02357     unsigned cdrw:1;            
02358     unsigned dvd:1;             
02359     unsigned dvdr:1;            
02360     unsigned dvdrw:1;           
02361     unsigned dvdpr:1;           
02362     unsigned dvdprw:1;          
02363     unsigned dvdprdl:1;         
02364     unsigned dvdram:1;          
02365     unsigned pppoe:1;           
02366     unsigned wlan:1;            
02367     unsigned with_acpi:1;       
02368     unsigned hotpluggable:1;    
02369   } is;
02370 
02371   struct tag_s {                
02372     unsigned remove:1;          
02373     unsigned freeit:1;          
02374     unsigned fixed:1;           
02375     unsigned ser_skip:1;        
02376     unsigned ser_device:2;      
02377   } tag;
02378 
02384   unsigned char *block0;
02385 
02389   char *driver;
02390 
02394   str_list_t *drivers;
02395 
02399   str_list_t *driver_modules;
02400 
02408   char *old_unique_id;
02409 
02415   char *parent_id;
02416 
02422   str_list_t *child_ids;
02423 
02428   char *unique_id1;
02429 
02436   char *usb_guid;
02437 
02438   driver_info_t *driver_info;   
02440   str_list_t *requires;         
02442   hal_prop_t *hal_prop;         
02444   hal_prop_t *persistent_prop;  
02446   char *modalias;               
02448   /*
02449    * These are used internally for memory management.
02450    * Do not even _think_ of modifying these!
02451    */
02452   unsigned ref_cnt;             
02453   struct s_hd_t *ref;           
02454 } hd_t;
02455 
02456 
02460 typedef struct {
02466   hd_t *hd;
02467 
02476   void (*progress)(char *pos, char *msg);
02477   
02482   char *log;
02483 
02491   unsigned debug;
02492 
02498   struct flag_struct {
02499     unsigned internal:1;        
02500     unsigned dformat:2;         
02501     unsigned no_parport:1;      
02502     unsigned iseries:1;         
02503     unsigned list_all:1;        
02504     unsigned fast:1;            
02505     unsigned list_md:1;         
02506     unsigned nofork:1;          
02507     unsigned nosysfs:1;         
02508     unsigned forked:1;          
02509     unsigned cpuemu:1;          
02510     unsigned udev:1;            
02511     unsigned edd_used:1;        
02512     unsigned keep_kmods:2;      
02513     unsigned nobioscrc:1;       
02514     unsigned biosvram:1;        
02515     unsigned nowpa:1;           
02516   } flags;
02517 
02518 
02523   str_list_t *only;
02524 
02525   /*
02526    * The following entries should *not* be accessed outside of libhd!
02527    */
02528   unsigned char probe[(pr_all + 7) / 8];        
02529   unsigned char probe_set[(pr_all + 7) / 8];    
02530   unsigned char probe_clr[(pr_all + 7) / 8];    
02531   unsigned last_idx;            
02532   unsigned module;              
02533   enum boot_arch boot;          
02534   hd_t *old_hd;                 
02535   pci_t *pci;                   
02536   isapnp_t *isapnp;             
02537   cdrom_info_t *cdrom;          
02538   str_list_t *net;              
02539   str_list_t *floppy;           
02540   misc_t *misc;                 
02541   serial_t *serial;             
02542   scsi_t *scsi;                 
02543   ser_device_t *ser_mouse;      
02544   ser_device_t *ser_modem;      
02545   str_list_t *cpu;              
02546   str_list_t *klog;             
02547   str_list_t *proc_usb;         
02548   usb_t *usb;                   
02549   modinfo_t *modinfo_ext;       
02550   modinfo_t *modinfo;           
02551   hddb2_data_t *hddb2[2];       
02552   str_list_t *kmods;            
02553   uint64_t used_irqs;           
02554   uint64_t assigned_irqs;       
02555   memory_range_t bios_rom;      
02556   memory_range_t bios_ram;      
02557   memory_range_t bios_ebda;     
02558   unsigned display;             
02559   unsigned color_code;          
02560   char *cmd_line;               
02561   str_list_t *xtra_hd;          
02562   devtree_t *devtree;           
02563   unsigned kernel_version;      
02564   int in_vmware;                
02565   hd_t *manual;                 
02566   str_list_t *disks;            
02567   str_list_t *partitions;       
02568   str_list_t *cdroms;           
02569   hd_smbios_t *smbios;          
02570   struct {
02571     unsigned ok:1;
02572     unsigned size;
02573     unsigned used;
02574     void *data;
02575     int id;
02576     int updated;
02577   } shm;                        
02578   unsigned pci_config_type;     
02579   hd_udevinfo_t *udevinfo;      
02580   hd_sysfsdrv_t *sysfsdrv;      
02581   uint64_t sysfsdrv_id;         
02582   str_list_t *scanner_db;       
02583   edd_info_t edd[0x80];         
02584   hal_device_t *hal;            
02585 } hd_data_t;
02586 
02587 
02588 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
02589  *
02590  *                      libhd interface functions
02591  *
02592  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
02593  */
02594 
02595 /* implemented in hd.c */
02596 
02598 void hd_scan(hd_data_t *hd_data);
02599 
02601 hd_data_t *hd_free_hd_data(hd_data_t *hd_data);
02602 
02604 hd_t *hd_free_hd_list(hd_t *hd);
02605 
02606 void hd_set_probe_feature(hd_data_t *hd_data, enum probe_feature feature);
02607 void hd_clear_probe_feature(hd_data_t *hd_data, enum probe_feature feature);
02608 int hd_probe_feature(hd_data_t *hd_data, enum probe_feature feature);
02609 void hd_set_probe_feature_hw(hd_data_t *hd_data, hd_hw_item_t item);
02610 
02611 enum probe_feature hd_probe_feature_by_name(char *name);
02612 char *hd_probe_feature_by_value(enum probe_feature feature);
02613 
02614 int hd_module_is_active(hd_data_t *hd_data, char *mod);
02615 
02616 hd_t *hd_base_class_list(hd_data_t *hd_data, unsigned base_class);
02617 hd_t *hd_sub_class_list(hd_data_t *hd_data, unsigned base_class, unsigned sub_class);
02618 hd_t *hd_bus_list(hd_data_t *hd_data, unsigned bus);
02619 const char* hd_busid_to_hwcfg(int busid);
02620 hd_t *hd_list(hd_data_t *hd_data, hd_hw_item_t item, int rescan, hd_t *hd_old);
02621 hd_t *hd_list_with_status(hd_data_t *hd_data, hd_hw_item_t item, hd_status_t status);
02622 hd_t *hd_list2(hd_data_t *hd_data, hd_hw_item_t *items, int rescan);
02623 hd_t *hd_list_with_status2(hd_data_t *hd_data, hd_hw_item_t *items, hd_status_t status);
02624 
02625 int hd_has_pcmcia(hd_data_t *hd_data);
02626 #if 0
02627 
02631 int hd_apm_enabled(hd_data_t *hd_data);
02632 #endif
02633 int hd_usb_support(hd_data_t *hd_data);
02634 int hd_smp_support(hd_data_t *hd_data);
02635 int hd_mac_color(hd_data_t *hd_data);
02636 int hd_color(hd_data_t *hd_data);
02637 int hd_is_uml(hd_data_t *hd_data);
02638 unsigned hd_display_adapter(hd_data_t *hd_data);
02639 unsigned hd_boot_disk(hd_data_t *hd_data, int *matches);
02640 enum cpu_arch hd_cpu_arch(hd_data_t *hd_data);
02641 enum boot_arch hd_boot_arch(hd_data_t *hd_data);
02642 
02643 hd_t *hd_get_device_by_idx(hd_data_t *hd_data, unsigned idx);
02644 
02645 void hd_set_hw_class(hd_t *hd, hd_hw_item_t hw_class);
02646 int hd_is_hw_class(hd_t *hd, hd_hw_item_t hw_class);
02647 
02648 int hd_is_sgi_altix(hd_data_t *hd_data);
02649 
02650 char *hd_version(void);
02651 
02652 hal_prop_t *hd_free_hal_properties(hal_prop_t *prop);
02653 hal_prop_t *hd_read_properties(const char *udi);
02654 int hd_write_properties(const char *udi, hal_prop_t *prop);
02655 
02656 int hd_change_status(const char *id, hd_status_t status, const char *config_string);
02657 int hd_change_config_status(hd_data_t *hd_data, const char *id, hd_status_t status, const char *config_string);
02658 int hd_read_mmap(hd_data_t *hd_data, char *name, unsigned char *buf, off_t start, unsigned size);
02659 
02660 /* implemented in hddb.c */
02661 
02665 str_list_t *hddb_get_packages(hd_data_t *hd_data);
02666 void hddb_add_info(hd_data_t *hd_data, hd_t *hd);
02667 
02668 void hddb_dump_raw(hddb2_data_t *hddb, FILE *f);
02669 void hddb_dump(hddb2_data_t *hddb, FILE *f);
02670 
02671 
02672 /* implemented in hdp.c */
02673 void hd_dump_entry(hd_data_t *hd_data, hd_t *hd, FILE *f);
02674 
02675 /* implemented in cdrom.c */
02676 cdrom_info_t *hd_read_cdrom_info(hd_data_t *hd_data, hd_t *hd);
02677 
02685 hd_manual_t *hd_manual_read_entry(hd_data_t *hd_data, const char *id);
02686 int hd_manual_write_entry(hd_data_t *hd_data, hd_manual_t *entry);
02687 hd_manual_t *hd_free_manual(hd_manual_t *manual);
02688 hd_t *hd_read_config(hd_data_t *hd_data, const char *id);
02689 int hd_write_config(hd_data_t *hd_data, hd_t *hd);
02690 char *hd_hw_item_name(hd_hw_item_t item);
02691 hd_hw_item_t hd_hw_item_type(char *name);
02692 char *hd_status_value_name(hd_status_value_t status);
02693 
02704 #define CDBISDN_VERSION 0x0101
02705 
02706 #ifndef PCI_ANY_ID
02707 #define PCI_ANY_ID      0xffff
02708 #endif
02709 
02710 #define CDBISDN_P_NONE  0x0
02711 #define CDBISDN_P_IRQ   0x1
02712 #define CDBISDN_P_MEM   0x2
02713 #define CDBISDN_P_IO    0x3
02714 
02716 typedef struct {
02717         char    *name;
02718         char    *shortname;
02719         int     vnr;
02720         int     refcnt;
02721 } cdb_isdn_vendor;
02722 
02723 typedef struct  {
02724         int     handle;         
02725         int     vhandle;        
02726         char    *name;          
02727         char    *lname;         
02728         char    *Class;         
02729         char    *bus;           
02730         int     revision;       
02731         int     vendor;         
02732         int     device;         
02733         int     subvendor;      
02735         int     subdevice;      
02737         unsigned int features;  
02738         int     line_cnt;       
02739         int     vario_cnt;      
02740         int     vario;          
02741 } cdb_isdn_card;
02742 
02743 typedef struct  {
02744         int     handle;         
02745         int     next_vario;     
02746         int     drvid;          
02747         int     typ;            
02748         int     subtyp;         
02749         int     smp;            
02750         char    *mod_name;      
02751         char    *para_str;      
02752         char    *mod_preload;   
02753         char    *cfg_prog;      
02754         char    *firmware;      
02755         char    *description;   
02756         char    *need_pkg;      
02757         char    *info;          
02758         char    *protocol;      
02759         char    *interface;     
02760         char    *io;            
02761         char    *irq;           
02762         char    *membase;       
02763         char    *features;      
02764         int     card_ref;       
02765         char    *name;          
02766 } cdb_isdn_vario;
02767 
02768 
02769 extern cdb_isdn_vendor  *hd_cdbisdn_get_vendor(int);
02770 extern cdb_isdn_card    *hd_cdbisdn_get_card(int);
02771 extern cdb_isdn_vario   *hd_cdbisdn_get_vario_from_type(int, int);
02772 extern cdb_isdn_card    *hd_cdbisdn_get_card_from_type(int, int);
02773 extern cdb_isdn_card    *hd_cdbisdn_get_card_from_id(int, int, int, int);
02774 extern cdb_isdn_vario   *hd_cdbisdn_get_vario(int);
02775 extern int              hd_cdbisdn_get_version(void);
02776 extern int              hd_cdbisdn_get_db_version(void);
02777 extern char             *hd_cdbisdn_get_db_date(void);
02778 
02784 #ifdef __cplusplus
02785 }
02786 #endif
02787 
02790 #endif  /* _HD_H */