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