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, 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;                            
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 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   char *sysfs_id;
01483   unsigned hd_idx;
01484 } edd_info_t;
01485 
01491 typedef struct {
01492   unsigned data_len, data_max;
01493   unsigned *data;
01494   unsigned names_len, names_max;
01495   char *names;
01496 } hddb_data_t;
01497 
01501 typedef uint32_t hddb_entry_mask_t;
01502 
01506 typedef struct hddb_list_s {   
01507   hddb_entry_mask_t key_mask;
01508   hddb_entry_mask_t value_mask;
01509   unsigned key;
01510   unsigned value;
01511 } hddb_list_t;
01512 
01516 typedef struct {
01517   unsigned list_len, list_max;
01518   hddb_list_t *list;
01519   unsigned ids_len, ids_max;
01520   unsigned *ids;
01521   unsigned strings_len, strings_max;
01522   char *strings;
01523 } hddb2_data_t;
01524 
01525 
01529 typedef enum modinfo_type_e { mi_none = 0, mi_pci, mi_other } modinfo_type_t;
01530 
01534 typedef struct {
01535   char *module;
01536   char *alias;
01537   modinfo_type_t type;
01538   union {
01539     struct {
01540       struct {
01541         unsigned vendor:1;
01542         unsigned device:1;
01543         unsigned sub_vendor:1;
01544         unsigned sub_device:1;
01545         unsigned base_class:1;
01546         unsigned sub_class:1;
01547         unsigned prog_if:1;
01548       } has;
01549       unsigned vendor;
01550       unsigned device;
01551       unsigned sub_vendor;
01552       unsigned sub_device;
01553       unsigned base_class;
01554       unsigned sub_class;
01555       unsigned prog_if;
01556     } pci;
01557 
01558     struct {
01559       struct {
01560         unsigned vendor:1;
01561         unsigned product:1;
01562         unsigned device_class:1;
01563         unsigned device_subclass:1;
01564       } has;
01565       unsigned vendor;
01566       unsigned product;
01567       unsigned device_class;
01568       unsigned device_subclass;
01569     } usb;
01570   };
01571 } modinfo_t;
01572 
01573 
01577 typedef enum {
01578   p_invalid, p_string, p_int32, p_uint64, p_double, p_bool, p_list
01579 } hal_prop_type_t;
01580 
01581 
01585 typedef struct hal_prop_s {
01586   struct hal_prop_s *next;
01587   hal_prop_type_t type;
01588   char *key;
01589   union {
01590     char *str;
01591     int32_t int32;
01592     uint64_t uint64;
01593     double d;     
01594     int b;
01595     str_list_t *list;
01596   } val;  
01597 } hal_prop_t;
01598 
01599 
01603 typedef struct hal_device_s {
01604   struct hal_device_s *next, *parent;
01605   char *udi;
01606   unsigned used:1;
01607   hal_prop_t *prop;
01608 } hal_device_t;
01609 
01610 
01614 typedef enum resource_types {
01615   res_any, res_phys_mem, res_mem, res_io, res_irq, res_dma, res_monitor,
01616   res_size, res_disk_geo, res_cache, res_baud, res_init_strings, res_pppd_option,
01617   res_framebuffer, res_hwaddr, res_link, res_wlan
01618 } hd_resource_types_t;
01619 
01620 
01624 typedef enum size_units {
01625   size_unit_cm, size_unit_cinch, size_unit_byte, size_unit_sectors,
01626   size_unit_kbyte, size_unit_mbyte, size_unit_gbyte, size_unit_mm
01627 } hd_size_units_t;
01628 
01632 typedef enum access_flags {
01633   acc_unknown,          
01634   acc_ro,               
01635   acc_wo,               
01636   acc_rw                
01637 } hd_access_flags_t;
01638 
01639 
01640 typedef enum yes_no_flag {
01641   flag_unknown,         
01642   flag_no,              
01643   flag_yes              
01644 } hd_yes_no_flag_t;
01645 
01646 
01647 typedef enum geo_types {
01648   geo_physical = 0, 
01649   geo_logical, 
01650   geo_bios_edd, 
01651   geo_bios_legacy
01652 } hd_geo_types_t;
01653 
01654 
01661 typedef struct {
01662   union u_hd_res_t *next;
01663   enum resource_types type;
01664 } res_any_t;
01665 
01666 typedef struct {
01667   union u_hd_res_t *next;
01668   enum resource_types type;
01669   uint64_t base, range;
01670   unsigned
01671     enabled:1,                  
01672     access:2,                   
01673     prefetch:2;                 
01674 } res_mem_t;
01675 
01676 typedef struct {
01677   union u_hd_res_t *next;
01678   enum resource_types type;
01679   uint64_t range;
01680 } res_phys_mem_t;
01681 
01682 typedef struct {
01683   union u_hd_res_t *next;
01684   enum resource_types type;
01685   uint64_t base, range;
01686   unsigned
01687     enabled:1,                          
01688     access:2;                           
01689 } res_io_t;
01690 
01691 typedef struct {
01692   union u_hd_res_t *next;
01693   enum resource_types type;
01694   unsigned base;
01695   unsigned triggered;                   
01696   unsigned enabled:1;                   
01697 } res_irq_t;
01698 
01699 typedef struct {
01700   union u_hd_res_t *next;
01701   enum resource_types type;
01702   unsigned base;
01703   unsigned enabled:1;                   
01704 } res_dma_t;
01705 
01706 typedef struct {
01707   union u_hd_res_t *next;
01708   enum resource_types type;
01709   enum size_units unit;
01710   uint64_t val1, val2;                  
01711 } res_size_t;
01712 
01713 typedef struct {
01714   union u_hd_res_t *next;
01715   enum resource_types type;
01716   unsigned speed;
01717   unsigned bits, stopbits;
01718   char parity;                          
01719   char handshake;                       
01720 } res_baud_t;
01721 
01722 typedef struct {
01723   union u_hd_res_t *next;
01724   enum resource_types type;
01725   unsigned size;                        
01726 } res_cache_t;
01727 
01728 typedef struct {
01729   union u_hd_res_t *next;
01730   enum resource_types type;
01731   unsigned cyls, heads, sectors;
01732   uint64_t size;
01733   enum geo_types geotype;               
01734 } res_disk_geo_t;
01735 
01736 typedef struct {
01737   union u_hd_res_t *next;
01738   enum resource_types type;
01739   unsigned width, height;               
01740   unsigned vfreq;                       
01741   unsigned interlaced:1;                
01742 } res_monitor_t;
01743 
01744 typedef struct {
01745   union u_hd_res_t *next;
01746   enum resource_types type;
01747   char *init1;
01748   char *init2;
01749 } res_init_strings_t;
01750 
01751 typedef struct {
01752   union u_hd_res_t *next;
01753   enum resource_types type;
01754   char *option;
01755 } res_pppd_option_t;
01756 
01757 typedef struct {
01758   union u_hd_res_t *next;
01759   enum resource_types type;
01760   unsigned width, height;               
01761   unsigned bytes_p_line;                
01762   unsigned colorbits;                   
01763   unsigned mode;                        
01764 } res_framebuffer_t;
01765 
01766 typedef struct {
01767   union u_hd_res_t *next;
01768   enum resource_types type;
01769   char *addr;
01770 } res_hwaddr_t;
01771 
01772 typedef struct {
01773   union u_hd_res_t *next;
01774   enum resource_types type;
01775   unsigned state:1;                     
01776 } res_link_t;
01777 
01779 typedef struct {
01780   union u_hd_res_t *next;
01781   enum resource_types type;
01782   str_list_t *channels;
01783   str_list_t *frequencies; 
01784   str_list_t *bitrates;    
01785   str_list_t *auth_modes;  
01786   str_list_t *enc_modes;   
01787 } res_wlan_t;
01788 
01790 typedef union u_hd_res_t {
01791   union u_hd_res_t *next;  
01792   res_any_t any;
01793   res_io_t io;
01794   res_mem_t mem;
01795   res_phys_mem_t phys_mem;
01796   res_irq_t irq;
01797   res_dma_t dma;
01798   res_size_t size;
01799   res_cache_t cache;
01800   res_baud_t baud;
01801   res_disk_geo_t disk_geo;
01802   res_monitor_t monitor;
01803   res_init_strings_t init_strings;
01804   res_pppd_option_t pppd_option;
01805   res_framebuffer_t framebuffer;
01806   res_hwaddr_t hwaddr;
01807   res_link_t link;
01808   res_wlan_t wlan;
01809 } hd_res_t;
01810 
01819 typedef struct {
01820   uint64_t addr, size;
01821   char *dev;
01822   unsigned tag;
01823 } misc_io_t;
01824 
01825 typedef struct {
01826   unsigned channel;
01827   char *dev;
01828   unsigned tag;
01829 } misc_dma_t;
01830 
01831 typedef struct {
01832   unsigned irq, events;
01833   int devs;
01834   char **dev;
01835   unsigned tag;
01836 } misc_irq_t;
01837 
01838 typedef struct {
01839   unsigned io_len, dma_len, irq_len;
01840   misc_io_t *io;
01841   misc_dma_t *dma;
01842   misc_irq_t *irq;
01843   str_list_t *proc_io, *proc_dma, *proc_irq;
01844 } misc_t;
01845 
01851 typedef struct s_serial_t {
01852   struct s_serial_t *next;
01853   char *name;
01854   char *device;
01855   unsigned line, port, irq, baud;
01856 } serial_t;
01857 
01861 typedef struct s_ser_device_t {
01862   struct s_ser_device_t *next;
01863   unsigned hd_idx;
01864   char *dev_name;
01865   str_list_t *at_resp;
01866   int fd;
01867   struct termios tio;
01868   unsigned max_baud, cur_baud;
01869   unsigned is_mouse:1;
01870   unsigned is_modem:1;
01871   unsigned do_io:1;
01872   unsigned char buf[0x1000];
01873   int buf_len;
01874   int garbage, non_pnp, pnp;
01875   unsigned char pnp_id[8];
01876   char *serial, *class_name, *dev_id, *user_name, *vend, *init_string1, *init_string2, *pppd_option;
01877   unsigned pnp_rev;
01878   unsigned bits;
01879 } ser_device_t;
01880 
01894 typedef struct isdn_parm_s {
01895   struct isdn_parm_s *next;
01896   char *name;                           
01897   unsigned valid:1;                     
01898   unsigned conflict:1;                  
01899   uint64_t value;                       
01900   unsigned type;                        
01901   unsigned flags;                       
01902   unsigned def_value;                   
01903   int alt_values;                       
01904   unsigned *alt_value;                  
01905 } isdn_parm_t;
01906 
01908 typedef enum driver_info_type {
01909   di_any, di_display, di_module, di_mouse, di_x11, di_isdn, di_kbd, di_dsl
01910 } hd_driver_info_t;
01911 
01913 typedef struct {
01914   union driver_info_u *next;
01915   enum driver_info_type type;           
01916   str_list_t *hddb0, *hddb1;            
01917 } driver_info_any_t;
01918 
01920 typedef struct {
01921   union driver_info_u *next;
01922   enum driver_info_type type;           
01923   str_list_t *hddb0, *hddb1;            
01924   unsigned width, height;               
01925   unsigned min_vsync, max_vsync;        
01926   unsigned min_hsync, max_hsync;        
01927   unsigned bandwidth;                   
01928   unsigned hdisp, hsyncstart, hsyncend, htotal; 
01929   unsigned vdisp, vsyncstart, vsyncend, vtotal; 
01930   char hflag,vflag; 
01931 } driver_info_display_t;
01932 
01934 typedef struct {
01935   union driver_info_u *next;
01936   enum driver_info_type type;           
01937   str_list_t *hddb0, *hddb1;            
01938   unsigned active:1;                    
01939   unsigned modprobe:1;                  
01940   str_list_t *names;                    
01941   str_list_t *mod_args;                 
01942   char *conf;                           
01943 } driver_info_module_t;
01944 
01946 typedef struct {
01947   union driver_info_u *next;
01948   enum driver_info_type type;           
01949   str_list_t *hddb0, *hddb1;            
01950   char *xf86;                           
01951   char *gpm;                            
01952   int buttons;                          
01953   int wheels;                           
01954 } driver_info_mouse_t;
01955 
01957 typedef struct {
01958   union driver_info_u *next;
01959   enum driver_info_type type;           
01960   str_list_t *hddb0, *hddb1;            
01961   char *server;                         
01962   char *xf86_ver;                       
01963   unsigned x3d:1;                       
01964   struct {
01965     unsigned all:5;                     
01966     unsigned c8:1, c15:1, c16:1, c24:1, c32:1;
01967   } colors;                             
01968   unsigned dacspeed;                    
01969   str_list_t *extensions;               
01970   str_list_t *options;                  
01971   str_list_t *raw;                      
01972   char *script;                         
01973 } driver_info_x11_t;
01974 
01976 typedef struct {
01977   union driver_info_u *next;
01978   enum driver_info_type type;           
01979   str_list_t *hddb0, *hddb1;            
01980   int i4l_type, i4l_subtype;            
01981   char *i4l_name;                       
01982   isdn_parm_t *params;                  
01983 } driver_info_isdn_t;
01984 
01986 typedef struct {
01987   union driver_info_u *next;
01988   enum driver_info_type type;           
01989   str_list_t *hddb0, *hddb1;            
01990   char *mode;                           
01991   char *name;                           
01992 } driver_info_dsl_t;
01993 
01995 typedef struct {
01996   union driver_info_u *next;
01997   enum driver_info_type type;           
01998   str_list_t *hddb0, *hddb1;            
01999   char *XkbRules;                       
02000   char *XkbModel;
02001   char *XkbLayout;
02002   char *keymap;                         
02003 } driver_info_kbd_t;
02004 
02005 /*
02006  * holds device driver info
02007  */
02008 typedef union driver_info_u {
02009   union driver_info_u *next;
02010   driver_info_any_t any;
02011   driver_info_module_t module;
02012   driver_info_mouse_t mouse;
02013   driver_info_x11_t x11;
02014   driver_info_display_t display;
02015   driver_info_isdn_t isdn;
02016   driver_info_dsl_t dsl;
02017   driver_info_kbd_t kbd;
02018 } driver_info_t;
02019 
02030 typedef enum hd_detail_type {
02031   hd_detail_pci, hd_detail_usb, hd_detail_isapnp, hd_detail_cdrom,
02032   hd_detail_floppy, hd_detail_bios, hd_detail_cpu, hd_detail_prom,
02033   hd_detail_monitor, hd_detail_sys, hd_detail_scsi, hd_detail_devtree,
02034   hd_detail_ccw
02035 } hd_detail_type_t;
02036 
02037 typedef struct {
02038   enum hd_detail_type type;
02039   pci_t *data;
02040 } hd_detail_pci_t;
02041 
02042 typedef struct {
02043   enum hd_detail_type type;
02044   usb_t *data;
02045 } hd_detail_usb_t;
02046 
02047 typedef struct {
02048   enum hd_detail_type type;
02049   isapnp_dev_t *data;
02050 } hd_detail_isapnp_t;
02051 
02052 typedef struct {
02053   enum hd_detail_type type;
02054   cdrom_info_t *data;
02055 } hd_detail_cdrom_t;
02056 
02057 typedef struct {
02058   enum hd_detail_type type;
02059   floppy_info_t *data;
02060 } hd_detail_floppy_t;
02061 
02062 typedef struct {
02063   enum hd_detail_type type;
02064   bios_info_t *data;
02065 } hd_detail_bios_t;
02066 
02067 typedef struct {
02068   enum hd_detail_type type;
02069   cpu_info_t *data;
02070 } hd_detail_cpu_t;
02071 
02072 typedef struct {
02073   enum hd_detail_type type;
02074   prom_info_t *data;
02075 } hd_detail_prom_t;
02076 
02077 typedef struct hd_detail_monitor_s {
02078   enum hd_detail_type type;
02079   monitor_info_t *data;
02080   struct hd_detail_monitor_s *next;
02081 } hd_detail_monitor_t;
02082 
02083 typedef struct {
02084   enum hd_detail_type type;
02085   sys_info_t *data;
02086 } hd_detail_sys_t;
02087 
02088 typedef struct {
02089   enum hd_detail_type type;
02090   scsi_t *data;
02091 } hd_detail_scsi_t;
02092 
02093 typedef struct {
02094   enum hd_detail_type type;
02095   devtree_t *data;
02096 } hd_detail_devtree_t;
02097 
02098 typedef struct {
02099   enum hd_detail_type type;
02100   ccw_t *data;
02101 } hd_detail_ccw_t;
02102 
02103 typedef union {
02104   enum hd_detail_type type;
02105   hd_detail_pci_t pci;
02106   hd_detail_usb_t usb;
02107   hd_detail_isapnp_t isapnp;
02108   hd_detail_cdrom_t cdrom;
02109   hd_detail_floppy_t floppy;
02110   hd_detail_bios_t bios;
02111   hd_detail_cpu_t cpu;
02112   hd_detail_prom_t prom;
02113   hd_detail_monitor_t monitor;
02114   hd_detail_sys_t sys;
02115   hd_detail_scsi_t scsi;
02116   hd_detail_devtree_t devtree;
02117   hd_detail_ccw_t ccw;
02118 } hd_detail_t;
02119 
02132 typedef struct hd_manual_s {
02133   struct hd_manual_s *next;
02134 
02135   char *unique_id;
02136   char *parent_id;
02137   char *child_ids;
02138   unsigned hw_class;
02139   char *model;
02140 
02141   hd_status_t status;
02142   char *config_string;
02143 
02144   /* More or less free-form key, value pairs.
02145    * key should not contain '=', however.
02146    */
02147   str_list_t *key;
02148   str_list_t *value;
02149 } hd_manual_t;
02150 
02151 
02157 typedef struct s_hd_t {
02158   struct s_hd_t *next;          
02164   unsigned idx;
02165 
02171   unsigned broken:1;
02172 
02176   hd_id_t bus;
02177 
02182   unsigned slot;
02183 
02187   unsigned func;
02188 
02192   hd_id_t base_class;
02193 
02197   hd_id_t sub_class;
02198 
02202   hd_id_t prog_if;
02203 
02210   hd_id_t vendor;
02211 
02220   hd_id_t device;
02221 
02228   hd_id_t sub_vendor;
02229 
02236   hd_id_t sub_device;
02237 
02243   hd_id_t revision;
02244 
02248   char *serial;
02249 
02254   hd_id_t compat_vendor;
02255 
02260   hd_id_t compat_device;
02261 
02266   hd_hw_item_t hw_class;
02267 
02272   unsigned char hw_class_list[(hw_all + 7) / 8];        
02280   char *model;
02281 
02287   unsigned attached_to;
02288 
02292   char *sysfs_id;
02293 
02297   char *sysfs_bus_id;
02298 
02302   char *sysfs_device_link;
02303 
02309   char *unix_dev_name;
02310 
02314   hd_dev_num_t unix_dev_num;
02315 
02322   str_list_t *unix_dev_names;
02323 
02330   char *unix_dev_name2;
02331 
02335   hd_dev_num_t unix_dev_num2;
02336 
02343   char *rom_id;
02344 
02348   char *udi;
02349 
02353   char *parent_udi;
02354 
02365   char *unique_id;
02366 
02368   str_list_t *unique_ids;
02369 
02373   unsigned module;
02374 
02378   unsigned line;
02379 
02383   unsigned count;
02384 
02388   hd_res_t *res;
02389 
02394   hd_detail_t *detail;
02395 
02401   str_list_t *extra_info;
02402 
02408   hd_status_t status;
02409 
02416   char *config_string;
02417 
02422   hd_hotplug_t hotplug;
02423 
02428   unsigned hotplug_slot;
02429 
02430   struct is_s {
02431     unsigned agp:1;             
02432     unsigned isapnp:1;          
02433     unsigned notready:1;        
02434     unsigned manual:1;          
02435     unsigned softraiddisk:1;    
02436     unsigned zip:1;             
02437     unsigned cdr:1;             
02438     unsigned cdrw:1;            
02439     unsigned dvd:1;             
02440     unsigned dvdr:1;            
02441     unsigned dvdrw:1;           
02442     unsigned dvdpr:1;           
02443     unsigned dvdprw:1;          
02444     unsigned dvdprdl:1;         
02445     unsigned dvdram:1;          
02446     unsigned pppoe:1;           
02447     unsigned wlan:1;            
02448     unsigned with_acpi:1;       
02449     unsigned hotpluggable:1;    
02450   } is;
02451 
02452   struct tag_s {                
02453     unsigned remove:1;          
02454     unsigned freeit:1;          
02455     unsigned fixed:1;           
02456     unsigned ser_skip:1;        
02457     unsigned ser_device:2;      
02458   } tag;
02459 
02465   unsigned char *block0;
02466 
02470   char *driver;
02471 
02475   char *driver_module;
02476 
02480   str_list_t *drivers;
02481 
02485   str_list_t *driver_modules;
02486 
02494   char *old_unique_id;
02495 
02501   char *parent_id;
02502 
02508   str_list_t *child_ids;
02509 
02514   char *unique_id1;
02515 
02522   char *usb_guid;
02523 
02524   driver_info_t *driver_info;   
02526   str_list_t *requires;         
02528   hal_prop_t *hal_prop;         
02530   hal_prop_t *persistent_prop;  
02532   char *modalias;               
02534   /*
02535    * These are used internally for memory management.
02536    * Do not even _think_ of modifying these!
02537    */
02538   unsigned ref_cnt;             
02539   struct s_hd_t *ref;           
02540 } hd_t;
02541 
02542 
02546 typedef struct {
02552   hd_t *hd;
02553 
02562   void (*progress)(char *pos, char *msg);
02563   
02568   char *log;
02569 
02577   unsigned debug;
02578 
02584   struct flag_struct {
02585     unsigned internal:1;        
02586     unsigned dformat:2;         
02587     unsigned no_parport:1;      
02588     unsigned iseries:1;         
02589     unsigned list_all:1;        
02590     unsigned fast:1;            
02591     unsigned list_md:1;         
02592     unsigned nofork:1;          
02593     unsigned nosysfs:1;         
02594     unsigned forked:1;          
02595     unsigned cpuemu:1;          
02596     unsigned udev:1;            
02597     unsigned edd_used:1;        
02598     unsigned keep_kmods:2;      
02599     unsigned nobioscrc:1;       
02600     unsigned biosvram:1;        
02601     unsigned nowpa:1;           
02602     unsigned pata:1;            
02603   } flags;
02604 
02605 
02610   str_list_t *only;
02611 
02612   /*
02613    * The following entries should *not* be accessed outside of libhd!
02614    */
02615   unsigned char probe[(pr_all + 7) / 8];        
02616   unsigned char probe_set[(pr_all + 7) / 8];    
02617   unsigned char probe_clr[(pr_all + 7) / 8];    
02618   unsigned last_idx;            
02619   unsigned module;              
02620   enum boot_arch boot;          
02621   hd_t *old_hd;                 
02622   pci_t *pci;                   
02623   isapnp_t *isapnp;             
02624   cdrom_info_t *cdrom;          
02625   str_list_t *net;              
02626   str_list_t *floppy;           
02627   misc_t *misc;                 
02628   serial_t *serial;             
02629   scsi_t *scsi;                 
02630   ser_device_t *ser_mouse;      
02631   ser_device_t *ser_modem;      
02632   str_list_t *cpu;              
02633   str_list_t *klog;             
02634   str_list_t *proc_usb;         
02635   usb_t *usb;                   
02636   modinfo_t *modinfo_ext;       
02637   modinfo_t *modinfo;           
02638   hddb2_data_t *hddb2[2];       
02639   str_list_t *kmods;            
02640   uint64_t used_irqs;           
02641   uint64_t assigned_irqs;       
02642   memory_range_t bios_rom;      
02643   memory_range_t bios_ram;      
02644   memory_range_t bios_ebda;     
02645   unsigned display;             
02646   unsigned color_code;          
02647   char *cmd_line;               
02648   str_list_t *xtra_hd;          
02649   devtree_t *devtree;           
02650   unsigned kernel_version;      
02651   int in_vmware;                
02652   hd_t *manual;                 
02653   str_list_t *disks;            
02654   str_list_t *partitions;       
02655   str_list_t *cdroms;           
02656   hd_smbios_t *smbios;          
02657   struct {
02658     unsigned ok:1;
02659     unsigned size;
02660     unsigned used;
02661     void *data;
02662     int id;
02663     int updated;
02664   } shm;                        
02665   unsigned pci_config_type;     
02666   hd_udevinfo_t *udevinfo;      
02667   hd_sysfsdrv_t *sysfsdrv;      
02668   uint64_t sysfsdrv_id;         
02669   str_list_t *scanner_db;       
02670   edd_info_t edd[0x80];         
02671   hal_device_t *hal;            
02672 } hd_data_t;
02673 
02674 
02675 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
02676  *
02677  *                      libhd interface functions
02678  *
02679  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
02680  */
02681 
02682 /* implemented in hd.c */
02683 
02685 void hd_scan(hd_data_t *hd_data);
02686 
02688 hd_data_t *hd_free_hd_data(hd_data_t *hd_data);
02689 
02691 hd_t *hd_free_hd_list(hd_t *hd);
02692 
02693 void hd_set_probe_feature(hd_data_t *hd_data, enum probe_feature feature);
02694 void hd_clear_probe_feature(hd_data_t *hd_data, enum probe_feature feature);
02695 int hd_probe_feature(hd_data_t *hd_data, enum probe_feature feature);
02696 void hd_set_probe_feature_hw(hd_data_t *hd_data, hd_hw_item_t item);
02697 
02698 enum probe_feature hd_probe_feature_by_name(char *name);
02699 char *hd_probe_feature_by_value(enum probe_feature feature);
02700 
02701 int hd_module_is_active(hd_data_t *hd_data, char *mod);
02702 
02703 hd_t *hd_base_class_list(hd_data_t *hd_data, unsigned base_class);
02704 hd_t *hd_sub_class_list(hd_data_t *hd_data, unsigned base_class, unsigned sub_class);
02705 hd_t *hd_bus_list(hd_data_t *hd_data, unsigned bus);
02706 const char* hd_busid_to_hwcfg(int busid);
02707 hd_t *hd_list(hd_data_t *hd_data, hd_hw_item_t item, int rescan, hd_t *hd_old);
02708 hd_t *hd_list_with_status(hd_data_t *hd_data, hd_hw_item_t item, hd_status_t status);
02709 hd_t *hd_list2(hd_data_t *hd_data, hd_hw_item_t *items, int rescan);
02710 hd_t *hd_list_with_status2(hd_data_t *hd_data, hd_hw_item_t *items, hd_status_t status);
02711 
02712 void hd_add_driver_data(hd_data_t *hd_data, hd_t *hd);
02713 
02714 int hd_has_pcmcia(hd_data_t *hd_data);
02715 #if 0
02716 
02720 int hd_apm_enabled(hd_data_t *hd_data);
02721 #endif
02722 int hd_usb_support(hd_data_t *hd_data);
02723 int hd_smp_support(hd_data_t *hd_data);
02724 int hd_mac_color(hd_data_t *hd_data);
02725 int hd_color(hd_data_t *hd_data);
02726 int hd_is_uml(hd_data_t *hd_data);
02727 int hd_is_xen(hd_data_t *hd_data);
02728 unsigned hd_display_adapter(hd_data_t *hd_data);
02729 unsigned hd_boot_disk(hd_data_t *hd_data, int *matches);
02730 enum cpu_arch hd_cpu_arch(hd_data_t *hd_data);
02731 enum boot_arch hd_boot_arch(hd_data_t *hd_data);
02732 
02733 hd_t *hd_get_device_by_idx(hd_data_t *hd_data, unsigned idx);
02734 
02735 void hd_set_hw_class(hd_t *hd, hd_hw_item_t hw_class);
02736 int hd_is_hw_class(hd_t *hd, hd_hw_item_t hw_class);
02737 
02738 int hd_is_sgi_altix(hd_data_t *hd_data);
02739 
02740 char *hd_version(void);
02741 
02742 hal_prop_t *hd_free_hal_properties(hal_prop_t *prop);
02743 hal_prop_t *hd_read_properties(const char *udi);
02744 int hd_write_properties(const char *udi, hal_prop_t *prop);
02745 
02746 int hd_change_status(const char *id, hd_status_t status, const char *config_string);
02747 int hd_change_config_status(hd_data_t *hd_data, const char *id, hd_status_t status, const char *config_string);
02748 int hd_read_mmap(hd_data_t *hd_data, char *name, unsigned char *buf, off_t start, unsigned size);
02749 
02750 /* implemented in hddb.c */
02751 
02755 str_list_t *hddb_get_packages(hd_data_t *hd_data);
02756 void hddb_add_info(hd_data_t *hd_data, hd_t *hd);
02757 
02758 void hddb_dump_raw(hddb2_data_t *hddb, FILE *f);
02759 void hddb_dump(hddb2_data_t *hddb, FILE *f);
02760 
02761 
02762 /* implemented in hdp.c */
02763 void hd_dump_entry(hd_data_t *hd_data, hd_t *hd, FILE *f);
02764 
02765 /* implemented in cdrom.c */
02766 cdrom_info_t *hd_read_cdrom_info(hd_data_t *hd_data, hd_t *hd);
02767 
02775 hd_manual_t *hd_manual_read_entry(hd_data_t *hd_data, const char *id);
02776 int hd_manual_write_entry(hd_data_t *hd_data, hd_manual_t *entry);
02777 hd_manual_t *hd_free_manual(hd_manual_t *manual);
02778 hd_t *hd_read_config(hd_data_t *hd_data, const char *id);
02779 int hd_write_config(hd_data_t *hd_data, hd_t *hd);
02780 char *hd_hw_item_name(hd_hw_item_t item);
02781 hd_hw_item_t hd_hw_item_type(char *name);
02782 char *hd_status_value_name(hd_status_value_t status);
02783 
02794 #define CDBISDN_VERSION 0x0101
02795 
02796 #ifndef PCI_ANY_ID
02797 #define PCI_ANY_ID      0xffff
02798 #endif
02799 
02800 #define CDBISDN_P_NONE  0x0
02801 #define CDBISDN_P_IRQ   0x1
02802 #define CDBISDN_P_MEM   0x2
02803 #define CDBISDN_P_IO    0x3
02804 
02806 typedef struct {
02807         char    *name;
02808         char    *shortname;
02809         int     vnr;
02810         int     refcnt;
02811 } cdb_isdn_vendor;
02812 
02813 typedef struct  {
02814         int     handle;         
02815         int     vhandle;        
02816         char    *name;          
02817         char    *lname;         
02818         char    *Class;         
02819         char    *bus;           
02820         int     revision;       
02821         int     vendor;         
02822         int     device;         
02823         int     subvendor;      
02825         int     subdevice;      
02827         unsigned int features;  
02828         int     line_cnt;       
02829         int     vario_cnt;      
02830         int     vario;          
02831 } cdb_isdn_card;
02832 
02833 typedef struct  {
02834         int     handle;         
02835         int     next_vario;     
02836         int     drvid;          
02837         int     typ;            
02838         int     subtyp;         
02839         int     smp;            
02840         char    *mod_name;      
02841         char    *para_str;      
02842         char    *mod_preload;   
02843         char    *cfg_prog;      
02844         char    *firmware;      
02845         char    *description;   
02846         char    *need_pkg;      
02847         char    *info;          
02848         char    *protocol;      
02849         char    *interface;     
02850         char    *io;            
02851         char    *irq;           
02852         char    *membase;       
02853         char    *features;      
02854         int     card_ref;       
02855         char    *name;          
02856 } cdb_isdn_vario;
02857 
02858 
02859 extern cdb_isdn_vendor  *hd_cdbisdn_get_vendor(int);
02860 extern cdb_isdn_card    *hd_cdbisdn_get_card(int);
02861 extern cdb_isdn_vario   *hd_cdbisdn_get_vario_from_type(int, int);
02862 extern cdb_isdn_card    *hd_cdbisdn_get_card_from_type(int, int);
02863 extern cdb_isdn_card    *hd_cdbisdn_get_card_from_id(int, int, int, int);
02864 extern cdb_isdn_vario   *hd_cdbisdn_get_vario(int);
02865 extern int              hd_cdbisdn_get_version(void);
02866 extern int              hd_cdbisdn_get_db_version(void);
02867 extern char             *hd_cdbisdn_get_db_date(void);
02868 
02874 #ifdef __cplusplus
02875 }
02876 #endif
02877 
02880 #endif  /* _HD_H */