Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

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