Main Page | Modules | Data Structures | Directories | 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      11
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_UDI            HARDWARE_DIR "/udi"
00056 #define HARDWARE_UNIQUE_KEYS    HARDWARE_DIR "/unique-keys"
00057 
00072 #define TAG_PCI         1       
00073 #define TAG_EISA        2       
00074 #define TAG_USB         3       
00075 #define TAG_SPECIAL     4       
00076 #define TAG_PCMCIA      5       
00081 #define ID_VALUE(id)            ((id) & 0xffff)
00082 
00086 #define ID_TAG(id)              (((id) >> 16) & 0xf)
00087 
00091 #define MAKE_ID(tag, id_val)    ((tag << 16) | (id_val))
00092 
00095 /*
00096  * flags to control the probing.
00097  */
00098 typedef enum probe_feature {
00099   pr_memory = 1, pr_pci, pr_isapnp, pr_net, pr_floppy, pr_misc,
00100   pr_misc_serial, pr_misc_par, pr_misc_floppy, pr_serial, pr_cpu, pr_bios,
00101   pr_monitor, pr_mouse, pr_scsi, pr_usb, pr_usb_mods, pr_adb, pr_modem,
00102   pr_modem_usb, pr_parallel, pr_parallel_lp, pr_parallel_zip, pr_isa,
00103   pr_isa_isdn, pr_isdn, pr_kbd, pr_prom, pr_sbus, pr_int, pr_braille,
00104   pr_braille_alva, pr_braille_fhp, pr_braille_ht, pr_ignx11, pr_sys,
00105   pr_bios_vbe, pr_isapnp_old, pr_isapnp_new, pr_isapnp_mod, pr_braille_baum,
00106   pr_manual, pr_fb, pr_veth, pr_pppoe, pr_scan, pr_pcmcia, pr_fork,
00107   pr_parallel_imm, pr_s390, pr_cpuemu, pr_sysfs, pr_s390disks, pr_udev,
00108   pr_block, pr_block_cdrom, pr_block_part, pr_edd, pr_edd_mod, pr_bios_ddc,
00109   pr_bios_fb, pr_bios_mode, pr_input, pr_block_mods, pr_bios_vesa,
00110   pr_cpuemu_debug, pr_scsi_noserial, pr_wlan, pr_bios_crc, pr_hal,
00111   pr_max, pr_lxrc, pr_default, pr_all           /* pr_all must be last */
00112 } hd_probe_feature_t;
00113 
00114 /*
00115  * list types for hd_list()
00116  *
00117  * if you want to modify this: cf. manual.c::hw_items[]
00118  *
00119  * Note: hw_tv _must_ be < hw_display!
00120  * Sync with check_hd and convert_hd!
00121  */
00122 typedef enum hw_item {
00123   hw_none = 0, hw_sys, hw_cpu, hw_keyboard, hw_braille, hw_mouse,
00124   hw_joystick, hw_printer, hw_scanner, hw_chipcard, hw_monitor, hw_tv,
00125   hw_display, hw_framebuffer, hw_camera, hw_sound, hw_storage_ctrl,
00126   hw_network_ctrl, hw_isdn, hw_modem, hw_network, hw_disk, hw_partition,
00127   hw_cdrom, hw_floppy, hw_manual, hw_usb_ctrl, hw_usb, hw_bios, hw_pci,
00128   hw_isapnp, hw_bridge, hw_hub, hw_scsi, hw_ide, hw_memory, hw_dvb,
00129   hw_pcmcia, hw_pcmcia_ctrl, hw_ieee1394, hw_ieee1394_ctrl, hw_hotplug,
00130   hw_hotplug_ctrl, hw_zip, hw_pppoe, hw_wlan, hw_redasd, hw_dsl, hw_block,
00131   hw_tape, hw_vbe, hw_bluetooth,
00132   /* append new entries here */
00133   hw_unknown, hw_all                                    /* hw_all must be last */
00134 } hd_hw_item_t;
00135 
00136 /*
00137  * device base classes and bus types
00138  *
00139  */
00140 
00141 /* base class values (superset of PCI classes) */
00142 typedef enum base_classes {
00143   /* these *must* match standard PCI class numbers */
00144   bc_none, bc_storage, bc_network, bc_display, bc_multimedia,
00145   bc_memory, bc_bridge, bc_comm, bc_system, bc_input, bc_docking,
00146   bc_processor, bc_serial, bc_wireless, bc_i2o, bc_other = 0xff,
00147 
00148   // add our own classes here (starting at 0x100 as PCI values are 8 bit)
00149   bc_monitor = 0x100, bc_internal, bc_modem, bc_isdn, bc_ps2, bc_mouse,
00150   bc_storage_device, bc_network_interface, bc_keyboard, bc_printer,
00151   bc_hub, bc_braille, bc_scanner, bc_joystick, bc_chipcard, bc_camera,
00152   bc_framebuffer, bc_dvb, bc_tv, bc_partition, bc_dsl, bc_bluetooth
00153 } hd_base_classes_t;
00154 
00155 /* subclass values of bc_monitor */
00156 typedef enum sc_monitor {
00157   sc_mon_other, sc_mon_crt, sc_mon_lcd
00158 } hd_sc_monitor_t;
00159 
00160 /* subclass values of bc_storage */
00161 typedef enum sc_storage {
00162   sc_sto_scsi, sc_sto_ide, sc_sto_floppy, sc_sto_ipi, sc_sto_raid,
00163   sc_sto_other = 0x80
00164 } hd_sc_storage_t;
00165 
00166 /* subclass values of bc_display */
00167 typedef enum sc_display {
00168   sc_dis_vga, sc_dis_xga, sc_dis_other = 0x80
00169 } hd_sc_display_t;
00170 
00171 /* subclass values of bc_framebuffer */
00172 typedef enum sc_framebuffer {
00173   sc_fb_vesa = 1
00174 } hd_sc_framebuffer_t;
00175 
00176 /* subclass values of bc_bridge */
00177 typedef enum sc_bridge { 
00178   sc_bridge_host, sc_bridge_isa, sc_bridge_eisa, sc_bridge_mc,
00179   sc_bridge_pci, sc_bridge_pcmcia, sc_bridge_nubus, sc_bridge_cardbus,
00180   sc_bridge_other = 0x80
00181 } hd_sc_bridge_t;
00182 
00183 /* subclass values of bc_comm */
00184 typedef enum sc_comm { 
00185   sc_com_ser, sc_com_par, sc_com_multi, sc_com_modem, sc_com_other = 0x80
00186 } hd_sc_comm_t;
00187 
00188 /* subclass values of bc_system */
00189 typedef enum sc_system {
00190   sc_sys_pic, sc_sys_dma, sc_sys_timer, sc_sys_rtc, sc_sys_other = 0x80
00191 } hd_sc_system_t;
00192 
00193 /* subclass values of bc_input */
00194 typedef enum sc_input {
00195   sc_inp_keyb, sc_inp_digit, sc_inp_mouse, sc_inp_other = 0x80
00196 } hd_sc_input_t;
00197 
00198 /* subclass values of bc_serial */
00199 typedef enum sc_serial {
00200   sc_ser_fire, sc_ser_access, sc_ser_ssa, sc_ser_usb, sc_ser_fiber,
00201   sc_ser_smbus, sc_ser_other = 0x80
00202 } hd_sc_serial_t;
00203 
00204 /* internal sub class values (bc_internal) */
00205 typedef enum sc_internal {
00206   sc_int_none, sc_int_isapnp_if, sc_int_main_mem, sc_int_cpu, sc_int_fpu,
00207   sc_int_bios, sc_int_prom, sc_int_sys
00208 } hd_sc_internal_t;
00209 
00210 /* subclass values of bc_mouse */
00211 typedef enum sc_mouse {
00212   sc_mou_ps2, sc_mou_ser, sc_mou_bus, sc_mou_usb, sc_mou_sun,
00213   sc_mou_other = 0x80
00214 } hd_sc_mouse_t;
00215 
00216 /* subclass values of bc_storage_device */
00217 typedef enum sc_std {
00218   sc_sdev_disk, sc_sdev_tape, sc_sdev_cdrom, sc_sdev_floppy, sc_sdev_scanner,
00219   sc_sdev_other = 0x80
00220 } hd_sc_std_t;
00221 
00222 /* subclass values of bc_network_interface */
00223 typedef enum sc_net_if {
00224   sc_nif_loopback, sc_nif_ethernet, sc_nif_tokenring, sc_nif_fddi,
00225   sc_nif_ctc, sc_nif_iucv, sc_nif_hsi, sc_nif_qeth,
00226   sc_nif_escon, sc_nif_myrinet, sc_nif_wlan, sc_nif_xp,
00227   sc_nif_usb, sc_nif_other = 0x80, sc_nif_sit
00228 } hd_sc_net_if_t;
00229 
00230 /* subclass values of bc_multimedia */
00231 typedef enum sc_multimedia {
00232   sc_multi_video, sc_multi_audio, sc_multi_other
00233 } hd_sc_multimedia_t;
00234 
00235 /* subclass values of bc_keyboard */
00236 typedef enum sc_keyboard {
00237   sc_keyboard_kbd, sc_keyboard_console
00238 } hd_sc_keyboard_t;
00239 
00240 /* subclass values of bc_hub */
00241 typedef enum sc_hub {
00242   sc_hub_other, sc_hub_usb
00243 } hd_sc_hub_t;
00244 
00245 /* subclass values of bc_camera */
00246 typedef enum sc_camera {
00247   sc_camera_webcam, sc_camera_digital
00248 } hd_sc_camera_t;
00249 
00250 /* subclass values of bc_modem */
00251 typedef enum sc_modem {
00252   sc_mod_at, sc_mod_win1, sc_mod_win2, sc_mod_win3, sc_mod_win4
00253 } hd_sc_modem_t;
00254 
00255 /* subclass values of bc_dsl */
00256 typedef enum sc_dsl {
00257   sc_dsl_unknown, sc_dsl_pppoe, sc_dsl_capi, sc_dsl_capiisdn
00258 } hd_sc_dsl_t;
00259 
00260 /* prog_if's of sc_ser_usb */
00261 typedef enum pif_usb_e {
00262   pif_usb_uhci = 0, pif_usb_ohci = 0x10, pif_usb_ehci = 0x20,
00263   pif_usb_other = 0x80, pif_usb_device = 0xfe
00264 } hd_pif_usb_t;
00265 
00266 /* CD-ROM  prog_if values */
00267 typedef enum pif_cdrom {
00268   pif_cdrom, pif_cdr, pif_cdrw, pif_dvd, pif_dvdr, pif_dvdram
00269 } hd_pif_cdrom_t ;
00270 
00271 /* S/390 disk prog_if values */
00272 typedef enum pif_s390disk {
00273   pif_scsi, pif_dasd, pif_dasd_fba
00274 } hd_pif_s390disk_t;
00275 
00276 /* bus type values similar to PCI bridge subclasses */
00277 typedef enum bus_types {
00278   bus_none, bus_isa, bus_eisa, bus_mc, bus_pci, bus_pcmcia, bus_nubus,
00279   bus_cardbus, bus_other,
00280 
00281   /* outside the range of the PCI values */
00282   bus_ps2 = 0x80, bus_serial, bus_parallel, bus_floppy, bus_scsi, bus_ide, bus_usb,
00283   bus_adb, bus_raid, bus_sbus, bus_i2o, bus_vio, bus_ccw, bus_iucv
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[0x80];      /* ddc monitor info */
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 } pci_t;
00985 
00986 /*
00987  * pci related flags cf. (pci_t).flags
00988  */
00989 typedef enum pci_flags {
00990   pci_flag_ok, pci_flag_pm, pci_flag_agp
00991 } hd_pci_flags_t;
00992 
00993 
00994 /*
00995  * raw USB data
00996  */
00997 typedef struct usb_s {
00998   struct usb_s *next;
00999   unsigned hd_idx;
01000   unsigned hd_base_idx;
01001   /* see Linux USB docs */
01002   str_list_t *c, *d, *e, *i, *p, *s, *t;
01003   struct usb_s *cloned;
01004   int bus, dev_nr, lev, parent, port, count, conns, used_conns, ifdescr;
01005   unsigned speed;
01006   unsigned vendor, device, rev;
01007   char *manufact, *product, *serial;
01008   char *driver;
01009   memory_range_t raw_descr;
01010   int d_cls, d_sub, d_prot;
01011   int i_alt, i_cls, i_sub, i_prot;
01012   unsigned country;
01013 } usb_t;
01014 
01015 /*
01016  *structures to hold the (raw) ISA-PnP data
01017  */
01018 typedef struct {
01019   int len;
01020   int type;
01021   unsigned char *data;
01022 } isapnp_res_t;
01023 
01024 typedef struct {
01025   int csn;
01026   int log_devs;
01027   unsigned char *serial;
01028   unsigned char *card_regs;
01029   unsigned char (*ldev_regs)[0xd0];
01030   int res_len;
01031   unsigned broken:1;            /* mark a broken card */
01032   isapnp_res_t *res;
01033 } isapnp_card_t;
01034 
01035 typedef struct {
01036   int read_port;
01037   int cards;
01038   isapnp_card_t *card;
01039 } isapnp_t;
01040 
01041 typedef struct {
01042   isapnp_card_t *card;
01043   int dev;
01044   unsigned flags;                               /* cf. enum isapnp_flags */
01045   unsigned ref:1;                               /* internally used flag */
01046 } isapnp_dev_t;
01047 
01048 /*
01049  * ISA-PnP related flags; cf. (isapnp_dev_t).flags
01050  */
01051 typedef enum isapnp_flags {
01052   isapnp_flag_act
01053 } hd_isapnp_flags_t;
01054 
01055 
01056 /*
01057  * raw SCSI data
01058  */
01059 typedef struct scsi_s {
01060   struct scsi_s *next;
01061   unsigned deleted:1;
01062   unsigned generic:1;
01063   unsigned fake:1;
01064   char *dev_name;
01065   char *guessed_dev_name;
01066   int generic_dev;
01067   unsigned host, channel, id, lun;
01068   char *vendor, *model, *rev, *type_str, *serial;
01069   int type;
01070   unsigned inode_low;
01071   char *proc_dir, *driver;
01072   unsigned unique;
01073   char *info;
01074   unsigned lgeo_c, lgeo_h, lgeo_s;
01075   unsigned pgeo_c, pgeo_h, pgeo_s;
01076   uint64_t size;
01077   unsigned sec_size;
01078   unsigned cache;
01079   str_list_t *host_info;
01080   char *usb_guid;
01081   unsigned pci_info;
01082   unsigned pci_bus;
01083   unsigned pci_slot;
01084   unsigned pci_func;
01085   uint64_t wwpn;
01086   uint64_t fcp_lun;
01087   char *controller_id;
01088 } scsi_t;
01089 
01090 
01091 /*
01092  * PROM tree on PPC
01093  */
01094 typedef struct devtree_s {
01095   struct devtree_s *next;
01096   struct devtree_s *parent;
01097   unsigned idx;
01098   char *path, *filename;
01099   unsigned pci:1;
01100   char *name, *model, *device_type, *compatible;
01101   int class_code;                       /* class : sub_class : prog-if */
01102   int vendor_id, device_id, subvendor_id, subdevice_id;
01103   int revision_id, interrupt;
01104   unsigned char *edid;                  /* 128 bytes */
01105 } devtree_t;
01106 
01107 /*
01108  * Device/CU model numbers for S/390
01109  */
01110 typedef struct ccw_s {
01111   unsigned char lcss;
01112   unsigned char cu_model;
01113   unsigned char dev_model;
01114 } ccw_t;
01115 
01116 /*
01117  * special CDROM entry
01118  */
01119 typedef struct cdrom_info_s {
01120   struct cdrom_info_s *next;
01121   char *name;
01122   unsigned speed;
01123   unsigned cdr:1, cdrw:1, dvd:1, dvdr:1, dvdram:1;
01124   unsigned cdrom:1;             /* cdrom in drive */
01125   struct {
01126     unsigned ok:1;
01127     char *volume, *publisher, *preparer, *application, *creation_date;
01128   } iso9660;
01129   struct {
01130     unsigned ok:1;
01131     unsigned platform;
01132     char *id_string;
01133     unsigned bootable:1;
01134     unsigned media_type;        /* boot emulation type */
01135     unsigned load_address;
01136     unsigned load_count;        /* sectors to load */
01137     unsigned start;             /* start sector */
01138     unsigned catalog;           /* boot catalog start */
01139     struct {
01140       unsigned c, h, s;
01141       unsigned size;
01142     } geo;
01143     char *label;
01144   } el_torito;
01145 
01146 } cdrom_info_t;
01147 
01148 // note: obsolete, will be removed
01149 typedef struct {
01150   unsigned char block0[512];
01151 } floppy_info_t;
01152 
01153 /*
01154  * bios data (ix86)
01155  */
01156 typedef struct {
01157   unsigned apm_supported:1;
01158   unsigned apm_enabled:1;
01159   unsigned apm_ver, apm_subver;
01160   unsigned apm_bios_flags;
01161 
01162   unsigned vbe_ver;
01163   unsigned vbe_video_mem;
01164 
01165   unsigned ser_port0, ser_port1, ser_port2, ser_port3;
01166   unsigned par_port0, par_port1, par_port2;
01167 
01168   /* The id is still in big endian format! */
01169   unsigned is_pnp_bios:1;
01170   unsigned pnp_id;
01171   unsigned lba_support:1;
01172 
01173   unsigned low_mem_size;
01174   smp_info_t smp;
01175   vbe_info_t vbe;
01176 
01177   unsigned smbios_ver;
01178 
01179   struct {
01180     unsigned width;
01181     unsigned height;
01182     char *vendor;
01183     char *name;
01184   } lcd;
01185 
01186   struct {
01187     char *vendor;
01188     char *type;
01189     unsigned bus;
01190     unsigned compat_vend;
01191     unsigned compat_dev;
01192   } mouse;
01193 
01194   struct {
01195     unsigned ok:1;
01196     unsigned scroll_lock:1;
01197     unsigned num_lock:1;
01198     unsigned caps_lock:1;
01199   } led;
01200 
01201   bios32_info_t bios32;
01202 
01203 } bios_info_t;
01204 
01205 
01206 /*
01207  * prom data (ppc, sparc)
01208  */
01209 typedef struct {
01210   unsigned has_color:1;
01211   unsigned color;
01212 } prom_info_t;
01213 
01214 
01215 /*
01216  * general system data
01217  */
01218 typedef struct {
01219   char *system_type;
01220   char *generation;
01221   char *vendor;
01222   char *model;
01223   char *serial;
01224   char *lang;
01225 } sys_info_t;
01226 
01227 
01228 /*
01229  * monitor (DDC) data
01230  */
01231 typedef struct {
01232   unsigned manu_year;
01233   unsigned min_vsync, max_vsync;        /* vsync range */
01234   unsigned min_hsync, max_hsync;        /* hsync range */
01235   char *vendor;
01236   char *name;
01237   char *serial;
01238 } monitor_info_t;
01239 
01240 
01241 typedef enum cpu_arch {
01242   arch_unknown = 0,
01243   arch_intel,
01244   arch_alpha,
01245   arch_sparc, arch_sparc64,
01246   arch_ppc, arch_ppc64,
01247   arch_68k,
01248   arch_ia64,
01249   arch_s390, arch_s390x,
01250   arch_arm,
01251   arch_mips,
01252   arch_x86_64
01253 } hd_cpu_arch_t;
01254 
01255 // ###### drop boot_arch at all?
01256 typedef enum boot_arch {
01257   boot_unknown = 0,
01258   boot_lilo, boot_milo, boot_aboot, boot_silo, boot_ppc, boot_elilo, boot_s390,
01259   boot_mips, boot_grub
01260 } hd_boot_arch_t;
01261 
01262 /* special cpu entry */
01263 typedef struct {
01264   enum cpu_arch architecture;
01265   unsigned family;              /* axp: cpu variation */
01266   unsigned model;               /* axp: cpu revision */
01267   unsigned stepping;
01268   unsigned cache;
01269   unsigned clock;
01270   unsigned units;               /* >1 "hyperthreading" */
01271   char *vend_name;              /* axp: system type */
01272   char *model_name;             /* axp: cpu model */
01273   char *platform;               /* x86: NULL */
01274   str_list_t *features;         /* x86: flags */
01275 } cpu_info_t;
01276 
01277 
01278 /*
01279  * enhanced disk data (cf. edd.c)
01280  */
01281 typedef struct {
01282   uint64_t sectors;
01283   struct {
01284     unsigned cyls, heads, sectors;
01285   } edd;
01286   struct {
01287     unsigned cyls, heads, sectors;
01288   } legacy;
01289   unsigned ext_fixed_disk:1;
01290   unsigned ext_lock_eject:1;
01291   unsigned ext_edd:1;
01292   unsigned ext_64bit:1;
01293   unsigned assigned:1;
01294   char *sysfs_id;
01295   unsigned hd_idx;
01296 } edd_info_t;
01297 
01298 
01299 /*
01300  * database info
01301  */
01302 typedef struct {
01303   unsigned data_len, data_max;
01304   unsigned *data;
01305   unsigned names_len, names_max;
01306   char *names;
01307 } hddb_data_t;
01308 
01309 typedef uint32_t hddb_entry_mask_t;
01310 
01311 typedef struct hddb_list_s {   
01312   hddb_entry_mask_t key_mask;
01313   hddb_entry_mask_t value_mask;
01314   unsigned key;
01315   unsigned value;
01316 } hddb_list_t;
01317 
01318 typedef struct {
01319   unsigned list_len, list_max;
01320   hddb_list_t *list;
01321   unsigned ids_len, ids_max;
01322   unsigned *ids;
01323   unsigned strings_len, strings_max;
01324   char *strings;
01325 } hddb2_data_t;
01326 
01327 /*
01328  * module.alias info
01329  */
01330 typedef enum modinfo_type_e { mi_none = 0, mi_pci, mi_usb, mi_pcmcia } modinfo_type_t;
01331 
01332 typedef struct {
01333   char *module;
01334   char *alias;
01335   modinfo_type_t type;
01336   union {
01337     struct {
01338       struct {
01339         unsigned vendor:1;
01340         unsigned device:1;
01341         unsigned sub_vendor:1;
01342         unsigned sub_device:1;
01343         unsigned base_class:1;
01344         unsigned sub_class:1;
01345         unsigned prog_if:1;
01346       } has;
01347       unsigned vendor;
01348       unsigned device;
01349       unsigned sub_vendor;
01350       unsigned sub_device;
01351       unsigned base_class;
01352       unsigned sub_class;
01353       unsigned prog_if;
01354     } pci;
01355 
01356     struct {
01357       struct {
01358         unsigned vendor:1;
01359         unsigned product:1;
01360         unsigned device_class:1;
01361         unsigned device_subclass:1;
01362       } has;
01363       unsigned vendor;
01364       unsigned product;
01365       unsigned device_class;
01366       unsigned device_subclass;
01367     } usb;
01368   };
01369 } modinfo_t;
01370 
01371 
01372 /*
01373  * HAL device property types
01374  */
01375 typedef enum {
01376   p_invalid, p_string, p_int32, p_uint64, p_double, p_bool, p_list
01377 } hal_prop_type_t;
01378 
01379 
01380 /*
01381  * HAL device properties
01382  */
01383 typedef struct hal_prop_s {
01384   struct hal_prop_s *next;
01385   hal_prop_type_t type;
01386   char *key;
01387   union {
01388     char *str;
01389     int32_t int32;
01390     uint64_t uint64;
01391     double d;     
01392     int b;
01393     str_list_t *list;
01394   } val;  
01395 } hal_prop_t;
01396 
01397 
01398 /*
01399  * HAL device
01400  */
01401 typedef struct hal_device_s {
01402   struct hal_device_s *next, *parent;
01403   char *udi;
01404   unsigned used:1;
01405   hal_prop_t *prop;
01406 } hal_device_t;
01407 
01408 
01409 /*
01410  * resource types
01411  */
01412 typedef enum resource_types {
01413   res_any, res_phys_mem, res_mem, res_io, res_irq, res_dma, res_monitor,
01414   res_size, res_disk_geo, res_cache, res_baud, res_init_strings, res_pppd_option,
01415   res_framebuffer, res_hwaddr, res_link, res_wlan
01416 } hd_resource_types_t;
01417 
01418 
01419 /*
01420  * size units (cf. (res_size_t).unit)
01421  */
01422 typedef enum size_units {
01423   size_unit_cm, size_unit_cinch, size_unit_byte, size_unit_sectors,
01424   size_unit_kbyte, size_unit_mbyte, size_unit_gbyte
01425 } hd_size_units_t;
01426 
01427 /*
01428  * access types for I/O and memory resources
01429  */
01430 typedef enum access_flags {
01431   acc_unknown, acc_ro, acc_wo, acc_rw           /* unknown, read only, write only, read/write */
01432 } hd_access_flags_t;
01433 
01434 
01435 typedef enum yes_no_flag {
01436   flag_unknown, flag_no, flag_yes               /* unknown, no, yes */
01437 } hd_yes_no_flag_t;
01438 
01439 
01440 typedef enum geo_types {
01441   geo_physical = 0, geo_logical, geo_bios_edd, geo_bios_legacy
01442 } hd_geo_types_t;
01443 
01444 
01445 /*
01446  * definitions for the various resource types
01447  */
01448 typedef struct {
01449   union u_hd_res_t *next;
01450   enum resource_types type;
01451 } res_any_t;
01452 
01453 typedef struct {
01454   union u_hd_res_t *next;
01455   enum resource_types type;
01456   uint64_t base, range;
01457   unsigned
01458     enabled:1,                          /* 0: disabled, 1 enabled */
01459     access:2,                           /* enum access_flags */
01460     prefetch:2;                         /* enum yes_no_flag */
01461 } res_mem_t;
01462 
01463 typedef struct {
01464   union u_hd_res_t *next;
01465   enum resource_types type;
01466   uint64_t range;
01467 } res_phys_mem_t;
01468 
01469 typedef struct {
01470   union u_hd_res_t *next;
01471   enum resource_types type;
01472   uint64_t base, range;
01473   unsigned
01474     enabled:1,                          /* 0: disabled, 1 enabled */
01475     access:2;                           /* enum access_flags */
01476 } res_io_t;
01477 
01478 typedef struct {
01479   union u_hd_res_t *next;
01480   enum resource_types type;
01481   unsigned base;
01482   unsigned triggered;                   /* # of interrupts */
01483   unsigned enabled:1;                   /* 0: disabled, 1 enabled */
01484 } res_irq_t;
01485 
01486 typedef struct {
01487   union u_hd_res_t *next;
01488   enum resource_types type;
01489   unsigned base;
01490   unsigned enabled:1;                   /* 0: disabled, 1 enabled */
01491 } res_dma_t;
01492 
01493 typedef struct {
01494   union u_hd_res_t *next;
01495   enum resource_types type;
01496   enum size_units unit;
01497   uint64_t val1, val2;                  /* to allow for 2D values */
01498 } res_size_t;
01499 
01500 typedef struct {
01501   union u_hd_res_t *next;
01502   enum resource_types type;
01503   unsigned speed;
01504   unsigned bits, stopbits;
01505   char parity;                          /* n, e, o, s, m */
01506   char handshake;                       /* -, h, s */
01507 } res_baud_t;
01508 
01509 typedef struct {
01510   union u_hd_res_t *next;
01511   enum resource_types type;
01512   unsigned size;                        /* in kbyte */
01513 } res_cache_t;
01514 
01515 typedef struct {
01516   union u_hd_res_t *next;
01517   enum resource_types type;
01518   unsigned cyls, heads, sectors;
01519   uint64_t size;
01520   enum geo_types geotype;               /* 0-3: physical/logical/bios edd/bios legacy */
01521 } res_disk_geo_t;
01522 
01523 typedef struct {
01524   union u_hd_res_t *next;
01525   enum resource_types type;
01526   unsigned width, height;               /* in pixel */
01527   unsigned vfreq;                       /* in Hz */
01528   unsigned interlaced:1;                /* 0/1 */
01529 } res_monitor_t;
01530 
01531 typedef struct {
01532   union u_hd_res_t *next;
01533   enum resource_types type;
01534   char *init1;
01535   char *init2;
01536 } res_init_strings_t;
01537 
01538 typedef struct {
01539   union u_hd_res_t *next;
01540   enum resource_types type;
01541   char *option;
01542 } res_pppd_option_t;
01543 
01544 typedef struct {
01545   union u_hd_res_t *next;
01546   enum resource_types type;
01547   unsigned width, height;               /* in pixel */
01548   unsigned bytes_p_line;                /* line length in bytes (do not confuse with 'width') */
01549   unsigned colorbits;                   /* 4, 8, 15, 16, 24, 32 */
01550   unsigned mode;                        /* mode number for kernel */
01551 } res_framebuffer_t;
01552 
01553 typedef struct {
01554   union u_hd_res_t *next;
01555   enum resource_types type;
01556   char *addr;
01557 } res_hwaddr_t;
01558 
01559 typedef struct {
01560   union u_hd_res_t *next;
01561   enum resource_types type;
01562   unsigned state:1;                     /* network link state: 0 - not connected, 1 - connected */
01563 } res_link_t;
01564 
01565 /* wlan capabilities */
01566 typedef struct {
01567   union u_hd_res_t *next;
01568   enum resource_types type;
01569   str_list_t *channels;
01570   str_list_t *frequencies; /* in GHz units */
01571   str_list_t *bitrates;    /* in Mbps units */
01572   str_list_t *auth_modes;  /* open, sharedkey, wpa-psk, wpa-eap, wpa-leap */
01573   str_list_t *enc_modes;   /* WEP40, WEP104, WEP128, WEP232, TKIP, CCMP */
01574 } res_wlan_t;
01575 
01576 typedef union u_hd_res_t {
01577   union u_hd_res_t *next;  
01578   res_any_t any;
01579   res_io_t io;
01580   res_mem_t mem;
01581   res_phys_mem_t phys_mem;
01582   res_irq_t irq;
01583   res_dma_t dma;
01584   res_size_t size;
01585   res_cache_t cache;
01586   res_baud_t baud;
01587   res_disk_geo_t disk_geo;
01588   res_monitor_t monitor;
01589   res_init_strings_t init_strings;
01590   res_pppd_option_t pppd_option;
01591   res_framebuffer_t framebuffer;
01592   res_hwaddr_t hwaddr;
01593   res_link_t link;
01594   res_wlan_t wlan;
01595 } hd_res_t;
01596 
01597 
01598 /*
01599  * data gathered by the misc module; basically resources from /proc
01600  */
01601 typedef struct {
01602   uint64_t addr, size;
01603   char *dev;
01604   unsigned tag;
01605 } misc_io_t;
01606 
01607 typedef struct {
01608   unsigned channel;
01609   char *dev;
01610   unsigned tag;
01611 } misc_dma_t;
01612 
01613 typedef struct {
01614   unsigned irq, events;
01615   int devs;
01616   char **dev;
01617   unsigned tag;
01618 } misc_irq_t;
01619 
01620 typedef struct {
01621   unsigned io_len, dma_len, irq_len;
01622   misc_io_t *io;
01623   misc_dma_t *dma;
01624   misc_irq_t *irq;
01625   str_list_t *proc_io, *proc_dma, *proc_irq;
01626 } misc_t;
01627 
01628 typedef struct s_serial_t {
01629   struct s_serial_t *next;
01630   char *name;
01631   char *device;
01632   unsigned line, port, irq, baud;
01633 } serial_t;
01634 
01635 typedef struct s_ser_device_t {
01636   struct s_ser_device_t *next;
01637   unsigned hd_idx;
01638   char *dev_name;
01639   str_list_t *at_resp;
01640   int fd;
01641   struct termios tio;
01642   unsigned max_baud, cur_baud;
01643   unsigned is_mouse:1;
01644   unsigned is_modem:1;
01645   unsigned do_io:1;
01646   unsigned char buf[0x1000];
01647   int buf_len;
01648   int garbage, non_pnp, pnp;
01649   unsigned char pnp_id[8];
01650   char *serial, *class_name, *dev_id, *user_name, *vend, *init_string1, *init_string2, *pppd_option;
01651   unsigned pnp_rev;
01652   unsigned bits;
01653 } ser_device_t;
01654 
01655 /*
01656  * Notes on isdn_parm_t:
01657  *   - def_value is only relevant of alt_values != 0
01658  *   - def_value should be a value out of alt_value[]
01659  *   - see libihw docu for the meaning of name,type,flags,def_value
01660  */
01661 typedef struct isdn_parm_s {
01662   struct isdn_parm_s *next;
01663   char *name;                           /* parameter name */
01664   unsigned valid:1;                     /* 1: entry is valid, 0: some inconsistencies */
01665   unsigned conflict:1;                  /* 1: ressource conflict (eg. no free irq) */
01666   uint64_t value;                       /* value of the parameter */
01667   unsigned type;                        /* CDBISDN type (P_...) */
01668   unsigned flags;                       /* CDBISDN flags (P_...) */
01669   unsigned def_value;                   /* default value */
01670   int alt_values;                       /* length of alt_value[] */
01671   unsigned *alt_value;                  /* possible values */
01672 } isdn_parm_t;
01673 
01674 /* device driver info types */
01675 typedef enum driver_info_type {
01676   di_any, di_display, di_module, di_mouse, di_x11, di_isdn, di_kbd, di_dsl
01677 } hd_driver_info_t;
01678 
01679 /* unspecific info */
01680 typedef struct {
01681   union driver_info_u *next;
01682   enum driver_info_type type;           /* driver info type */
01683   str_list_t *hddb0, *hddb1;            /* the actual driver database entries */
01684 } driver_info_any_t;
01685 
01686 /* display (monitor) info */
01687 typedef struct {
01688   union driver_info_u *next;
01689   enum driver_info_type type;           /* driver info type */
01690   str_list_t *hddb0, *hddb1;            /* the actual driver database entries */
01691   unsigned width, height;               /* max. useful display geometry */
01692   unsigned min_vsync, max_vsync;        /* vsync range */
01693   unsigned min_hsync, max_hsync;        /* hsync range */
01694   unsigned bandwidth;                   /* max. pixel clock */
01695 } driver_info_display_t;
01696 
01697 /* module info */
01698 typedef struct {
01699   union driver_info_u *next;
01700   enum driver_info_type type;           /* driver info type */
01701   str_list_t *hddb0, *hddb1;            /* the actual driver database entries */
01702   unsigned active:1;                    /* if module is currently active */
01703   unsigned modprobe:1;                  /* modprobe or insmod  */
01704   str_list_t *names;                    /* (ordered) list of module names */
01705   str_list_t *mod_args;                 /* list of module args (corresponds to the module name list) */
01706   char *conf;                           /* conf.modules entry, if any (e.g. for sb.o) */
01707 } driver_info_module_t;
01708 
01709 /* mouse protocol info */
01710 typedef struct {
01711   union driver_info_u *next;
01712   enum driver_info_type type;           /* driver info type */
01713   str_list_t *hddb0, *hddb1;            /* the actual driver database entries */
01714   char *xf86;                           /* the XF86 protocol name */
01715   char *gpm;                            /* dto, gpm */
01716   int buttons;                          /* number of buttons, -1 --> unknown */
01717   int wheels;                           /* dto, wheels */
01718 } driver_info_mouse_t;
01719 
01720 /* X11 server info */
01721 typedef struct {
01722   union driver_info_u *next;
01723   enum driver_info_type type;           /* driver info type */
01724   str_list_t *hddb0, *hddb1;            /* the actual driver database entries */
01725   char *server;                         /* the server/module name */
01726   char *xf86_ver;                       /* XFree86 version (3 or 4) */
01727   unsigned x3d:1;                       /* has 3D support */
01728   struct {
01729     unsigned all:5;                     /* the next 5 entries combined */
01730     unsigned c8:1, c15:1, c16:1, c24:1, c32:1;
01731   } colors;                             /* supported color depths */
01732   unsigned dacspeed;                    /* max. ramdac clock */
01733   str_list_t *extensions;               /* additional X extensions to load ('Module' section) */
01734   str_list_t *options;                  /* special server options */
01735   str_list_t *raw;                      /* extra info to add to XF86Config */
01736   char *script;                         /* 3d script to run */
01737 } driver_info_x11_t;
01738 
01739 /* isdn info */
01740 typedef struct {
01741   union driver_info_u *next;
01742   enum driver_info_type type;           /* driver info type */
01743   str_list_t *hddb0, *hddb1;            /* the actual driver database entries */
01744   int i4l_type, i4l_subtype;            /* I4L types */
01745   char *i4l_name;                       /* I4L card name */
01746   isdn_parm_t *params;                  /* isdn parameters */
01747 } driver_info_isdn_t;
01748 
01749 /* dsl info */
01750 typedef struct {
01751   union driver_info_u *next;
01752   enum driver_info_type type;           /* driver info type */
01753   str_list_t *hddb0, *hddb1;            /* the actual driver database entries */
01754   char *mode;                           /* DSL driver types */
01755   char *name;                           /* DSL driver name */
01756 } driver_info_dsl_t;
01757 
01758 /* keyboard info */
01759 typedef struct {
01760   union driver_info_u *next;
01761   enum driver_info_type type;           /* driver info type */
01762   str_list_t *hddb0, *hddb1;            /* the actual driver database entries */
01763   char *XkbRules;                       /* XF86Config entries */
01764   char *XkbModel;
01765   char *XkbLayout;
01766   char *keymap;                         /* console keymap */
01767 } driver_info_kbd_t;
01768 
01769 /*
01770  * holds device driver info
01771  */
01772 typedef union driver_info_u {
01773   union driver_info_u *next;
01774   driver_info_any_t any;
01775   driver_info_module_t module;
01776   driver_info_mouse_t mouse;
01777   driver_info_x11_t x11;
01778   driver_info_display_t display;
01779   driver_info_isdn_t isdn;
01780   driver_info_dsl_t dsl;
01781   driver_info_kbd_t kbd;
01782 } driver_info_t;
01783 
01784 
01785 /*
01786  * Some hardware doesn't fit into the hd_t scheme or there is info we
01787  * gathered during the scan process but that no-one really cares about. Such
01788  * stuff is stored in hd_detail_t.
01789  */
01790 typedef enum hd_detail_type {
01791   hd_detail_pci, hd_detail_usb, hd_detail_isapnp, hd_detail_cdrom,
01792   hd_detail_floppy, hd_detail_bios, hd_detail_cpu, hd_detail_prom,
01793   hd_detail_monitor, hd_detail_sys, hd_detail_scsi, hd_detail_devtree,
01794   hd_detail_ccw
01795 } hd_detail_type_t;
01796 
01797 typedef struct {
01798   enum hd_detail_type type;
01799   pci_t *data;
01800 } hd_detail_pci_t;
01801 
01802 typedef struct {
01803   enum hd_detail_type type;
01804   usb_t *data;
01805 } hd_detail_usb_t;
01806 
01807 typedef struct {
01808   enum hd_detail_type type;
01809   isapnp_dev_t *data;
01810 } hd_detail_isapnp_t;
01811 
01812 typedef struct {
01813   enum hd_detail_type type;
01814   cdrom_info_t *data;
01815 } hd_detail_cdrom_t;
01816 
01817 typedef struct {
01818   enum hd_detail_type type;
01819   floppy_info_t *data;
01820 } hd_detail_floppy_t;
01821 
01822 typedef struct {
01823   enum hd_detail_type type;
01824   bios_info_t *data;
01825 } hd_detail_bios_t;
01826 
01827 typedef struct {
01828   enum hd_detail_type type;
01829   cpu_info_t *data;
01830 } hd_detail_cpu_t;
01831 
01832 typedef struct {
01833   enum hd_detail_type type;
01834   prom_info_t *data;
01835 } hd_detail_prom_t;
01836 
01837 typedef struct {
01838   enum hd_detail_type type;
01839   monitor_info_t *data;
01840 } hd_detail_monitor_t;
01841 
01842 typedef struct {
01843   enum hd_detail_type type;
01844   sys_info_t *data;
01845 } hd_detail_sys_t;
01846 
01847 typedef struct {
01848   enum hd_detail_type type;
01849   scsi_t *data;
01850 } hd_detail_scsi_t;
01851 
01852 typedef struct {
01853   enum hd_detail_type type;
01854   devtree_t *data;
01855 } hd_detail_devtree_t;
01856 
01857 typedef struct {
01858   enum hd_detail_type type;
01859   ccw_t *data;
01860 } hd_detail_ccw_t;
01861 
01862 typedef union {
01863   enum hd_detail_type type;
01864   hd_detail_pci_t pci;
01865   hd_detail_usb_t usb;
01866   hd_detail_isapnp_t isapnp;
01867   hd_detail_cdrom_t cdrom;
01868   hd_detail_floppy_t floppy;
01869   hd_detail_bios_t bios;
01870   hd_detail_cpu_t cpu;
01871   hd_detail_prom_t prom;
01872   hd_detail_monitor_t monitor;
01873   hd_detail_sys_t sys;
01874   hd_detail_scsi_t scsi;
01875   hd_detail_devtree_t devtree;
01876   hd_detail_ccw_t ccw;
01877 } hd_detail_t;
01878 
01879 
01880 /* info about manually configured hardware (in /var/lib/hardware/) */
01881 typedef struct hd_manual_s {
01882   struct hd_manual_s *next;
01883 
01884   char *unique_id;
01885   char *parent_id;
01886   char *child_ids;
01887   unsigned hw_class;
01888   char *model;
01889 
01890   hd_status_t status;
01891   char *config_string;
01892 
01893   /* More or less free-form key, value pairs.
01894    * key should not contain '=', however.
01895    */
01896   str_list_t *key;
01897   str_list_t *value;
01898 } hd_manual_t;
01899 
01900 
01906 typedef struct s_hd_t {
01907   struct s_hd_t *next;          
01913   unsigned idx;
01914 
01920   unsigned broken:1;
01921 
01925   hd_id_t bus;
01926 
01931   unsigned slot;
01932 
01936   unsigned func;
01937 
01941   hd_id_t base_class;
01942 
01946   hd_id_t sub_class;
01947 
01951   hd_id_t prog_if;
01952 
01959   hd_id_t vendor;
01960 
01969   hd_id_t device;
01970 
01977   hd_id_t sub_vendor;
01978 
01985   hd_id_t sub_device;
01986 
01992   hd_id_t revision;
01993 
01997   char *serial;
01998 
02003   hd_id_t compat_vendor;
02004 
02009   hd_id_t compat_device;
02010 
02015   hd_hw_item_t hw_class;
02016 
02021   unsigned char hw_class_list[(hw_all + 7) / 8];        
02029   char *model;
02030 
02036   unsigned attached_to;
02037 
02041   char *sysfs_id;
02042 
02046   char *sysfs_bus_id;
02047 
02051   char *sysfs_device_link;
02052 
02058   char *unix_dev_name;
02059 
02063   hd_dev_num_t unix_dev_num;
02064 
02071   str_list_t *unix_dev_names;
02072 
02079   char *unix_dev_name2;
02080 
02084   hd_dev_num_t unix_dev_num2;
02085 
02092   char *rom_id;
02093 
02097   char *udi;
02098 
02102   char *parent_udi;
02103 
02114   char *unique_id;
02115 
02116   /* List of ids. */
02117   str_list_t *unique_ids;
02118 
02122   unsigned module;
02123 
02127   unsigned line;
02128 
02132   unsigned count;
02133 
02137   hd_res_t *res;
02138 
02143   hd_detail_t *detail;
02144 
02150   str_list_t *extra_info;
02151 
02157   hd_status_t status;
02158 
02165   char *config_string;
02166 
02171   hd_hotplug_t hotplug;
02172 
02177   unsigned hotplug_slot;
02178 
02179   struct is_s {
02180     unsigned agp:1;             /* AGP device */
02181     unsigned isapnp:1;          /* ISA-PnP device */
02182     unsigned notready:1;        /* block devices: no medium, other: device not configured */
02183     unsigned manual:1;          /* undetectable, manually configured hardware */
02184     unsigned softraiddisk:1;    /* disk belongs to some soft raid array */
02185     unsigned zip:1;             /* zip floppy */
02186     unsigned cdr:1;             /* CD-R */
02187     unsigned cdrw:1;            /* CD-RW */
02188     unsigned dvd:1;             /* DVD */
02189     unsigned dvdr:1;            /* DVD-R */
02190     unsigned dvdram:1;          /* DVD-RAM */
02191     unsigned pppoe:1;           /* PPPOE modem connected */
02192     unsigned wlan:1;            /* WLAN card */
02193     unsigned with_acpi:1;       /* acpi works fine */
02194   } is;
02195 
02196   struct tag_s {                /* this struct is for internal purposes only */
02197     unsigned remove:1;          /* schedule for removal */
02198     unsigned freeit:1;          /* for internal memory management */
02199     unsigned fixed:1;           /* fixed, do no longer modify this entry */
02200     unsigned ser_skip:1;        /* if serial line, don't scan for devices */
02201     unsigned ser_device:2;      /* if != 0: info about attached serial device; see serial.c */
02202   } tag;
02203 
02209   unsigned char *block0;
02210 
02214   char *driver;
02215 
02219   str_list_t *drivers;
02220 
02228   char *old_unique_id;
02229 
02235   char *parent_id;
02236 
02242   str_list_t *child_ids;
02243 
02248   char *unique_id1;
02249 
02256   char *usb_guid;
02257 
02258   driver_info_t *driver_info;   /* device driver info */
02259 
02260   str_list_t *requires;         /* packages/programs required for this hardware */
02261 
02262   hal_prop_t *hal_prop;         /* hal property list */
02263 
02264   hal_prop_t *persistent_prop;  /* persistent property list */
02265 
02266   char *modalias;               /* module alias */
02267 
02268   /*
02269    * These are used internally for memory management.
02270    * Do not even _think_ of modifying these!
02271    */
02272   unsigned ref_cnt;             
02273   struct s_hd_t *ref;           
02274 } hd_t;
02275 
02276 
02280 typedef struct {
02286   hd_t *hd;
02287 
02296   void (*progress)(char *pos, char *msg);
02297   
02301   char *log;
02302 
02308   unsigned debug;
02309 
02315   struct flag_struct {
02316     unsigned internal:1;        
02317     unsigned dformat:2;         
02318     unsigned no_parport:1;      
02319     unsigned iseries:1;         
02320     unsigned list_all:1;        
02321     unsigned fast:1;            
02322     unsigned list_md:1;         
02323     unsigned nofork:1;          
02324     unsigned nosysfs:1;         
02325     unsigned forked:1;          
02326     unsigned cpuemu:1;          
02327     unsigned udev:1;            
02328     unsigned edd_used:1;        
02329     unsigned keep_kmods:2;      
02330     unsigned nobioscrc:1;       
02331   } flags;
02332 
02333 
02337   str_list_t *only;
02338 
02339   /*
02340    * The following entries should *not* be accessed outside of libhd!
02341    */
02342   unsigned char probe[(pr_all + 7) / 8];        
02343   unsigned char probe_set[(pr_all + 7) / 8];    
02344   unsigned char probe_clr[(pr_all + 7) / 8];    
02345   unsigned last_idx;            
02346   unsigned module;              
02347   enum boot_arch boot;          
02348   hd_t *old_hd;                 
02349   pci_t *pci;                   
02350   isapnp_t *isapnp;             
02351   cdrom_info_t *cdrom;          
02352   str_list_t *net;              
02353   str_list_t *floppy;           
02354   misc_t *misc;                 
02355   serial_t *serial;             
02356   scsi_t *scsi;                 
02357   ser_device_t *ser_mouse;      
02358   ser_device_t *ser_modem;      
02359   str_list_t *cpu;              
02360   str_list_t *klog;             
02361   str_list_t *proc_usb;         
02362   usb_t *usb;                   
02363   modinfo_t *modinfo_ext;       
02364   modinfo_t *modinfo;           
02365   hddb2_data_t *hddb2[2];       
02366   str_list_t *kmods;            
02367   uint64_t used_irqs;           
02368   uint64_t assigned_irqs;       
02369   memory_range_t bios_rom;      
02370   memory_range_t bios_ram;      
02371   memory_range_t bios_ebda;     
02372   unsigned display;             
02373   unsigned color_code;          
02374   char *cmd_line;               
02375   str_list_t *xtra_hd;          
02376   devtree_t *devtree;           
02377   unsigned kernel_version;      
02378   int in_vmware;                
02379   hd_t *manual;                 
02380   str_list_t *disks;            
02381   str_list_t *partitions;       
02382   str_list_t *cdroms;           
02383   hd_smbios_t *smbios;          
02384   struct {
02385     unsigned ok:1;
02386     unsigned size;
02387     unsigned used;
02388     void *data;
02389     int id;
02390     int updated;
02391   } shm;                        
02392   unsigned pci_config_type;     
02393   hd_udevinfo_t *udevinfo;      
02394   hd_sysfsdrv_t *sysfsdrv;      
02395   uint64_t sysfsdrv_id;         
02396   str_list_t *scanner_db;       
02397   edd_info_t edd[0x80];         
02398   hal_device_t *hal;            
02399 } hd_data_t;
02400 
02401 
02402 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
02403  *
02404  *                      libhd interface functions
02405  *
02406  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
02407  */
02408 
02409 /* implemented in hd.c */
02410 
02411 /* the actual hardware scan */
02412 void hd_scan(hd_data_t *hd_data);
02413 
02415 hd_data_t *hd_free_hd_data(hd_data_t *hd_data);
02416 
02418 hd_t *hd_free_hd_list(hd_t *hd);
02419 
02420 void hd_set_probe_feature(hd_data_t *hd_data, enum probe_feature feature);
02421 void hd_clear_probe_feature(hd_data_t *hd_data, enum probe_feature feature);
02422 int hd_probe_feature(hd_data_t *hd_data, enum probe_feature feature);
02423 void hd_set_probe_feature_hw(hd_data_t *hd_data, hd_hw_item_t item);
02424 
02425 enum probe_feature hd_probe_feature_by_name(char *name);
02426 char *hd_probe_feature_by_value(enum probe_feature feature);
02427 
02428 int hd_module_is_active(hd_data_t *hd_data, char *mod);
02429 
02430 hd_t *hd_base_class_list(hd_data_t *hd_data, unsigned base_class);
02431 hd_t *hd_sub_class_list(hd_data_t *hd_data, unsigned base_class, unsigned sub_class);
02432 hd_t *hd_bus_list(hd_data_t *hd_data, unsigned bus);
02433 const char* hd_busid_to_hwcfg(int busid);
02434 hd_t *hd_list(hd_data_t *hd_data, hd_hw_item_t item, int rescan, hd_t *hd_old);
02435 hd_t *hd_list_with_status(hd_data_t *hd_data, hd_hw_item_t item, hd_status_t status);
02436 hd_t *hd_list2(hd_data_t *hd_data, hd_hw_item_t *items, int rescan);
02437 hd_t *hd_list_with_status2(hd_data_t *hd_data, hd_hw_item_t *items, hd_status_t status);
02438 
02439 int hd_has_pcmcia(hd_data_t *hd_data);
02440 // will be gone soon
02441 // int hd_apm_enabled(hd_data_t *hd_data);
02442 int hd_usb_support(hd_data_t *hd_data);
02443 int hd_smp_support(hd_data_t *hd_data);
02444 int hd_mac_color(hd_data_t *hd_data);
02445 int hd_color(hd_data_t *hd_data);
02446 int hd_is_uml(hd_data_t *hd_data);
02447 unsigned hd_display_adapter(hd_data_t *hd_data);
02448 unsigned hd_boot_disk(hd_data_t *hd_data, int *matches);
02449 enum cpu_arch hd_cpu_arch(hd_data_t *hd_data);
02450 enum boot_arch hd_boot_arch(hd_data_t *hd_data);
02451 
02452 hd_t *hd_get_device_by_idx(hd_data_t *hd_data, unsigned idx);
02453 
02454 void hd_set_hw_class(hd_t *hd, hd_hw_item_t hw_class);
02455 int hd_is_hw_class(hd_t *hd, hd_hw_item_t hw_class);
02456 
02457 int hd_is_sgi_altix(hd_data_t *hd_data);
02458 
02459 char *hd_version(void);
02460 
02461 hal_prop_t *hd_free_hal_properties(hal_prop_t *prop);
02462 hal_prop_t *hd_read_properties(const char *udi);
02463 int hd_write_properties(const char *udi, hal_prop_t *prop);
02464 
02465 /* implemented in hddb.c */
02466 
02467 str_list_t *get_hddb_packages(hd_data_t *hd_data);
02468 void hddb_add_info(hd_data_t *hd_data, hd_t *hd);
02469 
02470 void hddb_dump_raw(hddb2_data_t *hddb, FILE *f);
02471 void hddb_dump(hddb2_data_t *hddb, FILE *f);
02472 
02473 /* implemented in hdp.c */
02474 
02475 void hd_dump_entry(hd_data_t *hd_data, hd_t *hd, FILE *f);
02476 
02477 
02478 /* implemented in cdrom.c */
02479 
02480 cdrom_info_t *hd_read_cdrom_info(hd_data_t *hd_data, hd_t *hd);
02481 
02482 /* implemented in manual.c */
02483 hd_manual_t *hd_manual_read_entry(hd_data_t *hd_data, const char *id);
02484 int hd_manual_write_entry(hd_data_t *hd_data, hd_manual_t *entry);
02485 hd_manual_t *hd_free_manual(hd_manual_t *manual);
02486 hd_t *hd_read_config(hd_data_t *hd_data, const char *id);
02487 int hd_write_config(hd_data_t *hd_data, hd_t *hd);
02488 char *hd_hw_item_name(hd_hw_item_t item);
02489 hd_hw_item_t hd_hw_item_type(char *name);
02490 char *hd_status_value_name(hd_status_value_t status);
02491 int hd_change_status(const char *id, hd_status_t status, const char *config_string);
02492 int hd_change_config_status(hd_data_t *hd_data, const char *id, hd_status_t status, const char *config_string);
02493 int hd_read_mmap(hd_data_t *hd_data, char *name, unsigned char *buf, off_t start, unsigned size);
02494 
02495 
02496 /*
02497  * - - - - - CDB ISDN interface - - - - -
02498  */
02499 
02500 
02501 /* (C) 2003 kkeil@suse.de */
02502 
02503 #define CDBISDN_VERSION 0x0101
02504 
02505 #ifndef PCI_ANY_ID
02506 #define PCI_ANY_ID      0xffff
02507 #endif
02508 
02509 #define CDBISDN_P_NONE  0x0
02510 #define CDBISDN_P_IRQ   0x1
02511 #define CDBISDN_P_MEM   0x2
02512 #define CDBISDN_P_IO    0x3
02513 
02514 /* vendor info */
02515 typedef struct {
02516         char    *name;
02517         char    *shortname;
02518         int     vnr;
02519         int     refcnt;
02520 } cdb_isdn_vendor;
02521 
02522 typedef struct  {
02523         int     handle;         /* internal identifier idx in database */
02524         int     vhandle;        /* internal identifier to vendor database */
02525         char    *name;          /* cardname */
02526         char    *lname;         /* vendor short name + cardname */
02527         char    *Class;         /* CLASS of the card */
02528         char    *bus;           /* bus type */
02529         int     revision;       /* revision used with USB */
02530         int     vendor;         /* Vendor ID for ISAPNP and PCI cards */
02531         int     device;         /* Device ID for ISAPNP and PCI cards */
02532         int     subvendor;      /* Subvendor ID for PCI cards */
02533                                 /* A value of 0xffff is ANY_ID */
02534         int     subdevice;      /* Subdevice ID for PCI cards */
02535                                 /* A value of 0xffff is ANY_ID */
02536         unsigned int features;  /* feature flags */
02537         int     line_cnt;       /* count of ISDN ports */
02538         int     vario_cnt;      /* count of driver varios */
02539         int     vario;          /* referenz to driver vario record */
02540 } cdb_isdn_card;
02541 
02542 typedef struct  {
02543         int     handle;         /* idx in database */   
02544         int     next_vario;     /* link to alternate vario */
02545         int     drvid;          /* unique id of the driver vario */
02546         int     typ;            /* Type to identify the driver */
02547         int     subtyp;         /* Subtype of the driver type */
02548         int     smp;            /* SMP supported ? */
02549         char    *mod_name;      /* name of the driver module */
02550         char    *para_str;      /* optional parameter string */
02551         char    *mod_preload;   /* optional modules to preload */
02552         char    *cfg_prog;      /* optional cfg prog */
02553         char    *firmware;      /* optional firmware to load */
02554         char    *description;   /* optional description */
02555         char    *need_pkg;      /* list of packages needed for function */
02556         char    *info;          /* optional additional info */
02557         char    *protocol;      /* supported D-channel protocols */
02558         char    *interface;     /* supported API interfaces */
02559         char    *io;            /* possible IO ports with legacy ISA cards */
02560         char    *irq;           /* possible interrupts with legacy ISA cards */
02561         char    *membase;       /* possible membase with legacy ISA cards */
02562         char    *features;      /* optional features*/
02563         int     card_ref;       /* reference to a card */
02564         char    *name;          /* driver name */
02565 } cdb_isdn_vario;
02566 
02567 
02568 extern cdb_isdn_vendor  *hd_cdbisdn_get_vendor(int);
02569 extern cdb_isdn_card    *hd_cdbisdn_get_card(int);
02570 extern cdb_isdn_vario   *hd_cdbisdn_get_vario_from_type(int, int);
02571 extern cdb_isdn_card    *hd_cdbisdn_get_card_from_type(int, int);
02572 extern cdb_isdn_card    *hd_cdbisdn_get_card_from_id(int, int, int, int);
02573 extern cdb_isdn_vario   *hd_cdbisdn_get_vario(int);
02574 extern int              hd_cdbisdn_get_version(void);
02575 extern int              hd_cdbisdn_get_db_version(void);
02576 extern char             *hd_cdbisdn_get_db_date(void);
02577 
02578 /* CDB ISDN interface end */
02579 
02580 #ifdef __cplusplus
02581 }
02582 #endif
02583 
02584 #endif  /* _HD_H */