• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

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