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

hd.h

Go to the documentation of this file.
00001 #ifndef _HD_H 00002 #define _HD_H 00003 00004 #ifdef __cplusplus 00005 extern "C" { 00006 #endif 00007 00008 00009 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 00010 * 00011 * libhd data structures 00012 * 00013 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 00014 */ 00015 00016 #define HD_VERSION 7 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 00050 /* 00051 * libhd's directory 00052 */ 00053 #define HARDWARE_DIR "/var/lib/hardware" 00054 #define HARDWARE_UNIQUE_KEYS HARDWARE_DIR "/unique-keys" 00055 00070 #define TAG_PCI 1 00071 #define TAG_EISA 2 00072 #define TAG_USB 3 00073 #define TAG_SPECIAL 4 00074 #define TAG_PCMCIA 5 00079 #define ID_VALUE(id) ((id) & 0xffff) 00080 00084 #define ID_TAG(id) (((id) >> 16) & 0xf) 00085 00089 #define MAKE_ID(tag, id_val) ((tag << 16) | (id_val)) 00090 00093 /* 00094 * flags to control the probing. 00095 */ 00096 typedef enum probe_feature { 00097 pr_memory = 1, pr_pci, pr_pci_range, pr_pci_ext, pr_isapnp, pr_cdrom, 00098 pr_cdrom_info, pr_net, pr_floppy, pr_misc, pr_misc_serial, pr_misc_par, 00099 pr_misc_floppy, pr_serial, pr_cpu, pr_bios, pr_monitor, pr_mouse, pr_ide, 00100 pr_scsi, pr_scsi_geo, pr_scsi_cache, pr_usb, pr_usb_mods, pr_adb, 00101 pr_modem, pr_modem_usb, pr_parallel, pr_parallel_lp, pr_parallel_zip, 00102 pr_isa, pr_isa_isdn, pr_dac960, pr_smart, pr_isdn, pr_kbd, pr_prom, 00103 pr_sbus, pr_int, pr_braille, pr_braille_alva, pr_braille_fhp, 00104 pr_braille_ht, pr_ignx11, pr_sys, pr_dasd, pr_i2o, pr_cciss, pr_bios_vbe, 00105 pr_isapnp_old, pr_isapnp_new, pr_isapnp_mod, pr_braille_baum, pr_manual, 00106 pr_fb, pr_bios_vbe2, pr_veth, pr_partition, pr_disk, pr_ataraid, pr_pppoe, 00107 pr_scan, pr_partition_add, pr_pcmcia, pr_fork, pr_parallel_imm, pr_s390, 00108 /* pr_bios_32, */ 00109 pr_max, pr_lxrc, pr_default, pr_all /* pr_all must be last */ 00110 } hd_probe_feature_t; 00111 00112 /* 00113 * list types for hd_list() 00114 * 00115 * if you want to modify this: cf. manual.c::hw_items[] 00116 * 00117 * Note: hw_tv _must_ be < hw_display! 00118 */ 00119 typedef enum hw_item { 00120 hw_sys = 1, hw_cpu, hw_keyboard, hw_braille, hw_mouse, hw_joystick, 00121 hw_printer, hw_scanner, hw_chipcard, hw_monitor, hw_tv, hw_display, 00122 hw_framebuffer, hw_camera, hw_sound, hw_storage_ctrl, hw_network_ctrl, 00123 hw_isdn, hw_modem, hw_network, hw_disk, hw_partition, hw_cdrom, hw_floppy, 00124 hw_manual, hw_usb_ctrl, hw_usb, hw_bios, hw_pci, hw_isapnp, hw_bridge, 00125 hw_hub, hw_scsi, hw_ide, hw_memory, hw_dvb, hw_pcmcia, hw_pcmcia_ctrl, 00126 hw_ieee1394, hw_ieee1394_ctrl, hw_hotplug, hw_hotplug_ctrl, hw_zip, hw_pppoe, 00127 hw_wlan, /* append new entries here */ 00128 hw_unknown, hw_all /* hw_all must be last */ 00129 } hd_hw_item_t; 00130 00131 /* 00132 * device base classes and bus types 00133 * 00134 */ 00135 00136 /* base class values (superset of PCI classes) */ 00137 typedef enum base_classes { 00138 /* these *must* match standard PCI class numbers */ 00139 bc_none, bc_storage, bc_network, bc_display, bc_multimedia, 00140 bc_memory, bc_bridge, bc_comm, bc_system, bc_input, bc_docking, 00141 bc_processor, bc_serial, bc_wireless, bc_i2o, bc_other = 0xff, 00142 00143 // add our own classes here (starting at 0x100 as PCI values are 8 bit) 00144 bc_monitor = 0x100, bc_internal, bc_modem, bc_isdn, bc_ps2, bc_mouse, 00145 bc_storage_device, bc_network_interface, bc_keyboard, bc_printer, 00146 bc_hub, bc_braille, bc_scanner, bc_joystick, bc_chipcard, bc_camera, 00147 bc_framebuffer, bc_dvb, bc_tv, bc_partition 00148 } hd_base_classes_t; 00149 00150 /* subclass values of bc_monitor */ 00151 typedef enum sc_monitor { 00152 sc_mon_other, sc_mon_crt, sc_mon_lcd 00153 } hd_sc_monitor_t; 00154 00155 /* subclass values of bc_storage */ 00156 typedef enum sc_storage { 00157 sc_sto_scsi, sc_sto_ide, sc_sto_floppy, sc_sto_ipi, sc_sto_raid, 00158 sc_sto_other = 0x80 00159 } hd_sc_storage_t; 00160 00161 /* subclass values of bc_display */ 00162 typedef enum sc_display { 00163 sc_dis_vga, sc_dis_xga, sc_dis_other = 0x80 00164 } hd_sc_display_t; 00165 00166 /* subclass values of bc_framebuffer */ 00167 typedef enum sc_framebuffer { 00168 sc_fb_vesa = 1 00169 } hd_sc_framebuffer_t; 00170 00171 /* subclass values of bc_bridge */ 00172 typedef enum sc_bridge { 00173 sc_bridge_host, sc_bridge_isa, sc_bridge_eisa, sc_bridge_mc, 00174 sc_bridge_pci, sc_bridge_pcmcia, sc_bridge_nubus, sc_bridge_cardbus, 00175 sc_bridge_other = 0x80 00176 } hd_sc_bridge_t; 00177 00178 /* subclass values of bc_comm */ 00179 typedef enum sc_comm { 00180 sc_com_ser, sc_com_par, sc_com_multi, sc_com_modem, sc_com_other = 0x80 00181 } hd_sc_comm_t; 00182 00183 /* subclass values of bc_system */ 00184 typedef enum sc_system { 00185 sc_sys_pic, sc_sys_dma, sc_sys_timer, sc_sys_rtc, sc_sys_other = 0x80 00186 } hd_sc_system_t; 00187 00188 /* subclass values of bc_input */ 00189 typedef enum sc_input { 00190 sc_inp_keyb, sc_inp_digit, sc_inp_mouse, sc_inp_other = 0x80 00191 } hd_sc_input_t; 00192 00193 /* subclass values of bc_serial */ 00194 typedef enum sc_serial { 00195 sc_ser_fire, sc_ser_access, sc_ser_ssa, sc_ser_usb, sc_ser_fiber, 00196 sc_ser_smbus, sc_ser_other = 0x80 00197 } hd_sc_serial_t; 00198 00199 /* internal sub class values (bc_internal) */ 00200 typedef enum sc_internal { 00201 sc_int_none, sc_int_isapnp_if, sc_int_main_mem, sc_int_cpu, sc_int_fpu, 00202 sc_int_bios, sc_int_prom, sc_int_sys 00203 } hd_sc_internal_t; 00204 00205 /* subclass values of bc_mouse */ 00206 typedef enum sc_mouse { 00207 sc_mou_ps2, sc_mou_ser, sc_mou_bus, sc_mou_usb, sc_mou_sun, 00208 sc_mou_other = 0x80 00209 } hd_sc_mouse_t; 00210 00211 /* subclass values of bc_storage_device */ 00212 typedef enum sc_std { 00213 sc_sdev_disk, sc_sdev_tape, sc_sdev_cdrom, sc_sdev_floppy, sc_sdev_scanner, 00214 sc_sdev_other = 0x80 00215 } hd_sc_std_t; 00216 00217 /* subclass values of bc_network_interface */ 00218 typedef enum sc_net_if { 00219 sc_nif_loopback, sc_nif_ethernet, sc_nif_tokenring, sc_nif_fddi, 00220 sc_nif_ctc, sc_nif_iucv, sc_nif_hsi, sc_nif_qeth, 00221 sc_nif_escon, sc_nif_myrinet, sc_nif_wlan, sc_nif_other = 0x80, sc_nif_sit 00222 } hd_sc_net_if_t; 00223 00224 /* subclass values of bc_multimedia */ 00225 typedef enum sc_multimedia { 00226 sc_multi_video, sc_multi_audio, sc_multi_other 00227 } hd_sc_multimedia_t; 00228 00229 /* subclass values of bc_keyboard */ 00230 typedef enum sc_keyboard { 00231 sc_keyboard_kbd, sc_keyboard_console 00232 } hd_sc_keyboard_t; 00233 00234 /* subclass values of bc_hub */ 00235 typedef enum sc_hub { 00236 sc_hub_other, sc_hub_usb 00237 } hd_sc_hub_t; 00238 00239 /* subclass values of bc_camera */ 00240 typedef enum sc_camera { 00241 sc_camera_webcam, sc_camera_digital 00242 } hd_sc_camera_t; 00243 00244 /* subclass values of bc_modem */ 00245 typedef enum sc_modem { 00246 sc_mod_at, sc_mod_win1, sc_mod_win2, sc_mod_win3 00247 } hd_sc_modem_t; 00248 00249 /* prog_if's of sc_ser_usb */ 00250 typedef enum pif_usb_e { 00251 pif_usb_uhci = 0, pif_usb_ohci = 0x10, pif_usb_ehci = 0x20, 00252 pif_usb_other = 0x80, pif_usb_device = 0xfe 00253 } hd_pif_usb_t; 00254 00255 /* CD-ROM prog_if values */ 00256 typedef enum pif_cdrom { 00257 pif_cdrom, pif_cdr, pif_cdrw, pif_dvd, pif_dvdr, pif_dvdram 00258 } hd_pif_cdrom_t ; 00259 00260 /* bus type values similar to PCI bridge subclasses */ 00261 typedef enum bus_types { 00262 bus_none, bus_isa, bus_eisa, bus_mc, bus_pci, bus_pcmcia, bus_nubus, 00263 bus_cardbus, bus_other, 00264 00265 /* outside the range of the PCI values */ 00266 bus_ps2 = 0x80, bus_serial, bus_parallel, bus_floppy, bus_scsi, bus_ide, bus_usb, 00267 bus_adb, bus_raid, bus_sbus, bus_i2o, bus_vio 00268 } hd_bus_types_t; 00269 00276 typedef struct { 00280 unsigned invalid:1; 00290 unsigned reconfig:3; 00291 00297 unsigned configured:3; 00298 00309 unsigned available:3; 00310 00318 unsigned needed:3; 00319 00326 unsigned available_orig:3; 00327 00331 unsigned active:3; 00332 } hd_status_t; 00333 00334 /* hardware config status values */ 00335 typedef enum { 00336 status_no = 1, status_yes, status_unknown, status_new 00337 } hd_status_value_t; 00338 00342 typedef enum { 00343 hp_none, 00344 hp_pcmcia, 00345 hp_cardbus, 00346 hp_pci, 00347 hp_usb, 00348 hp_ieee1394 00349 } hd_hotplug_t; 00350 00351 00356 typedef struct { 00357 unsigned id; 00358 char *name; 00359 } hd_id_t; 00360 00365 typedef struct s_str_list_t { 00366 struct s_str_list_t *next; 00367 char *str; 00368 } str_list_t; 00369 00370 00371 /* 00372 * for memory areas 00373 */ 00374 typedef struct { 00375 unsigned start, size; /* base address & size */ 00376 unsigned char *data; /* actual data */ 00377 } memory_range_t; 00378 00379 00380 /* 00381 * smp info according to Intel smp spec (ia32) 00382 */ 00383 typedef struct { 00384 unsigned ok:1; /* data are valid */ 00385 unsigned rev; /* MP spec revision */ 00386 unsigned mpfp; /* MP Floating Pointer struct */ 00387 unsigned mpconfig_ok:1; /* MP config table valid */ 00388 unsigned mpconfig; /* MP config table */ 00389 unsigned mpconfig_size; /* dto, size */ 00390 unsigned char feature[5]; /* MP feature info */ 00391 char oem_id[9]; /* oem id */ 00392 char prod_id[13]; /* product id */ 00393 unsigned cpus, cpus_en; /* number of cpus & ennabled cpus */ 00394 } smp_info_t; 00395 00396 00397 /* 00398 * vesa bios extensions info 00399 */ 00400 typedef struct vbe_mode_info_s { 00401 unsigned number; /* mode number */ 00402 unsigned attributes; /* mode attributes */ 00403 unsigned width, height; /* mode size */ 00404 unsigned bytes_p_line; /* line length */ 00405 unsigned pixel_size; /* bits per pixel */ 00406 unsigned fb_start; /* frame buffer start address (if any) */ 00407 unsigned win_A_start; /* window A start address */ 00408 unsigned win_A_attr; /* window A attributes */ 00409 unsigned win_B_start; /* window B start address */ 00410 unsigned win_B_attr; /* window B attributes */ 00411 unsigned win_size; /* window size in bytes */ 00412 unsigned win_gran; /* window granularity in bytes */ 00413 unsigned pixel_clock; /* maximum pixel clock */ 00414 } vbe_mode_info_t; 00415 00416 00417 typedef struct { 00418 unsigned ok:1; /* data are valid */ 00419 unsigned version; /* vbe version */ 00420 unsigned oem_version; /* oem version info */ 00421 unsigned memory; /* in bytes */ 00422 unsigned fb_start; /* != 0 if framebuffer is supported */ 00423 char *oem_name; /* oem name */ 00424 char *vendor_name; /* vendor name */ 00425 char *product_name; /* product name */ 00426 char *product_revision; /* product revision */ 00427 unsigned modes; /* number of supported video modes */ 00428 vbe_mode_info_t *mode; /* video mode list */ 00429 unsigned current_mode; /* current video mode */ 00430 unsigned char ddc[0x80]; /* ddc monitor info */ 00431 } vbe_info_t; 00432 00433 00434 /* 00435 * Compaq Controller Order EV (CQHORD) definition 00436 */ 00437 typedef struct { 00438 unsigned id; 00439 unsigned char slot; 00440 unsigned char bus; 00441 unsigned char devfn; 00442 unsigned char misc; 00443 } cpq_ctlorder_t; 00444 00445 00446 typedef struct { 00447 unsigned ok:1; /* data are valid */ 00448 unsigned entry; /* entry point */ 00449 unsigned compaq:1; /* is compaq system */ 00450 cpq_ctlorder_t cpq_ctrl[32]; /* 32 == MAX_CONTROLLERS */ 00451 } bios32_info_t; 00452 00453 00454 /* 00455 * smbios entries 00456 */ 00457 typedef enum { 00458 sm_biosinfo, sm_sysinfo, sm_boardinfo, sm_chassis, 00459 sm_processor, sm_memctrl, sm_memmodule, sm_cache, 00460 sm_connect, sm_slot, sm_onboard, sm_oem, 00461 sm_config, sm_lang, sm_group, sm_eventlog, 00462 sm_memarray, sm_memdevice, sm_memerror, sm_memarraymap, 00463 sm_memdevicemap, sm_mouse, sm_battery, sm_reset, 00464 sm_secure, sm_power, sm_voltage, sm_cool, 00465 sm_temperature, sm_current, sm_outofband, sm_bis, 00466 sm_boot, sm_memerror64, sm_mandev, sm_mandevcomp, 00467 sm_mdtd, sm_inactive = 126, sm_end = 127 00468 } hd_smbios_type_t; 00469 00470 typedef struct { 00471 union u_hd_smbios_t *next; 00472 hd_smbios_type_t type; 00473 int data_len; 00474 unsigned char *data; 00475 str_list_t *strings; 00476 int handle; 00477 } smbios_any_t; 00478 00479 typedef struct { 00480 union u_hd_smbios_t *next; 00481 hd_smbios_type_t type; 00482 int data_len; 00483 unsigned char *data; 00484 str_list_t *strings; 00485 int handle; 00486 char *vendor; 00487 char *version; 00488 char *date; 00489 uint64_t features; 00490 unsigned xfeatures; 00491 } smbios_biosinfo_t; 00492 00493 typedef struct { 00494 union u_hd_smbios_t *next; 00495 hd_smbios_type_t type; 00496 int data_len; 00497 unsigned char *data; 00498 str_list_t *strings; 00499 int handle; 00500 char *manuf; 00501 char *product; 00502 char *version; 00503 char *serial; 00504 unsigned wake_up; 00505 } smbios_sysinfo_t; 00506 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 *manuf; 00515 char *product; 00516 char *version; 00517 char *serial; 00518 } smbios_boardinfo_t; 00519 00520 typedef struct { 00521 union u_hd_smbios_t *next; 00522 hd_smbios_type_t type; 00523 int data_len; 00524 unsigned char *data; 00525 str_list_t *strings; 00526 int handle; 00527 char *manuf; 00528 unsigned ch_type; 00529 } smbios_chassis_t; 00530 00531 typedef struct { 00532 union u_hd_smbios_t *next; 00533 hd_smbios_type_t type; 00534 int data_len; 00535 unsigned char *data; 00536 str_list_t *strings; 00537 int handle; 00538 char *socket; 00539 char *manuf; 00540 char *version; 00541 unsigned voltage; /* in 0.1 V */ 00542 unsigned ext_clock; /* MHz */ 00543 unsigned max_speed; /* MHz */ 00544 unsigned current_speed; /* MHz */ 00545 unsigned status; 00546 unsigned upgrade; 00547 } smbios_processor_t; 00548 00549 typedef struct { 00550 union u_hd_smbios_t *next; 00551 hd_smbios_type_t type; 00552 int data_len; 00553 unsigned char *data; 00554 str_list_t *strings; 00555 int handle; 00556 char *descr[8]; 00557 unsigned dtype[8]; 00558 } smbios_onboard_t; 00559 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 *current; 00568 } smbios_lang_t; 00569 00570 typedef struct { 00571 union u_hd_smbios_t *next; 00572 hd_smbios_type_t type; 00573 int data_len; 00574 unsigned char *data; 00575 str_list_t *strings; 00576 int handle; 00577 unsigned ecc; 00578 unsigned max_size; /* kB */ 00579 } smbios_memarray_t; 00580 00581 typedef struct { 00582 union u_hd_smbios_t *next; 00583 hd_smbios_type_t type; 00584 int data_len; 00585 unsigned char *data; 00586 str_list_t *strings; 00587 int handle; 00588 char *location; 00589 char *bank; 00590 unsigned width; 00591 unsigned eccbits; 00592 unsigned size; /* kB */ 00593 unsigned form; 00594 unsigned type1; 00595 unsigned type2; 00596 unsigned speed; 00597 } smbios_memdevice_t; 00598 00599 typedef struct { 00600 union u_hd_smbios_t *next; 00601 hd_smbios_type_t type; 00602 int data_len; 00603 unsigned char *data; 00604 str_list_t *strings; 00605 int handle; 00606 unsigned mtype; 00607 unsigned interface; 00608 unsigned buttons; 00609 } smbios_mouse_t; 00610 00611 typedef union u_hd_smbios_t { 00612 union u_hd_smbios_t *next; 00613 smbios_any_t any; 00614 smbios_biosinfo_t biosinfo; 00615 smbios_sysinfo_t sysinfo; 00616 smbios_boardinfo_t boardinfo; 00617 smbios_chassis_t chassis; 00618 smbios_processor_t processor; 00619 smbios_lang_t lang; 00620 smbios_memarray_t memarray; 00621 smbios_memdevice_t memdevice; 00622 smbios_mouse_t mouse; 00623 smbios_onboard_t onboard; 00624 } hd_smbios_t; 00625 00626 00627 /* 00628 * structure holding the (raw) PCI data 00629 */ 00630 typedef struct s_pci_t { 00631 struct s_pci_t *next; /* linked list */ 00632 unsigned data_len; /* the actual length of the data field */ 00633 unsigned data_ext_len; /* max. accessed config byte; see code */ 00634 unsigned char data[256]; /* the PCI data */ 00635 char *log; /* log messages */ 00636 unsigned flags, /* various info, see enum pci_flags */ 00637 cmd, /* PCI_COMMAND */ 00638 hdr_type, /* PCI_HEADER_TYPE */ 00639 secondary_bus; /* > 0 for PCI & CB bridges */ 00640 unsigned bus, /* PCI bus #, *nothing* to do with hw_t.bus */ 00641 slot, func; /* slot & function */ 00642 unsigned base_class, sub_class, prog_if; /* PCI device classes */ 00643 unsigned dev, vend, sub_dev, sub_vend, rev; /* vendor & device ids */ 00644 unsigned irq; /* used irq, if any */ 00645 uint64_t base_addr[6]; /* I/O or memory base */ 00646 uint64_t base_len[6]; /* I/O or memory ranges */ 00647 uint64_t rom_base_addr; /* memory base for card ROM */ 00648 uint64_t rom_base_len; /* memory range for card ROM */ 00649 } pci_t; 00650 00651 /* 00652 * pci related flags cf. (pci_t).flags 00653 */ 00654 typedef enum pci_flags { 00655 pci_flag_ok, pci_flag_pm, pci_flag_agp 00656 } hd_pci_flags_t; 00657 00658 00659 /* 00660 * raw USB data 00661 */ 00662 typedef struct usb_s { 00663 struct usb_s *next; 00664 unsigned hd_idx; 00665 unsigned hd_base_idx; 00666 /* see Linux USB docs */ 00667 str_list_t *c, *d, *e, *i, *p, *s, *t; 00668 struct usb_s *cloned; 00669 int bus, dev_nr, lev, parent, port, count, conns, used_conns, ifdescr; 00670 unsigned speed; 00671 unsigned vendor, device, rev; 00672 char *manufact, *product, *serial; 00673 char *driver; 00674 memory_range_t raw_descr; 00675 int d_cls, d_sub, d_prot; 00676 int i_alt, i_cls, i_sub, i_prot; 00677 unsigned country; 00678 } usb_t; 00679 00680 /* 00681 *structures to hold the (raw) ISA-PnP data 00682 */ 00683 typedef struct { 00684 int len; 00685 int type; 00686 unsigned char *data; 00687 } isapnp_res_t; 00688 00689 typedef struct { 00690 int csn; 00691 int log_devs; 00692 unsigned char *serial; 00693 unsigned char *card_regs; 00694 unsigned char (*ldev_regs)[0xd0]; 00695 int res_len; 00696 unsigned broken:1; /* mark a broken card */ 00697 isapnp_res_t *res; 00698 } isapnp_card_t; 00699 00700 typedef struct { 00701 int read_port; 00702 int cards; 00703 isapnp_card_t *card; 00704 } isapnp_t; 00705 00706 typedef struct { 00707 isapnp_card_t *card; 00708 int dev; 00709 unsigned flags; /* cf. enum isapnp_flags */ 00710 unsigned ref:1; /* internally used flag */ 00711 } isapnp_dev_t; 00712 00713 /* 00714 * ISA-PnP related flags; cf. (isapnp_dev_t).flags 00715 */ 00716 typedef enum isapnp_flags { 00717 isapnp_flag_act 00718 } hd_isapnp_flags_t; 00719 00720 00721 /* 00722 * raw SCSI data 00723 */ 00724 typedef struct scsi_s { 00725 struct scsi_s *next; 00726 unsigned deleted:1; 00727 unsigned generic:1; 00728 unsigned fake:1; 00729 char *dev_name; 00730 char *guessed_dev_name; 00731 int generic_dev; 00732 unsigned host, channel, id, lun; 00733 char *vendor, *model, *rev, *type_str, *serial; 00734 int type; 00735 unsigned inode_low; 00736 char *proc_dir, *driver; 00737 unsigned unique; 00738 char *info; 00739 unsigned lgeo_c, lgeo_h, lgeo_s; 00740 unsigned pgeo_c, pgeo_h, pgeo_s; 00741 uint64_t size; 00742 unsigned sec_size; 00743 unsigned cache; 00744 str_list_t *host_info; 00745 char *usb_guid; 00746 unsigned pci_info; 00747 unsigned pci_bus; 00748 unsigned pci_slot; 00749 unsigned pci_func; 00750 } scsi_t; 00751 00752 00753 /* 00754 * PROM tree on PPC 00755 */ 00756 typedef struct devtree_s { 00757 struct devtree_s *next; 00758 struct devtree_s *parent; 00759 unsigned idx; 00760 char *path, *filename; 00761 unsigned pci:1; 00762 char *name, *model, *device_type, *compatible; 00763 int class_code; /* class : sub_class : prog-if */ 00764 int vendor_id, device_id, subvendor_id, subdevice_id; 00765 int revision_id, interrupt; 00766 unsigned char *edid; /* 128 bytes */ 00767 } devtree_t; 00768 00769 00770 /* 00771 * special CDROM entry 00772 */ 00773 typedef struct cdrom_info_s { 00774 struct cdrom_info_s *next; 00775 char *name; 00776 unsigned speed; 00777 unsigned cdr:1, cdrw:1, dvd:1, dvdr:1, dvdram:1; 00778 unsigned cdrom:1; /* cdrom in drive */ 00779 struct { 00780 unsigned ok:1; 00781 char *volume, *publisher, *preparer, *application, *creation_date; 00782 } iso9660; 00783 struct { 00784 unsigned ok:1; 00785 unsigned platform; 00786 char *id_string; 00787 unsigned bootable:1; 00788 unsigned media_type; /* boot emulation type */ 00789 unsigned load_address; 00790 unsigned load_count; /* sectors to load */ 00791 unsigned start; /* start sector */ 00792 unsigned catalog; /* boot catalog start */ 00793 struct { 00794 unsigned c, h, s; 00795 unsigned size; 00796 } geo; 00797 char *label; 00798 } el_torito; 00799 00800 } cdrom_info_t; 00801 00802 // note: obsolete, will be removed 00803 typedef struct { 00804 unsigned char block0[512]; 00805 } floppy_info_t; 00806 00807 /* 00808 * bios data (ix86) 00809 */ 00810 typedef struct { 00811 unsigned apm_supported:1; 00812 unsigned apm_enabled:1; 00813 unsigned apm_ver, apm_subver; 00814 unsigned apm_bios_flags; 00815 00816 unsigned vbe_ver; 00817 unsigned vbe_video_mem; 00818 00819 unsigned ser_port0, ser_port1, ser_port2, ser_port3; 00820 unsigned par_port0, par_port1, par_port2; 00821 00822 /* The id is still in big endian format! */ 00823 unsigned is_pnp_bios:1; 00824 unsigned pnp_id; 00825 unsigned lba_support:1; 00826 00827 unsigned low_mem_size; 00828 smp_info_t smp; 00829 vbe_info_t vbe; 00830 00831 unsigned smbios_ver; 00832 00833 struct { 00834 unsigned width; 00835 unsigned height; 00836 char *vendor; 00837 char *name; 00838 } lcd; 00839 00840 struct { 00841 char *vendor; 00842 char *type; 00843 unsigned bus; 00844 unsigned compat_vend; 00845 unsigned compat_dev; 00846 } mouse; 00847 00848 struct { 00849 unsigned ok:1; 00850 unsigned scroll_lock:1; 00851 unsigned num_lock:1; 00852 unsigned caps_lock:1; 00853 } led; 00854 00855 bios32_info_t bios32; 00856 00857 } bios_info_t; 00858 00859 00860 /* 00861 * prom data (ppc, sparc) 00862 */ 00863 typedef struct { 00864 unsigned has_color:1; 00865 unsigned color; 00866 } prom_info_t; 00867 00868 00869 /* 00870 * general system data 00871 */ 00872 typedef struct { 00873 char *system_type; 00874 char *generation; 00875 char *vendor; 00876 char *model; 00877 char *serial; 00878 char *lang; 00879 } sys_info_t; 00880 00881 00882 /* 00883 * monitor (DDC) data 00884 */ 00885 typedef struct { 00886 unsigned manu_year; 00887 unsigned min_vsync, max_vsync; /* vsync range */ 00888 unsigned min_hsync, max_hsync; /* hsync range */ 00889 char *vendor; 00890 char *name; 00891 char *serial; 00892 } monitor_info_t; 00893 00894 00895 typedef enum cpu_arch { 00896 arch_unknown = 0, 00897 arch_intel, 00898 arch_alpha, 00899 arch_sparc, arch_sparc64, 00900 arch_ppc, arch_ppc64, 00901 arch_68k, 00902 arch_ia64, 00903 arch_s390, arch_s390x, 00904 arch_arm, 00905 arch_mips, 00906 arch_x86_64 00907 } hd_cpu_arch_t; 00908 00909 // ###### drop boot_arch at all? 00910 typedef enum boot_arch { 00911 boot_unknown = 0, 00912 boot_lilo, boot_milo, boot_aboot, boot_silo, boot_ppc, boot_elilo, boot_s390, 00913 boot_mips, boot_grub 00914 } hd_boot_arch_t; 00915 00916 /* special cpu entry */ 00917 typedef struct { 00918 enum cpu_arch architecture; 00919 unsigned family; /* axp: cpu variation */ 00920 unsigned model; /* axp: cpu revision */ 00921 unsigned stepping; 00922 unsigned cache; 00923 unsigned clock; 00924 unsigned units; /* >1 "hyperthreading" */ 00925 char *vend_name; /* axp: system type */ 00926 char *model_name; /* axp: cpu model */ 00927 char *platform; /* x86: NULL */ 00928 str_list_t *features; /* x86: flags */ 00929 } cpu_info_t; 00930 00931 00932 /* 00933 * database info 00934 */ 00935 typedef struct { 00936 unsigned data_len, data_max; 00937 unsigned *data; 00938 unsigned names_len, names_max; 00939 char *names; 00940 } hddb_data_t; 00941 00942 typedef uint32_t hddb_entry_mask_t; 00943 00944 typedef struct hddb_list_s { 00945 hddb_entry_mask_t key_mask; 00946 hddb_entry_mask_t value_mask; 00947 unsigned key; 00948 unsigned value; 00949 } hddb_list_t; 00950 00951 typedef struct { 00952 unsigned list_len, list_max; 00953 hddb_list_t *list; 00954 unsigned ids_len, ids_max; 00955 unsigned *ids; 00956 unsigned strings_len, strings_max; 00957 char *strings; 00958 } hddb2_data_t; 00959 00960 /* 00961 * pci module info 00962 */ 00963 typedef struct { 00964 char *module; 00965 unsigned vendor; 00966 unsigned device; 00967 unsigned subvendor; 00968 unsigned subdevice; 00969 unsigned pciclass; 00970 unsigned classmask; 00971 } hddb_pci_t; 00972 00973 00974 /* 00975 * resource types 00976 */ 00977 typedef enum resource_types { 00978 res_any, res_phys_mem, res_mem, res_io, res_irq, res_dma, res_monitor, 00979 res_size, res_disk_geo, res_cache, res_baud, res_init_strings, res_pppd_option, 00980 res_framebuffer 00981 } hd_resource_types_t; 00982 00983 00984 /* 00985 * size units (cf. (res_size_t).unit) 00986 */ 00987 typedef enum size_units { 00988 size_unit_cm, size_unit_cinch, size_unit_byte, size_unit_sectors, 00989 size_unit_kbyte, size_unit_mbyte, size_unit_gbyte 00990 } hd_size_units_t; 00991 00992 /* 00993 * access types for I/O and memory resources 00994 */ 00995 typedef enum access_flags { 00996 acc_unknown, acc_ro, acc_wo, acc_rw /* unknown, read only, write only, read/write */ 00997 } hd_access_flags_t; 00998 00999 typedef enum yes_no_flag { 01000 flag_unknown, flag_no, flag_yes /* unknown, no, yes */ 01001 } hd_yes_no_flag_t; 01002 01003 01004 /* 01005 * definitions for the various resource types 01006 */ 01007 typedef struct { 01008 union u_hd_res_t *next; 01009 enum resource_types type; 01010 } res_any_t; 01011 01012 typedef struct { 01013 union u_hd_res_t *next; 01014 enum resource_types type; 01015 uint64_t base, range; 01016 unsigned 01017 enabled:1, /* 0: disabled, 1 enabled */ 01018 access:2, /* enum access_flags */ 01019 prefetch:2; /* enum yes_no_flag */ 01020 } res_mem_t; 01021 01022 typedef struct { 01023 union u_hd_res_t *next; 01024 enum resource_types type; 01025 uint64_t range; 01026 } res_phys_mem_t; 01027 01028 typedef struct { 01029 union u_hd_res_t *next; 01030 enum resource_types type; 01031 uint64_t base, range; 01032 unsigned 01033 enabled:1, /* 0: disabled, 1 enabled */ 01034 access:2; /* enum access_flags */ 01035 } res_io_t; 01036 01037 typedef struct { 01038 union u_hd_res_t *next; 01039 enum resource_types type; 01040 unsigned base; 01041 unsigned triggered; /* # of interrupts */ 01042 unsigned enabled:1; /* 0: disabled, 1 enabled */ 01043 } res_irq_t; 01044 01045 typedef struct { 01046 union u_hd_res_t *next; 01047 enum resource_types type; 01048 unsigned base; 01049 unsigned enabled:1; /* 0: disabled, 1 enabled */ 01050 } res_dma_t; 01051 01052 typedef struct { 01053 union u_hd_res_t *next; 01054 enum resource_types type; 01055 enum size_units unit; 01056 uint64_t val1, val2; /* to allow for 2D values */ 01057 } res_size_t; 01058 01059 typedef struct { 01060 union u_hd_res_t *next; 01061 enum resource_types type; 01062 unsigned speed; 01063 unsigned bits, stopbits; 01064 char parity; /* n, e, o, s, m */ 01065 char handshake; /* -, h, s */ 01066 } res_baud_t; 01067 01068 typedef struct { 01069 union u_hd_res_t *next; 01070 enum resource_types type; 01071 unsigned size; /* in kbyte */ 01072 } res_cache_t; 01073 01074 typedef struct { 01075 union u_hd_res_t *next; 01076 enum resource_types type; 01077 unsigned cyls, heads, sectors; 01078 unsigned logical:1; /* logical/physical geometry */ 01079 } res_disk_geo_t; 01080 01081 typedef struct { 01082 union u_hd_res_t *next; 01083 enum resource_types type; 01084 unsigned width, height; /* in pixel */ 01085 unsigned vfreq; /* in Hz */ 01086 unsigned interlaced:1; /* 0/1 */ 01087 } res_monitor_t; 01088 01089 typedef struct { 01090 union u_hd_res_t *next; 01091 enum resource_types type; 01092 char *init1; 01093 char *init2; 01094 } res_init_strings_t; 01095 01096 typedef struct { 01097 union u_hd_res_t *next; 01098 enum resource_types type; 01099 char *option; 01100 } res_pppd_option_t; 01101 01102 typedef struct { 01103 union u_hd_res_t *next; 01104 enum resource_types type; 01105 unsigned width, height; /* in pixel */ 01106 unsigned bytes_p_line; /* line length in bytes (do not confuse with 'width') */ 01107 unsigned colorbits; /* 4, 8, 15, 16, 24, 32 */ 01108 unsigned mode; /* mode number for kernel */ 01109 } res_framebuffer_t; 01110 01111 typedef union u_hd_res_t { 01112 union u_hd_res_t *next; 01113 res_any_t any; 01114 res_io_t io; 01115 res_mem_t mem; 01116 res_phys_mem_t phys_mem; 01117 res_irq_t irq; 01118 res_dma_t dma; 01119 res_size_t size; 01120 res_cache_t cache; 01121 res_baud_t baud; 01122 res_disk_geo_t disk_geo; 01123 res_monitor_t monitor; 01124 res_init_strings_t init_strings; 01125 res_pppd_option_t pppd_option; 01126 res_framebuffer_t framebuffer; 01127 } hd_res_t; 01128 01129 01130 /* 01131 * data gathered by the misc module; basically resources from /proc 01132 */ 01133 typedef struct { 01134 uint64_t addr, size; 01135 char *dev; 01136 unsigned tag; 01137 } misc_io_t; 01138 01139 typedef struct { 01140 unsigned channel; 01141 char *dev; 01142 unsigned tag; 01143 } misc_dma_t; 01144 01145 typedef struct { 01146 unsigned irq, events; 01147 int devs; 01148 char **dev; 01149 unsigned tag; 01150 } misc_irq_t; 01151 01152 typedef struct { 01153 unsigned io_len, dma_len, irq_len; 01154 misc_io_t *io; 01155 misc_dma_t *dma; 01156 misc_irq_t *irq; 01157 str_list_t *proc_io, *proc_dma, *proc_irq; 01158 } misc_t; 01159 01160 typedef struct s_serial_t { 01161 struct s_serial_t *next; 01162 char *name; 01163 char *device; 01164 unsigned line, port, irq, baud; 01165 } serial_t; 01166 01167 typedef struct s_ser_device_t { 01168 struct s_ser_device_t *next; 01169 unsigned hd_idx; 01170 char *dev_name; 01171 str_list_t *at_resp; 01172 int fd; 01173 struct termios tio; 01174 unsigned max_baud, cur_baud; 01175 unsigned is_mouse:1; 01176 unsigned is_modem:1; 01177 unsigned do_io:1; 01178 unsigned char buf[0x1000]; 01179 int buf_len; 01180 int garbage, non_pnp, pnp; 01181 unsigned char pnp_id[8]; 01182 char *serial, *class_name, *dev_id, *user_name, *vend, *init_string1, *init_string2, *pppd_option; 01183 unsigned pnp_rev; 01184 unsigned bits; 01185 } ser_device_t; 01186 01187 /* 01188 * Notes on isdn_parm_t: 01189 * - def_value is only relevant of alt_values != 0 01190 * - def_value should be a value out of alt_value[] 01191 * - see libihw docu for the meaning of name,type,flags,def_value 01192 */ 01193 typedef struct isdn_parm_s { 01194 struct isdn_parm_s *next; 01195 char *name; /* parameter name */ 01196 unsigned valid:1; /* 1: entry is valid, 0: some inconsistencies */ 01197 unsigned conflict:1; /* 1: ressource conflict (eg. no free irq) */ 01198 uint64_t value; /* value of the parameter */ 01199 unsigned type; /* CDBISDN type (P_...) */ 01200 unsigned flags; /* CDBISDN flags (P_...) */ 01201 unsigned def_value; /* default value */ 01202 int alt_values; /* length of alt_value[] */ 01203 unsigned *alt_value; /* possible values */ 01204 } isdn_parm_t; 01205 01206 /* device driver info types */ 01207 typedef enum driver_info_type { 01208 di_any, di_display, di_module, di_mouse, di_x11, di_isdn, di_kbd 01209 } hd_driver_info_t; 01210 01211 /* unspecific info */ 01212 typedef struct { 01213 union driver_info_u *next; 01214 enum driver_info_type type; /* driver info type */ 01215 str_list_t *hddb0, *hddb1; /* the actual driver database entries */ 01216 } driver_info_any_t; 01217 01218 /* display (monitor) info */ 01219 typedef struct { 01220 union driver_info_u *next; 01221 enum driver_info_type type; /* driver info type */ 01222 str_list_t *hddb0, *hddb1; /* the actual driver database entries */ 01223 unsigned width, height; /* max. useful display geometry */ 01224 unsigned min_vsync, max_vsync; /* vsync range */ 01225 unsigned min_hsync, max_hsync; /* hsync range */ 01226 unsigned bandwidth; /* max. pixel clock */ 01227 } driver_info_display_t; 01228 01229 /* module info */ 01230 typedef struct { 01231 union driver_info_u *next; 01232 enum driver_info_type type; /* driver info type */ 01233 str_list_t *hddb0, *hddb1; /* the actual driver database entries */ 01234 unsigned active:1; /* if module is currently active */ 01235 unsigned modprobe:1; /* modprobe or insmod */ 01236 str_list_t *names; /* (ordered) list of module names */ 01237 str_list_t *mod_args; /* list of module args (corresponds to the module name list) */ 01238 char *conf; /* conf.modules entry, if any (e.g. for sb.o) */ 01239 } driver_info_module_t; 01240 01241 /* mouse protocol info */ 01242 typedef struct { 01243 union driver_info_u *next; 01244 enum driver_info_type type; /* driver info type */ 01245 str_list_t *hddb0, *hddb1; /* the actual driver database entries */ 01246 char *xf86; /* the XF86 protocol name */ 01247 char *gpm; /* dto, gpm */ 01248 int buttons; /* number of buttons, -1 --> unknown */ 01249 int wheels; /* dto, wheels */ 01250 } driver_info_mouse_t; 01251 01252 /* X11 server info */ 01253 typedef struct { 01254 union driver_info_u *next; 01255 enum driver_info_type type; /* driver info type */ 01256 str_list_t *hddb0, *hddb1; /* the actual driver database entries */ 01257 char *server; /* the server/module name */ 01258 char *xf86_ver; /* XFree86 version (3 or 4) */ 01259 unsigned x3d:1; /* has 3D support */ 01260 struct { 01261 unsigned all:5; /* the next 5 entries combined */ 01262 unsigned c8:1, c15:1, c16:1, c24:1, c32:1; 01263 } colors; /* supported color depths */ 01264 unsigned dacspeed; /* max. ramdac clock */ 01265 str_list_t *extensions; /* additional X extensions to load ('Module' section) */ 01266 str_list_t *options; /* special server options */ 01267 str_list_t *raw; /* extra info to add to XF86Config */ 01268 char *script; /* 3d script to run */ 01269 } driver_info_x11_t; 01270 01271 /* isdn info */ 01272 typedef struct { 01273 union driver_info_u *next; 01274 enum driver_info_type type; /* driver info type */ 01275 str_list_t *hddb0, *hddb1; /* the actual driver database entries */ 01276 int i4l_type, i4l_subtype; /* I4L types */ 01277 char *i4l_name; /* I4L card name */ 01278 isdn_parm_t *params; /* isdn parameters */ 01279 } driver_info_isdn_t; 01280 01281 /* keyboard info */ 01282 typedef struct { 01283 union driver_info_u *next; 01284 enum driver_info_type type; /* driver info type */ 01285 str_list_t *hddb0, *hddb1; /* the actual driver database entries */ 01286 char *XkbRules; /* XF86Config entries */ 01287 char *XkbModel; 01288 char *XkbLayout; 01289 char *keymap; /* console keymap */ 01290 } driver_info_kbd_t; 01291 01292 /* 01293 * holds device driver info 01294 */ 01295 typedef union driver_info_u { 01296 union driver_info_u *next; 01297 driver_info_any_t any; 01298 driver_info_module_t module; 01299 driver_info_mouse_t mouse; 01300 driver_info_x11_t x11; 01301 driver_info_display_t display; 01302 driver_info_isdn_t isdn; 01303 driver_info_kbd_t kbd; 01304 } driver_info_t; 01305 01306 01307 /* 01308 * Some hardware doesn't fit into the hd_t scheme or there is info we 01309 * gathered during the scan process but that no-one really cares about. Such 01310 * stuff is stored in hd_detail_t. 01311 */ 01312 typedef enum hd_detail_type { 01313 hd_detail_pci, hd_detail_usb, hd_detail_isapnp, hd_detail_cdrom, 01314 hd_detail_floppy, hd_detail_bios, hd_detail_cpu, hd_detail_prom, 01315 hd_detail_monitor, hd_detail_sys, hd_detail_scsi, hd_detail_devtree 01316 } hd_detail_type_t; 01317 01318 typedef struct { 01319 enum hd_detail_type type; 01320 pci_t *data; 01321 } hd_detail_pci_t; 01322 01323 typedef struct { 01324 enum hd_detail_type type; 01325 usb_t *data; 01326 } hd_detail_usb_t; 01327 01328 typedef struct { 01329 enum hd_detail_type type; 01330 isapnp_dev_t *data; 01331 } hd_detail_isapnp_t; 01332 01333 typedef struct { 01334 enum hd_detail_type type; 01335 cdrom_info_t *data; 01336 } hd_detail_cdrom_t; 01337 01338 typedef struct { 01339 enum hd_detail_type type; 01340 floppy_info_t *data; 01341 } hd_detail_floppy_t; 01342 01343 typedef struct { 01344 enum hd_detail_type type; 01345 bios_info_t *data; 01346 } hd_detail_bios_t; 01347 01348 typedef struct { 01349 enum hd_detail_type type; 01350 cpu_info_t *data; 01351 } hd_detail_cpu_t; 01352 01353 typedef struct { 01354 enum hd_detail_type type; 01355 prom_info_t *data; 01356 } hd_detail_prom_t; 01357 01358 typedef struct { 01359 enum hd_detail_type type; 01360 monitor_info_t *data; 01361 } hd_detail_monitor_t; 01362 01363 typedef struct { 01364 enum hd_detail_type type; 01365 sys_info_t *data; 01366 } hd_detail_sys_t; 01367 01368 typedef struct { 01369 enum hd_detail_type type; 01370 scsi_t *data; 01371 } hd_detail_scsi_t; 01372 01373 typedef struct { 01374 enum hd_detail_type type; 01375 devtree_t *data; 01376 } hd_detail_devtree_t; 01377 01378 typedef union { 01379 enum hd_detail_type type; 01380 hd_detail_pci_t pci; 01381 hd_detail_usb_t usb; 01382 hd_detail_isapnp_t isapnp; 01383 hd_detail_cdrom_t cdrom; 01384 hd_detail_floppy_t floppy; 01385 hd_detail_bios_t bios; 01386 hd_detail_cpu_t cpu; 01387 hd_detail_prom_t prom; 01388 hd_detail_monitor_t monitor; 01389 hd_detail_sys_t sys; 01390 hd_detail_scsi_t scsi; 01391 hd_detail_devtree_t devtree; 01392 } hd_detail_t; 01393 01394 01395 /* info about manually configured hardware (in /var/lib/hardware/) */ 01396 typedef struct hd_manual_s { 01397 struct hd_manual_s *next; 01398 01399 char *unique_id; 01400 char *parent_id; 01401 char *child_ids; 01402 unsigned hw_class; 01403 char *model; 01404 01405 hd_status_t status; 01406 char *config_string; 01407 01408 /* More or less free-form key, value pairs. 01409 * key should not contain '=', however. 01410 */ 01411 str_list_t *key; 01412 str_list_t *value; 01413 } hd_manual_t; 01414 01415 01421 typedef struct s_hd_t { 01422 struct s_hd_t *next; 01428 unsigned idx; 01429 01435 unsigned broken:1; 01436 01440 hd_id_t bus; 01441 01446 unsigned slot; 01447 01451 unsigned func; 01452 01456 hd_id_t base_class; 01457 01461 hd_id_t sub_class; 01462 01466 hd_id_t prog_if; 01467 01474 hd_id_t vendor; 01475 01484 hd_id_t device; 01485 01492 hd_id_t sub_vendor; 01493 01500 hd_id_t sub_device; 01501 01507 hd_id_t revision; 01508 01512 char *serial; 01513 01518 hd_id_t compat_vendor; 01519 01524 hd_id_t compat_device; 01525 01530 hd_hw_item_t hw_class; 01531 01536 unsigned char hw_class_list[(hw_all + 7) / 8]; 01544 char *model; 01545 01551 unsigned attached_to; 01552 01558 char *unix_dev_name; 01559 01566 char *unix_dev_name2; 01567 01574 char *rom_id; 01575 01586 char *unique_id; 01587 01591 unsigned module; 01592 01596 unsigned line; 01597 01601 unsigned count; 01602 01606 hd_res_t *res; 01607 01612 hd_detail_t *detail; 01613 01619 str_list_t *extra_info; 01620 01626 hd_status_t status; 01627 01634 char *config_string; 01635 01640 hd_hotplug_t hotplug; 01641 01646 unsigned hotplug_slot; 01647 01648 struct is_s { 01649 unsigned agp:1; /* AGP device */ 01650 unsigned isapnp:1; /* ISA-PnP device */ 01651 unsigned notready:1; /* block devices: no medium, other: device not configured */ 01652 unsigned manual:1; /* undetectable, manually configured hardware */ 01653 unsigned softraiddisk:1; /* disk belongs to some soft raid array */ 01654 unsigned zip:1; /* zip floppy */ 01655 unsigned cdr:1; /* CD-R */ 01656 unsigned cdrw:1; /* CD-RW */ 01657 unsigned dvd:1; /* DVD */ 01658 unsigned dvdr:1; /* DVD-R */ 01659 unsigned dvdram:1; /* DVD-RAM */ 01660 unsigned pppoe:1; /* PPPOE modem connected */ 01661 unsigned wlan:1; /* WLAN card */ 01662 } is; 01663 01664 struct tag_s { /* this struct is for internal purposes only */ 01665 unsigned remove:1; /* schedule for removal */ 01666 unsigned freeit:1; /* for internal memory management */ 01667 unsigned fixed:1; /* fixed, do no longer modify this entry */ 01668 unsigned ser_skip:1; /* if serial line, don't scan for devices */ 01669 unsigned ser_device:2; /* if != 0: info about attached serial device; see serial.c */ 01670 } tag; 01671 01677 unsigned char *block0; 01678 01682 char *driver; 01683 01691 char *old_unique_id; 01692 01698 char *parent_id; 01699 01705 str_list_t *child_ids; 01706 01711 char *unique_id1; 01712 01719 char *usb_guid; 01720 01721 driver_info_t *driver_info; /* device driver info */ 01722 01723 str_list_t *requires; /* packages/programs required for this hardware */ 01724 01725 /* 01726 * These are used internally for memory management. 01727 * Do not even _think_ of modifying these! 01728 */ 01729 unsigned ref_cnt; 01730 struct s_hd_t *ref; 01731 } hd_t; 01732 01733 01737 typedef struct { 01743 hd_t *hd; 01744 01753 void (*progress)(char *pos, char *msg); 01754 01758 char *log; 01759 01765 unsigned debug; 01766 01772 struct flag_struct { 01773 unsigned internal:1; 01774 unsigned dformat:2; 01775 unsigned no_parport:1; 01776 unsigned iseries:1; 01777 unsigned list_all:1; 01778 unsigned fast:1; 01779 unsigned list_md:1; 01780 unsigned nofork:1; 01781 unsigned forked:1; 01782 } flags; 01783 01784 01785 /* 01786 * The following entries should *not* be accessed outside of libhd! 01787 */ 01788 01789 unsigned char probe[(pr_all + 7) / 8]; 01790 unsigned char probe_set[(pr_all + 7) / 8]; 01791 unsigned char probe_clr[(pr_all + 7) / 8]; 01792 unsigned last_idx; 01793 unsigned module; 01794 enum boot_arch boot; 01795 hd_t *old_hd; 01796 pci_t *pci; 01797 isapnp_t *isapnp; 01798 cdrom_info_t *cdrom; 01799 str_list_t *net; 01800 str_list_t *floppy; 01801 misc_t *misc; 01802 serial_t *serial; 01803 scsi_t *scsi; 01804 ser_device_t *ser_mouse; 01805 ser_device_t *ser_modem; 01806 str_list_t *cpu; 01807 str_list_t *klog; 01808 str_list_t *proc_usb; 01809 usb_t *usb; 01810 hddb_pci_t *hddb_pci; 01811 hddb2_data_t *hddb2[2]; 01812 str_list_t *kmods; 01813 uint64_t used_irqs; 01814 uint64_t assigned_irqs; 01815 memory_range_t bios_rom; 01816 memory_range_t bios_ram; 01817 memory_range_t bios_ebda; 01818 unsigned display; 01819 unsigned color_code; 01820 char *cmd_line; 01821 str_list_t *xtra_hd; 01822 devtree_t *devtree; 01823 unsigned kernel_version; 01824 int in_vmware; 01825 hd_manual_t *manual; 01826 str_list_t *disks; 01827 str_list_t *partitions; 01828 hd_smbios_t *smbios; 01829 struct { 01830 unsigned ok:1; 01831 unsigned size; 01832 unsigned used; 01833 void *data; 01834 int id; 01835 int updated; 01836 } shm; 01837 } hd_data_t; 01838 01839 01840 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 01841 * 01842 * libhd interface functions 01843 * 01844 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 01845 */ 01846 01847 /* implemented in hd.c */ 01848 01849 /* the actual hardware scan */ 01850 void hd_scan(hd_data_t *hd_data); 01851 01853 hd_data_t *hd_free_hd_data(hd_data_t *hd_data); 01854 01856 hd_t *hd_free_hd_list(hd_t *hd); 01857 01858 void hd_set_probe_feature(hd_data_t *hd_data, enum probe_feature feature); 01859 void hd_clear_probe_feature(hd_data_t *hd_data, enum probe_feature feature); 01860 int hd_probe_feature(hd_data_t *hd_data, enum probe_feature feature); 01861 void hd_set_probe_feature_hw(hd_data_t *hd_data, hd_hw_item_t item); 01862 01863 enum probe_feature hd_probe_feature_by_name(char *name); 01864 char *hd_probe_feature_by_value(enum probe_feature feature); 01865 01866 int hd_module_is_active(hd_data_t *hd_data, char *mod); 01867 01868 hd_t *hd_base_class_list(hd_data_t *hd_data, unsigned base_class); 01869 hd_t *hd_sub_class_list(hd_data_t *hd_data, unsigned base_class, unsigned sub_class); 01870 hd_t *hd_bus_list(hd_data_t *hd_data, unsigned bus); 01871 hd_t *hd_list(hd_data_t *hd_data, hd_hw_item_t item, int rescan, hd_t *hd_old); 01872 hd_t *hd_list_with_status(hd_data_t *hd_data, hd_hw_item_t item, hd_status_t status); 01873 hd_t *hd_list2(hd_data_t *hd_data, hd_hw_item_t *items, int rescan); 01874 hd_t *hd_list_with_status2(hd_data_t *hd_data, hd_hw_item_t *items, hd_status_t status); 01875 01876 int hd_has_special_eide(hd_data_t *hd_data); 01877 int hd_has_pcmcia(hd_data_t *hd_data); 01878 int hd_apm_enabled(hd_data_t *hd_data); 01879 int hd_usb_support(hd_data_t *hd_data); 01880 int hd_smp_support(hd_data_t *hd_data); 01881 int hd_mac_color(hd_data_t *hd_data); 01882 int hd_color(hd_data_t *hd_data); 01883 unsigned hd_display_adapter(hd_data_t *hd_data); 01884 unsigned hd_boot_disk(hd_data_t *hd_data, int *matches); 01885 enum cpu_arch hd_cpu_arch(hd_data_t *hd_data); 01886 enum boot_arch hd_boot_arch(hd_data_t *hd_data); 01887 01888 hd_t *hd_get_device_by_idx(hd_data_t *hd_data, unsigned idx); 01889 01890 void hd_set_hw_class(hd_t *hd, hd_hw_item_t hw_class); 01891 int hd_is_hw_class(hd_t *hd, hd_hw_item_t hw_class); 01892 01893 /* implemented in hddb.c */ 01894 01895 str_list_t *get_hddb_packages(hd_data_t *hd_data); 01896 01897 void hddb_dump_raw(hddb2_data_t *hddb, FILE *f); 01898 void hddb_dump(hddb2_data_t *hddb, FILE *f); 01899 01900 /* implemented in hdp.c */ 01901 01902 void hd_dump_entry(hd_data_t *hd_data, hd_t *hd, FILE *f); 01903 01904 01905 /* implemented in cdrom.c */ 01906 01907 cdrom_info_t *hd_read_cdrom_info(hd_data_t *hd_data, hd_t *hd); 01908 01909 /* implemented in manual.c */ 01910 hd_manual_t *hd_manual_read_entry(hd_data_t *hd_data, const char *id); 01911 int hd_manual_write_entry(hd_data_t *hd_data, hd_manual_t *entry); 01912 hd_manual_t *hd_free_manual(hd_manual_t *manual); 01913 hd_t *hd_read_config(hd_data_t *hd_data, const char *id); 01914 int hd_write_config(hd_data_t *hd_data, hd_t *hd); 01915 char *hd_hw_item_name(hd_hw_item_t item); 01916 char *hd_status_value_name(hd_status_value_t status); 01917 int hd_change_status(const char *id, hd_status_t status, const char *config_string); 01918 01919 01920 /* 01921 * - - - - - CDB ISDN interface - - - - - 01922 */ 01923 01924 01925 /* (C) 2003 kkeil@suse.de */ 01926 01927 #define CDBISDN_VERSION 0x0100 01928 01929 #ifndef PCI_ANY_ID 01930 #define PCI_ANY_ID 0xffff 01931 #endif 01932 01933 #define CDBISDN_P_NONE 0x0 01934 #define CDBISDN_P_IRQ 0x1 01935 #define CDBISDN_P_MEM 0x2 01936 #define CDBISDN_P_IO 0x3 01937 01938 /* vendor info */ 01939 typedef struct { 01940 char *name; 01941 char *shortname; 01942 int vnr; 01943 int refcnt; 01944 } cdb_isdn_vendor; 01945 01946 typedef struct { 01947 int handle; /* internal identifier idx in database */ 01948 int vhandle; /* internal identifier to vendor database */ 01949 const char *name; /* cardname */ 01950 const char *lname; /* vendor short name + cardname */ 01951 const char *Class; /* CLASS of the card */ 01952 const char *bus; /* bus type */ 01953 int revision; /* revision used with USB */ 01954 int vendor; /* Vendor ID for ISAPNP and PCI cards */ 01955 int device; /* Device ID for ISAPNP and PCI cards */ 01956 int subvendor; /* Subvendor ID for PCI cards */ 01957 /* A value of 0xffff is ANY_ID */ 01958 int subdevice; /* Subdevice ID for PCI cards */ 01959 /* A value of 0xffff is ANY_ID */ 01960 unsigned int features; /* feature flags */ 01961 int line_cnt; /* count of ISDN ports */ 01962 int vario_cnt; /* count of driver varios */ 01963 int vario; /* referenz to driver vario record */ 01964 } cdb_isdn_card; 01965 01966 typedef struct { 01967 int handle; /* idx in database */ 01968 int next_vario; /* link to alternate vario */ 01969 int drvid; /* unique id of the driver vario */ 01970 int typ; /* Type to identify the driver */ 01971 int subtyp; /* Subtype of the driver type */ 01972 int smp; /* SMP supported ? */ 01973 const char *mod_name; /* name of the driver module */ 01974 const char *para_str; /* optional parameter string */ 01975 const char *mod_preload;/* optional modules to preload */ 01976 const char *cfg_prog; /* optional cfg prog */ 01977 const char *firmware; /* optional firmware to load */ 01978 const char *description;/* optional description */ 01979 const char *need_pkg; /* list of packages needed for function */ 01980 const char *info; /* optional additional info */ 01981 const char *protocol; /* supported D-channel protocols */ 01982 const char *interface; /* supported API interfaces */ 01983 const char *io; /* possible IO ports with legacy ISA cards */ 01984 const char *irq; /* possible interrupts with legacy ISA cards */ 01985 const char *membase; /* possible membase with legacy ISA cards */ 01986 const char *features; /* optional features*/ 01987 int card_ref; /* reference to a card */ 01988 const char *name; /* driver name */ 01989 } cdb_isdn_vario; 01990 01991 01992 extern cdb_isdn_vendor *hd_cdbisdn_get_vendor(int); 01993 extern cdb_isdn_card *hd_cdbisdn_get_card(int); 01994 extern cdb_isdn_vario *hd_cdbisdn_get_vario_from_type(int, int); 01995 extern cdb_isdn_card *hd_cdbisdn_get_card_from_type(int, int); 01996 extern cdb_isdn_card *hd_cdbisdn_get_card_from_id(int, int, int, int); 01997 extern cdb_isdn_vario *hd_cdbisdn_get_vario(int); 01998 extern int hd_cdbisdn_get_version(void); 01999 extern int hd_cdbisdn_get_db_version(void); 02000 extern char *hd_cdbisdn_get_db_date(void); 02001 02002 /* CDB ISDN interface end */ 02003 02004 #ifdef __cplusplus 02005 } 02006 #endif 02007 02008 #endif /* _HD_H */