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