• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files

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      14
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, hw_fingerprint,
00145   hw_unknown, hw_all                            
00146 } hd_hw_item_t;
00147 
00155 typedef enum base_classes {
00156   // these *must* match standard PCI class numbers
00157   bc_none, bc_storage, bc_network, bc_display, bc_multimedia,
00158   bc_memory, bc_bridge, bc_comm, bc_system, bc_input, bc_docking,
00159   bc_processor, bc_serial, bc_wireless, bc_i2o, bc_other = 0xff,
00160 
00161   // add our own classes here (starting at 0x100 as PCI values are 8 bit)
00162   bc_monitor = 0x100, bc_internal, bc_modem, bc_isdn, bc_ps2, bc_mouse,
00163   bc_storage_device, bc_network_interface, bc_keyboard, bc_printer,
00164   bc_hub, bc_braille, bc_scanner, bc_joystick, bc_chipcard, bc_camera,
00165   bc_framebuffer, bc_dvb, bc_tv, bc_partition, bc_dsl, bc_bluetooth, bc_fingerprint
00166 } hd_base_classes_t;
00167 
00169 typedef enum sc_monitor {
00170   sc_mon_other, sc_mon_crt, sc_mon_lcd
00171 } hd_sc_monitor_t;
00172 
00174 typedef enum sc_storage {
00175   sc_sto_scsi, sc_sto_ide, sc_sto_floppy, sc_sto_ipi, sc_sto_raid,
00176   sc_sto_other = 0x80
00177 } hd_sc_storage_t;
00178 
00180 typedef enum sc_display {
00181   sc_dis_vga, sc_dis_xga, sc_dis_other = 0x80
00182 } hd_sc_display_t;
00183 
00185 typedef enum sc_framebuffer {
00186   sc_fb_vesa = 1
00187 } hd_sc_framebuffer_t;
00188 
00190 typedef enum sc_bridge { 
00191   sc_bridge_host, sc_bridge_isa, sc_bridge_eisa, sc_bridge_mc,
00192   sc_bridge_pci, sc_bridge_pcmcia, sc_bridge_nubus, sc_bridge_cardbus,
00193   sc_bridge_other = 0x80
00194 } hd_sc_bridge_t;
00195 
00197 typedef enum sc_comm { 
00198   sc_com_ser, sc_com_par, sc_com_multi, sc_com_modem, sc_com_other = 0x80
00199 } hd_sc_comm_t;
00200 
00202 typedef enum sc_system {
00203   sc_sys_pic, sc_sys_dma, sc_sys_timer, sc_sys_rtc, sc_sys_other = 0x80
00204 } hd_sc_system_t;
00205 
00207 typedef enum sc_input {
00208   sc_inp_keyb, sc_inp_digit, sc_inp_mouse, sc_inp_other = 0x80
00209 } hd_sc_input_t;
00210 
00212 typedef enum sc_serial {
00213   sc_ser_fire, sc_ser_access, sc_ser_ssa, sc_ser_usb, sc_ser_fiber,
00214   sc_ser_smbus, sc_ser_other = 0x80
00215 } hd_sc_serial_t;
00216 
00218 typedef enum sc_internal {
00219   sc_int_none, sc_int_isapnp_if, sc_int_main_mem, sc_int_cpu, sc_int_fpu,
00220   sc_int_bios, sc_int_prom, sc_int_sys
00221 } hd_sc_internal_t;
00222 
00224 typedef enum sc_mouse {
00225   sc_mou_ps2, sc_mou_ser, sc_mou_bus, sc_mou_usb, sc_mou_sun,
00226   sc_mou_other = 0x80
00227 } hd_sc_mouse_t;
00228 
00230 typedef enum sc_std {
00231   sc_sdev_disk, sc_sdev_tape, sc_sdev_cdrom, sc_sdev_floppy, sc_sdev_scanner,
00232   sc_sdev_other = 0x80
00233 } hd_sc_std_t;
00234 
00236 typedef enum sc_net_if {
00237   sc_nif_loopback, sc_nif_ethernet, sc_nif_tokenring, sc_nif_fddi,
00238   sc_nif_ctc, sc_nif_iucv, sc_nif_hsi, sc_nif_qeth,
00239   sc_nif_escon, sc_nif_myrinet, sc_nif_wlan, sc_nif_xp,
00240   sc_nif_usb, sc_nif_other = 0x80, sc_nif_sit
00241 } hd_sc_net_if_t;
00242 
00244 typedef enum sc_multimedia {
00245   sc_multi_video, sc_multi_audio, sc_multi_other
00246 } hd_sc_multimedia_t;
00247 
00249 typedef enum sc_keyboard {
00250   sc_keyboard_kbd, sc_keyboard_console
00251 } hd_sc_keyboard_t;
00252 
00254 typedef enum sc_hub {
00255   sc_hub_other, sc_hub_usb
00256 } hd_sc_hub_t;
00257 
00259 typedef enum sc_camera {
00260   sc_camera_webcam, sc_camera_digital
00261 } hd_sc_camera_t;
00262 
00264 typedef enum sc_modem {
00265   sc_mod_at, sc_mod_win1, sc_mod_win2, sc_mod_win3, sc_mod_win4
00266 } hd_sc_modem_t;
00267 
00269 typedef enum sc_dsl {
00270   sc_dsl_unknown, sc_dsl_pppoe, sc_dsl_capi, sc_dsl_capiisdn
00271 } hd_sc_dsl_t;
00272 
00274 typedef enum pif_usb_e {
00275   pif_usb_uhci = 0, pif_usb_ohci = 0x10, pif_usb_ehci = 0x20,
00276   pif_usb_other = 0x80, pif_usb_device = 0xfe
00277 } hd_pif_usb_t;
00278 
00280 typedef enum pif_cdrom {
00281   pif_cdrom, pif_cdr, pif_cdrw, pif_dvd, pif_dvdr, pif_dvdram
00282 } hd_pif_cdrom_t ;
00283 
00285 typedef enum pif_s390disk {
00286   pif_scsi, pif_dasd, pif_dasd_fba
00287 } hd_pif_s390disk_t;
00288 
00290 typedef enum bus_types {
00291   bus_none, bus_isa, bus_eisa, bus_mc, bus_pci, bus_pcmcia, bus_nubus,
00292   bus_cardbus, bus_other,
00293 
00295   bus_ps2 = 0x80, bus_serial, bus_parallel, bus_floppy, bus_scsi, bus_ide, bus_usb,
00296   bus_adb, bus_raid, bus_sbus, bus_i2o, bus_vio, bus_ccw, bus_iucv, bus_ps3_system_bus
00297 } 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[4];                         
01048   unsigned char edid_data[4][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 enum pmac_model {
01185         AAPL_3400,
01186         AAPL_3500,
01187         AAPL_7200,
01188         AAPL_7300,
01189         AAPL_7500,
01190         AAPL_8500,
01191         AAPL_9500,
01192         AAPL_Gossamer,
01193         AAPL_PowerBook1998,
01194         AAPL_PowerMac_G3,
01195         AAPL_ShinerESB,
01196         AAPL_e407,
01197         AAPL_e411,
01198         PowerBook1_1,
01199         PowerBook2_1,
01200         PowerBook2_2,
01201         PowerBook3_1,
01202         PowerBook3_2,
01203         PowerBook3_3,
01204         PowerBook3_4,
01205         PowerBook3_5,
01206         PowerBook4_1,
01207         PowerBook4_2,
01208         PowerBook4_3,
01209         PowerBook5_1,
01210         PowerBook5_2,
01211         PowerBook5_3,
01212         PowerBook5_4,
01213         PowerBook5_5,
01214         PowerBook5_6,
01215         PowerBook5_7,
01216         PowerBook5_8,
01217         PowerBook5_9,
01218         PowerBook6_1,
01219         PowerBook6_2,
01220         PowerBook6_3,
01221         PowerBook6_4,
01222         PowerBook6_5,
01223         PowerBook6_7,
01224         PowerBook6_8,
01225         PowerMac1_1,
01226         PowerMac1_2,
01227         PowerMac10_1,
01228         PowerMac11_2,
01229         PowerMac12_1,
01230         PowerMac2_1,
01231         PowerMac2_2,
01232         PowerMac3_1,
01233         PowerMac3_2,
01234         PowerMac3_3,
01235         PowerMac3_4,
01236         PowerMac3_5,
01237         PowerMac3_6,
01238         PowerMac4_1,
01239         PowerMac4_2,
01240         PowerMac4_4,
01241         PowerMac5_1,
01242         PowerMac6_1,
01243         PowerMac6_3,
01244         PowerMac6_4,
01245         PowerMac7_2,
01246         PowerMac7_3,
01247         PowerMac8_1,
01248         PowerMac9_1,
01249         RackMac1_1,
01250         RackMac1_2,
01251         RackMac3_1,
01252         iMac_1,
01253 };
01257 struct pmac_mb_def {
01258   enum pmac_model model;
01259   const char *string;
01260 };
01261 
01265 typedef struct ccw_s {
01266   unsigned char lcss;
01267   unsigned char cu_model;
01268   unsigned char dev_model;
01269 } ccw_t;
01270 
01271 
01275 typedef struct cdrom_info_s {
01276   struct cdrom_info_s *next;
01277   char *name;
01278   unsigned speed;
01279   unsigned cdr:1, cdrw:1, dvd:1, dvdr:1, dvdram:1;
01280   unsigned cdrom:1;             
01281   struct {
01282     unsigned ok:1;
01283     char *volume, *publisher, *preparer, *application, *creation_date;
01284   } iso9660;
01285   struct {
01286     unsigned ok:1;
01287     unsigned platform;
01288     char *id_string;
01289     unsigned bootable:1;
01290     unsigned media_type;        
01291     unsigned load_address;
01292     unsigned load_count;        
01293     unsigned start;             
01294     unsigned catalog;           
01295     struct {
01296       unsigned c, h, s;
01297       unsigned size;
01298     } geo;
01299     char *label;
01300   } el_torito;
01301 
01302 } cdrom_info_t;
01303 
01304 
01310 typedef struct {
01311   unsigned char block0[512];
01312 } floppy_info_t;
01313 
01314 
01318 typedef struct {
01319   unsigned apm_supported:1;
01320   unsigned apm_enabled:1;
01321   unsigned apm_ver, apm_subver;
01322   unsigned apm_bios_flags;
01323 
01324   unsigned vbe_ver;
01325   unsigned vbe_video_mem;
01326 
01327   unsigned ser_port0, ser_port1, ser_port2, ser_port3;
01328   unsigned par_port0, par_port1, par_port2;
01329 
01331   unsigned is_pnp_bios:1;
01332   unsigned pnp_id;
01333   unsigned lba_support:1;
01334 
01335   unsigned low_mem_size;
01336   smp_info_t smp;
01337   vbe_info_t vbe;
01338 
01339   unsigned smbios_ver;
01340 
01341   struct {
01342     unsigned width;
01343     unsigned height;
01344     unsigned xsize;
01345     unsigned ysize;
01346     char *vendor;
01347     char *name;
01348   } lcd;
01349 
01350   struct {
01351     char *vendor;
01352     char *type;
01353     unsigned bus;
01354     unsigned compat_vend;
01355     unsigned compat_dev;
01356   } mouse;
01357 
01358   struct {
01359     unsigned ok:1;
01360     unsigned scroll_lock:1;
01361     unsigned num_lock:1;
01362     unsigned caps_lock:1;
01363   } led;
01364 
01365   bios32_info_t bios32;
01366 
01367 } bios_info_t;
01368 
01369 
01373 typedef struct {
01374   unsigned has_color:1;
01375   unsigned color;
01376 } prom_info_t;
01377 
01378 
01382 typedef struct {
01383   char *system_type;
01384   char *generation;
01385   char *vendor;
01386   char *model;
01387   char *serial;
01388   char *lang;
01389   char *formfactor;
01390 } sys_info_t;
01391 
01392 
01396 typedef struct {
01397   unsigned manu_year;
01398   unsigned min_vsync, max_vsync;        
01399   unsigned min_hsync, max_hsync;        
01400   unsigned clock;                       
01401   unsigned width, height;               
01402   unsigned width_mm, height_mm;         
01403   unsigned hdisp, hsyncstart, hsyncend, htotal; 
01404   unsigned vdisp, vsyncstart, vsyncend, vtotal; 
01405   char hflag,vflag; 
01406   char *vendor;
01407   char *name;
01408   char *serial;
01409 } monitor_info_t;
01410 
01417 typedef enum cpu_arch {
01418   arch_unknown = 0,
01419   arch_intel,
01420   arch_alpha,
01421   arch_sparc, arch_sparc64,
01422   arch_ppc, arch_ppc64,
01423   arch_68k,
01424   arch_ia64,
01425   arch_s390, arch_s390x,
01426   arch_arm,
01427   arch_mips,
01428   arch_x86_64
01429 } hd_cpu_arch_t;
01430 
01434 typedef enum boot_arch {
01435   boot_unknown = 0,
01436   boot_lilo, boot_milo, boot_aboot, boot_silo, boot_ppc, boot_elilo, boot_s390,
01437   boot_mips, boot_grub
01438 } hd_boot_arch_t;
01439 
01440 
01449 typedef struct {
01450   enum cpu_arch architecture;
01451   unsigned family;              
01452   unsigned model;               
01453   unsigned stepping;
01454   unsigned cache;
01455   unsigned clock;
01456   unsigned units;               
01457   char *vend_name;              
01458   char *model_name;             
01459   char *platform;               
01460   str_list_t *features;         
01461   double bogo;                  
01462 } cpu_info_t;
01463 
01464 
01469 typedef struct {
01470   uint64_t sectors;
01471   struct {
01472     unsigned cyls, heads, sectors;
01473   } edd;
01474   struct {
01475     unsigned cyls, heads, sectors;
01476   } legacy;
01477   unsigned ext_fixed_disk:1;
01478   unsigned ext_lock_eject:1;
01479   unsigned ext_edd:1;
01480   unsigned ext_64bit:1;
01481   unsigned assigned:1;
01482   unsigned valid:1;
01483   char *sysfs_id;
01484   unsigned hd_idx;
01485   unsigned signature;
01486 } edd_info_t;
01487 
01493 typedef struct {
01494   unsigned data_len, data_max;
01495   unsigned *data;
01496   unsigned names_len, names_max;
01497   char *names;
01498 } hddb_data_t;
01499 
01503 typedef uint32_t hddb_entry_mask_t;
01504 
01508 typedef struct hddb_list_s {   
01509   hddb_entry_mask_t key_mask;
01510   hddb_entry_mask_t value_mask;
01511   unsigned key;
01512   unsigned value;
01513 } hddb_list_t;
01514 
01518 typedef struct {
01519   unsigned list_len, list_max;
01520   hddb_list_t *list;
01521   unsigned ids_len, ids_max;
01522   unsigned *ids;
01523   unsigned strings_len, strings_max;
01524   char *strings;
01525 } hddb2_data_t;
01526 
01527 
01531 typedef enum modinfo_type_e { mi_none = 0, mi_pci, mi_other } modinfo_type_t;
01532 
01536 typedef struct {
01537   char *module;
01538   char *alias;
01539   modinfo_type_t type;
01540   union {
01541     struct {
01542       struct {
01543         unsigned vendor:1;
01544         unsigned device:1;
01545         unsigned sub_vendor:1;
01546         unsigned sub_device:1;
01547         unsigned base_class:1;
01548         unsigned sub_class:1;
01549         unsigned prog_if:1;
01550       } has;
01551       unsigned vendor;
01552       unsigned device;
01553       unsigned sub_vendor;
01554       unsigned sub_device;
01555       unsigned base_class;
01556       unsigned sub_class;
01557       unsigned prog_if;
01558     } pci;
01559 
01560     struct {
01561       struct {
01562         unsigned vendor:1;
01563         unsigned product:1;
01564         unsigned device_class:1;
01565         unsigned device_subclass:1;
01566       } has;
01567       unsigned vendor;
01568       unsigned product;
01569       unsigned device_class;
01570       unsigned device_subclass;
01571     } usb;
01572   };
01573 } modinfo_t;
01574 
01575 
01579 typedef enum {
01580   p_invalid, p_string, p_int32, p_uint64, p_double, p_bool, p_list
01581 } hal_prop_type_t;
01582 
01583 
01587 typedef struct hal_prop_s {
01588   struct hal_prop_s *next;
01589   hal_prop_type_t type;
01590   char *key;
01591   union {
01592     char *str;
01593     int32_t int32;
01594     uint64_t uint64;
01595     double d;     
01596     int b;
01597     str_list_t *list;
01598   } val;  
01599 } hal_prop_t;
01600 
01601 
01605 typedef struct hal_device_s {
01606   struct hal_device_s *next, *parent;
01607   char *udi;
01608   unsigned used:1;
01609   hal_prop_t *prop;
01610 } hal_device_t;
01611 
01612 
01616 typedef enum resource_types {
01617   res_any, res_phys_mem, res_mem, res_io, res_irq, res_dma, res_monitor,
01618   res_size, res_disk_geo, res_cache, res_baud, res_init_strings, res_pppd_option,
01619   res_framebuffer, res_hwaddr, res_link, res_wlan
01620 } hd_resource_types_t;
01621 
01622 
01626 typedef enum size_units {
01627   size_unit_cm, size_unit_cinch, size_unit_byte, size_unit_sectors,
01628   size_unit_kbyte, size_unit_mbyte, size_unit_gbyte, size_unit_mm
01629 } hd_size_units_t;
01630 
01634 typedef enum access_flags {
01635   acc_unknown,          
01636   acc_ro,               
01637   acc_wo,               
01638   acc_rw                
01639 } hd_access_flags_t;
01640 
01641 
01642 typedef enum yes_no_flag {
01643   flag_unknown,         
01644   flag_no,              
01645   flag_yes              
01646 } hd_yes_no_flag_t;
01647 
01648 
01649 typedef enum geo_types {
01650   geo_physical = 0, 
01651   geo_logical, 
01652   geo_bios_edd, 
01653   geo_bios_legacy
01654 } hd_geo_types_t;
01655 
01656 
01663 typedef struct {
01664   union u_hd_res_t *next;
01665   enum resource_types type;
01666 } res_any_t;
01667 
01668 typedef struct {
01669   union u_hd_res_t *next;
01670   enum resource_types type;
01671   uint64_t base, range;
01672   unsigned
01673     enabled:1,                  
01674     access:2,                   
01675     prefetch:2;                 
01676 } res_mem_t;
01677 
01678 typedef struct {
01679   union u_hd_res_t *next;
01680   enum resource_types type;
01681   uint64_t range;
01682 } res_phys_mem_t;
01683 
01684 typedef struct {
01685   union u_hd_res_t *next;
01686   enum resource_types type;
01687   uint64_t base, range;
01688   unsigned
01689     enabled:1,                          
01690     access:2;                           
01691 } res_io_t;
01692 
01693 typedef struct {
01694   union u_hd_res_t *next;
01695   enum resource_types type;
01696   unsigned base;
01697   unsigned triggered;                   
01698   unsigned enabled:1;                   
01699 } res_irq_t;
01700 
01701 typedef struct {
01702   union u_hd_res_t *next;
01703   enum resource_types type;
01704   unsigned base;
01705   unsigned enabled:1;                   
01706 } res_dma_t;
01707 
01708 typedef struct {
01709   union u_hd_res_t *next;
01710   enum resource_types type;
01711   enum size_units unit;
01712   uint64_t val1, val2;                  
01713 } res_size_t;
01714 
01715 typedef struct {
01716   union u_hd_res_t *next;
01717   enum resource_types type;
01718   unsigned speed;
01719   unsigned bits, stopbits;
01720   char parity;                          
01721   char handshake;                       
01722 } res_baud_t;
01723 
01724 typedef struct {
01725   union u_hd_res_t *next;
01726   enum resource_types type;
01727   unsigned size;                        
01728 } res_cache_t;
01729 
01730 typedef struct {
01731   union u_hd_res_t *next;
01732   enum resource_types type;
01733   unsigned cyls, heads, sectors;
01734   uint64_t size;
01735   enum geo_types geotype;               
01736 } res_disk_geo_t;
01737 
01738 typedef struct {
01739   union u_hd_res_t *next;
01740   enum resource_types type;
01741   unsigned width, height;               
01742   unsigned vfreq;                       
01743   unsigned interlaced:1;                
01744 } res_monitor_t;
01745 
01746 typedef struct {
01747   union u_hd_res_t *next;
01748   enum resource_types type;
01749   char *init1;
01750   char *init2;
01751 } res_init_strings_t;
01752 
01753 typedef struct {
01754   union u_hd_res_t *next;
01755   enum resource_types type;
01756   char *option;
01757 } res_pppd_option_t;
01758 
01759 typedef struct {
01760   union u_hd_res_t *next;
01761   enum resource_types type;
01762   unsigned width, height;               
01763   unsigned bytes_p_line;                
01764   unsigned colorbits;                   
01765   unsigned mode;                        
01766 } res_framebuffer_t;
01767 
01768 typedef struct {
01769   union u_hd_res_t *next;
01770   enum resource_types type;
01771   char *addr;
01772 } res_hwaddr_t;
01773 
01774 typedef struct {
01775   union u_hd_res_t *next;
01776   enum resource_types type;
01777   unsigned state:1;                     
01778 } res_link_t;
01779 
01781 typedef struct {
01782   union u_hd_res_t *next;
01783   enum resource_types type;
01784   str_list_t *channels;
01785   str_list_t *frequencies; 
01786   str_list_t *bitrates;    
01787   str_list_t *auth_modes;  
01788   str_list_t *enc_modes;   
01789 } res_wlan_t;
01790 
01792 typedef union u_hd_res_t {
01793   union u_hd_res_t *next;  
01794   res_any_t any;
01795   res_io_t io;
01796   res_mem_t mem;
01797   res_phys_mem_t phys_mem;
01798   res_irq_t irq;
01799   res_dma_t dma;
01800   res_size_t size;
01801   res_cache_t cache;
01802   res_baud_t baud;
01803   res_disk_geo_t disk_geo;
01804   res_monitor_t monitor;
01805   res_init_strings_t init_strings;
01806   res_pppd_option_t pppd_option;
01807   res_framebuffer_t framebuffer;
01808   res_hwaddr_t hwaddr;
01809   res_link_t link;
01810   res_wlan_t wlan;
01811 } hd_res_t;
01812 
01821 typedef struct {
01822   uint64_t addr, size;
01823   char *dev;
01824   unsigned tag;
01825 } misc_io_t;
01826 
01827 typedef struct {
01828   unsigned channel;
01829   char *dev;
01830   unsigned tag;
01831 } misc_dma_t;
01832 
01833 typedef struct {
01834   unsigned irq, events;
01835   int devs;
01836   char **dev;
01837   unsigned tag;
01838 } misc_irq_t;
01839 
01840 typedef struct {
01841   unsigned io_len, dma_len, irq_len;
01842   misc_io_t *io;
01843   misc_dma_t *dma;
01844   misc_irq_t *irq;
01845   str_list_t *proc_io, *proc_dma, *proc_irq;
01846 } misc_t;
01847 
01853 typedef struct s_serial_t {
01854   struct s_serial_t *next;
01855   char *name;
01856   char *device;
01857   unsigned line, port, irq, baud;
01858 } serial_t;
01859 
01863 typedef struct s_ser_device_t {
01864   struct s_ser_device_t *next;
01865   unsigned hd_idx;
01866   char *dev_name;
01867   str_list_t *at_resp;
01868   int fd;
01869   struct termios tio;
01870   unsigned max_baud, cur_baud;
01871   unsigned is_mouse:1;
01872   unsigned is_modem:1;
01873   unsigned do_io:1;
01874   unsigned char buf[0x1000];
01875   int buf_len;
01876   int garbage, non_pnp, pnp;
01877   unsigned char pnp_id[8];
01878   char *serial, *class_name, *dev_id, *user_name, *vend, *init_string1, *init_string2, *pppd_option;
01879   unsigned pnp_rev;
01880   unsigned bits;
01881 } ser_device_t;
01882 
01896 typedef struct isdn_parm_s {
01897   struct isdn_parm_s *next;
01898   char *name;                           
01899   unsigned valid:1;                     
01900   unsigned conflict:1;                  
01901   uint64_t value;                       
01902   unsigned type;                        
01903   unsigned flags;                       
01904   unsigned def_value;                   
01905   int alt_values;                       
01906   unsigned *alt_value;                  
01907 } isdn_parm_t;
01908 
01910 typedef enum driver_info_type {
01911   di_any, di_display, di_module, di_mouse, di_x11, di_isdn, di_kbd, di_dsl
01912 } hd_driver_info_t;
01913 
01915 typedef struct {
01916   union driver_info_u *next;
01917   enum driver_info_type type;           
01918   str_list_t *hddb0, *hddb1;            
01919 } driver_info_any_t;
01920 
01922 typedef struct {
01923   union driver_info_u *next;
01924   enum driver_info_type type;           
01925   str_list_t *hddb0, *hddb1;            
01926   unsigned width, height;               
01927   unsigned min_vsync, max_vsync;        
01928   unsigned min_hsync, max_hsync;        
01929   unsigned bandwidth;                   
01930   unsigned hdisp, hsyncstart, hsyncend, htotal; 
01931   unsigned vdisp, vsyncstart, vsyncend, vtotal; 
01932   char hflag,vflag; 
01933 } driver_info_display_t;
01934 
01936 typedef struct {
01937   union driver_info_u *next;
01938   enum driver_info_type type;           
01939   str_list_t *hddb0, *hddb1;            
01940   unsigned active:1;                    
01941   unsigned modprobe:1;                  
01942   str_list_t *names;                    
01943   str_list_t *mod_args;                 
01944   char *conf;                           
01945 } driver_info_module_t;
01946 
01948 typedef struct {
01949   union driver_info_u *next;
01950   enum driver_info_type type;           
01951   str_list_t *hddb0, *hddb1;            
01952   char *xf86;                           
01953   char *gpm;                            
01954   int buttons;                          
01955   int wheels;                           
01956 } driver_info_mouse_t;
01957 
01959 typedef struct {
01960   union driver_info_u *next;
01961   enum driver_info_type type;           
01962   str_list_t *hddb0, *hddb1;            
01963   char *server;                         
01964   char *xf86_ver;                       
01965   unsigned x3d:1;                       
01966   struct {
01967     unsigned all:5;                     
01968     unsigned c8:1, c15:1, c16:1, c24:1, c32:1;
01969   } colors;                             
01970   unsigned dacspeed;                    
01971   str_list_t *extensions;               
01972   str_list_t *options;                  
01973   str_list_t *raw;                      
01974   char *script;                         
01975 } driver_info_x11_t;
01976 
01978 typedef struct {
01979   union driver_info_u *next;
01980   enum driver_info_type type;           
01981   str_list_t *hddb0, *hddb1;            
01982   int i4l_type, i4l_subtype;            
01983   char *i4l_name;                       
01984   isdn_parm_t *params;                  
01985 } driver_info_isdn_t;
01986 
01988 typedef struct {
01989   union driver_info_u *next;
01990   enum driver_info_type type;           
01991   str_list_t *hddb0, *hddb1;            
01992   char *mode;                           
01993   char *name;                           
01994 } driver_info_dsl_t;
01995 
01997 typedef struct {
01998   union driver_info_u *next;
01999   enum driver_info_type type;           
02000   str_list_t *hddb0, *hddb1;            
02001   char *XkbRules;                       
02002   char *XkbModel;
02003   char *XkbLayout;
02004   char *keymap;                         
02005 } driver_info_kbd_t;
02006 
02007 /*
02008  * holds device driver info
02009  */
02010 typedef union driver_info_u {
02011   union driver_info_u *next;
02012   driver_info_any_t any;
02013   driver_info_module_t module;
02014   driver_info_mouse_t mouse;
02015   driver_info_x11_t x11;
02016   driver_info_display_t display;
02017   driver_info_isdn_t isdn;
02018   driver_info_dsl_t dsl;
02019   driver_info_kbd_t kbd;
02020 } driver_info_t;
02021 
02032 typedef enum hd_detail_type {
02033   hd_detail_pci, hd_detail_usb, hd_detail_isapnp, hd_detail_cdrom,
02034   hd_detail_floppy, hd_detail_bios, hd_detail_cpu, hd_detail_prom,
02035   hd_detail_monitor, hd_detail_sys, hd_detail_scsi, hd_detail_devtree,
02036   hd_detail_ccw
02037 } hd_detail_type_t;
02038 
02039 typedef struct {
02040   enum hd_detail_type type;
02041   pci_t *data;
02042 } hd_detail_pci_t;
02043 
02044 typedef struct {
02045   enum hd_detail_type type;
02046   usb_t *data;
02047 } hd_detail_usb_t;
02048 
02049 typedef struct {
02050   enum hd_detail_type type;
02051   isapnp_dev_t *data;
02052 } hd_detail_isapnp_t;
02053 
02054 typedef struct {
02055   enum hd_detail_type type;
02056   cdrom_info_t *data;
02057 } hd_detail_cdrom_t;
02058 
02059 typedef struct {
02060   enum hd_detail_type type;
02061   floppy_info_t *data;
02062 } hd_detail_floppy_t;
02063 
02064 typedef struct {
02065   enum hd_detail_type type;
02066   bios_info_t *data;
02067 } hd_detail_bios_t;
02068 
02069 typedef struct {
02070   enum hd_detail_type type;
02071   cpu_info_t *data;
02072 } hd_detail_cpu_t;
02073 
02074 typedef struct {
02075   enum hd_detail_type type;
02076   prom_info_t *data;
02077 } hd_detail_prom_t;
02078 
02079 typedef struct hd_detail_monitor_s {
02080   enum hd_detail_type type;
02081   monitor_info_t *data;
02082   struct hd_detail_monitor_s *next;
02083 } hd_detail_monitor_t;
02084 
02085 typedef struct {
02086   enum hd_detail_type type;
02087   sys_info_t *data;
02088 } hd_detail_sys_t;
02089 
02090 typedef struct {
02091   enum hd_detail_type type;
02092   scsi_t *data;
02093 } hd_detail_scsi_t;
02094 
02095 typedef struct {
02096   enum hd_detail_type type;
02097   devtree_t *data;
02098 } hd_detail_devtree_t;
02099 
02100 typedef struct {
02101   enum hd_detail_type type;
02102   ccw_t *data;
02103 } hd_detail_ccw_t;
02104 
02105 typedef union {
02106   enum hd_detail_type type;
02107   hd_detail_pci_t pci;
02108   hd_detail_usb_t usb;
02109   hd_detail_isapnp_t isapnp;
02110   hd_detail_cdrom_t cdrom;
02111   hd_detail_floppy_t floppy;
02112   hd_detail_bios_t bios;
02113   hd_detail_cpu_t cpu;
02114   hd_detail_prom_t prom;
02115   hd_detail_monitor_t monitor;
02116   hd_detail_sys_t sys;
02117   hd_detail_scsi_t scsi;
02118   hd_detail_devtree_t devtree;
02119   hd_detail_ccw_t ccw;
02120 } hd_detail_t;
02121 
02134 typedef struct hd_manual_s {
02135   struct hd_manual_s *next;
02136 
02137   char *unique_id;
02138   char *parent_id;
02139   char *child_ids;
02140   unsigned hw_class;
02141   char *model;
02142 
02143   hd_status_t status;
02144   char *config_string;
02145 
02146   /* More or less free-form key, value pairs.
02147    * key should not contain '=', however.
02148    */
02149   str_list_t *key;
02150   str_list_t *value;
02151 } hd_manual_t;
02152 
02153 
02159 typedef struct s_hd_t {
02160   struct s_hd_t *next;          
02166   unsigned idx;
02167 
02173   unsigned broken:1;
02174 
02178   hd_id_t bus;
02179 
02184   unsigned slot;
02185 
02189   unsigned func;
02190 
02194   hd_id_t base_class;
02195 
02199   hd_id_t sub_class;
02200 
02204   hd_id_t prog_if;
02205 
02212   hd_id_t vendor;
02213 
02222   hd_id_t device;
02223 
02230   hd_id_t sub_vendor;
02231 
02238   hd_id_t sub_device;
02239 
02245   hd_id_t revision;
02246 
02250   char *serial;
02251 
02256   hd_id_t compat_vendor;
02257 
02262   hd_id_t compat_device;
02263 
02268   hd_hw_item_t hw_class;
02269 
02274   unsigned char hw_class_list[(hw_all + 7) / 8];        
02282   char *model;
02283 
02289   unsigned attached_to;
02290 
02294   char *sysfs_id;
02295 
02299   char *sysfs_bus_id;
02300 
02304   char *sysfs_device_link;
02305 
02311   char *unix_dev_name;
02312 
02316   hd_dev_num_t unix_dev_num;
02317 
02324   str_list_t *unix_dev_names;
02325 
02332   char *unix_dev_name2;
02333 
02337   hd_dev_num_t unix_dev_num2;
02338 
02345   char *rom_id;
02346 
02350   char *udi;
02351 
02355   char *parent_udi;
02356 
02367   char *unique_id;
02368 
02370   str_list_t *unique_ids;
02371 
02375   unsigned module;
02376 
02380   unsigned line;
02381 
02385   unsigned count;
02386 
02390   hd_res_t *res;
02391 
02396   hd_detail_t *detail;
02397 
02403   str_list_t *extra_info;
02404 
02410   hd_status_t status;
02411 
02418   char *config_string;
02419 
02424   hd_hotplug_t hotplug;
02425 
02430   unsigned hotplug_slot;
02431 
02432   struct is_s {
02433     unsigned agp:1;             
02434     unsigned isapnp:1;          
02435     unsigned notready:1;        
02436     unsigned manual:1;          
02437     unsigned softraiddisk:1;    
02438     unsigned zip:1;             
02439     unsigned cdr:1;             
02440     unsigned cdrw:1;            
02441     unsigned dvd:1;             
02442     unsigned dvdr:1;            
02443     unsigned dvdrw:1;           
02444     unsigned dvdpr:1;           
02445     unsigned dvdprw:1;          
02446     unsigned dvdprdl:1;         
02447     unsigned dvdram:1;          
02448     unsigned pppoe:1;           
02449     unsigned wlan:1;            
02450     unsigned with_acpi:1;       
02451     unsigned hotpluggable:1;    
02452   } is;
02453 
02454   struct tag_s {                
02455     unsigned remove:1;          
02456     unsigned freeit:1;          
02457     unsigned fixed:1;           
02458     unsigned ser_skip:1;        
02459     unsigned ser_device:2;      
02460   } tag;
02461 
02467   unsigned char *block0;
02468 
02472   char *driver;
02473 
02477   char *driver_module;
02478 
02482   str_list_t *drivers;
02483 
02487   str_list_t *driver_modules;
02488 
02496   char *old_unique_id;
02497 
02503   char *parent_id;
02504 
02510   str_list_t *child_ids;
02511 
02516   char *unique_id1;
02517 
02524   char *usb_guid;
02525 
02526   driver_info_t *driver_info;   
02528   str_list_t *requires;         
02530   hal_prop_t *hal_prop;         
02532   hal_prop_t *persistent_prop;  
02534   char *modalias;               
02536   /*
02537    * These are used internally for memory management.
02538    * Do not even _think_ of modifying these!
02539    */
02540   unsigned ref_cnt;             
02541   struct s_hd_t *ref;           
02542 } hd_t;
02543 
02544 
02548 typedef struct {
02554   hd_t *hd;
02555 
02564   void (*progress)(char *pos, char *msg);
02565   
02570   char *log;
02571 
02579   unsigned debug;
02580 
02586   struct flag_struct {
02587     unsigned internal:1;        
02588     unsigned dformat:2;         
02589     unsigned no_parport:1;      
02590     unsigned iseries:1;         
02591     unsigned list_all:1;        
02592     unsigned fast:1;            
02593     unsigned list_md:1;         
02594     unsigned nofork:1;          
02595     unsigned nosysfs:1;         
02596     unsigned forked:1;          
02597     unsigned cpuemu:1;          
02598     unsigned udev:1;            
02599     unsigned edd_used:1;        
02600     unsigned keep_kmods:2;      
02601     unsigned nobioscrc:1;       
02602     unsigned biosvram:1;        
02603     unsigned nowpa:1;           
02604     unsigned pata:1;            
02605     unsigned vbox:1;            
02606     unsigned vmware:1;          
02607   } flags;
02608 
02609 
02614   str_list_t *only;
02615 
02616   /*
02617    * The following entries should *not* be accessed outside of libhd!
02618    */
02619   unsigned char probe[(pr_all + 7) / 8];        
02620   unsigned char probe_set[(pr_all + 7) / 8];    
02621   unsigned char probe_clr[(pr_all + 7) / 8];    
02622   unsigned last_idx;            
02623   unsigned module;              
02624   enum boot_arch boot;          
02625   hd_t *old_hd;                 
02626   pci_t *pci;                   
02627   isapnp_t *isapnp;             
02628   cdrom_info_t *cdrom;          
02629   str_list_t *net;              
02630   str_list_t *floppy;           
02631   misc_t *misc;                 
02632   serial_t *serial;             
02633   scsi_t *scsi;                 
02634   ser_device_t *ser_mouse;      
02635   ser_device_t *ser_modem;      
02636   str_list_t *cpu;              
02637   str_list_t *klog;             
02638   str_list_t *proc_usb;         
02639   usb_t *usb;                   
02640   modinfo_t *modinfo_ext;       
02641   modinfo_t *modinfo;           
02642   hddb2_data_t *hddb2[2];       
02643   str_list_t *kmods;            
02644   uint64_t used_irqs;           
02645   uint64_t assigned_irqs;       
02646   memory_range_t bios_rom;      
02647   memory_range_t bios_ram;      
02648   memory_range_t bios_ebda;     
02649   unsigned display;             
02650   unsigned color_code;          
02651   char *cmd_line;               
02652   str_list_t *xtra_hd;          
02653   devtree_t *devtree;           
02654   unsigned kernel_version;      
02655   hd_t *manual;                 
02656   str_list_t *disks;            
02657   str_list_t *partitions;       
02658   str_list_t *cdroms;           
02659   hd_smbios_t *smbios;          
02660   struct {
02661     unsigned ok:1;
02662     unsigned size;
02663     unsigned used;
02664     void *data;
02665     int id;
02666     int updated;
02667   } shm;                        
02668   unsigned pci_config_type;     
02669   hd_udevinfo_t *udevinfo;      
02670   hd_sysfsdrv_t *sysfsdrv;      
02671   uint64_t sysfsdrv_id;         
02672   str_list_t *scanner_db;       
02673   edd_info_t edd[0x80];         
02674   hal_device_t *hal;            
02675 } hd_data_t;
02676 
02677 
02678 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
02679  *
02680  *                      libhd interface functions
02681  *
02682  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
02683  */
02684 
02685 /* implemented in hd.c */
02686 
02688 void hd_scan(hd_data_t *hd_data);
02689 
02691 hd_data_t *hd_free_hd_data(hd_data_t *hd_data);
02692 
02694 hd_t *hd_free_hd_list(hd_t *hd);
02695 
02696 void hd_set_probe_feature(hd_data_t *hd_data, enum probe_feature feature);
02697 void hd_clear_probe_feature(hd_data_t *hd_data, enum probe_feature feature);
02698 int hd_probe_feature(hd_data_t *hd_data, enum probe_feature feature);
02699 void hd_set_probe_feature_hw(hd_data_t *hd_data, hd_hw_item_t item);
02700 
02701 enum probe_feature hd_probe_feature_by_name(char *name);
02702 char *hd_probe_feature_by_value(enum probe_feature feature);
02703 
02704 int hd_module_is_active(hd_data_t *hd_data, char *mod);
02705 
02706 hd_t *hd_base_class_list(hd_data_t *hd_data, unsigned base_class);
02707 hd_t *hd_sub_class_list(hd_data_t *hd_data, unsigned base_class, unsigned sub_class);
02708 hd_t *hd_bus_list(hd_data_t *hd_data, unsigned bus);
02709 const char* hd_busid_to_hwcfg(int busid);
02710 hd_t *hd_list(hd_data_t *hd_data, hd_hw_item_t item, int rescan, hd_t *hd_old);
02711 hd_t *hd_list_with_status(hd_data_t *hd_data, hd_hw_item_t item, hd_status_t status);
02712 hd_t *hd_list2(hd_data_t *hd_data, hd_hw_item_t *items, int rescan);
02713 hd_t *hd_list_with_status2(hd_data_t *hd_data, hd_hw_item_t *items, hd_status_t status);
02714 
02715 void hd_add_driver_data(hd_data_t *hd_data, hd_t *hd);
02716 
02717 int hd_has_pcmcia(hd_data_t *hd_data);
02718 #if 0
02719 
02723 int hd_apm_enabled(hd_data_t *hd_data);
02724 #endif
02725 int hd_usb_support(hd_data_t *hd_data);
02726 int hd_smp_support(hd_data_t *hd_data);
02727 int hd_mac_color(hd_data_t *hd_data);
02728 int hd_color(hd_data_t *hd_data);
02729 int hd_is_uml(hd_data_t *hd_data);
02730 int hd_is_xen(hd_data_t *hd_data);
02731 unsigned hd_display_adapter(hd_data_t *hd_data);
02732 unsigned hd_boot_disk(hd_data_t *hd_data, int *matches);
02733 enum cpu_arch hd_cpu_arch(hd_data_t *hd_data);
02734 enum boot_arch hd_boot_arch(hd_data_t *hd_data);
02735 
02736 hd_t *hd_get_device_by_idx(hd_data_t *hd_data, unsigned idx);
02737 
02738 void hd_set_hw_class(hd_t *hd, hd_hw_item_t hw_class);
02739 int hd_is_hw_class(hd_t *hd, hd_hw_item_t hw_class);
02740 
02741 int hd_is_sgi_altix(hd_data_t *hd_data);
02742 
02743 char *hd_version(void);
02744 
02745 hal_prop_t *hd_free_hal_properties(hal_prop_t *prop);
02746 hal_prop_t *hd_read_properties(const char *udi);
02747 int hd_write_properties(const char *udi, hal_prop_t *prop);
02748 
02749 int hd_change_status(const char *id, hd_status_t status, const char *config_string);
02750 int hd_change_config_status(hd_data_t *hd_data, const char *id, hd_status_t status, const char *config_string);
02751 int hd_read_mmap(hd_data_t *hd_data, char *name, unsigned char *buf, off_t start, unsigned size);
02752 
02753 /* implemented in hddb.c */
02754 
02758 str_list_t *hddb_get_packages(hd_data_t *hd_data);
02759 void hddb_add_info(hd_data_t *hd_data, hd_t *hd);
02760 
02761 void hddb_dump_raw(hddb2_data_t *hddb, FILE *f);
02762 void hddb_dump(hddb2_data_t *hddb, FILE *f);
02763 
02764 
02765 /* implemented in hdp.c */
02766 void hd_dump_entry(hd_data_t *hd_data, hd_t *hd, FILE *f);
02767 
02768 /* implemented in cdrom.c */
02769 cdrom_info_t *hd_read_cdrom_info(hd_data_t *hd_data, hd_t *hd);
02770 
02778 hd_manual_t *hd_manual_read_entry(hd_data_t *hd_data, const char *id);
02779 int hd_manual_write_entry(hd_data_t *hd_data, hd_manual_t *entry);
02780 hd_manual_t *hd_free_manual(hd_manual_t *manual);
02781 hd_t *hd_read_config(hd_data_t *hd_data, const char *id);
02782 int hd_write_config(hd_data_t *hd_data, hd_t *hd);
02783 char *hd_hw_item_name(hd_hw_item_t item);
02784 hd_hw_item_t hd_hw_item_type(char *name);
02785 char *hd_status_value_name(hd_status_value_t status);
02786 
02797 #define CDBISDN_VERSION 0x0101
02798 
02799 #ifndef PCI_ANY_ID
02800 #define PCI_ANY_ID      0xffff
02801 #endif
02802 
02803 #define CDBISDN_P_NONE  0x0
02804 #define CDBISDN_P_IRQ   0x1
02805 #define CDBISDN_P_MEM   0x2
02806 #define CDBISDN_P_IO    0x3
02807 
02809 typedef struct {
02810         char    *name;
02811         char    *shortname;
02812         int     vnr;
02813         int     refcnt;
02814 } cdb_isdn_vendor;
02815 
02816 typedef struct  {
02817         int     handle;         
02818         int     vhandle;        
02819         char    *name;          
02820         char    *lname;         
02821         char    *Class;         
02822         char    *bus;           
02823         int     revision;       
02824         int     vendor;         
02825         int     device;         
02826         int     subvendor;      
02828         int     subdevice;      
02830         unsigned int features;  
02831         int     line_cnt;       
02832         int     vario_cnt;      
02833         int     vario;          
02834 } cdb_isdn_card;
02835 
02836 typedef struct  {
02837         int     handle;         
02838         int     next_vario;     
02839         int     drvid;          
02840         int     typ;            
02841         int     subtyp;         
02842         int     smp;            
02843         char    *mod_name;      
02844         char    *para_str;      
02845         char    *mod_preload;   
02846         char    *cfg_prog;      
02847         char    *firmware;      
02848         char    *description;   
02849         char    *need_pkg;      
02850         char    *info;          
02851         char    *protocol;      
02852         char    *interface;     
02853         char    *io;            
02854         char    *irq;           
02855         char    *membase;       
02856         char    *features;      
02857         int     card_ref;       
02858         char    *name;          
02859 } cdb_isdn_vario;
02860 
02861 
02862 extern cdb_isdn_vendor  *hd_cdbisdn_get_vendor(int);
02863 extern cdb_isdn_card    *hd_cdbisdn_get_card(int);
02864 extern cdb_isdn_vario   *hd_cdbisdn_get_vario_from_type(int, int);
02865 extern cdb_isdn_card    *hd_cdbisdn_get_card_from_type(int, int);
02866 extern cdb_isdn_card    *hd_cdbisdn_get_card_from_id(int, int, int, int);
02867 extern cdb_isdn_vario   *hd_cdbisdn_get_vario(int);
02868 extern int              hd_cdbisdn_get_version(void);
02869 extern int              hd_cdbisdn_get_db_version(void);
02870 extern char             *hd_cdbisdn_get_db_date(void);
02871 
02877 #ifdef __cplusplus
02878 }
02879 #endif
02880 
02883 #endif  /* _HD_H */