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, pr_bios_acpi, pr_bios_ddc_ports_1, pr_bios_ddc_ports_2,
00121   pr_bios_ddc_ports_3, pr_bios_ddc_ports_4, pr_modules_pata,
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,
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
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 } hd_bus_types_t;
00298 
00307 typedef struct {
00311   unsigned invalid:1;
00312 
00322   unsigned reconfig:3;
00323 
00329   unsigned configured:3;
00330 
00341   unsigned available:3;
00342 
00350   unsigned needed:3;
00351 
00358   unsigned available_orig:3;
00359 
00363   unsigned active:3;
00364 } hd_status_t;
00365 
00367 typedef enum {
00368   status_no = 1, status_yes, status_unknown, status_new
00369 } hd_status_value_t;
00370 
00374 typedef enum {
00375   hp_none,      
00376   hp_pcmcia,    
00377   hp_cardbus,   
00378   hp_pci,       
00379   hp_usb,       
00380   hp_ieee1394   
00381 } hd_hotplug_t;
00382 
00393 typedef struct {
00394   unsigned id;          
00395   char *name;           
00396 } hd_id_t;
00397 
00398 
00403 typedef struct s_str_list_t {
00404   struct s_str_list_t *next;    
00405   char *str;                    
00406 } str_list_t;
00407 
00408 
00412 typedef struct {
00413   unsigned char bitmap[16];     
00414   unsigned bits;                
00415   unsigned not_empty:1;         
00416   str_list_t *str;              
00417 } hd_bitmap_t;
00418 
00435 typedef struct {
00436   unsigned start, size;         
00437   unsigned char *data;          
00438 } memory_range_t;
00439 
00440 
00444 typedef struct {
00445   unsigned ok:1;                
00446   unsigned rev;                 
00447   unsigned mpfp;                
00448   unsigned mpconfig_ok:1;       
00449   unsigned mpconfig;            
00450   unsigned mpconfig_size;       
00451   unsigned char feature[5];     
00452   char oem_id[9];               
00453   char prod_id[13];             
00454   unsigned cpus, cpus_en;       
00455 } smp_info_t;
00456 
00457 
00461 typedef struct vbe_mode_info_s {
00462   unsigned number;              
00463   unsigned attributes;          
00464   unsigned width, height;       
00465   unsigned bytes_p_line;        
00466   unsigned pixel_size;          
00467   unsigned fb_start;            
00468   unsigned win_A_start;         
00469   unsigned win_A_attr;          
00470   unsigned win_B_start;         
00471   unsigned win_B_attr;          
00472   unsigned win_size;            
00473   unsigned win_gran;            
00474   unsigned pixel_clock;         
00475 } vbe_mode_info_t;
00476 
00482 typedef struct {
00483   unsigned ok:1;                
00484   unsigned version;             
00485   unsigned oem_version;         
00486   unsigned memory;              
00487   unsigned fb_start;            
00488   char *oem_name;               
00489   char *vendor_name;            
00490   char *product_name;           
00491   char *product_revision;       
00492   unsigned modes;               
00493   vbe_mode_info_t *mode;        
00494   unsigned current_mode;        
00495   unsigned ddc_ports;           
00496   unsigned char ddc_port[4][0x80];      
00497 } vbe_info_t;
00498 
00499 
00503 typedef struct {
00504     unsigned id;
00505     unsigned char slot;
00506     unsigned char bus;
00507     unsigned char devfn;
00508     unsigned char misc;
00509 } cpq_ctlorder_t; 
00510 
00511 
00512 typedef struct {
00513   unsigned ok:1;                
00514   unsigned entry;               
00515   unsigned compaq:1;            
00516   cpq_ctlorder_t cpq_ctrl[32];  
00517 } bios32_info_t;
00518 
00528 typedef enum {
00529   sm_biosinfo, sm_sysinfo, sm_boardinfo, sm_chassis,
00530   sm_processor, sm_memctrl, sm_memmodule, sm_cache,
00531   sm_connect, sm_slot, sm_onboard, sm_oem,
00532   sm_config, sm_lang, sm_group, sm_eventlog,
00533   sm_memarray, sm_memdevice, sm_memerror, sm_memarraymap,
00534   sm_memdevicemap, sm_mouse, sm_battery, sm_reset,
00535   sm_secure, sm_power, sm_voltage, sm_cool,
00536   sm_temperature, sm_current, sm_outofband, sm_bis,
00537   sm_boot, sm_mem64error, sm_mandev, sm_mandevcomp,
00538   sm_mdtd, sm_inactive = 126, sm_end = 127
00539 } hd_smbios_type_t;
00540 
00541 
00543 typedef struct {
00544   union u_hd_smbios_t *next;    
00545   hd_smbios_type_t type;        
00546   int data_len;                 
00547   unsigned char *data;          
00548   str_list_t *strings;          
00549   int handle;                   
00550 } smbios_any_t;
00551 
00552 
00554 typedef struct {
00555   union u_hd_smbios_t *next;
00556   hd_smbios_type_t type;
00557   int data_len;
00558   unsigned char *data;
00559   str_list_t *strings;
00560   int handle;
00561   char *vendor;                 
00562   char *version;                
00563   char *date;                   
00564   hd_bitmap_t feature;          
00565   unsigned start;               
00566   unsigned rom_size;            
00567 } smbios_biosinfo_t;
00568 
00569 
00571 typedef struct {
00572   union u_hd_smbios_t *next;
00573   hd_smbios_type_t type;
00574   int data_len;
00575   unsigned char *data;
00576   str_list_t *strings;
00577   int handle;
00578   char *manuf;                  
00579   char *product;                
00580   char *version;                
00581   char *serial;                 
00582   unsigned char uuid[16];       
00583   hd_id_t wake_up;              
00584 } smbios_sysinfo_t;
00585 
00586 
00588 typedef struct {
00589   union u_hd_smbios_t *next;
00590   hd_smbios_type_t type;
00591   int data_len;
00592   unsigned char *data;
00593   str_list_t *strings;
00594   int handle;
00595   char *manuf;                  
00596   char *product;                
00597   char *version;                
00598   char *serial;                 
00599   char *asset;                  
00600   hd_id_t board_type;           
00601   hd_bitmap_t feature;          
00602   char *location;               
00603   int chassis;                  
00604   int objects_len;              
00605   int *objects;                 
00606 } smbios_boardinfo_t;
00607 
00608 
00610 typedef struct {
00611   union u_hd_smbios_t *next;
00612   hd_smbios_type_t type;
00613   int data_len;
00614   unsigned char *data;
00615   str_list_t *strings;
00616   int handle;
00617   char *manuf;                  
00618   char *version;                
00619   char *serial;                 
00620   char *asset;                  
00621   hd_id_t ch_type;              
00622   unsigned lock;                
00623   hd_id_t bootup;               
00624   hd_id_t power;                
00625   hd_id_t thermal;              
00626   hd_id_t security;             
00627   unsigned oem;                 
00628 } smbios_chassis_t;
00629 
00630 
00632 typedef struct {
00633   union u_hd_smbios_t *next;
00634   hd_smbios_type_t type;
00635   int data_len;
00636   unsigned char *data;
00637   str_list_t *strings;
00638   int handle;
00639   char *socket;                 
00640   hd_id_t upgrade;              
00641   char *manuf;                  
00642   char *version;                
00643   char *serial;                 
00644   char *asset;                  
00645   char *part;                   
00646   hd_id_t pr_type;              
00647   hd_id_t family;               
00648   uint64_t cpu_id;              
00649   unsigned voltage;             
00650   unsigned ext_clock;           
00651   unsigned max_speed;           
00652   unsigned current_speed;       
00653   unsigned sock_status;         
00654   hd_id_t cpu_status;           
00655   int l1_cache;                 
00656   int l2_cache;                 
00657   int l3_cache;                 
00658 } smbios_processor_t;
00659 
00660 
00662 typedef struct {
00663   union u_hd_smbios_t *next;
00664   hd_smbios_type_t type;
00665   int data_len;
00666   unsigned char *data;
00667   str_list_t *strings;
00668   int handle;
00669   char *socket;                 
00670   unsigned max_size;            
00671   unsigned current_size;        
00672   unsigned speed;               
00673   hd_id_t mode;                 
00674   unsigned state;               
00675   hd_id_t location;             
00676   unsigned socketed;            
00677   unsigned level;               
00678   hd_id_t ecc;                  
00679   hd_id_t cache_type;           
00680   hd_id_t assoc;                
00681   hd_bitmap_t supp_sram;        
00682   hd_bitmap_t sram;             
00683 } smbios_cache_t;
00684 
00685 
00687 typedef struct {
00688   union u_hd_smbios_t *next;
00689   hd_smbios_type_t type;
00690   int data_len;
00691   unsigned char *data;
00692   str_list_t *strings;
00693   int handle;
00694   hd_id_t port_type;            
00695   char *i_des;                  
00696   hd_id_t i_type;               
00697   char *x_des;                  
00698   hd_id_t x_type;               
00699 } smbios_connect_t;
00700 
00701 
00703 typedef struct {
00704   union u_hd_smbios_t *next;
00705   hd_smbios_type_t type;
00706   int data_len;
00707   unsigned char *data;
00708   str_list_t *strings;
00709   int handle;
00710   char *desig;                  
00711   hd_id_t slot_type;            
00712   hd_id_t bus_width;            
00713   hd_id_t usage;                
00714   hd_id_t length;               
00715   unsigned id;                  
00716   hd_bitmap_t feature;          
00717 } smbios_slot_t;
00718 
00719 
00721 typedef struct {
00722   union u_hd_smbios_t *next;
00723   hd_smbios_type_t type;
00724   int data_len;
00725   unsigned char *data;
00726   str_list_t *strings;
00727   int handle;
00728   unsigned dev_len;             
00729   struct {
00730     char *name;                 
00731     hd_id_t type;               
00732     unsigned status;            
00733   } *dev;                       
00734 } smbios_onboard_t;
00735 
00736 
00738 typedef struct {
00739   union u_hd_smbios_t *next;
00740   hd_smbios_type_t type;
00741   int data_len;
00742   unsigned char *data;
00743   str_list_t *strings;
00744   int handle;
00745   str_list_t *oem_strings;      
00746 } smbios_oem_t;
00747 
00748 
00750 typedef struct {
00751   union u_hd_smbios_t *next;
00752   hd_smbios_type_t type;
00753   int data_len;
00754   unsigned char *data;
00755   str_list_t *strings;
00756   int handle;
00757   str_list_t *options;          
00758 } smbios_config_t;
00759 
00760 
00762 typedef struct {
00763   union u_hd_smbios_t *next;
00764   hd_smbios_type_t type;
00765   int data_len;
00766   unsigned char *data;
00767   str_list_t *strings;          
00768   int handle;
00769   char *current;                
00770 } smbios_lang_t;
00771 
00772 
00774 typedef struct {
00775   union u_hd_smbios_t *next;
00776   hd_smbios_type_t type;
00777   int data_len;
00778   unsigned char *data;
00779   str_list_t *strings;
00780   int handle;
00781   char *name;                   
00782   int items_len;                
00783   int *item_handles;            
00784 } smbios_group_t;
00785 
00786 
00788 typedef struct {
00789   union u_hd_smbios_t *next;
00790   hd_smbios_type_t type;
00791   int data_len;
00792   unsigned char *data;
00793   str_list_t *strings;
00794   int handle;
00795   hd_id_t location;             
00796   hd_id_t use;                  
00797   hd_id_t ecc;                  
00798   unsigned max_size;            
00799   int error_handle;             
00800   unsigned slots;               
00801 } smbios_memarray_t;
00802 
00803 
00805 typedef struct {
00806   union u_hd_smbios_t *next;
00807   hd_smbios_type_t type;
00808   int data_len;
00809   unsigned char *data;
00810   str_list_t *strings;
00811   int handle;
00812   char *location;               
00813   char *bank;                   
00814   char *manuf;                  
00815   char *serial;                 
00816   char *asset;                  
00817   char *part;                   
00818   int array_handle;             
00819   int error_handle;             
00820   unsigned width;               
00821   unsigned eccbits;             
00822   unsigned size;                
00823   hd_id_t form;                 
00824   unsigned set;                 
00825   hd_id_t mem_type;             
00826   hd_bitmap_t type_detail;      
00827   unsigned speed;               
00828 } smbios_memdevice_t;
00829 
00830 
00832 typedef struct {
00833   union u_hd_smbios_t *next;
00834   hd_smbios_type_t type;
00835   int data_len;
00836   unsigned char *data;
00837   str_list_t *strings;
00838   int handle;
00839   hd_id_t err_type;             
00840   hd_id_t granularity;          
00841   hd_id_t operation;            
00842   unsigned syndrome;            
00843   unsigned array_addr;          
00844   unsigned device_addr;         
00845   unsigned range;               
00846 } smbios_memerror_t;
00847 
00848 
00850 typedef struct {
00851   union u_hd_smbios_t *next;
00852   hd_smbios_type_t type;
00853   int data_len;
00854   unsigned char *data;
00855   str_list_t *strings;
00856   int handle;
00857   int array_handle;             
00858   uint64_t start_addr;          
00859   uint64_t end_addr;            
00860   unsigned part_width;          
00861 } smbios_memarraymap_t;
00862 
00863 
00865 typedef struct {
00866   union u_hd_smbios_t *next;
00867   hd_smbios_type_t type;
00868   int data_len;
00869   unsigned char *data;
00870   str_list_t *strings;
00871   int handle;
00872   int memdevice_handle;         
00873   int arraymap_handle;          
00874   uint64_t start_addr;          
00875   uint64_t end_addr;            
00876   unsigned row_pos;             
00877   unsigned interleave_pos;      
00878   unsigned interleave_depth;    
00879 } smbios_memdevicemap_t;
00880 
00881 
00883 typedef struct {
00884   union u_hd_smbios_t *next;
00885   hd_smbios_type_t type;
00886   int data_len;
00887   unsigned char *data;
00888   str_list_t *strings;
00889   int handle;
00890   hd_id_t mtype;                
00891   hd_id_t interface;            
00892   unsigned buttons;             
00893 } smbios_mouse_t;
00894 
00895 
00897 typedef struct {
00898   union u_hd_smbios_t *next;
00899   hd_smbios_type_t type;
00900   int data_len;
00901   unsigned char *data;
00902   str_list_t *strings;
00903   int handle;
00904   hd_id_t power;                
00905   hd_id_t keyboard;             
00906   hd_id_t admin;                
00907   hd_id_t reset;                
00908 } smbios_secure_t;
00909 
00910 
00912 typedef struct {
00913   union u_hd_smbios_t *next;
00914   hd_smbios_type_t type;
00915   int data_len;
00916   unsigned char *data;
00917   str_list_t *strings;
00918   int handle;
00919   unsigned month;               
00920   unsigned day;                 
00921   unsigned hour;                
00922   unsigned minute;              
00923   unsigned second;              
00924 } smbios_power_t;
00925 
00926 
00928 typedef struct {
00929   union u_hd_smbios_t *next;
00930   hd_smbios_type_t type;
00931   int data_len;
00932   unsigned char *data;
00933   str_list_t *strings;
00934   int handle;
00935   hd_id_t err_type;             
00936   hd_id_t granularity;          
00937   hd_id_t operation;            
00938   unsigned syndrome;            
00939   uint64_t array_addr;          
00940   uint64_t device_addr;         
00941   unsigned range;               
00942 } smbios_mem64error_t;
00943 
00944 
00946 typedef union u_hd_smbios_t {
00947   union u_hd_smbios_t *next;  
00948   smbios_any_t any;
00949   smbios_biosinfo_t biosinfo;
00950   smbios_sysinfo_t sysinfo;
00951   smbios_boardinfo_t boardinfo;
00952   smbios_chassis_t chassis;
00953   smbios_processor_t processor;
00954   smbios_cache_t cache;
00955   smbios_connect_t connect;
00956   smbios_slot_t slot;
00957   smbios_onboard_t onboard;
00958   smbios_oem_t oem;
00959   smbios_config_t config;
00960   smbios_lang_t lang;
00961   smbios_group_t group;
00962   smbios_memarray_t memarray;
00963   smbios_memdevice_t memdevice;
00964   smbios_memerror_t memerror;
00965   smbios_memarraymap_t memarraymap;
00966   smbios_memdevicemap_t memdevicemap;
00967   smbios_mouse_t mouse;
00968   smbios_secure_t secure;
00969   smbios_power_t power;
00970   smbios_mem64error_t mem64error;
00971 } hd_smbios_t;
00972 
00980 typedef struct s_udevinfo_t {
00981   struct s_udevinfo_t *next;
00982   char *sysfs;
00983   char *name;
00984   str_list_t *links;
00985 } hd_udevinfo_t;
00986 
00987 
00991 typedef struct s_sysfsdrv_t {
00992   struct s_sysfsdrv_t *next;
00993   char *driver;
00994   char *device;
00995   char *module;
00996 } hd_sysfsdrv_t;
00997 
00998 
01004 typedef struct {
01005   int type;
01006   unsigned major, minor, range;
01007 } hd_dev_num_t;
01008 
01009 
01024 typedef struct s_pci_t {
01025   struct s_pci_t *next;                         
01026   unsigned data_len;                            
01027   unsigned data_ext_len;                        
01028   unsigned char data[256];                      
01029   char *log;                                    
01030   unsigned flags,                               
01031            cmd,                                 
01032            hdr_type,                            
01033            secondary_bus;                       
01034   unsigned bus,                                 
01035            slot, func;                          
01036   unsigned base_class, sub_class, prog_if;      
01037   unsigned dev, vend, sub_dev, sub_vend, rev;   
01038   unsigned irq;                                 
01039   uint64_t base_addr[7];                        
01040   uint64_t base_len[7];                         
01041   unsigned addr_flags[7];                       
01042   uint64_t rom_base_addr;                       
01043   uint64_t rom_base_len;                        
01044   char *sysfs_id;                               
01045   char *sysfs_bus_id;                           
01046   char *modalias;                               
01047   unsigned edid_len;                            
01048   unsigned char edid[0x80];                     
01049 } pci_t;
01050 
01055 typedef enum pci_flags {
01056   pci_flag_ok, pci_flag_pm, pci_flag_agp
01057 } hd_pci_flags_t;
01058 
01059 
01064 typedef struct usb_s {
01065   struct usb_s *next;
01066   unsigned hd_idx;
01067   unsigned hd_base_idx;
01068   str_list_t *c, *d, *e, *i, *p, *s, *t;
01069   struct usb_s *cloned;
01070   int bus, dev_nr, lev, parent, port, count, conns, used_conns, ifdescr;
01071   unsigned speed;
01072   unsigned vendor, device, rev;
01073   char *manufact, *product, *serial;
01074   char *driver;
01075   memory_range_t raw_descr;
01076   int d_cls, d_sub, d_prot;
01077   int i_alt, i_cls, i_sub, i_prot;
01078   unsigned country;
01079 } usb_t;
01080 
01081 
01085 typedef struct {
01086   int len;
01087   int type;
01088   unsigned char *data;
01089 } isapnp_res_t;
01090 
01094 typedef struct {
01095   int csn;
01096   int log_devs;
01097   unsigned char *serial;
01098   unsigned char *card_regs;
01099   unsigned char (*ldev_regs)[0xd0];
01100   int res_len;
01101   unsigned broken:1;            
01102   isapnp_res_t *res;
01103 } isapnp_card_t;
01104 
01108 typedef struct {
01109   int read_port;
01110   int cards;
01111   isapnp_card_t *card;
01112 } isapnp_t;
01113 
01117 typedef struct {
01118   isapnp_card_t *card;
01119   int dev;
01120   unsigned flags;               
01121   unsigned ref:1;               
01122 } isapnp_dev_t;
01123 
01128 typedef enum isapnp_flags {
01129   isapnp_flag_act
01130 } hd_isapnp_flags_t;
01131 
01132 
01136 typedef struct scsi_s {
01137   struct scsi_s *next;
01138   unsigned deleted:1;
01139   unsigned generic:1;
01140   unsigned fake:1;
01141   char *dev_name;
01142   char *guessed_dev_name;
01143   int generic_dev;
01144   unsigned host, channel, id, lun;
01145   char *vendor, *model, *rev, *type_str, *serial;
01146   int type;
01147   unsigned inode_low;
01148   char *proc_dir, *driver;
01149   unsigned unique;
01150   char *info;
01151   unsigned lgeo_c, lgeo_h, lgeo_s;
01152   unsigned pgeo_c, pgeo_h, pgeo_s;
01153   uint64_t size;
01154   unsigned sec_size;
01155   unsigned cache;
01156   str_list_t *host_info;
01157   char *usb_guid;
01158   unsigned pci_info;
01159   unsigned pci_bus;
01160   unsigned pci_slot;
01161   unsigned pci_func;
01162   uint64_t wwpn;
01163   uint64_t fcp_lun;
01164   char *controller_id;
01165 } scsi_t;
01166 
01167 
01171 typedef struct devtree_s {
01172   struct devtree_s *next;
01173   struct devtree_s *parent;
01174   unsigned idx;
01175   char *path, *filename;
01176   unsigned pci:1;
01177   char *name, *model, *device_type, *compatible;
01178   int class_code;                       
01179   int vendor_id, device_id, subvendor_id, subdevice_id;
01180   int revision_id, interrupt;
01181   unsigned char *edid;                  
01182 } devtree_t;
01183 
01184 
01188 typedef struct ccw_s {
01189   unsigned char lcss;
01190   unsigned char cu_model;
01191   unsigned char dev_model;
01192 } ccw_t;
01193 
01194 
01198 typedef struct cdrom_info_s {
01199   struct cdrom_info_s *next;
01200   char *name;
01201   unsigned speed;
01202   unsigned cdr:1, cdrw:1, dvd:1, dvdr:1, dvdram:1;
01203   unsigned cdrom:1;             
01204   struct {
01205     unsigned ok:1;
01206     char *volume, *publisher, *preparer, *application, *creation_date;
01207   } iso9660;
01208   struct {
01209     unsigned ok:1;
01210     unsigned platform;
01211     char *id_string;
01212     unsigned bootable:1;
01213     unsigned media_type;        
01214     unsigned load_address;
01215     unsigned load_count;        
01216     unsigned start;             
01217     unsigned catalog;           
01218     struct {
01219       unsigned c, h, s;
01220       unsigned size;
01221     } geo;
01222     char *label;
01223   } el_torito;
01224 
01225 } cdrom_info_t;
01226 
01227 
01233 typedef struct {
01234   unsigned char block0[512];
01235 } floppy_info_t;
01236 
01237 
01241 typedef struct {
01242   unsigned apm_supported:1;
01243   unsigned apm_enabled:1;
01244   unsigned apm_ver, apm_subver;
01245   unsigned apm_bios_flags;
01246 
01247   unsigned vbe_ver;
01248   unsigned vbe_video_mem;
01249 
01250   unsigned ser_port0, ser_port1, ser_port2, ser_port3;
01251   unsigned par_port0, par_port1, par_port2;
01252 
01254   unsigned is_pnp_bios:1;
01255   unsigned pnp_id;
01256   unsigned lba_support:1;
01257 
01258   unsigned low_mem_size;
01259   smp_info_t smp;
01260   vbe_info_t vbe;
01261 
01262   unsigned smbios_ver;
01263 
01264   struct {
01265     unsigned width;
01266     unsigned height;
01267     unsigned xsize;
01268     unsigned ysize;
01269     char *vendor;
01270     char *name;
01271   } lcd;
01272 
01273   struct {
01274     char *vendor;
01275     char *type;
01276     unsigned bus;
01277     unsigned compat_vend;
01278     unsigned compat_dev;
01279   } mouse;
01280 
01281   struct {
01282     unsigned ok:1;
01283     unsigned scroll_lock:1;
01284     unsigned num_lock:1;
01285     unsigned caps_lock:1;
01286   } led;
01287 
01288   bios32_info_t bios32;
01289 
01290 } bios_info_t;
01291 
01292 
01296 typedef struct {
01297   unsigned has_color:1;
01298   unsigned color;
01299 } prom_info_t;
01300 
01301 
01305 typedef struct {
01306   char *system_type;
01307   char *generation;
01308   char *vendor;
01309   char *model;
01310   char *serial;
01311   char *lang;
01312   char *formfactor;
01313 } sys_info_t;
01314 
01315 
01319 typedef struct {
01320   unsigned manu_year;
01321   unsigned min_vsync, max_vsync;        
01322   unsigned min_hsync, max_hsync;        
01323   unsigned clock;                       
01324   unsigned width, height;               
01325   unsigned width_mm, height_mm;         
01326   unsigned hdisp, hsyncstart, hsyncend, htotal; 
01327   unsigned vdisp, vsyncstart, vsyncend, vtotal; 
01328   char hflag,vflag; 
01329   char *vendor;
01330   char *name;
01331   char *serial;
01332 } monitor_info_t;
01333 
01340 typedef enum cpu_arch {
01341   arch_unknown = 0,
01342   arch_intel,
01343   arch_alpha,
01344   arch_sparc, arch_sparc64,
01345   arch_ppc, arch_ppc64,
01346   arch_68k,
01347   arch_ia64,
01348   arch_s390, arch_s390x,
01349   arch_arm,
01350   arch_mips,
01351   arch_x86_64
01352 } hd_cpu_arch_t;
01353 
01357 typedef enum boot_arch {
01358   boot_unknown = 0,
01359   boot_lilo, boot_milo, boot_aboot, boot_silo, boot_ppc, boot_elilo, boot_s390,
01360   boot_mips, boot_grub
01361 } hd_boot_arch_t;
01362 
01363 
01372 typedef struct {
01373   enum cpu_arch architecture;
01374   unsigned family;              
01375   unsigned model;               
01376   unsigned stepping;
01377   unsigned cache;
01378   unsigned clock;
01379   unsigned units;               
01380   char *vend_name;              
01381   char *model_name;             
01382   char *platform;               
01383   str_list_t *features;         
01384   double bogo;                  
01385 } cpu_info_t;
01386 
01387 
01392 typedef struct {
01393   uint64_t sectors;
01394   struct {
01395     unsigned cyls, heads, sectors;
01396   } edd;
01397   struct {
01398     unsigned cyls, heads, sectors;
01399   } legacy;
01400   unsigned ext_fixed_disk:1;
01401   unsigned ext_lock_eject:1;
01402   unsigned ext_edd:1;
01403   unsigned ext_64bit:1;
01404   unsigned assigned:1;
01405   char *sysfs_id;
01406   unsigned hd_idx;
01407 } edd_info_t;
01408 
01414 typedef struct {
01415   unsigned data_len, data_max;
01416   unsigned *data;
01417   unsigned names_len, names_max;
01418   char *names;
01419 } hddb_data_t;
01420 
01424 typedef uint32_t hddb_entry_mask_t;
01425 
01429 typedef struct hddb_list_s {   
01430   hddb_entry_mask_t key_mask;
01431   hddb_entry_mask_t value_mask;
01432   unsigned key;
01433   unsigned value;
01434 } hddb_list_t;
01435 
01439 typedef struct {
01440   unsigned list_len, list_max;
01441   hddb_list_t *list;
01442   unsigned ids_len, ids_max;
01443   unsigned *ids;
01444   unsigned strings_len, strings_max;
01445   char *strings;
01446 } hddb2_data_t;
01447 
01448 
01452 typedef enum modinfo_type_e { mi_none = 0, mi_pci, mi_other } modinfo_type_t;
01453 
01457 typedef struct {
01458   char *module;
01459   char *alias;
01460   modinfo_type_t type;
01461   union {
01462     struct {
01463       struct {
01464         unsigned vendor:1;
01465         unsigned device:1;
01466         unsigned sub_vendor:1;
01467         unsigned sub_device:1;
01468         unsigned base_class:1;
01469         unsigned sub_class:1;
01470         unsigned prog_if:1;
01471       } has;
01472       unsigned vendor;
01473       unsigned device;
01474       unsigned sub_vendor;
01475       unsigned sub_device;
01476       unsigned base_class;
01477       unsigned sub_class;
01478       unsigned prog_if;
01479     } pci;
01480 
01481     struct {
01482       struct {
01483         unsigned vendor:1;
01484         unsigned product:1;
01485         unsigned device_class:1;
01486         unsigned device_subclass:1;
01487       } has;
01488       unsigned vendor;
01489       unsigned product;
01490       unsigned device_class;
01491       unsigned device_subclass;
01492     } usb;
01493   };
01494 } modinfo_t;
01495 
01496 
01500 typedef enum {
01501   p_invalid, p_string, p_int32, p_uint64, p_double, p_bool, p_list
01502 } hal_prop_type_t;
01503 
01504 
01508 typedef struct hal_prop_s {
01509   struct hal_prop_s *next;
01510   hal_prop_type_t type;
01511   char *key;
01512   union {
01513     char *str;
01514     int32_t int32;
01515     uint64_t uint64;
01516     double d;     
01517     int b;
01518     str_list_t *list;
01519   } val;  
01520 } hal_prop_t;
01521 
01522 
01526 typedef struct hal_device_s {
01527   struct hal_device_s *next, *parent;
01528   char *udi;
01529   unsigned used:1;
01530   hal_prop_t *prop;
01531 } hal_device_t;
01532 
01533 
01537 typedef enum resource_types {
01538   res_any, res_phys_mem, res_mem, res_io, res_irq, res_dma, res_monitor,
01539   res_size, res_disk_geo, res_cache, res_baud, res_init_strings, res_pppd_option,
01540   res_framebuffer, res_hwaddr, res_link, res_wlan
01541 } hd_resource_types_t;
01542 
01543 
01547 typedef enum size_units {
01548   size_unit_cm, size_unit_cinch, size_unit_byte, size_unit_sectors,
01549   size_unit_kbyte, size_unit_mbyte, size_unit_gbyte, size_unit_mm
01550 } hd_size_units_t;
01551 
01555 typedef enum access_flags {
01556   acc_unknown,          
01557   acc_ro,               
01558   acc_wo,               
01559   acc_rw                
01560 } hd_access_flags_t;
01561 
01562 
01563 typedef enum yes_no_flag {
01564   flag_unknown,         
01565   flag_no,              
01566   flag_yes              
01567 } hd_yes_no_flag_t;
01568 
01569 
01570 typedef enum geo_types {
01571   geo_physical = 0, 
01572   geo_logical, 
01573   geo_bios_edd, 
01574   geo_bios_legacy
01575 } hd_geo_types_t;
01576 
01577 
01584 typedef struct {
01585   union u_hd_res_t *next;
01586   enum resource_types type;
01587 } res_any_t;
01588 
01589 typedef struct {
01590   union u_hd_res_t *next;
01591   enum resource_types type;
01592   uint64_t base, range;
01593   unsigned
01594     enabled:1,                  
01595     access:2,                   
01596     prefetch:2;                 
01597 } res_mem_t;
01598 
01599 typedef struct {
01600   union u_hd_res_t *next;
01601   enum resource_types type;
01602   uint64_t range;
01603 } res_phys_mem_t;
01604 
01605 typedef struct {
01606   union u_hd_res_t *next;
01607   enum resource_types type;
01608   uint64_t base, range;
01609   unsigned
01610     enabled:1,                          
01611     access:2;                           
01612 } res_io_t;
01613 
01614 typedef struct {
01615   union u_hd_res_t *next;
01616   enum resource_types type;
01617   unsigned base;
01618   unsigned triggered;                   
01619   unsigned enabled:1;                   
01620 } res_irq_t;
01621 
01622 typedef struct {
01623   union u_hd_res_t *next;
01624   enum resource_types type;
01625   unsigned base;
01626   unsigned enabled:1;                   
01627 } res_dma_t;
01628 
01629 typedef struct {
01630   union u_hd_res_t *next;
01631   enum resource_types type;
01632   enum size_units unit;
01633   uint64_t val1, val2;                  
01634 } res_size_t;
01635 
01636 typedef struct {
01637   union u_hd_res_t *next;
01638   enum resource_types type;
01639   unsigned speed;
01640   unsigned bits, stopbits;
01641   char parity;                          
01642   char handshake;                       
01643 } res_baud_t;
01644 
01645 typedef struct {
01646   union u_hd_res_t *next;
01647   enum resource_types type;
01648   unsigned size;                        
01649 } res_cache_t;
01650 
01651 typedef struct {
01652   union u_hd_res_t *next;
01653   enum resource_types type;
01654   unsigned cyls, heads, sectors;
01655   uint64_t size;
01656   enum geo_types geotype;               
01657 } res_disk_geo_t;
01658 
01659 typedef struct {
01660   union u_hd_res_t *next;
01661   enum resource_types type;
01662   unsigned width, height;               
01663   unsigned vfreq;                       
01664   unsigned interlaced:1;                
01665 } res_monitor_t;
01666 
01667 typedef struct {
01668   union u_hd_res_t *next;
01669   enum resource_types type;
01670   char *init1;
01671   char *init2;
01672 } res_init_strings_t;
01673 
01674 typedef struct {
01675   union u_hd_res_t *next;
01676   enum resource_types type;
01677   char *option;
01678 } res_pppd_option_t;
01679 
01680 typedef struct {
01681   union u_hd_res_t *next;
01682   enum resource_types type;
01683   unsigned width, height;               
01684   unsigned bytes_p_line;                
01685   unsigned colorbits;                   
01686   unsigned mode;                        
01687 } res_framebuffer_t;
01688 
01689 typedef struct {
01690   union u_hd_res_t *next;
01691   enum resource_types type;
01692   char *addr;
01693 } res_hwaddr_t;
01694 
01695 typedef struct {
01696   union u_hd_res_t *next;
01697   enum resource_types type;
01698   unsigned state:1;                     
01699 } res_link_t;
01700 
01702 typedef struct {
01703   union u_hd_res_t *next;
01704   enum resource_types type;
01705   str_list_t *channels;
01706   str_list_t *frequencies; 
01707   str_list_t *bitrates;    
01708   str_list_t *auth_modes;  
01709   str_list_t *enc_modes;   
01710 } res_wlan_t;
01711 
01713 typedef union u_hd_res_t {
01714   union u_hd_res_t *next;  
01715   res_any_t any;
01716   res_io_t io;
01717   res_mem_t mem;
01718   res_phys_mem_t phys_mem;
01719   res_irq_t irq;
01720   res_dma_t dma;
01721   res_size_t size;
01722   res_cache_t cache;
01723   res_baud_t baud;
01724   res_disk_geo_t disk_geo;
01725   res_monitor_t monitor;
01726   res_init_strings_t init_strings;
01727   res_pppd_option_t pppd_option;
01728   res_framebuffer_t framebuffer;
01729   res_hwaddr_t hwaddr;
01730   res_link_t link;
01731   res_wlan_t wlan;
01732 } hd_res_t;
01733 
01742 typedef struct {
01743   uint64_t addr, size;
01744   char *dev;
01745   unsigned tag;
01746 } misc_io_t;
01747 
01748 typedef struct {
01749   unsigned channel;
01750   char *dev;
01751   unsigned tag;
01752 } misc_dma_t;
01753 
01754 typedef struct {
01755   unsigned irq, events;
01756   int devs;
01757   char **dev;
01758   unsigned tag;
01759 } misc_irq_t;
01760 
01761 typedef struct {
01762   unsigned io_len, dma_len, irq_len;
01763   misc_io_t *io;
01764   misc_dma_t *dma;
01765   misc_irq_t *irq;
01766   str_list_t *proc_io, *proc_dma, *proc_irq;
01767 } misc_t;
01768 
01774 typedef struct s_serial_t {
01775   struct s_serial_t *next;
01776   char *name;
01777   char *device;
01778   unsigned line, port, irq, baud;
01779 } serial_t;
01780 
01784 typedef struct s_ser_device_t {
01785   struct s_ser_device_t *next;
01786   unsigned hd_idx;
01787   char *dev_name;
01788   str_list_t *at_resp;
01789   int fd;
01790   struct termios tio;
01791   unsigned max_baud, cur_baud;
01792   unsigned is_mouse:1;
01793   unsigned is_modem:1;
01794   unsigned do_io:1;
01795   unsigned char buf[0x1000];
01796   int buf_len;
01797   int garbage, non_pnp, pnp;
01798   unsigned char pnp_id[8];
01799   char *serial, *class_name, *dev_id, *user_name, *vend, *init_string1, *init_string2, *pppd_option;
01800   unsigned pnp_rev;
01801   unsigned bits;
01802 } ser_device_t;
01803 
01817 typedef struct isdn_parm_s {
01818   struct isdn_parm_s *next;
01819   char *name;                           
01820   unsigned valid:1;                     
01821   unsigned conflict:1;                  
01822   uint64_t value;                       
01823   unsigned type;                        
01824   unsigned flags;                       
01825   unsigned def_value;                   
01826   int alt_values;                       
01827   unsigned *alt_value;                  
01828 } isdn_parm_t;
01829 
01831 typedef enum driver_info_type {
01832   di_any, di_display, di_module, di_mouse, di_x11, di_isdn, di_kbd, di_dsl
01833 } hd_driver_info_t;
01834 
01836 typedef struct {
01837   union driver_info_u *next;
01838   enum driver_info_type type;           
01839   str_list_t *hddb0, *hddb1;            
01840 } driver_info_any_t;
01841 
01843 typedef struct {
01844   union driver_info_u *next;
01845   enum driver_info_type type;           
01846   str_list_t *hddb0, *hddb1;            
01847   unsigned width, height;               
01848   unsigned min_vsync, max_vsync;        
01849   unsigned min_hsync, max_hsync;        
01850   unsigned bandwidth;                   
01851   unsigned hdisp, hsyncstart, hsyncend, htotal; 
01852   unsigned vdisp, vsyncstart, vsyncend, vtotal; 
01853   char hflag,vflag; 
01854 } driver_info_display_t;
01855 
01857 typedef struct {
01858   union driver_info_u *next;
01859   enum driver_info_type type;           
01860   str_list_t *hddb0, *hddb1;            
01861   unsigned active:1;                    
01862   unsigned modprobe:1;                  
01863   str_list_t *names;                    
01864   str_list_t *mod_args;                 
01865   char *conf;                           
01866 } driver_info_module_t;
01867 
01869 typedef struct {
01870   union driver_info_u *next;
01871   enum driver_info_type type;           
01872   str_list_t *hddb0, *hddb1;            
01873   char *xf86;                           
01874   char *gpm;                            
01875   int buttons;                          
01876   int wheels;                           
01877 } driver_info_mouse_t;
01878 
01880 typedef struct {
01881   union driver_info_u *next;
01882   enum driver_info_type type;           
01883   str_list_t *hddb0, *hddb1;            
01884   char *server;                         
01885   char *xf86_ver;                       
01886   unsigned x3d:1;                       
01887   struct {
01888     unsigned all:5;                     
01889     unsigned c8:1, c15:1, c16:1, c24:1, c32:1;
01890   } colors;                             
01891   unsigned dacspeed;                    
01892   str_list_t *extensions;               
01893   str_list_t *options;                  
01894   str_list_t *raw;                      
01895   char *script;                         
01896 } driver_info_x11_t;
01897 
01899 typedef struct {
01900   union driver_info_u *next;
01901   enum driver_info_type type;           
01902   str_list_t *hddb0, *hddb1;            
01903   int i4l_type, i4l_subtype;            
01904   char *i4l_name;                       
01905   isdn_parm_t *params;                  
01906 } driver_info_isdn_t;
01907 
01909 typedef struct {
01910   union driver_info_u *next;
01911   enum driver_info_type type;           
01912   str_list_t *hddb0, *hddb1;            
01913   char *mode;                           
01914   char *name;                           
01915 } driver_info_dsl_t;
01916 
01918 typedef struct {
01919   union driver_info_u *next;
01920   enum driver_info_type type;           
01921   str_list_t *hddb0, *hddb1;            
01922   char *XkbRules;                       
01923   char *XkbModel;
01924   char *XkbLayout;
01925   char *keymap;                         
01926 } driver_info_kbd_t;
01927 
01928 /*
01929  * holds device driver info
01930  */
01931 typedef union driver_info_u {
01932   union driver_info_u *next;
01933   driver_info_any_t any;
01934   driver_info_module_t module;
01935   driver_info_mouse_t mouse;
01936   driver_info_x11_t x11;
01937   driver_info_display_t display;
01938   driver_info_isdn_t isdn;
01939   driver_info_dsl_t dsl;
01940   driver_info_kbd_t kbd;
01941 } driver_info_t;
01942 
01953 typedef enum hd_detail_type {
01954   hd_detail_pci, hd_detail_usb, hd_detail_isapnp, hd_detail_cdrom,
01955   hd_detail_floppy, hd_detail_bios, hd_detail_cpu, hd_detail_prom,
01956   hd_detail_monitor, hd_detail_sys, hd_detail_scsi, hd_detail_devtree,
01957   hd_detail_ccw
01958 } hd_detail_type_t;
01959 
01960 typedef struct {
01961   enum hd_detail_type type;
01962   pci_t *data;
01963 } hd_detail_pci_t;
01964 
01965 typedef struct {
01966   enum hd_detail_type type;
01967   usb_t *data;
01968 } hd_detail_usb_t;
01969 
01970 typedef struct {
01971   enum hd_detail_type type;
01972   isapnp_dev_t *data;
01973 } hd_detail_isapnp_t;
01974 
01975 typedef struct {
01976   enum hd_detail_type type;
01977   cdrom_info_t *data;
01978 } hd_detail_cdrom_t;
01979 
01980 typedef struct {
01981   enum hd_detail_type type;
01982   floppy_info_t *data;
01983 } hd_detail_floppy_t;
01984 
01985 typedef struct {
01986   enum hd_detail_type type;
01987   bios_info_t *data;
01988 } hd_detail_bios_t;
01989 
01990 typedef struct {
01991   enum hd_detail_type type;
01992   cpu_info_t *data;
01993 } hd_detail_cpu_t;
01994 
01995 typedef struct {
01996   enum hd_detail_type type;
01997   prom_info_t *data;
01998 } hd_detail_prom_t;
01999 
02000 typedef struct {
02001   enum hd_detail_type type;
02002   monitor_info_t *data;
02003 } hd_detail_monitor_t;
02004 
02005 typedef struct {
02006   enum hd_detail_type type;
02007   sys_info_t *data;
02008 } hd_detail_sys_t;
02009 
02010 typedef struct {
02011   enum hd_detail_type type;
02012   scsi_t *data;
02013 } hd_detail_scsi_t;
02014 
02015 typedef struct {
02016   enum hd_detail_type type;
02017   devtree_t *data;
02018 } hd_detail_devtree_t;
02019 
02020 typedef struct {
02021   enum hd_detail_type type;
02022   ccw_t *data;
02023 } hd_detail_ccw_t;
02024 
02025 typedef union {
02026   enum hd_detail_type type;
02027   hd_detail_pci_t pci;
02028   hd_detail_usb_t usb;
02029   hd_detail_isapnp_t isapnp;
02030   hd_detail_cdrom_t cdrom;
02031   hd_detail_floppy_t floppy;
02032   hd_detail_bios_t bios;
02033   hd_detail_cpu_t cpu;
02034   hd_detail_prom_t prom;
02035   hd_detail_monitor_t monitor;
02036   hd_detail_sys_t sys;
02037   hd_detail_scsi_t scsi;
02038   hd_detail_devtree_t devtree;
02039   hd_detail_ccw_t ccw;
02040 } hd_detail_t;
02041 
02054 typedef struct hd_manual_s {
02055   struct hd_manual_s *next;
02056 
02057   char *unique_id;
02058   char *parent_id;
02059   char *child_ids;
02060   unsigned hw_class;
02061   char *model;
02062 
02063   hd_status_t status;
02064   char *config_string;
02065 
02066   /* More or less free-form key, value pairs.
02067    * key should not contain '=', however.
02068    */
02069   str_list_t *key;
02070   str_list_t *value;
02071 } hd_manual_t;
02072 
02073 
02079 typedef struct s_hd_t {
02080   struct s_hd_t *next;          
02086   unsigned idx;
02087 
02093   unsigned broken:1;
02094 
02098   hd_id_t bus;
02099 
02104   unsigned slot;
02105 
02109   unsigned func;
02110 
02114   hd_id_t base_class;
02115 
02119   hd_id_t sub_class;
02120 
02124   hd_id_t prog_if;
02125 
02132   hd_id_t vendor;
02133 
02142   hd_id_t device;
02143 
02150   hd_id_t sub_vendor;
02151 
02158   hd_id_t sub_device;
02159 
02165   hd_id_t revision;
02166 
02170   char *serial;
02171 
02176   hd_id_t compat_vendor;
02177 
02182   hd_id_t compat_device;
02183 
02188   hd_hw_item_t hw_class;
02189 
02194   unsigned char hw_class_list[(hw_all + 7) / 8];        
02202   char *model;
02203 
02209   unsigned attached_to;
02210 
02214   char *sysfs_id;
02215 
02219   char *sysfs_bus_id;
02220 
02224   char *sysfs_device_link;
02225 
02231   char *unix_dev_name;
02232 
02236   hd_dev_num_t unix_dev_num;
02237 
02244   str_list_t *unix_dev_names;
02245 
02252   char *unix_dev_name2;
02253 
02257   hd_dev_num_t unix_dev_num2;
02258 
02265   char *rom_id;
02266 
02270   char *udi;
02271 
02275   char *parent_udi;
02276 
02287   char *unique_id;
02288 
02290   str_list_t *unique_ids;
02291 
02295   unsigned module;
02296 
02300   unsigned line;
02301 
02305   unsigned count;
02306 
02310   hd_res_t *res;
02311 
02316   hd_detail_t *detail;
02317 
02323   str_list_t *extra_info;
02324 
02330   hd_status_t status;
02331 
02338   char *config_string;
02339 
02344   hd_hotplug_t hotplug;
02345 
02350   unsigned hotplug_slot;
02351 
02352   struct is_s {
02353     unsigned agp:1;             
02354     unsigned isapnp:1;          
02355     unsigned notready:1;        
02356     unsigned manual:1;          
02357     unsigned softraiddisk:1;    
02358     unsigned zip:1;             
02359     unsigned cdr:1;             
02360     unsigned cdrw:1;            
02361     unsigned dvd:1;             
02362     unsigned dvdr:1;            
02363     unsigned dvdrw:1;           
02364     unsigned dvdpr:1;           
02365     unsigned dvdprw:1;          
02366     unsigned dvdprdl:1;         
02367     unsigned dvdram:1;          
02368     unsigned pppoe:1;           
02369     unsigned wlan:1;            
02370     unsigned with_acpi:1;       
02371     unsigned hotpluggable:1;    
02372   } is;
02373 
02374   struct tag_s {                
02375     unsigned remove:1;          
02376     unsigned freeit:1;          
02377     unsigned fixed:1;           
02378     unsigned ser_skip:1;        
02379     unsigned ser_device:2;      
02380   } tag;
02381 
02387   unsigned char *block0;
02388 
02392   char *driver;
02393 
02397   char *driver_module;
02398 
02402   str_list_t *drivers;
02403 
02407   str_list_t *driver_modules;
02408 
02416   char *old_unique_id;
02417 
02423   char *parent_id;
02424 
02430   str_list_t *child_ids;
02431 
02436   char *unique_id1;
02437 
02444   char *usb_guid;
02445 
02446   driver_info_t *driver_info;   
02448   str_list_t *requires;         
02450   hal_prop_t *hal_prop;         
02452   hal_prop_t *persistent_prop;  
02454   char *modalias;               
02456   /*
02457    * These are used internally for memory management.
02458    * Do not even _think_ of modifying these!
02459    */
02460   unsigned ref_cnt;             
02461   struct s_hd_t *ref;           
02462 } hd_t;
02463 
02464 
02468 typedef struct {
02474   hd_t *hd;
02475 
02484   void (*progress)(char *pos, char *msg);
02485   
02490   char *log;
02491 
02499   unsigned debug;
02500 
02506   struct flag_struct {
02507     unsigned internal:1;        
02508     unsigned dformat:2;         
02509     unsigned no_parport:1;      
02510     unsigned iseries:1;         
02511     unsigned list_all:1;        
02512     unsigned fast:1;            
02513     unsigned list_md:1;         
02514     unsigned nofork:1;          
02515     unsigned nosysfs:1;         
02516     unsigned forked:1;          
02517     unsigned cpuemu:1;          
02518     unsigned udev:1;            
02519     unsigned edd_used:1;        
02520     unsigned keep_kmods:2;      
02521     unsigned nobioscrc:1;       
02522     unsigned biosvram:1;        
02523     unsigned nowpa:1;           
02524     unsigned pata:1;            
02525   } flags;
02526 
02527 
02532   str_list_t *only;
02533 
02534   /*
02535    * The following entries should *not* be accessed outside of libhd!
02536    */
02537   unsigned char probe[(pr_all + 7) / 8];        
02538   unsigned char probe_set[(pr_all + 7) / 8];    
02539   unsigned char probe_clr[(pr_all + 7) / 8];    
02540   unsigned last_idx;            
02541   unsigned module;              
02542   enum boot_arch boot;          
02543   hd_t *old_hd;                 
02544   pci_t *pci;                   
02545   isapnp_t *isapnp;             
02546   cdrom_info_t *cdrom;          
02547   str_list_t *net;              
02548   str_list_t *floppy;           
02549   misc_t *misc;                 
02550   serial_t *serial;             
02551   scsi_t *scsi;                 
02552   ser_device_t *ser_mouse;      
02553   ser_device_t *ser_modem;      
02554   str_list_t *cpu;              
02555   str_list_t *klog;             
02556   str_list_t *proc_usb;         
02557   usb_t *usb;                   
02558   modinfo_t *modinfo_ext;       
02559   modinfo_t *modinfo;           
02560   hddb2_data_t *hddb2[2];       
02561   str_list_t *kmods;            
02562   uint64_t used_irqs;           
02563   uint64_t assigned_irqs;       
02564   memory_range_t bios_rom;      
02565   memory_range_t bios_ram;      
02566   memory_range_t bios_ebda;     
02567   unsigned display;             
02568   unsigned color_code;          
02569   char *cmd_line;               
02570   str_list_t *xtra_hd;          
02571   devtree_t *devtree;           
02572   unsigned kernel_version;      
02573   int in_vmware;                
02574   hd_t *manual;                 
02575   str_list_t *disks;            
02576   str_list_t *partitions;       
02577   str_list_t *cdroms;           
02578   hd_smbios_t *smbios;          
02579   struct {
02580     unsigned ok:1;
02581     unsigned size;
02582     unsigned used;
02583     void *data;
02584     int id;
02585     int updated;
02586   } shm;                        
02587   unsigned pci_config_type;     
02588   hd_udevinfo_t *udevinfo;      
02589   hd_sysfsdrv_t *sysfsdrv;      
02590   uint64_t sysfsdrv_id;         
02591   str_list_t *scanner_db;       
02592   edd_info_t edd[0x80];         
02593   hal_device_t *hal;            
02594 } hd_data_t;
02595 
02596 
02597 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
02598  *
02599  *                      libhd interface functions
02600  *
02601  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
02602  */
02603 
02604 /* implemented in hd.c */
02605 
02607 void hd_scan(hd_data_t *hd_data);
02608 
02610 hd_data_t *hd_free_hd_data(hd_data_t *hd_data);
02611 
02613 hd_t *hd_free_hd_list(hd_t *hd);
02614 
02615 void hd_set_probe_feature(hd_data_t *hd_data, enum probe_feature feature);
02616 void hd_clear_probe_feature(hd_data_t *hd_data, enum probe_feature feature);
02617 int hd_probe_feature(hd_data_t *hd_data, enum probe_feature feature);
02618 void hd_set_probe_feature_hw(hd_data_t *hd_data, hd_hw_item_t item);
02619 
02620 enum probe_feature hd_probe_feature_by_name(char *name);
02621 char *hd_probe_feature_by_value(enum probe_feature feature);
02622 
02623 int hd_module_is_active(hd_data_t *hd_data, char *mod);
02624 
02625 hd_t *hd_base_class_list(hd_data_t *hd_data, unsigned base_class);
02626 hd_t *hd_sub_class_list(hd_data_t *hd_data, unsigned base_class, unsigned sub_class);
02627 hd_t *hd_bus_list(hd_data_t *hd_data, unsigned bus);
02628 const char* hd_busid_to_hwcfg(int busid);
02629 hd_t *hd_list(hd_data_t *hd_data, hd_hw_item_t item, int rescan, hd_t *hd_old);
02630 hd_t *hd_list_with_status(hd_data_t *hd_data, hd_hw_item_t item, hd_status_t status);
02631 hd_t *hd_list2(hd_data_t *hd_data, hd_hw_item_t *items, int rescan);
02632 hd_t *hd_list_with_status2(hd_data_t *hd_data, hd_hw_item_t *items, hd_status_t status);
02633 
02634 void hd_add_driver_data(hd_data_t *hd_data, hd_t *hd);
02635 
02636 int hd_has_pcmcia(hd_data_t *hd_data);
02637 #if 0
02638 
02642 int hd_apm_enabled(hd_data_t *hd_data);
02643 #endif
02644 int hd_usb_support(hd_data_t *hd_data);
02645 int hd_smp_support(hd_data_t *hd_data);
02646 int hd_mac_color(hd_data_t *hd_data);
02647 int hd_color(hd_data_t *hd_data);
02648 int hd_is_uml(hd_data_t *hd_data);
02649 int hd_is_xen(hd_data_t *hd_data);
02650 unsigned hd_display_adapter(hd_data_t *hd_data);
02651 unsigned hd_boot_disk(hd_data_t *hd_data, int *matches);
02652 enum cpu_arch hd_cpu_arch(hd_data_t *hd_data);
02653 enum boot_arch hd_boot_arch(hd_data_t *hd_data);
02654 
02655 hd_t *hd_get_device_by_idx(hd_data_t *hd_data, unsigned idx);
02656 
02657 void hd_set_hw_class(hd_t *hd, hd_hw_item_t hw_class);
02658 int hd_is_hw_class(hd_t *hd, hd_hw_item_t hw_class);
02659 
02660 int hd_is_sgi_altix(hd_data_t *hd_data);
02661 
02662 char *hd_version(void);
02663 
02664 hal_prop_t *hd_free_hal_properties(hal_prop_t *prop);
02665 hal_prop_t *hd_read_properties(const char *udi);
02666 int hd_write_properties(const char *udi, hal_prop_t *prop);
02667 
02668 int hd_change_status(const char *id, hd_status_t status, const char *config_string);
02669 int hd_change_config_status(hd_data_t *hd_data, const char *id, hd_status_t status, const char *config_string);
02670 int hd_read_mmap(hd_data_t *hd_data, char *name, unsigned char *buf, off_t start, unsigned size);
02671 
02672 /* implemented in hddb.c */
02673 
02677 str_list_t *hddb_get_packages(hd_data_t *hd_data);
02678 void hddb_add_info(hd_data_t *hd_data, hd_t *hd);
02679 
02680 void hddb_dump_raw(hddb2_data_t *hddb, FILE *f);
02681 void hddb_dump(hddb2_data_t *hddb, FILE *f);
02682 
02683 
02684 /* implemented in hdp.c */
02685 void hd_dump_entry(hd_data_t *hd_data, hd_t *hd, FILE *f);
02686 
02687 /* implemented in cdrom.c */
02688 cdrom_info_t *hd_read_cdrom_info(hd_data_t *hd_data, hd_t *hd);
02689 
02697 hd_manual_t *hd_manual_read_entry(hd_data_t *hd_data, const char *id);
02698 int hd_manual_write_entry(hd_data_t *hd_data, hd_manual_t *entry);
02699 hd_manual_t *hd_free_manual(hd_manual_t *manual);
02700 hd_t *hd_read_config(hd_data_t *hd_data, const char *id);
02701 int hd_write_config(hd_data_t *hd_data, hd_t *hd);
02702 char *hd_hw_item_name(hd_hw_item_t item);
02703 hd_hw_item_t hd_hw_item_type(char *name);
02704 char *hd_status_value_name(hd_status_value_t status);
02705 
02716 #define CDBISDN_VERSION 0x0101
02717 
02718 #ifndef PCI_ANY_ID
02719 #define PCI_ANY_ID      0xffff
02720 #endif
02721 
02722 #define CDBISDN_P_NONE  0x0
02723 #define CDBISDN_P_IRQ   0x1
02724 #define CDBISDN_P_MEM   0x2
02725 #define CDBISDN_P_IO    0x3
02726 
02728 typedef struct {
02729         char    *name;
02730         char    *shortname;
02731         int     vnr;
02732         int     refcnt;
02733 } cdb_isdn_vendor;
02734 
02735 typedef struct  {
02736         int     handle;         
02737         int     vhandle;        
02738         char    *name;          
02739         char    *lname;         
02740         char    *Class;         
02741         char    *bus;           
02742         int     revision;       
02743         int     vendor;         
02744         int     device;         
02745         int     subvendor;      
02747         int     subdevice;      
02749         unsigned int features;  
02750         int     line_cnt;       
02751         int     vario_cnt;      
02752         int     vario;          
02753 } cdb_isdn_card;
02754 
02755 typedef struct  {
02756         int     handle;         
02757         int     next_vario;     
02758         int     drvid;          
02759         int     typ;            
02760         int     subtyp;         
02761         int     smp;            
02762         char    *mod_name;      
02763         char    *para_str;      
02764         char    *mod_preload;   
02765         char    *cfg_prog;      
02766         char    *firmware;      
02767         char    *description;   
02768         char    *need_pkg;      
02769         char    *info;          
02770         char    *protocol;      
02771         char    *interface;     
02772         char    *io;            
02773         char    *irq;           
02774         char    *membase;       
02775         char    *features;      
02776         int     card_ref;       
02777         char    *name;          
02778 } cdb_isdn_vario;
02779 
02780 
02781 extern cdb_isdn_vendor  *hd_cdbisdn_get_vendor(int);
02782 extern cdb_isdn_card    *hd_cdbisdn_get_card(int);
02783 extern cdb_isdn_vario   *hd_cdbisdn_get_vario_from_type(int, int);
02784 extern cdb_isdn_card    *hd_cdbisdn_get_card_from_type(int, int);
02785 extern cdb_isdn_card    *hd_cdbisdn_get_card_from_id(int, int, int, int);
02786 extern cdb_isdn_vario   *hd_cdbisdn_get_vario(int);
02787 extern int              hd_cdbisdn_get_version(void);
02788 extern int              hd_cdbisdn_get_db_version(void);
02789 extern char             *hd_cdbisdn_get_db_date(void);
02790 
02796 #ifdef __cplusplus
02797 }
02798 #endif
02799 
02802 #endif  /* _HD_H */