hd.h

Go to the documentation of this file.
00001 #ifndef _HD_H
00002 #define _HD_H
00003 
00004 #ifdef __cplusplus
00005 extern "C" {
00006 #endif
00007 
00008 
00009 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00010  *
00011  *                      libhd data structures
00012  *
00013  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00014  */
00015 
00016 #define HD_VERSION      12
00017 
00018 /*
00019  * debug flags
00020  */
00021 #define HD_DEB_SHOW_LOG         (1 <<  0)
00022 #define HD_DEB_PROGRESS         (1 <<  1)
00023 #define HD_DEB_CREATION         (1 <<  2)
00024 #define HD_DEB_DRIVER_INFO      (1 <<  3)
00025 #define HD_DEB_PCI              (1 <<  4)
00026 #define HD_DEB_ISAPNP           (1 <<  5)
00027 #define HD_DEB_CDROM            (1 <<  6)
00028 #define HD_DEB_NET              (1 <<  7)
00029 #define HD_DEB_FLOPPY           (1 <<  8)
00030 #define HD_DEB_MISC             (1 <<  9)
00031 #define HD_DEB_SERIAL           (1 << 10)
00032 #define HD_DEB_MONITOR          (1 << 11)
00033 #define HD_DEB_CPU              (1 << 12)
00034 #define HD_DEB_BIOS             (1 << 13)
00035 #define HD_DEB_MOUSE            (1 << 14)
00036 #define HD_DEB_IDE              (1 << 15)
00037 #define HD_DEB_SCSI             (1 << 16)
00038 #define HD_DEB_USB              (1 << 17)
00039 #define HD_DEB_ADB              (1 << 18)
00040 #define HD_DEB_MODEM            (1 << 19)
00041 #define HD_DEB_PARALLEL         (1 << 20)
00042 #define HD_DEB_ISA              (1 << 21)
00043 #define HD_DEB_BOOT             (1 << 22)
00044 #define HD_DEB_HDDB             (1 << 23)
00045 
00046 #include <stdio.h>
00047 #include <inttypes.h>
00048 #include <termios.h>
00049 #include <sys/types.h>
00050 
00051 /*
00052  * libhd's directory
00053  */
00054 #define HARDWARE_DIR            "/var/lib/hardware"
00055 
00070 #define TAG_PCI         1       
00071 #define TAG_EISA        2       
00072 #define TAG_USB         3       
00073 #define TAG_SPECIAL     4       
00074 #define TAG_PCMCIA      5       
00079 #define ID_VALUE(id)            ((id) & 0xffff)
00080 
00084 #define ID_TAG(id)              (((id) >> 16) & 0xf)
00085 
00089 #define MAKE_ID(tag, id_val)    ((tag << 16) | (id_val))
00090 
00093 /*
00094  * flags to control the probing.
00095  */
00096 typedef enum probe_feature {
00097   pr_memory = 1, pr_pci, pr_isapnp, pr_net, pr_floppy, pr_misc,
00098   pr_misc_serial, pr_misc_par, pr_misc_floppy, pr_serial, pr_cpu, pr_bios,
00099   pr_monitor, pr_mouse, pr_scsi, pr_usb, pr_usb_mods, pr_adb, pr_modem,
00100   pr_modem_usb, pr_parallel, pr_parallel_lp, pr_parallel_zip, pr_isa,
00101   pr_isa_isdn, pr_isdn, pr_kbd, pr_prom, pr_sbus, pr_int, pr_braille,
00102   pr_braille_alva, pr_braille_fhp, pr_braille_ht, pr_ignx11, pr_sys,
00103   pr_bios_vbe, pr_isapnp_old, pr_isapnp_new, pr_isapnp_mod, pr_braille_baum,
00104   pr_manual, pr_fb, pr_veth, pr_pppoe, pr_scan, pr_pcmcia, pr_fork,
00105   pr_parallel_imm, pr_s390, pr_cpuemu, pr_sysfs, pr_s390disks, pr_udev,
00106   pr_block, pr_block_cdrom, pr_block_part, pr_edd, pr_edd_mod, pr_bios_ddc,
00107   pr_bios_fb, pr_bios_mode, pr_input, pr_block_mods, pr_bios_vesa,
00108   pr_cpuemu_debug, pr_scsi_noserial, pr_wlan, pr_bios_crc, pr_hal,
00109   pr_bios_vram,
00110   pr_max, pr_lxrc, pr_default, pr_all           /* pr_all must be last */
00111 } hd_probe_feature_t;
00112 
00113 /*
00114  * list types for hd_list()
00115  *
00116  * if you want to modify this: cf. manual.c::hw_items[]
00117  *
00118  * Note: hw_tv _must_ be < hw_display!
00119  * Sync with check_hd and convert_hd!
00120  */
00121 typedef enum hw_item {
00122   hw_none = 0, hw_sys, hw_cpu, hw_keyboard, hw_braille, hw_mouse,
00123   hw_joystick, hw_printer, hw_scanner, hw_chipcard, hw_monitor, hw_tv,
00124   hw_display, hw_framebuffer, hw_camera, hw_sound, hw_storage_ctrl,
00125   hw_network_ctrl, hw_isdn, hw_modem, hw_network, hw_disk, hw_partition,
00126   hw_cdrom, hw_floppy, hw_manual, hw_usb_ctrl, hw_usb, hw_bios, hw_pci,
00127   hw_isapnp, hw_bridge, hw_hub, hw_scsi, hw_ide, hw_memory, hw_dvb,
00128   hw_pcmcia, hw_pcmcia_ctrl, hw_ieee1394, hw_ieee1394_ctrl, hw_hotplug,
00129   hw_hotplug_ctrl, hw_zip, hw_pppoe, hw_wlan, hw_redasd, hw_dsl, hw_block,
00130   hw_tape, hw_vbe, hw_bluetooth,
00131   /* append new entries here */
00132   hw_unknown, hw_all                                    /* hw_all must be last */
00133 } hd_hw_item_t;
00134 
00135 /*
00136  * device base classes and bus types
00137  *
00138  */
00139 
00140 /* base class values (superset of PCI classes) */
00141 typedef enum base_classes {
00142   /* these *must* match standard PCI class numbers */
00143   bc_none, bc_storage, bc_network, bc_display, bc_multimedia,
00144   bc_memory, bc_bridge, bc_comm, bc_system, bc_input, bc_docking,
00145   bc_processor, bc_serial, bc_wireless, bc_i2o, bc_other = 0xff,
00146 
00147   // add our own classes here (starting at 0x100 as PCI values are 8 bit)
00148   bc_monitor = 0x100, bc_internal, bc_modem, bc_isdn, bc_ps2, bc_mouse,
00149   bc_storage_device, bc_network_interface, bc_keyboard, bc_printer,
00150   bc_hub, bc_braille, bc_scanner, bc_joystick, bc_chipcard, bc_camera,
00151   bc_framebuffer, bc_dvb, bc_tv, bc_partition, bc_dsl, bc_bluetooth
00152 } hd_base_classes_t;
00153 
00154 /* subclass values of bc_monitor */
00155 typedef enum sc_monitor {
00156   sc_mon_other, sc_mon_crt, sc_mon_lcd
00157 } hd_sc_monitor_t;
00158 
00159 /* subclass values of bc_storage */
00160 typedef enum sc_storage {
00161   sc_sto_scsi, sc_sto_ide, sc_sto_floppy, sc_sto_ipi, sc_sto_raid,
00162   sc_sto_other = 0x80
00163 } hd_sc_storage_t;
00164 
00165 /* subclass values of bc_display */
00166 typedef enum sc_display {
00167   sc_dis_vga, sc_dis_xga, sc_dis_other = 0x80
00168 } hd_sc_display_t;
00169 
00170 /* subclass values of bc_framebuffer */
00171 typedef enum sc_framebuffer {
00172   sc_fb_vesa = 1
00173 } hd_sc_framebuffer_t;
00174 
00175 /* subclass values of bc_bridge */
00176 typedef enum sc_bridge { 
00177   sc_bridge_host, sc_bridge_isa, sc_bridge_eisa, sc_bridge_mc,
00178   sc_bridge_pci, sc_bridge_pcmcia, sc_bridge_nubus, sc_bridge_cardbus,
00179   sc_bridge_other = 0x80
00180 } hd_sc_bridge_t;
00181 
00182 /* subclass values of bc_comm */
00183 typedef enum sc_comm { 
00184   sc_com_ser, sc_com_par, sc_com_multi, sc_com_modem, sc_com_other = 0x80
00185 } hd_sc_comm_t;
00186 
00187 /* subclass values of bc_system */
00188 typedef enum sc_system {
00189   sc_sys_pic, sc_sys_dma, sc_sys_timer, sc_sys_rtc, sc_sys_other = 0x80
00190 } hd_sc_system_t;
00191 
00192 /* subclass values of bc_input */
00193 typedef enum sc_input {
00194   sc_inp_keyb, sc_inp_digit, sc_inp_mouse, sc_inp_other = 0x80
00195 } hd_sc_input_t;
00196 
00197 /* subclass values of bc_serial */
00198 typedef enum sc_serial {
00199   sc_ser_fire, sc_ser_access, sc_ser_ssa, sc_ser_usb, sc_ser_fiber,
00200   sc_ser_smbus, sc_ser_other = 0x80
00201 } hd_sc_serial_t;
00202 
00203 /* internal sub class values (bc_internal) */
00204 typedef enum sc_internal {
00205   sc_int_none, sc_int_isapnp_if, sc_int_main_mem, sc_int_cpu, sc_int_fpu,
00206   sc_int_bios, sc_int_prom, sc_int_sys
00207 } hd_sc_internal_t;
00208 
00209 /* subclass values of bc_mouse */
00210 typedef enum sc_mouse {
00211   sc_mou_ps2, sc_mou_ser, sc_mou_bus, sc_mou_usb, sc_mou_sun,
00212   sc_mou_other = 0x80
00213 } hd_sc_mouse_t;
00214 
00215 /* subclass values of bc_storage_device */
00216 typedef enum sc_std {
00217   sc_sdev_disk, sc_sdev_tape, sc_sdev_cdrom, sc_sdev_floppy, sc_sdev_scanner,
00218   sc_sdev_other = 0x80
00219 } hd_sc_std_t;
00220 
00221 /* subclass values of bc_network_interface */
00222 typedef enum sc_net_if {
00223   sc_nif_loopback, sc_nif_ethernet, sc_nif_tokenring, sc_nif_fddi,
00224   sc_nif_ctc, sc_nif_iucv, sc_nif_hsi, sc_nif_qeth,
00225   sc_nif_escon, sc_nif_myrinet, sc_nif_wlan, sc_nif_xp,
00226   sc_nif_usb, sc_nif_other = 0x80, sc_nif_sit
00227 } hd_sc_net_if_t;
00228 
00229 /* subclass values of bc_multimedia */
00230 typedef enum sc_multimedia {
00231   sc_multi_video, sc_multi_audio, sc_multi_other
00232 } hd_sc_multimedia_t;
00233 
00234 /* subclass values of bc_keyboard */
00235 typedef enum sc_keyboard {
00236   sc_keyboard_kbd, sc_keyboard_console
00237 } hd_sc_keyboard_t;
00238 
00239 /* subclass values of bc_hub */
00240 typedef enum sc_hub {
00241   sc_hub_other, sc_hub_usb
00242 } hd_sc_hub_t;
00243 
00244 /* subclass values of bc_camera */
00245 typedef enum sc_camera {
00246   sc_camera_webcam, sc_camera_digital
00247 } hd_sc_camera_t;
00248 
00249 /* subclass values of bc_modem */
00250 typedef enum sc_modem {
00251   sc_mod_at, sc_mod_win1, sc_mod_win2, sc_mod_win3, sc_mod_win4
00252 } hd_sc_modem_t;
00253 
00254 /* subclass values of bc_dsl */
00255 typedef enum sc_dsl {
00256   sc_dsl_unknown, sc_dsl_pppoe, sc_dsl_capi, sc_dsl_capiisdn
00257 } hd_sc_dsl_t;
00258 
00259 /* prog_if's of sc_ser_usb */
00260 typedef enum pif_usb_e {
00261   pif_usb_uhci = 0, pif_usb_ohci = 0x10, pif_usb_ehci = 0x20,
00262   pif_usb_other = 0x80, pif_usb_device = 0xfe
00263 } hd_pif_usb_t;
00264 
00265 /* CD-ROM  prog_if values */
00266 typedef enum pif_cdrom {
00267   pif_cdrom, pif_cdr, pif_cdrw, pif_dvd, pif_dvdr, pif_dvdram
00268 } hd_pif_cdrom_t ;
00269 
00270 /* S/390 disk prog_if values */
00271 typedef enum pif_s390disk {
00272   pif_scsi, pif_dasd, pif_dasd_fba
00273 } hd_pif_s390disk_t;
00274 
00275 /* bus type values similar to PCI bridge subclasses */
00276 typedef enum bus_types {
00277   bus_none, bus_isa, bus_eisa, bus_mc, bus_pci, bus_pcmcia, bus_nubus,
00278   bus_cardbus, bus_other,
00279 
00280   /* outside the range of the PCI values */
00281   bus_ps2 = 0x80, bus_serial, bus_parallel, bus_floppy, bus_scsi, bus_ide, bus_usb,
00282   bus_adb, bus_raid, bus_sbus, bus_i2o, bus_vio, bus_ccw, bus_iucv
00283 } hd_bus_types_t;
00284 
00291 typedef struct {
00295   unsigned invalid:1;
00305   unsigned reconfig:3;
00306 
00312   unsigned configured:3;
00313 
00324   unsigned available:3;
00325 
00333   unsigned needed:3;
00334 
00341   unsigned available_orig:3;
00342 
00346   unsigned active:3;
00347 } hd_status_t;
00348 
00349 /* hardware config status values */
00350 typedef enum {
00351   status_no = 1, status_yes, status_unknown, status_new
00352 } hd_status_value_t;
00353 
00357 typedef enum {
00358   hp_none,      
00359   hp_pcmcia,    
00360   hp_cardbus,   
00361   hp_pci,       
00362   hp_usb,       
00363   hp_ieee1394   
00364 } hd_hotplug_t;
00365 
00366 
00371 typedef struct {
00372   unsigned id;          
00373   char *name;           
00374 } hd_id_t;
00375 
00380 typedef struct s_str_list_t {
00381   struct s_str_list_t *next;    
00382   char *str;                    
00383 } str_list_t;
00384 
00385 
00386 typedef struct {
00387   unsigned char bitmap[16];     /* large enough for all uses */
00388   unsigned bits;                /* real bitmap length in bits */
00389   unsigned not_empty:1;         /* at least 1 bit is set */
00390   str_list_t *str;              /* interpreted bitmask */
00391 } hd_bitmap_t;
00392 
00393 
00394 /*
00395  * for memory areas
00396  */
00397 typedef struct {
00398   unsigned start, size;         /* base address & size */
00399   unsigned char *data;          /* actual data */
00400 } memory_range_t;
00401 
00402 
00403 /*
00404  * smp info according to Intel smp spec (ia32)
00405  */
00406 typedef struct {
00407   unsigned ok:1;                /* data are valid */
00408   unsigned rev;                 /* MP spec revision */
00409   unsigned mpfp;                /* MP Floating Pointer struct */
00410   unsigned mpconfig_ok:1;       /* MP config table valid */
00411   unsigned mpconfig;            /* MP config table */
00412   unsigned mpconfig_size;       /* dto, size */
00413   unsigned char feature[5];     /* MP feature info */
00414   char oem_id[9];               /* oem id */
00415   char prod_id[13];             /* product id */
00416   unsigned cpus, cpus_en;       /* number of cpus & ennabled cpus */
00417 } smp_info_t;
00418 
00419 
00420 /*
00421  * vesa bios extensions info
00422  */
00423 typedef struct vbe_mode_info_s {
00424   unsigned number;              /* mode number */
00425   unsigned attributes;          /* mode attributes */
00426   unsigned width, height;       /* mode size */
00427   unsigned bytes_p_line;        /* line length */
00428   unsigned pixel_size;          /* bits per pixel */
00429   unsigned fb_start;            /* frame buffer start address (if any) */
00430   unsigned win_A_start;         /* window A start address */
00431   unsigned win_A_attr;          /* window A attributes */
00432   unsigned win_B_start;         /* window B start address */
00433   unsigned win_B_attr;          /* window B attributes */
00434   unsigned win_size;            /* window size in bytes */
00435   unsigned win_gran;            /* window granularity in bytes */
00436   unsigned pixel_clock;         /* maximum pixel clock */
00437 } vbe_mode_info_t;
00438 
00439 
00440 typedef struct {
00441   unsigned ok:1;                /* data are valid */
00442   unsigned version;             /* vbe version */
00443   unsigned oem_version;         /* oem version info */
00444   unsigned memory;              /* in bytes */
00445   unsigned fb_start;            /* != 0 if framebuffer is supported */
00446   char *oem_name;               /* oem name */
00447   char *vendor_name;            /* vendor name */
00448   char *product_name;           /* product name */
00449   char *product_revision;       /* product revision */
00450   unsigned modes;               /* number of supported video modes */
00451   vbe_mode_info_t *mode;        /* video mode list */
00452   unsigned current_mode;        /* current video mode */
00453   unsigned char ddc_port[2][0x80];      /* ddc monitor info per port */
00454 } vbe_info_t;
00455 
00456 
00457 /*
00458  * Compaq Controller Order EV (CQHORD) definition
00459  */
00460 typedef struct {
00461     unsigned id;
00462     unsigned char slot;
00463     unsigned char bus;
00464     unsigned char devfn;
00465     unsigned char misc;
00466 } cpq_ctlorder_t; 
00467 
00468 
00469 typedef struct {
00470   unsigned ok:1;                /* data are valid */
00471   unsigned entry;               /* entry point */
00472   unsigned compaq:1;            /* is compaq system */
00473   cpq_ctlorder_t cpq_ctrl[32];  /* 32 == MAX_CONTROLLERS */
00474 } bios32_info_t;
00475 
00476 
00477 /*
00478  * smbios entries
00479  */
00480 typedef enum {
00481   sm_biosinfo, sm_sysinfo, sm_boardinfo, sm_chassis,
00482   sm_processor, sm_memctrl, sm_memmodule, sm_cache,
00483   sm_connect, sm_slot, sm_onboard, sm_oem,
00484   sm_config, sm_lang, sm_group, sm_eventlog,
00485   sm_memarray, sm_memdevice, sm_memerror, sm_memarraymap,
00486   sm_memdevicemap, sm_mouse, sm_battery, sm_reset,
00487   sm_secure, sm_power, sm_voltage, sm_cool,
00488   sm_temperature, sm_current, sm_outofband, sm_bis,
00489   sm_boot, sm_mem64error, sm_mandev, sm_mandevcomp,
00490   sm_mdtd, sm_inactive = 126, sm_end = 127
00491 } hd_smbios_type_t;
00492 
00493 
00494 /* common part of all smbios_* types */
00495 typedef struct {
00496   union u_hd_smbios_t *next;    /* link to next entry */
00497   hd_smbios_type_t type;        /* BIOS info type */
00498   int data_len;                 /* formatted section length */
00499   unsigned char *data;          /* formatted section */
00500   str_list_t *strings;          /* strings taken from the unformed section */
00501   int handle;                   /* handle, unique 16 bit number */
00502 } smbios_any_t;
00503 
00504 
00505 /* BIOS related information */
00506 typedef struct {
00507   union u_hd_smbios_t *next;
00508   hd_smbios_type_t type;
00509   int data_len;
00510   unsigned char *data;
00511   str_list_t *strings;
00512   int handle;
00513   char *vendor;                 /* vendor name */
00514   char *version;                /* version (free form) */
00515   char *date;                   /* date mm/dd/yyyy (old: yy) */
00516   hd_bitmap_t feature;          /* BIOS characteristics */
00517   unsigned start;               /* start address */
00518   unsigned rom_size;            /* ROM size (in bytes) */
00519 } smbios_biosinfo_t;
00520 
00521 
00522 /* overall system related information */
00523 typedef struct {
00524   union u_hd_smbios_t *next;
00525   hd_smbios_type_t type;
00526   int data_len;
00527   unsigned char *data;
00528   str_list_t *strings;
00529   int handle;
00530   char *manuf;                  /* manufacturer */
00531   char *product;                /* product name */
00532   char *version;                /* version */
00533   char *serial;                 /* serial number */
00534   unsigned char uuid[16];       /* universal unique id; all 0x00: undef, all 0xff: undef but settable */
00535   hd_id_t wake_up;              /* wake-up type */
00536 } smbios_sysinfo_t;
00537 
00538 
00539 /* motherboard related information */
00540 typedef struct {
00541   union u_hd_smbios_t *next;
00542   hd_smbios_type_t type;
00543   int data_len;
00544   unsigned char *data;
00545   str_list_t *strings;
00546   int handle;
00547   char *manuf;                  /* manufacturer */
00548   char *product;                /* product name */
00549   char *version;                /* version */
00550   char *serial;                 /* serial number */
00551   char *asset;                  /* asset tag */
00552   hd_id_t board_type;           /* board type */
00553   hd_bitmap_t feature;          /* board features */
00554   char *location;               /* location in chassis */
00555   int chassis;                  /* handle of chassis */
00556   int objects_len;              /* number of contained objects */
00557   int *objects;                 /* array of object handles */
00558 } smbios_boardinfo_t;
00559 
00560 
00561 /* chassis information */
00562 typedef struct {
00563   union u_hd_smbios_t *next;
00564   hd_smbios_type_t type;
00565   int data_len;
00566   unsigned char *data;
00567   str_list_t *strings;
00568   int handle;
00569   char *manuf;                  /* manufacturer */
00570   char *version;                /* version */
00571   char *serial;                 /* serial number */
00572   char *asset;                  /* asset tag */
00573   hd_id_t ch_type;              /* chassis type */
00574   unsigned lock;                /* 1: lock present, 0: not present or unknown */
00575   hd_id_t bootup;               /* bootup state */
00576   hd_id_t power;                /* power supply state (at last boot) */
00577   hd_id_t thermal;              /* thermal state (at last boot) */
00578   hd_id_t security;             /* security state (at last boot) */
00579   unsigned oem;                 /* OEM-specific information */
00580 } smbios_chassis_t;
00581 
00582 
00583 /* processor information */
00584 typedef struct {
00585   union u_hd_smbios_t *next;
00586   hd_smbios_type_t type;
00587   int data_len;
00588   unsigned char *data;
00589   str_list_t *strings;
00590   int handle;
00591   char *socket;                 /* socket */
00592   hd_id_t upgrade;              /* socket type */
00593   char *manuf;                  /* manufacturer */
00594   char *version;                /* version */
00595   char *serial;                 /* serial number */
00596   char *asset;                  /* asset tag */
00597   char *part;                   /* part number */
00598   hd_id_t pr_type;              /* processor type */
00599   hd_id_t family;               /* processor family */
00600   uint64_t cpu_id;              /* processor id */
00601   unsigned voltage;             /* in 0.1 V */
00602   unsigned ext_clock;           /* MHz */
00603   unsigned max_speed;           /* MHz */
00604   unsigned current_speed;       /* MHz */
00605   unsigned sock_status;         /* socket status (1: populated, 0: empty */
00606   hd_id_t cpu_status;           /* cpu status */
00607   int l1_cache;                 /* handle of L1 cache */
00608   int l2_cache;                 /* handle of L2 cache */
00609   int l3_cache;                 /* handle of L3 cache */
00610 } smbios_processor_t;
00611 
00612 
00613 /* cache information */
00614 typedef struct {
00615   union u_hd_smbios_t *next;
00616   hd_smbios_type_t type;
00617   int data_len;
00618   unsigned char *data;
00619   str_list_t *strings;
00620   int handle;
00621   char *socket;                 /* socket designation */
00622   unsigned max_size;            /* max cache size in kbytes */
00623   unsigned current_size;        /* current size in kbytes */
00624   unsigned speed;               /* cache speed in nanoseconds */
00625   hd_id_t mode;                 /* operational mode */
00626   unsigned state;               /* 0/1: disabled/enabled */
00627   hd_id_t location;             /* cache location */
00628   unsigned socketed;            /* 0/1: not socketed/socketed */
00629   unsigned level;               /* cache level (0 = L1, 1 = L2, ...) */
00630   hd_id_t ecc;                  /* error correction type */
00631   hd_id_t cache_type;           /* logical cache type */
00632   hd_id_t assoc;                /* cache associativity */
00633   hd_bitmap_t supp_sram;        /* supported SRAM types */
00634   hd_bitmap_t sram;             /* current SRAM type */
00635 } smbios_cache_t;
00636 
00637 
00638 /* port connector information */
00639 typedef struct {
00640   union u_hd_smbios_t *next;
00641   hd_smbios_type_t type;
00642   int data_len;
00643   unsigned char *data;
00644   str_list_t *strings;
00645   int handle;
00646   hd_id_t port_type;            /* port type */
00647   char *i_des;                  /* internal reference designator */
00648   hd_id_t i_type;               /* internal connector type */
00649   char *x_des;                  /* external reference designator */
00650   hd_id_t x_type;               /* external connector type */
00651 } smbios_connect_t;
00652 
00653 
00654 /* system slot information */
00655 typedef struct {
00656   union u_hd_smbios_t *next;
00657   hd_smbios_type_t type;
00658   int data_len;
00659   unsigned char *data;
00660   str_list_t *strings;
00661   int handle;
00662   char *desig;                  /* slot designation */
00663   hd_id_t slot_type;            /* slot type */
00664   hd_id_t bus_width;            /* data bus width */
00665   hd_id_t usage;                /* current usage */
00666   hd_id_t length;               /* slot length */
00667   unsigned id;                  /* slot id */
00668   hd_bitmap_t feature;          /* slot characteristics */
00669 } smbios_slot_t;
00670 
00671 
00672 /* on board devices information */
00673 typedef struct {
00674   union u_hd_smbios_t *next;
00675   hd_smbios_type_t type;
00676   int data_len;
00677   unsigned char *data;
00678   str_list_t *strings;
00679   int handle;
00680   unsigned dev_len;             /* device list length */
00681   struct {
00682     char *name;                 /* device name */
00683     hd_id_t type;               /* device type */
00684     unsigned status;            /* 0: disabled, 1: enabled */
00685   } *dev;                       /* device list  */
00686 } smbios_onboard_t;
00687 
00688 
00689 /* OEM information */
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   str_list_t *oem_strings;      /* OEM strings */
00698 } smbios_oem_t;
00699 
00700 
00701 /* system config options */
00702 typedef struct {
00703   union u_hd_smbios_t *next;
00704   hd_smbios_type_t type;
00705   int data_len;
00706   unsigned char *data;
00707   str_list_t *strings;
00708   int handle;
00709   str_list_t *options;          /* system config options */
00710 } smbios_config_t;
00711 
00712 
00713 /* language information */
00714 typedef struct {
00715   union u_hd_smbios_t *next;
00716   hd_smbios_type_t type;
00717   int data_len;
00718   unsigned char *data;
00719   str_list_t *strings;          /* list of languages */
00720   int handle;
00721   char *current;                /* current language */
00722 } smbios_lang_t;
00723 
00724 
00725 /* group associations */
00726 typedef struct {
00727   union u_hd_smbios_t *next;
00728   hd_smbios_type_t type;
00729   int data_len;
00730   unsigned char *data;
00731   str_list_t *strings;
00732   int handle;
00733   char *name;                   /* group name */
00734   int items_len;                /* number of items in this group */
00735   int *item_handles;            /* array of item handles */
00736 } smbios_group_t;
00737 
00738 
00739 /* physical memory array (consists of several memory devices) */
00740 typedef struct {
00741   union u_hd_smbios_t *next;
00742   hd_smbios_type_t type;
00743   int data_len;
00744   unsigned char *data;
00745   str_list_t *strings;
00746   int handle;
00747   hd_id_t location;             /* memory device location */
00748   hd_id_t use;                  /* memory usage */
00749   hd_id_t ecc;                  /* ECC types */
00750   unsigned max_size;            /* maximum memory size in kB */
00751   int error_handle;             /* points to error info record; 0xfffe: not supported, 0xffff: no error */
00752   unsigned slots;               /* slots or sockets for this device */
00753 } smbios_memarray_t;
00754 
00755 
00756 /* memory device */
00757 typedef struct {
00758   union u_hd_smbios_t *next;
00759   hd_smbios_type_t type;
00760   int data_len;
00761   unsigned char *data;
00762   str_list_t *strings;
00763   int handle;
00764   char *location;               /* device location */
00765   char *bank;                   /* bank location */
00766   char *manuf;                  /* manufacturer */
00767   char *serial;                 /* serial number */
00768   char *asset;                  /* asset tag */
00769   char *part;                   /* part number */
00770   int array_handle;             /* memory array this device belongs to */
00771   int error_handle;             /* points to error info record; 0xfffe: not supported, 0xffff: no error */
00772   unsigned width;               /* data width in bits */
00773   unsigned eccbits;             /* ecc bits */
00774   unsigned size;                /* kB */
00775   hd_id_t form;                 /* form factor */
00776   unsigned set;                 /* 0: does not belong to a set; 1-0xfe: set number; 0xff: unknown */
00777   hd_id_t mem_type;             /* memory type */
00778   hd_bitmap_t type_detail;      /* memory type details */
00779   unsigned speed;               /* in MHz */
00780 } smbios_memdevice_t;
00781 
00782 
00783 /* 32-bit memory error information  */
00784 typedef struct {
00785   union u_hd_smbios_t *next;
00786   hd_smbios_type_t type;
00787   int data_len;
00788   unsigned char *data;
00789   str_list_t *strings;
00790   int handle;
00791   hd_id_t err_type;             /* error type memory */
00792   hd_id_t granularity;          /* memory array or memory partition */
00793   hd_id_t operation;            /* mem operation causing the error */
00794   unsigned syndrome;            /* vendor-specific ECC syndrome; 0: unknown */
00795   unsigned array_addr;          /* fault address rel. to mem array; 0x80000000: unknown */
00796   unsigned device_addr;         /* fault address rel to mem device; 0x80000000: unknown */
00797   unsigned range;               /* range, within which the error can be determined; 0x80000000: unknown */
00798 } smbios_memerror_t;
00799 
00800 
00801 /* memory array mapped address */
00802 typedef struct {
00803   union u_hd_smbios_t *next;
00804   hd_smbios_type_t type;
00805   int data_len;
00806   unsigned char *data;
00807   str_list_t *strings;
00808   int handle;
00809   int array_handle;             /* memory array this mapping belongs to */
00810   uint64_t start_addr;          /* memory range start address */
00811   uint64_t end_addr;            /* end address */
00812   unsigned part_width;          /* number of memory devices */
00813 } smbios_memarraymap_t;
00814 
00815 
00816 /* memory device mapped address */
00817 typedef struct {
00818   union u_hd_smbios_t *next;
00819   hd_smbios_type_t type;
00820   int data_len;
00821   unsigned char *data;
00822   str_list_t *strings;
00823   int handle;
00824   int memdevice_handle;         /* memory device handle */
00825   int arraymap_handle;          /* memory array mapping handle */
00826   uint64_t start_addr;          /* memory range start address */
00827   uint64_t end_addr;            /* end address */
00828   unsigned row_pos;             /* position of the referenced memory device in a row of the address partition */
00829   unsigned interleave_pos;      /* dto, in an interleave */
00830   unsigned interleave_depth;    /* number of consecutive rows */
00831 } smbios_memdevicemap_t;
00832 
00833 
00834 /* pointing device (aka 'mouse') information */
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 mtype;                /* mouse type */
00843   hd_id_t interface;            /* interface type */
00844   unsigned buttons;             /* number of buttons */
00845 } smbios_mouse_t;
00846 
00847 
00848 /* hardware security */
00849 typedef struct {
00850   union u_hd_smbios_t *next;
00851   hd_smbios_type_t type;
00852   int data_len;
00853   unsigned char *data;
00854   str_list_t *strings;
00855   int handle;
00856   hd_id_t power;                /* power-on password status */
00857   hd_id_t keyboard;             /* keyboard password status */
00858   hd_id_t admin;                /* admin password status */
00859   hd_id_t reset;                /* front panel reset status */
00860 } smbios_secure_t;
00861 
00862 
00863 /* system power controls */
00864 typedef struct {
00865   union u_hd_smbios_t *next;
00866   hd_smbios_type_t type;
00867   int data_len;
00868   unsigned char *data;
00869   str_list_t *strings;
00870   int handle;
00871   unsigned month;               /* next scheduled power-on month */
00872   unsigned day;                 /* dto, day */
00873   unsigned hour;                /* dto, hour */
00874   unsigned minute;              /* dto, minute */
00875   unsigned second;              /* dto, second */
00876 } smbios_power_t;
00877 
00878 
00879 /* 64-bit memory error information  */
00880 typedef struct {
00881   union u_hd_smbios_t *next;
00882   hd_smbios_type_t type;
00883   int data_len;
00884   unsigned char *data;
00885   str_list_t *strings;
00886   int handle;
00887   hd_id_t err_type;             /* error type memory */
00888   hd_id_t granularity;          /* memory array or memory partition */
00889   hd_id_t operation;            /* mem operation causing the error */
00890   unsigned syndrome;            /* vendor-specific ECC syndrome; 0: unknown */
00891   uint64_t array_addr;          /* fault address rel. to mem array; 0x80000000: unknown */
00892   uint64_t device_addr;         /* fault address rel to mem device; 0x80000000: unknown */
00893   unsigned range;               /* range, within which the error can be determined; 0x80000000: unknown */
00894 } smbios_mem64error_t;
00895 
00896 
00897 typedef union u_hd_smbios_t {
00898   union u_hd_smbios_t *next;  
00899   smbios_any_t any;
00900   smbios_biosinfo_t biosinfo;
00901   smbios_sysinfo_t sysinfo;
00902   smbios_boardinfo_t boardinfo;
00903   smbios_chassis_t chassis;
00904   smbios_processor_t processor;
00905   smbios_cache_t cache;
00906   smbios_connect_t connect;
00907   smbios_slot_t slot;
00908   smbios_onboard_t onboard;
00909   smbios_oem_t oem;
00910   smbios_config_t config;
00911   smbios_lang_t lang;
00912   smbios_group_t group;
00913   smbios_memarray_t memarray;
00914   smbios_memdevice_t memdevice;
00915   smbios_memerror_t memerror;
00916   smbios_memarraymap_t memarraymap;
00917   smbios_memdevicemap_t memdevicemap;
00918   smbios_mouse_t mouse;
00919   smbios_secure_t secure;
00920   smbios_power_t power;
00921   smbios_mem64error_t mem64error;
00922 } hd_smbios_t;
00923 
00924 
00925 /*
00926  * udev database info
00927  */
00928 typedef struct s_udevinfo_t {
00929   struct s_udevinfo_t *next;
00930   char *sysfs;
00931   char *name;
00932   str_list_t *links;
00933 } hd_udevinfo_t;
00934 
00935 
00936 /*
00937  * sysfs driver info
00938  */
00939 typedef struct s_sysfsdrv_t {
00940   struct s_sysfsdrv_t *next;
00941   char *driver;
00942   char *device;
00943 } hd_sysfsdrv_t;
00944 
00945 
00946 /*
00947  * device number; type is either 0 or 'b' or 'c'.
00948  *
00949  * range: number of nodes
00950  */
00951 typedef struct {
00952   int type;
00953   unsigned major, minor, range;
00954 } hd_dev_num_t;
00955 
00956 
00957 /*
00958  * structure holding the (raw) PCI data
00959  */
00960 typedef struct s_pci_t {
00961   struct s_pci_t *next;                         /* linked list */
00962   unsigned data_len;                            /* the actual length of the data field */
00963   unsigned data_ext_len;                        /* max. accessed config byte; see code */
00964   unsigned char data[256];                      /* the PCI data */
00965   char *log;                                    /* log messages */
00966   unsigned flags,                               /* various info, see enum pci_flags */
00967            cmd,                                 /* PCI_COMMAND */
00968            hdr_type,                            /* PCI_HEADER_TYPE */
00969            secondary_bus;                       /* > 0 for PCI & CB bridges */
00970   unsigned bus,                                 /* PCI bus #, *nothing* to do with hw_t.bus */
00971            slot, func;                          /* slot & function */
00972   unsigned base_class, sub_class, prog_if;      /* PCI device classes */
00973   unsigned dev, vend, sub_dev, sub_vend, rev;   /* vendor & device ids */
00974   unsigned irq;                                 /* used irq, if any */
00975   uint64_t base_addr[7];                        /* I/O or memory base */
00976   uint64_t base_len[7];                         /* I/O or memory ranges */
00977   unsigned addr_flags[7];                       /* I/O or memory address flags */
00978   uint64_t rom_base_addr;                       /* memory base for card ROM */
00979   uint64_t rom_base_len;                        /* memory range for card ROM */
00980   char *sysfs_id;                               /* sysfs path */
00981   char *sysfs_bus_id;                           /* sysfs bus id */
00982   char *modalias;                               /* module alias */
00983   unsigned edid_len;                            /* edid record length */
00984   unsigned char edid[0x80];                     /* edid record */
00985 } pci_t;
00986 
00987 /*
00988  * pci related flags cf. (pci_t).flags
00989  */
00990 typedef enum pci_flags {
00991   pci_flag_ok, pci_flag_pm, pci_flag_agp
00992 } hd_pci_flags_t;
00993 
00994 
00995 /*
00996  * raw USB data
00997  */
00998 typedef struct usb_s {
00999   struct usb_s *next;
01000   unsigned hd_idx;
01001   unsigned hd_base_idx;
01002   /* see Linux USB docs */
01003   str_list_t *c, *d, *e, *i, *p, *s, *t;
01004   struct usb_s *cloned;
01005   int bus, dev_nr, lev, parent, port, count, conns, used_conns, ifdescr;
01006   unsigned speed;
01007   unsigned vendor, device, rev;
01008   char *manufact, *product, *serial;
01009   char *driver;
01010   memory_range_t raw_descr;
01011   int d_cls, d_sub, d_prot;
01012   int i_alt, i_cls, i_sub, i_prot;
01013   unsigned country;
01014 } usb_t;
01015 
01016 /*
01017  *structures to hold the (raw) ISA-PnP data
01018  */
01019 typedef struct {
01020   int len;
01021   int type;
01022   unsigned char *data;
01023 } isapnp_res_t;
01024 
01025 typedef struct {
01026   int csn;
01027   int log_devs;
01028   unsigned char *serial;
01029   unsigned char *card_regs;
01030   unsigned char (*ldev_regs)[0xd0];
01031   int res_len;
01032   unsigned broken:1;            /* mark a broken card */
01033   isapnp_res_t *res;
01034 } isapnp_card_t;
01035 
01036 typedef struct {
01037   int read_port;
01038   int cards;
01039   isapnp_card_t *card;
01040 } isapnp_t;
01041 
01042 typedef struct {
01043   isapnp_card_t *card;
01044   int dev;
01045   unsigned flags;                               /* cf. enum isapnp_flags */
01046   unsigned ref:1;                               /* internally used flag */
01047 } isapnp_dev_t;
01048 
01049 /*
01050  * ISA-PnP related flags; cf. (isapnp_dev_t).flags
01051  */
01052 typedef enum isapnp_flags {
01053   isapnp_flag_act
01054 } hd_isapnp_flags_t;
01055 
01056 
01057 /*
01058  * raw SCSI data
01059  */
01060 typedef struct scsi_s {
01061   struct scsi_s *next;
01062   unsigned deleted:1;
01063   unsigned generic:1;
01064   unsigned fake:1;
01065   char *dev_name;
01066   char *guessed_dev_name;
01067   int generic_dev;
01068   unsigned host, channel, id, lun;
01069   char *vendor, *model, *rev, *type_str, *serial;
01070   int type;
01071   unsigned inode_low;
01072   char *proc_dir, *driver;
01073   unsigned unique;
01074   char *info;
01075   unsigned lgeo_c, lgeo_h, lgeo_s;
01076   unsigned pgeo_c, pgeo_h, pgeo_s;
01077   uint64_t size;
01078   unsigned sec_size;
01079   unsigned cache;
01080   str_list_t *host_info;
01081   char *usb_guid;
01082   unsigned pci_info;
01083   unsigned pci_bus;
01084   unsigned pci_slot;
01085   unsigned pci_func;
01086   uint64_t wwpn;
01087   uint64_t fcp_lun;
01088   char *controller_id;
01089 } scsi_t;
01090 
01091 
01092 /*
01093  * PROM tree on PPC
01094  */
01095 typedef struct devtree_s {
01096   struct devtree_s *next;
01097   struct devtree_s *parent;
01098   unsigned idx;
01099   char *path, *filename;
01100   unsigned pci:1;
01101   char *name, *model, *device_type, *compatible;
01102   int class_code;                       /* class : sub_class : prog-if */
01103   int vendor_id, device_id, subvendor_id, subdevice_id;
01104   int revision_id, interrupt;
01105   unsigned char *edid;                  /* 128 bytes */
01106 } devtree_t;
01107 
01108 /*
01109  * Device/CU model numbers for S/390
01110  */
01111 typedef struct ccw_s {
01112   unsigned char lcss;
01113   unsigned char cu_model;
01114   unsigned char dev_model;
01115 } ccw_t;
01116 
01117 /*
01118  * special CDROM entry
01119  */
01120 typedef struct cdrom_info_s {
01121   struct cdrom_info_s *next;
01122   char *name;
01123   unsigned speed;
01124   unsigned cdr:1, cdrw:1, dvd:1, dvdr:1, dvdram:1;
01125   unsigned cdrom:1;             /* cdrom in drive */
01126   struct {
01127     unsigned ok:1;
01128     char *volume, *publisher, *preparer, *application, *creation_date;
01129   } iso9660;
01130   struct {
01131     unsigned ok:1;
01132     unsigned platform;
01133     char *id_string;
01134     unsigned bootable:1;
01135     unsigned media_type;        /* boot emulation type */
01136     unsigned load_address;
01137     unsigned load_count;        /* sectors to load */
01138     unsigned start;             /* start sector */
01139     unsigned catalog;           /* boot catalog start */
01140     struct {
01141       unsigned c, h, s;
01142       unsigned size;
01143     } geo;
01144     char *label;
01145   } el_torito;
01146 
01147 } cdrom_info_t;
01148 
01149 // note: obsolete, will be removed
01150 typedef struct {
01151   unsigned char block0[512];
01152 } floppy_info_t;
01153 
01154 /*
01155  * bios data (ix86)
01156  */
01157 typedef struct {
01158   unsigned apm_supported:1;
01159   unsigned apm_enabled:1;
01160   unsigned apm_ver, apm_subver;
01161   unsigned apm_bios_flags;
01162 
01163   unsigned vbe_ver;
01164   unsigned vbe_video_mem;
01165 
01166   unsigned ser_port0, ser_port1, ser_port2, ser_port3;
01167   unsigned par_port0, par_port1, par_port2;
01168 
01169   /* The id is still in big endian format! */
01170   unsigned is_pnp_bios:1;
01171   unsigned pnp_id;
01172   unsigned lba_support:1;
01173 
01174   unsigned low_mem_size;
01175   smp_info_t smp;
01176   vbe_info_t vbe;
01177 
01178   unsigned smbios_ver;
01179 
01180   struct {
01181     unsigned width;
01182     unsigned height;
01183     unsigned xsize;
01184     unsigned ysize;
01185     char *vendor;
01186     char *name;
01187   } lcd;
01188 
01189   struct {
01190     char *vendor;
01191     char *type;
01192     unsigned bus;
01193     unsigned compat_vend;
01194     unsigned compat_dev;
01195   } mouse;
01196 
01197   struct {
01198     unsigned ok:1;
01199     unsigned scroll_lock:1;
01200     unsigned num_lock:1;
01201     unsigned caps_lock:1;
01202   } led;
01203 
01204   bios32_info_t bios32;
01205 
01206 } bios_info_t;
01207 
01208 
01209 /*
01210  * prom data (ppc, sparc)
01211  */
01212 typedef struct {
01213   unsigned has_color:1;
01214   unsigned color;
01215 } prom_info_t;
01216 
01217 
01218 /*
01219  * general system data
01220  */
01221 typedef struct {
01222   char *system_type;
01223   char *generation;
01224   char *vendor;
01225   char *model;
01226   char *serial;
01227   char *lang;
01228   char *formfactor;
01229 } sys_info_t;
01230 
01231 
01232 /*
01233  * monitor (DDC) data
01234  */
01235 typedef struct {
01236   unsigned manu_year;
01237   unsigned min_vsync, max_vsync;        /* vsync range */
01238   unsigned min_hsync, max_hsync;        /* hsync range */
01239   unsigned clock;                       /* pixel clock in kHz */
01240   unsigned width, height;               /* display size */
01241   unsigned width_mm, height_mm;         /* dto, in mm */
01242   char *vendor;
01243   char *name;
01244   char *serial;
01245 } monitor_info_t;
01246 
01247 
01248 typedef enum cpu_arch {
01249   arch_unknown = 0,
01250   arch_intel,
01251   arch_alpha,
01252   arch_sparc, arch_sparc64,
01253   arch_ppc, arch_ppc64,
01254   arch_68k,
01255   arch_ia64,
01256   arch_s390, arch_s390x,
01257   arch_arm,
01258   arch_mips,
01259   arch_x86_64
01260 } hd_cpu_arch_t;
01261 
01262 // ###### drop boot_arch at all?
01263 typedef enum boot_arch {
01264   boot_unknown = 0,
01265   boot_lilo, boot_milo, boot_aboot, boot_silo, boot_ppc, boot_elilo, boot_s390,
01266   boot_mips, boot_grub
01267 } hd_boot_arch_t;
01268 
01269 /* special cpu entry */
01270 typedef struct {
01271   enum cpu_arch architecture;
01272   unsigned family;              /* axp: cpu variation */
01273   unsigned model;               /* axp: cpu revision */
01274   unsigned stepping;
01275   unsigned cache;
01276   unsigned clock;
01277   unsigned units;               /* >1 "hyperthreading" */
01278   char *vend_name;              /* axp: system type */
01279   char *model_name;             /* axp: cpu model */
01280   char *platform;               /* x86: NULL */
01281   str_list_t *features;         /* x86: flags */
01282 } cpu_info_t;
01283 
01284 
01285 /*
01286  * enhanced disk data (cf. edd.c)
01287  */
01288 typedef struct {
01289   uint64_t sectors;
01290   struct {
01291     unsigned cyls, heads, sectors;
01292   } edd;
01293   struct {
01294     unsigned cyls, heads, sectors;
01295   } legacy;
01296   unsigned ext_fixed_disk:1;
01297   unsigned ext_lock_eject:1;
01298   unsigned ext_edd:1;
01299   unsigned ext_64bit:1;
01300   unsigned assigned:1;
01301   char *sysfs_id;
01302   unsigned hd_idx;
01303 } edd_info_t;
01304 
01305 
01306 /*
01307  * database info
01308  */
01309 typedef struct {
01310   unsigned data_len, data_max;
01311   unsigned *data;
01312   unsigned names_len, names_max;
01313   char *names;
01314 } hddb_data_t;
01315 
01316 typedef uint32_t hddb_entry_mask_t;
01317 
01318 typedef struct hddb_list_s {   
01319   hddb_entry_mask_t key_mask;
01320   hddb_entry_mask_t value_mask;
01321   unsigned key;
01322   unsigned value;
01323 } hddb_list_t;
01324 
01325 typedef struct {
01326   unsigned list_len, list_max;
01327   hddb_list_t *list;
01328   unsigned ids_len, ids_max;
01329   unsigned *ids;
01330   unsigned strings_len, strings_max;
01331   char *strings;
01332 } hddb2_data_t;
01333 
01334 /*
01335  * module.alias info
01336  */
01337 typedef enum modinfo_type_e { mi_none = 0, mi_pci, mi_usb, mi_pcmcia } modinfo_type_t;
01338 
01339 typedef struct {
01340   char *module;
01341   char *alias;
01342   modinfo_type_t type;
01343   union {
01344     struct {
01345       struct {
01346         unsigned vendor:1;
01347         unsigned device:1;
01348         unsigned sub_vendor:1;
01349         unsigned sub_device:1;
01350         unsigned base_class:1;
01351         unsigned sub_class:1;
01352         unsigned prog_if:1;
01353       } has;
01354       unsigned vendor;
01355       unsigned device;
01356       unsigned sub_vendor;
01357       unsigned sub_device;
01358       unsigned base_class;
01359       unsigned sub_class;
01360       unsigned prog_if;
01361     } pci;
01362 
01363     struct {
01364       struct {
01365         unsigned vendor:1;
01366         unsigned product:1;
01367         unsigned device_class:1;
01368         unsigned device_subclass:1;
01369       } has;
01370       unsigned vendor;
01371       unsigned product;
01372       unsigned device_class;
01373       unsigned device_subclass;
01374     } usb;
01375   };
01376 } modinfo_t;
01377 
01378 
01379 /*
01380  * HAL device property types
01381  */
01382 typedef enum {
01383   p_invalid, p_string, p_int32, p_uint64, p_double, p_bool, p_list
01384 } hal_prop_type_t;
01385 
01386 
01387 /*
01388  * HAL device properties
01389  */
01390 typedef struct hal_prop_s {
01391   struct hal_prop_s *next;
01392   hal_prop_type_t type;
01393   char *key;
01394   union {
01395     char *str;
01396     int32_t int32;
01397     uint64_t uint64;
01398     double d;     
01399     int b;
01400     str_list_t *list;
01401   } val;  
01402 } hal_prop_t;
01403 
01404 
01405 /*
01406  * HAL device
01407  */
01408 typedef struct hal_device_s {
01409   struct hal_device_s *next, *parent;
01410   char *udi;
01411   unsigned used:1;
01412   hal_prop_t *prop;
01413 } hal_device_t;
01414 
01415 
01416 /*
01417  * resource types
01418  */
01419 typedef enum resource_types {
01420   res_any, res_phys_mem, res_mem, res_io, res_irq, res_dma, res_monitor,
01421   res_size, res_disk_geo, res_cache, res_baud, res_init_strings, res_pppd_option,
01422   res_framebuffer, res_hwaddr, res_link, res_wlan
01423 } hd_resource_types_t;
01424 
01425 
01426 /*
01427  * size units (cf. (res_size_t).unit)
01428  */
01429 typedef enum size_units {
01430   size_unit_cm, size_unit_cinch, size_unit_byte, size_unit_sectors,
01431   size_unit_kbyte, size_unit_mbyte, size_unit_gbyte, size_unit_mm
01432 } hd_size_units_t;
01433 
01434 /*
01435  * access types for I/O and memory resources
01436  */
01437 typedef enum access_flags {
01438   acc_unknown, acc_ro, acc_wo, acc_rw           /* unknown, read only, write only, read/write */
01439 } hd_access_flags_t;
01440 
01441 
01442 typedef enum yes_no_flag {
01443   flag_unknown, flag_no, flag_yes               /* unknown, no, yes */
01444 } hd_yes_no_flag_t;
01445 
01446 
01447 typedef enum geo_types {
01448   geo_physical = 0, geo_logical, geo_bios_edd, geo_bios_legacy
01449 } hd_geo_types_t;
01450 
01451 
01452 /*
01453  * definitions for the various resource types
01454  */
01455 typedef struct {
01456   union u_hd_res_t *next;
01457   enum resource_types type;
01458 } res_any_t;
01459 
01460 typedef struct {
01461   union u_hd_res_t *next;
01462   enum resource_types type;
01463   uint64_t base, range;
01464   unsigned
01465     enabled:1,                          /* 0: disabled, 1 enabled */
01466     access:2,                           /* enum access_flags */
01467     prefetch:2;                         /* enum yes_no_flag */
01468 } res_mem_t;
01469 
01470 typedef struct {
01471   union u_hd_res_t *next;
01472   enum resource_types type;
01473   uint64_t range;
01474 } res_phys_mem_t;
01475 
01476 typedef struct {
01477   union u_hd_res_t *next;
01478   enum resource_types type;
01479   uint64_t base, range;
01480   unsigned
01481     enabled:1,                          /* 0: disabled, 1 enabled */
01482     access:2;                           /* enum access_flags */
01483 } res_io_t;
01484 
01485 typedef struct {
01486   union u_hd_res_t *next;
01487   enum resource_types type;
01488   unsigned base;
01489   unsigned triggered;                   /* # of interrupts */
01490   unsigned enabled:1;                   /* 0: disabled, 1 enabled */
01491 } res_irq_t;
01492 
01493 typedef struct {
01494   union u_hd_res_t *next;
01495   enum resource_types type;
01496   unsigned base;
01497   unsigned enabled:1;                   /* 0: disabled, 1 enabled */
01498 } res_dma_t;
01499 
01500 typedef struct {
01501   union u_hd_res_t *next;
01502   enum resource_types type;
01503   enum size_units unit;
01504   uint64_t val1, val2;                  /* to allow for 2D values */
01505 } res_size_t;
01506 
01507 typedef struct {
01508   union u_hd_res_t *next;
01509   enum resource_types type;
01510   unsigned speed;
01511   unsigned bits, stopbits;
01512   char parity;                          /* n, e, o, s, m */
01513   char handshake;                       /* -, h, s */
01514 } res_baud_t;
01515 
01516 typedef struct {
01517   union u_hd_res_t *next;
01518   enum resource_types type;
01519   unsigned size;                        /* in kbyte */
01520 } res_cache_t;
01521 
01522 typedef struct {
01523   union u_hd_res_t *next;
01524   enum resource_types type;
01525   unsigned cyls, heads, sectors;
01526   uint64_t size;
01527   enum geo_types geotype;               /* 0-3: physical/logical/bios edd/bios legacy */
01528 } res_disk_geo_t;
01529 
01530 typedef struct {
01531   union u_hd_res_t *next;
01532   enum resource_types type;
01533   unsigned width, height;               /* in pixel */
01534   unsigned vfreq;                       /* in Hz */
01535   unsigned interlaced:1;                /* 0/1 */
01536 } res_monitor_t;
01537 
01538 typedef struct {
01539   union u_hd_res_t *next;
01540   enum resource_types type;
01541   char *init1;
01542   char *init2;
01543 } res_init_strings_t;
01544 
01545 typedef struct {
01546   union u_hd_res_t *next;
01547   enum resource_types type;
01548   char *option;
01549 } res_pppd_option_t;
01550 
01551 typedef struct {
01552   union u_hd_res_t *next;
01553   enum resource_types type;
01554   unsigned width, height;               /* in pixel */
01555   unsigned bytes_p_line;                /* line length in bytes (do not confuse with 'width') */
01556   unsigned colorbits;                   /* 4, 8, 15, 16, 24, 32 */
01557   unsigned mode;                        /* mode number for kernel */
01558 } res_framebuffer_t;
01559 
01560 typedef struct {
01561   union u_hd_res_t *next;
01562   enum resource_types type;
01563   char *addr;
01564 } res_hwaddr_t;
01565 
01566 typedef struct {
01567   union u_hd_res_t *next;
01568   enum resource_types type;
01569   unsigned state:1;                     /* network link state: 0 - not connected, 1 - connected */
01570 } res_link_t;
01571 
01572 /* wlan capabilities */
01573 typedef struct {
01574   union u_hd_res_t *next;
01575   enum resource_types type;
01576   str_list_t *channels;
01577   str_list_t *frequencies; /* in GHz units */
01578   str_list_t *bitrates;    /* in Mbps units */
01579   str_list_t *auth_modes;  /* open, sharedkey, wpa-psk, wpa-eap, wpa-leap */
01580   str_list_t *enc_modes;   /* WEP40, WEP104, WEP128, WEP232, TKIP, CCMP */
01581 } res_wlan_t;
01582 
01583 typedef union u_hd_res_t {
01584   union u_hd_res_t *next;  
01585   res_any_t any;
01586   res_io_t io;
01587   res_mem_t mem;
01588   res_phys_mem_t phys_mem;
01589   res_irq_t irq;
01590   res_dma_t dma;
01591   res_size_t size;
01592   res_cache_t cache;
01593   res_baud_t baud;
01594   res_disk_geo_t disk_geo;
01595   res_monitor_t monitor;
01596   res_init_strings_t init_strings;
01597   res_pppd_option_t pppd_option;
01598   res_framebuffer_t framebuffer;
01599   res_hwaddr_t hwaddr;
01600   res_link_t link;
01601   res_wlan_t wlan;
01602 } hd_res_t;
01603 
01604 
01605 /*
01606  * data gathered by the misc module; basically resources from /proc
01607  */
01608 typedef struct {
01609   uint64_t addr, size;
01610   char *dev;
01611   unsigned tag;
01612 } misc_io_t;
01613 
01614 typedef struct {
01615   unsigned channel;
01616   char *dev;
01617   unsigned tag;
01618 } misc_dma_t;
01619 
01620 typedef struct {
01621   unsigned irq, events;
01622   int devs;
01623   char **dev;
01624   unsigned tag;
01625 } misc_irq_t;
01626 
01627 typedef struct {
01628   unsigned io_len, dma_len, irq_len;
01629   misc_io_t *io;
01630   misc_dma_t *dma;
01631   misc_irq_t *irq;
01632   str_list_t *proc_io, *proc_dma, *proc_irq;
01633 } misc_t;
01634 
01635 typedef struct s_serial_t {
01636   struct s_serial_t *next;
01637   char *name;
01638   char *device;
01639   unsigned line, port, irq, baud;
01640 } serial_t;
01641 
01642 typedef struct s_ser_device_t {
01643   struct s_ser_device_t *next;
01644   unsigned hd_idx;
01645   char *dev_name;
01646   str_list_t *at_resp;
01647   int fd;
01648   struct termios tio;
01649   unsigned max_baud, cur_baud;
01650   unsigned is_mouse:1;
01651   unsigned is_modem:1;
01652   unsigned do_io:1;
01653   unsigned char buf[0x1000];
01654   int buf_len;
01655   int garbage, non_pnp, pnp;
01656   unsigned char pnp_id[8];
01657   char *serial, *class_name, *dev_id, *user_name, *vend, *init_string1, *init_string2, *pppd_option;
01658   unsigned pnp_rev;
01659   unsigned bits;
01660 } ser_device_t;
01661 
01662 /*
01663  * Notes on isdn_parm_t:
01664  *   - def_value is only relevant of alt_values != 0
01665  *   - def_value should be a value out of alt_value[]
01666  *   - see libihw docu for the meaning of name,type,flags,def_value
01667  */
01668 typedef struct isdn_parm_s {
01669   struct isdn_parm_s *next;
01670   char *name;                           /* parameter name */
01671   unsigned valid:1;                     /* 1: entry is valid, 0: some inconsistencies */
01672   unsigned conflict:1;                  /* 1: ressource conflict (eg. no free irq) */
01673   uint64_t value;                       /* value of the parameter */
01674   unsigned type;                        /* CDBISDN type (P_...) */
01675   unsigned flags;                       /* CDBISDN flags (P_...) */
01676   unsigned def_value;                   /* default value */
01677   int alt_values;                       /* length of alt_value[] */
01678   unsigned *alt_value;                  /* possible values */
01679 } isdn_parm_t;
01680 
01681 /* device driver info types */
01682 typedef enum driver_info_type {
01683   di_any, di_display, di_module, di_mouse, di_x11, di_isdn, di_kbd, di_dsl
01684 } hd_driver_info_t;
01685 
01686 /* unspecific info */
01687 typedef struct {
01688   union driver_info_u *next;
01689   enum driver_info_type type;           /* driver info type */
01690   str_list_t *hddb0, *hddb1;            /* the actual driver database entries */
01691 } driver_info_any_t;
01692 
01693 /* display (monitor) info */
01694 typedef struct {
01695   union driver_info_u *next;
01696   enum driver_info_type type;           /* driver info type */
01697   str_list_t *hddb0, *hddb1;            /* the actual driver database entries */
01698   unsigned width, height;               /* max. useful display geometry */
01699   unsigned min_vsync, max_vsync;        /* vsync range */
01700   unsigned min_hsync, max_hsync;        /* hsync range */
01701   unsigned bandwidth;                   /* max. pixel clock */
01702 } driver_info_display_t;
01703 
01704 /* module info */
01705 typedef struct {
01706   union driver_info_u *next;
01707   enum driver_info_type type;           /* driver info type */
01708   str_list_t *hddb0, *hddb1;            /* the actual driver database entries */
01709   unsigned active:1;                    /* if module is currently active */
01710   unsigned modprobe:1;                  /* modprobe or insmod  */
01711   str_list_t *names;                    /* (ordered) list of module names */
01712   str_list_t *mod_args;                 /* list of module args (corresponds to the module name list) */
01713   char *conf;                           /* conf.modules entry, if any (e.g. for sb.o) */
01714 } driver_info_module_t;
01715 
01716 /* mouse protocol info */
01717 typedef struct {
01718   union driver_info_u *next;
01719   enum driver_info_type type;           /* driver info type */
01720   str_list_t *hddb0, *hddb1;            /* the actual driver database entries */
01721   char *xf86;                           /* the XF86 protocol name */
01722   char *gpm;                            /* dto, gpm */
01723   int buttons;                          /* number of buttons, -1 --> unknown */
01724   int wheels;                           /* dto, wheels */
01725 } driver_info_mouse_t;
01726 
01727 /* X11 server info */
01728 typedef struct {
01729   union driver_info_u *next;
01730   enum driver_info_type type;           /* driver info type */
01731   str_list_t *hddb0, *hddb1;            /* the actual driver database entries */
01732   char *server;                         /* the server/module name */
01733   char *xf86_ver;                       /* XFree86 version (3 or 4) */
01734   unsigned x3d:1;                       /* has 3D support */
01735   struct {
01736     unsigned all:5;                     /* the next 5 entries combined */
01737     unsigned c8:1, c15:1, c16:1, c24:1, c32:1;
01738   } colors;                             /* supported color depths */
01739   unsigned dacspeed;                    /* max. ramdac clock */
01740   str_list_t *extensions;               /* additional X extensions to load ('Module' section) */
01741   str_list_t *options;                  /* special server options */
01742   str_list_t *raw;                      /* extra info to add to XF86Config */
01743   char *script;                         /* 3d script to run */
01744 } driver_info_x11_t;
01745 
01746 /* isdn info */
01747 typedef struct {
01748   union driver_info_u *next;
01749   enum driver_info_type type;           /* driver info type */
01750   str_list_t *hddb0, *hddb1;            /* the actual driver database entries */
01751   int i4l_type, i4l_subtype;            /* I4L types */
01752   char *i4l_name;                       /* I4L card name */
01753   isdn_parm_t *params;                  /* isdn parameters */
01754 } driver_info_isdn_t;
01755 
01756 /* dsl info */
01757 typedef struct {
01758   union driver_info_u *next;
01759   enum driver_info_type type;           /* driver info type */
01760   str_list_t *hddb0, *hddb1;            /* the actual driver database entries */
01761   char *mode;                           /* DSL driver types */
01762   char *name;                           /* DSL driver name */
01763 } driver_info_dsl_t;
01764 
01765 /* keyboard info */
01766 typedef struct {
01767   union driver_info_u *next;
01768   enum driver_info_type type;           /* driver info type */
01769   str_list_t *hddb0, *hddb1;            /* the actual driver database entries */
01770   char *XkbRules;                       /* XF86Config entries */
01771   char *XkbModel;
01772   char *XkbLayout;
01773   char *keymap;                         /* console keymap */
01774 } driver_info_kbd_t;
01775 
01776 /*
01777  * holds device driver info
01778  */
01779 typedef union driver_info_u {
01780   union driver_info_u *next;
01781   driver_info_any_t any;
01782   driver_info_module_t module;
01783   driver_info_mouse_t mouse;
01784   driver_info_x11_t x11;
01785   driver_info_display_t display;
01786   driver_info_isdn_t isdn;
01787   driver_info_dsl_t dsl;
01788   driver_info_kbd_t kbd;
01789 } driver_info_t;
01790 
01791 
01792 /*
01793  * Some hardware doesn't fit into the hd_t scheme or there is info we
01794  * gathered during the scan process but that no-one really cares about. Such
01795  * stuff is stored in hd_detail_t.
01796  */
01797 typedef enum hd_detail_type {
01798   hd_detail_pci, hd_detail_usb, hd_detail_isapnp, hd_detail_cdrom,
01799   hd_detail_floppy, hd_detail_bios, hd_detail_cpu, hd_detail_prom,
01800   hd_detail_monitor, hd_detail_sys, hd_detail_scsi, hd_detail_devtree,
01801   hd_detail_ccw
01802 } hd_detail_type_t;
01803 
01804 typedef struct {
01805   enum hd_detail_type type;
01806   pci_t *data;
01807 } hd_detail_pci_t;
01808 
01809 typedef struct {
01810   enum hd_detail_type type;
01811   usb_t *data;
01812 } hd_detail_usb_t;
01813 
01814 typedef struct {
01815   enum hd_detail_type type;
01816   isapnp_dev_t *data;
01817 } hd_detail_isapnp_t;
01818 
01819 typedef struct {
01820   enum hd_detail_type type;
01821   cdrom_info_t *data;
01822 } hd_detail_cdrom_t;
01823 
01824 typedef struct {
01825   enum hd_detail_type type;
01826   floppy_info_t *data;
01827 } hd_detail_floppy_t;
01828 
01829 typedef struct {
01830   enum hd_detail_type type;
01831   bios_info_t *data;
01832 } hd_detail_bios_t;
01833 
01834 typedef struct {
01835   enum hd_detail_type type;
01836   cpu_info_t *data;
01837 } hd_detail_cpu_t;
01838 
01839 typedef struct {
01840   enum hd_detail_type type;
01841   prom_info_t *data;
01842 } hd_detail_prom_t;
01843 
01844 typedef struct {
01845   enum hd_detail_type type;
01846   monitor_info_t *data;
01847 } hd_detail_monitor_t;
01848 
01849 typedef struct {
01850   enum hd_detail_type type;
01851   sys_info_t *data;
01852 } hd_detail_sys_t;
01853 
01854 typedef struct {
01855   enum hd_detail_type type;
01856   scsi_t *data;
01857 } hd_detail_scsi_t;
01858 
01859 typedef struct {
01860   enum hd_detail_type type;
01861   devtree_t *data;
01862 } hd_detail_devtree_t;
01863 
01864 typedef struct {
01865   enum hd_detail_type type;
01866   ccw_t *data;
01867 } hd_detail_ccw_t;
01868 
01869 typedef union {
01870   enum hd_detail_type type;
01871   hd_detail_pci_t pci;
01872   hd_detail_usb_t usb;
01873   hd_detail_isapnp_t isapnp;
01874   hd_detail_cdrom_t cdrom;
01875   hd_detail_floppy_t floppy;
01876   hd_detail_bios_t bios;
01877   hd_detail_cpu_t cpu;
01878   hd_detail_prom_t prom;
01879   hd_detail_monitor_t monitor;
01880   hd_detail_sys_t sys;
01881   hd_detail_scsi_t scsi;
01882   hd_detail_devtree_t devtree;
01883   hd_detail_ccw_t ccw;
01884 } hd_detail_t;
01885 
01886 
01887 /* info about manually configured hardware (in /var/lib/hardware/) */
01888 typedef struct hd_manual_s {
01889   struct hd_manual_s *next;
01890 
01891   char *unique_id;
01892   char *parent_id;
01893   char *child_ids;
01894   unsigned hw_class;
01895   char *model;
01896 
01897   hd_status_t status;
01898   char *config_string;
01899 
01900   /* More or less free-form key, value pairs.
01901    * key should not contain '=', however.
01902    */
01903   str_list_t *key;
01904   str_list_t *value;
01905 } hd_manual_t;
01906 
01907 
01913 typedef struct s_hd_t {
01914   struct s_hd_t *next;          
01920   unsigned idx;
01921 
01927   unsigned broken:1;
01928 
01932   hd_id_t bus;
01933 
01938   unsigned slot;
01939 
01943   unsigned func;
01944 
01948   hd_id_t base_class;
01949 
01953   hd_id_t sub_class;
01954 
01958   hd_id_t prog_if;
01959 
01966   hd_id_t vendor;
01967 
01976   hd_id_t device;
01977 
01984   hd_id_t sub_vendor;
01985 
01992   hd_id_t sub_device;
01993 
01999   hd_id_t revision;
02000 
02004   char *serial;
02005 
02010   hd_id_t compat_vendor;
02011 
02016   hd_id_t compat_device;
02017 
02022   hd_hw_item_t hw_class;
02023 
02028   unsigned char hw_class_list[(hw_all + 7) / 8];        
02036   char *model;
02037 
02043   unsigned attached_to;
02044 
02048   char *sysfs_id;
02049 
02053   char *sysfs_bus_id;
02054 
02058   char *sysfs_device_link;
02059 
02065   char *unix_dev_name;
02066 
02070   hd_dev_num_t unix_dev_num;
02071 
02078   str_list_t *unix_dev_names;
02079 
02086   char *unix_dev_name2;
02087 
02091   hd_dev_num_t unix_dev_num2;
02092 
02099   char *rom_id;
02100 
02104   char *udi;
02105 
02109   char *parent_udi;
02110 
02121   char *unique_id;
02122 
02123   /* List of ids. */
02124   str_list_t *unique_ids;
02125 
02129   unsigned module;
02130 
02134   unsigned line;
02135 
02139   unsigned count;
02140 
02144   hd_res_t *res;
02145 
02150   hd_detail_t *detail;
02151 
02157   str_list_t *extra_info;
02158 
02164   hd_status_t status;
02165 
02172   char *config_string;
02173 
02178   hd_hotplug_t hotplug;
02179 
02184   unsigned hotplug_slot;
02185 
02186   struct is_s {
02187     unsigned agp:1;             /* AGP device */
02188     unsigned isapnp:1;          /* ISA-PnP device */
02189     unsigned notready:1;        /* block devices: no medium, other: device not configured */
02190     unsigned manual:1;          /* undetectable, manually configured hardware */
02191     unsigned softraiddisk:1;    /* disk belongs to some soft raid array */
02192     unsigned zip:1;             /* zip floppy */
02193     unsigned cdr:1;             /* CD-R */
02194     unsigned cdrw:1;            /* CD-RW */
02195     unsigned dvd:1;             /* DVD */
02196     unsigned dvdr:1;            /* DVD-R */
02197     unsigned dvdrw:1;           /* DVD-RW */
02198     unsigned dvdpr:1;           /* DVD+R */
02199     unsigned dvdprw:1;          /* DVD+RW */
02200     unsigned dvdprdl:1;         /* DVD+RDL */
02201     unsigned dvdram:1;          /* DVDRAM */
02202     unsigned pppoe:1;           /* PPPOE modem connected */
02203     unsigned wlan:1;            /* WLAN card */
02204     unsigned with_acpi:1;       /* acpi works fine */
02205     unsigned hotpluggable:1;    /* hotpluggable storage device */
02206   } is;
02207 
02208   struct tag_s {                /* this struct is for internal purposes only */
02209     unsigned remove:1;          /* schedule for removal */
02210     unsigned freeit:1;          /* for internal memory management */
02211     unsigned fixed:1;           /* fixed, do no longer modify this entry */
02212     unsigned ser_skip:1;        /* if serial line, don't scan for devices */
02213     unsigned ser_device:2;      /* if != 0: info about attached serial device; see serial.c */
02214   } tag;
02215 
02221   unsigned char *block0;
02222 
02226   char *driver;
02227 
02231   str_list_t *drivers;
02232 
02240   char *old_unique_id;
02241 
02247   char *parent_id;
02248 
02254   str_list_t *child_ids;
02255 
02260   char *unique_id1;
02261 
02268   char *usb_guid;
02269 
02270   driver_info_t *driver_info;   /* device driver info */
02271 
02272   str_list_t *requires;         /* packages/programs required for this hardware */
02273 
02274   hal_prop_t *hal_prop;         /* hal property list */
02275 
02276   hal_prop_t *persistent_prop;  /* persistent property list */
02277 
02278   char *modalias;               /* module alias */
02279 
02280   /*
02281    * These are used internally for memory management.
02282    * Do not even _think_ of modifying these!
02283    */
02284   unsigned ref_cnt;             
02285   struct s_hd_t *ref;           
02286 } hd_t;
02287 
02288 
02292 typedef struct {
02298   hd_t *hd;
02299 
02308   void (*progress)(char *pos, char *msg);
02309   
02313   char *log;
02314 
02320   unsigned debug;
02321 
02327   struct flag_struct {
02328     unsigned internal:1;        
02329     unsigned dformat:2;         
02330     unsigned no_parport:1;      
02331     unsigned iseries:1;         
02332     unsigned list_all:1;        
02333     unsigned fast:1;            
02334     unsigned list_md:1;         
02335     unsigned nofork:1;          
02336     unsigned nosysfs:1;         
02337     unsigned forked:1;          
02338     unsigned cpuemu:1;          
02339     unsigned udev:1;            
02340     unsigned edd_used:1;        
02341     unsigned keep_kmods:2;      
02342     unsigned nobioscrc:1;       
02343     unsigned biosvram:1;        
02344     unsigned nowpa:1;           
02345   } flags;
02346 
02347 
02351   str_list_t *only;
02352 
02353   /*
02354    * The following entries should *not* be accessed outside of libhd!
02355    */
02356   unsigned char probe[(pr_all + 7) / 8];        
02357   unsigned char probe_set[(pr_all + 7) / 8];    
02358   unsigned char probe_clr[(pr_all + 7) / 8];    
02359   unsigned last_idx;            
02360   unsigned module;              
02361   enum boot_arch boot;          
02362   hd_t *old_hd;                 
02363   pci_t *pci;                   
02364   isapnp_t *isapnp;             
02365   cdrom_info_t *cdrom;          
02366   str_list_t *net;              
02367   str_list_t *floppy;           
02368   misc_t *misc;                 
02369   serial_t *serial;             
02370   scsi_t *scsi;                 
02371   ser_device_t *ser_mouse;      
02372   ser_device_t *ser_modem;      
02373   str_list_t *cpu;              
02374   str_list_t *klog;             
02375   str_list_t *proc_usb;         
02376   usb_t *usb;                   
02377   modinfo_t *modinfo_ext;       
02378   modinfo_t *modinfo;           
02379   hddb2_data_t *hddb2[2];       
02380   str_list_t *kmods;            
02381   uint64_t used_irqs;           
02382   uint64_t assigned_irqs;       
02383   memory_range_t bios_rom;      
02384   memory_range_t bios_ram;      
02385   memory_range_t bios_ebda;     
02386   unsigned display;             
02387   unsigned color_code;          
02388   char *cmd_line;               
02389   str_list_t *xtra_hd;          
02390   devtree_t *devtree;           
02391   unsigned kernel_version;      
02392   int in_vmware;                
02393   hd_t *manual;                 
02394   str_list_t *disks;            
02395   str_list_t *partitions;       
02396   str_list_t *cdroms;           
02397   hd_smbios_t *smbios;          
02398   struct {
02399     unsigned ok:1;
02400     unsigned size;
02401     unsigned used;
02402     void *data;
02403     int id;
02404     int updated;
02405   } shm;                        
02406   unsigned pci_config_type;     
02407   hd_udevinfo_t *udevinfo;      
02408   hd_sysfsdrv_t *sysfsdrv;      
02409   uint64_t sysfsdrv_id;         
02410   str_list_t *scanner_db;       
02411   edd_info_t edd[0x80];         
02412   hal_device_t *hal;            
02413 } hd_data_t;
02414 
02415 
02416 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
02417  *
02418  *                      libhd interface functions
02419  *
02420  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
02421  */
02422 
02423 /* implemented in hd.c */
02424 
02425 /* the actual hardware scan */
02426 void hd_scan(hd_data_t *hd_data);
02427 
02429 hd_data_t *hd_free_hd_data(hd_data_t *hd_data);
02430 
02432 hd_t *hd_free_hd_list(hd_t *hd);
02433 
02434 void hd_set_probe_feature(hd_data_t *hd_data, enum probe_feature feature);
02435 void hd_clear_probe_feature(hd_data_t *hd_data, enum probe_feature feature);
02436 int hd_probe_feature(hd_data_t *hd_data, enum probe_feature feature);
02437 void hd_set_probe_feature_hw(hd_data_t *hd_data, hd_hw_item_t item);
02438 
02439 enum probe_feature hd_probe_feature_by_name(char *name);
02440 char *hd_probe_feature_by_value(enum probe_feature feature);
02441 
02442 int hd_module_is_active(hd_data_t *hd_data, char *mod);
02443 
02444 hd_t *hd_base_class_list(hd_data_t *hd_data, unsigned base_class);
02445 hd_t *hd_sub_class_list(hd_data_t *hd_data, unsigned base_class, unsigned sub_class);
02446 hd_t *hd_bus_list(hd_data_t *hd_data, unsigned bus);
02447 const char* hd_busid_to_hwcfg(int busid);
02448 hd_t *hd_list(hd_data_t *hd_data, hd_hw_item_t item, int rescan, hd_t *hd_old);
02449 hd_t *hd_list_with_status(hd_data_t *hd_data, hd_hw_item_t item, hd_status_t status);
02450 hd_t *hd_list2(hd_data_t *hd_data, hd_hw_item_t *items, int rescan);
02451 hd_t *hd_list_with_status2(hd_data_t *hd_data, hd_hw_item_t *items, hd_status_t status);
02452 
02453 int hd_has_pcmcia(hd_data_t *hd_data);
02454 // will be gone soon
02455 // int hd_apm_enabled(hd_data_t *hd_data);
02456 int hd_usb_support(hd_data_t *hd_data);
02457 int hd_smp_support(hd_data_t *hd_data);
02458 int hd_mac_color(hd_data_t *hd_data);
02459 int hd_color(hd_data_t *hd_data);
02460 int hd_is_uml(hd_data_t *hd_data);
02461 unsigned hd_display_adapter(hd_data_t *hd_data);
02462 unsigned hd_boot_disk(hd_data_t *hd_data, int *matches);
02463 enum cpu_arch hd_cpu_arch(hd_data_t *hd_data);
02464 enum boot_arch hd_boot_arch(hd_data_t *hd_data);
02465 
02466 hd_t *hd_get_device_by_idx(hd_data_t *hd_data, unsigned idx);
02467 
02468 void hd_set_hw_class(hd_t *hd, hd_hw_item_t hw_class);
02469 int hd_is_hw_class(hd_t *hd, hd_hw_item_t hw_class);
02470 
02471 int hd_is_sgi_altix(hd_data_t *hd_data);
02472 
02473 char *hd_version(void);
02474 
02475 hal_prop_t *hd_free_hal_properties(hal_prop_t *prop);
02476 hal_prop_t *hd_read_properties(const char *udi);
02477 int hd_write_properties(const char *udi, hal_prop_t *prop);
02478 
02479 /* implemented in hddb.c */
02480 
02481 str_list_t *get_hddb_packages(hd_data_t *hd_data);
02482 void hddb_add_info(hd_data_t *hd_data, hd_t *hd);
02483 
02484 void hddb_dump_raw(hddb2_data_t *hddb, FILE *f);
02485 void hddb_dump(hddb2_data_t *hddb, FILE *f);
02486 
02487 /* implemented in hdp.c */
02488 
02489 void hd_dump_entry(hd_data_t *hd_data, hd_t *hd, FILE *f);
02490 
02491 
02492 /* implemented in cdrom.c */
02493 
02494 cdrom_info_t *hd_read_cdrom_info(hd_data_t *hd_data, hd_t *hd);
02495 
02496 /* implemented in manual.c */
02497 hd_manual_t *hd_manual_read_entry(hd_data_t *hd_data, const char *id);
02498 int hd_manual_write_entry(hd_data_t *hd_data, hd_manual_t *entry);
02499 hd_manual_t *hd_free_manual(hd_manual_t *manual);
02500 hd_t *hd_read_config(hd_data_t *hd_data, const char *id);
02501 int hd_write_config(hd_data_t *hd_data, hd_t *hd);
02502 char *hd_hw_item_name(hd_hw_item_t item);
02503 hd_hw_item_t hd_hw_item_type(char *name);
02504 char *hd_status_value_name(hd_status_value_t status);
02505 int hd_change_status(const char *id, hd_status_t status, const char *config_string);
02506 int hd_change_config_status(hd_data_t *hd_data, const char *id, hd_status_t status, const char *config_string);
02507 int hd_read_mmap(hd_data_t *hd_data, char *name, unsigned char *buf, off_t start, unsigned size);
02508 
02509 
02510 /*
02511  * - - - - - CDB ISDN interface - - - - -
02512  */
02513 
02514 
02515 /* (C) 2003 kkeil@suse.de */
02516 
02517 #define CDBISDN_VERSION 0x0101
02518 
02519 #ifndef PCI_ANY_ID
02520 #define PCI_ANY_ID      0xffff
02521 #endif
02522 
02523 #define CDBISDN_P_NONE  0x0
02524 #define CDBISDN_P_IRQ   0x1
02525 #define CDBISDN_P_MEM   0x2
02526 #define CDBISDN_P_IO    0x3
02527 
02528 /* vendor info */
02529 typedef struct {
02530         char    *name;
02531         char    *shortname;
02532         int     vnr;
02533         int     refcnt;
02534 } cdb_isdn_vendor;
02535 
02536 typedef struct  {
02537         int     handle;         /* internal identifier idx in database */
02538         int     vhandle;        /* internal identifier to vendor database */
02539         char    *name;          /* cardname */
02540         char    *lname;         /* vendor short name + cardname */
02541         char    *Class;         /* CLASS of the card */
02542         char    *bus;           /* bus type */
02543         int     revision;       /* revision used with USB */
02544         int     vendor;         /* Vendor ID for ISAPNP and PCI cards */
02545         int     device;         /* Device ID for ISAPNP and PCI cards */
02546         int     subvendor;      /* Subvendor ID for PCI cards */
02547                                 /* A value of 0xffff is ANY_ID */
02548         int     subdevice;      /* Subdevice ID for PCI cards */
02549                                 /* A value of 0xffff is ANY_ID */
02550         unsigned int features;  /* feature flags */
02551         int     line_cnt;       /* count of ISDN ports */
02552         int     vario_cnt;      /* count of driver varios */
02553         int     vario;          /* referenz to driver vario record */
02554 } cdb_isdn_card;
02555 
02556 typedef struct  {
02557         int     handle;         /* idx in database */   
02558         int     next_vario;     /* link to alternate vario */
02559         int     drvid;          /* unique id of the driver vario */
02560         int     typ;            /* Type to identify the driver */
02561         int     subtyp;         /* Subtype of the driver type */
02562         int     smp;            /* SMP supported ? */
02563         char    *mod_name;      /* name of the driver module */
02564         char    *para_str;      /* optional parameter string */
02565         char    *mod_preload;   /* optional modules to preload */
02566         char    *cfg_prog;      /* optional cfg prog */
02567         char    *firmware;      /* optional firmware to load */
02568         char    *description;   /* optional description */
02569         char    *need_pkg;      /* list of packages needed for function */
02570         char    *info;          /* optional additional info */
02571         char    *protocol;      /* supported D-channel protocols */
02572         char    *interface;     /* supported API interfaces */
02573         char    *io;            /* possible IO ports with legacy ISA cards */
02574         char    *irq;           /* possible interrupts with legacy ISA cards */
02575         char    *membase;       /* possible membase with legacy ISA cards */
02576         char    *features;      /* optional features*/
02577         int     card_ref;       /* reference to a card */
02578         char    *name;          /* driver name */
02579 } cdb_isdn_vario;
02580 
02581 
02582 extern cdb_isdn_vendor  *hd_cdbisdn_get_vendor(int);
02583 extern cdb_isdn_card    *hd_cdbisdn_get_card(int);
02584 extern cdb_isdn_vario   *hd_cdbisdn_get_vario_from_type(int, int);
02585 extern cdb_isdn_card    *hd_cdbisdn_get_card_from_type(int, int);
02586 extern cdb_isdn_card    *hd_cdbisdn_get_card_from_id(int, int, int, int);
02587 extern cdb_isdn_vario   *hd_cdbisdn_get_vario(int);
02588 extern int              hd_cdbisdn_get_version(void);
02589 extern int              hd_cdbisdn_get_db_version(void);
02590 extern char             *hd_cdbisdn_get_db_date(void);
02591 
02592 /* CDB ISDN interface end */
02593 
02594 #ifdef __cplusplus
02595 }
02596 #endif
02597 
02598 #endif  /* _HD_H */