9 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11 * libhd data structures
13 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
21 #define HD_DEB_SHOW_LOG (1 << 0)
22 #define HD_DEB_PROGRESS (1 << 1)
23 #define HD_DEB_CREATION (1 << 2)
24 #define HD_DEB_DRIVER_INFO (1 << 3)
25 #define HD_DEB_PCI (1 << 4)
26 #define HD_DEB_ISAPNP (1 << 5)
27 #define HD_DEB_CDROM (1 << 6)
28 #define HD_DEB_NET (1 << 7)
29 #define HD_DEB_FLOPPY (1 << 8)
30 #define HD_DEB_MISC (1 << 9)
31 #define HD_DEB_SERIAL (1 << 10)
32 #define HD_DEB_MONITOR (1 << 11)
33 #define HD_DEB_CPU (1 << 12)
34 #define HD_DEB_BIOS (1 << 13)
35 #define HD_DEB_MOUSE (1 << 14)
36 #define HD_DEB_IDE (1 << 15)
37 #define HD_DEB_SCSI (1 << 16)
38 #define HD_DEB_USB (1 << 17)
39 #define HD_DEB_ADB (1 << 18)
40 #define HD_DEB_MODEM (1 << 19)
41 #define HD_DEB_PARALLEL (1 << 20)
42 #define HD_DEB_ISA (1 << 21)
43 #define HD_DEB_BOOT (1 << 22)
44 #define HD_DEB_HDDB (1 << 23)
49 #include <sys/types.h>
54 #define HARDWARE_DIR "/var/lib/hardware"
55 #define HARDWARE_UNIQUE_KEYS HARDWARE_DIR "/unique-keys"
58 * \defgroup idmacros Id macros
59 * Macros to handle device and vendor ids.
61 * Example: to check if an id is a pci id and get its value,
62 * do something like this:
64 * if(ID_TAG(hd->dev) == TAG_PCI) {
65 * pci_id = ID_VALUE(hd->dev)
71 #define TAG_PCI 1 /**< PCI ids. */
72 #define TAG_EISA 2 /**< EISA ids (monitors, ISA-PnP, modems, mice etc). */
73 #define TAG_USB 3 /**< USB ids. */
74 #define TAG_SPECIAL 4 /**< Internally used ids. */
75 #define TAG_PCMCIA 5 /**< PCMCIA ids. */
78 * Get the real id value.
80 #define ID_VALUE(id) ((id) & 0xffff)
85 #define ID_TAG(id) (((id) >> 16) & 0xf)
88 * Combine tag and id value.
90 #define MAKE_ID(tag, id_val) ((tag << 16) | (id_val))
95 * flags to control the probing.
97 typedef enum probe_feature
{
98 pr_memory
= 1, pr_pci
, pr_isapnp
, pr_net
, pr_floppy
, pr_misc
,
99 pr_misc_serial
, pr_misc_par
, pr_misc_floppy
, pr_serial
, pr_cpu
, pr_bios
,
100 pr_monitor
, pr_mouse
, pr_scsi
, pr_usb
, pr_usb_mods
, pr_adb
, pr_modem
,
101 pr_modem_usb
, pr_parallel
, pr_parallel_lp
, pr_parallel_zip
, pr_isa
,
102 pr_isa_isdn
, pr_isdn
, pr_kbd
, pr_prom
, pr_sbus
, pr_int
, pr_braille
,
103 pr_braille_alva
, pr_braille_fhp
, pr_braille_ht
, pr_ignx11
, pr_sys
,
104 pr_bios_vbe
, pr_isapnp_old
, pr_isapnp_new
, pr_isapnp_mod
, pr_braille_baum
,
105 pr_manual
, pr_fb
, pr_veth
, pr_pppoe
, pr_scan
, pr_pcmcia
, pr_fork
,
106 pr_parallel_imm
, pr_s390
, pr_cpuemu
, pr_sysfs
, pr_s390disks
, pr_udev
,
107 pr_block
, pr_block_cdrom
, pr_block_part
, pr_edd
, pr_edd_mod
, pr_bios_ddc
,
108 pr_bios_fb
, pr_bios_mode
, pr_input
, pr_block_mods
, pr_bios_vesa
,
109 pr_cpuemu_debug
, pr_scsi_noserial
, pr_wlan
,
110 pr_max
, pr_lxrc
, pr_dsl
, pr_default
, pr_all
/* pr_all must be last */
111 } hd_probe_feature_t
;
114 * list types for hd_list()
116 * if you want to modify this: cf. manual.c::hw_items[]
118 * Note: hw_tv _must_ be < hw_display!
120 typedef enum hw_item
{
121 hw_sys
= 1, hw_cpu
, hw_keyboard
, hw_braille
, hw_mouse
, hw_joystick
,
122 hw_printer
, hw_scanner
, hw_chipcard
, hw_monitor
, hw_tv
, hw_display
,
123 hw_framebuffer
, hw_camera
, hw_sound
, hw_storage_ctrl
, hw_network_ctrl
,
124 hw_isdn
, hw_modem
, hw_network
, hw_disk
, hw_partition
, hw_cdrom
, hw_floppy
,
125 hw_manual
, hw_usb_ctrl
, hw_usb
, hw_bios
, hw_pci
, hw_isapnp
, hw_bridge
,
126 hw_hub
, hw_scsi
, hw_ide
, hw_memory
, hw_dvb
, hw_pcmcia
, hw_pcmcia_ctrl
,
127 hw_ieee1394
, hw_ieee1394_ctrl
, hw_hotplug
, hw_hotplug_ctrl
, hw_zip
, hw_pppoe
,
128 hw_wlan
, hw_redasd
, hw_dsl
, hw_block
, hw_tape
, hw_vbe
, hw_bluetooth
,
129 /* append new entries here */
130 hw_unknown
, hw_all
/* hw_all must be last */
134 * device base classes and bus types
138 /* base class values (superset of PCI classes) */
139 typedef enum base_classes
{
140 /* these *must* match standard PCI class numbers */
141 bc_none
, bc_storage
, bc_network
, bc_display
, bc_multimedia
,
142 bc_memory
, bc_bridge
, bc_comm
, bc_system
, bc_input
, bc_docking
,
143 bc_processor
, bc_serial
, bc_wireless
, bc_i2o
, bc_other
= 0xff,
145 // add our own classes here (starting at 0x100 as PCI values are 8 bit)
146 bc_monitor
= 0x100, bc_internal
, bc_modem
, bc_isdn
, bc_ps2
, bc_mouse
,
147 bc_storage_device
, bc_network_interface
, bc_keyboard
, bc_printer
,
148 bc_hub
, bc_braille
, bc_scanner
, bc_joystick
, bc_chipcard
, bc_camera
,
149 bc_framebuffer
, bc_dvb
, bc_tv
, bc_partition
, bc_dsl
, bc_bluetooth
152 /* subclass values of bc_monitor */
153 typedef enum sc_monitor
{
154 sc_mon_other
, sc_mon_crt
, sc_mon_lcd
157 /* subclass values of bc_storage */
158 typedef enum sc_storage
{
159 sc_sto_scsi
, sc_sto_ide
, sc_sto_floppy
, sc_sto_ipi
, sc_sto_raid
,
163 /* subclass values of bc_display */
164 typedef enum sc_display
{
165 sc_dis_vga
, sc_dis_xga
, sc_dis_other
= 0x80
168 /* subclass values of bc_framebuffer */
169 typedef enum sc_framebuffer
{
171 } hd_sc_framebuffer_t
;
173 /* subclass values of bc_bridge */
174 typedef enum sc_bridge
{
175 sc_bridge_host
, sc_bridge_isa
, sc_bridge_eisa
, sc_bridge_mc
,
176 sc_bridge_pci
, sc_bridge_pcmcia
, sc_bridge_nubus
, sc_bridge_cardbus
,
177 sc_bridge_other
= 0x80
180 /* subclass values of bc_comm */
181 typedef enum sc_comm
{
182 sc_com_ser
, sc_com_par
, sc_com_multi
, sc_com_modem
, sc_com_other
= 0x80
185 /* subclass values of bc_system */
186 typedef enum sc_system
{
187 sc_sys_pic
, sc_sys_dma
, sc_sys_timer
, sc_sys_rtc
, sc_sys_other
= 0x80
190 /* subclass values of bc_input */
191 typedef enum sc_input
{
192 sc_inp_keyb
, sc_inp_digit
, sc_inp_mouse
, sc_inp_other
= 0x80
195 /* subclass values of bc_serial */
196 typedef enum sc_serial
{
197 sc_ser_fire
, sc_ser_access
, sc_ser_ssa
, sc_ser_usb
, sc_ser_fiber
,
198 sc_ser_smbus
, sc_ser_other
= 0x80
201 /* internal sub class values (bc_internal) */
202 typedef enum sc_internal
{
203 sc_int_none
, sc_int_isapnp_if
, sc_int_main_mem
, sc_int_cpu
, sc_int_fpu
,
204 sc_int_bios
, sc_int_prom
, sc_int_sys
207 /* subclass values of bc_mouse */
208 typedef enum sc_mouse
{
209 sc_mou_ps2
, sc_mou_ser
, sc_mou_bus
, sc_mou_usb
, sc_mou_sun
,
213 /* subclass values of bc_storage_device */
214 typedef enum sc_std
{
215 sc_sdev_disk
, sc_sdev_tape
, sc_sdev_cdrom
, sc_sdev_floppy
, sc_sdev_scanner
,
219 /* subclass values of bc_network_interface */
220 typedef enum sc_net_if
{
221 sc_nif_loopback
, sc_nif_ethernet
, sc_nif_tokenring
, sc_nif_fddi
,
222 sc_nif_ctc
, sc_nif_iucv
, sc_nif_hsi
, sc_nif_qeth
,
223 sc_nif_escon
, sc_nif_myrinet
, sc_nif_wlan
, sc_nif_xp
,
224 sc_nif_usb
, sc_nif_other
= 0x80, sc_nif_sit
227 /* subclass values of bc_multimedia */
228 typedef enum sc_multimedia
{
229 sc_multi_video
, sc_multi_audio
, sc_multi_other
230 } hd_sc_multimedia_t
;
232 /* subclass values of bc_keyboard */
233 typedef enum sc_keyboard
{
234 sc_keyboard_kbd
, sc_keyboard_console
237 /* subclass values of bc_hub */
238 typedef enum sc_hub
{
239 sc_hub_other
, sc_hub_usb
242 /* subclass values of bc_camera */
243 typedef enum sc_camera
{
244 sc_camera_webcam
, sc_camera_digital
247 /* subclass values of bc_modem */
248 typedef enum sc_modem
{
249 sc_mod_at
, sc_mod_win1
, sc_mod_win2
, sc_mod_win3
, sc_mod_win4
252 /* subclass values of bc_dsl */
253 typedef enum sc_dsl
{
254 sc_dsl_unknown
, sc_dsl_pppoe
, sc_dsl_capi
, sc_dsl_capiisdn
257 /* prog_if's of sc_ser_usb */
258 typedef enum pif_usb_e
{
259 pif_usb_uhci
= 0, pif_usb_ohci
= 0x10, pif_usb_ehci
= 0x20,
260 pif_usb_other
= 0x80, pif_usb_device
= 0xfe
263 /* CD-ROM prog_if values */
264 typedef enum pif_cdrom
{
265 pif_cdrom
, pif_cdr
, pif_cdrw
, pif_dvd
, pif_dvdr
, pif_dvdram
268 /* S/390 disk prog_if values */
269 typedef enum pif_s390disk
{
270 pif_scsi
, pif_dasd
, pif_dasd_fba
273 /* bus type values similar to PCI bridge subclasses */
274 typedef enum bus_types
{
275 bus_none
, bus_isa
, bus_eisa
, bus_mc
, bus_pci
, bus_pcmcia
, bus_nubus
,
276 bus_cardbus
, bus_other
,
278 /* outside the range of the PCI values */
279 bus_ps2
= 0x80, bus_serial
, bus_parallel
, bus_floppy
, bus_scsi
, bus_ide
, bus_usb
,
280 bus_adb
, bus_raid
, bus_sbus
, bus_i2o
, bus_vio
, bus_ccw
, bus_iucv
285 * The status is stored in /var/lib/hardware/unique-keys/ and used
286 * to detect if the hardware is new and has to be configured by some
287 * hardware %config tool.
291 * Status fields are invalid.
295 * Hardware should be reconfigured.
296 * Either \ref hd_status_t::status_yes or \ref hd_status_t::status_no.
297 * A hardware must be reconfigured if it is in state
298 * \ref hd_status_t::available == \ref hd_status_t::status_no and
299 * \ref hd_status_t::needed == \ref hd_status_t::status_yes.
300 * In other words, if a hardware that was
301 * needed to run the system is gone.
306 * Hardware %config status.
307 * Set to \ref hd_status_t::status_yes if the hardware has been configured, otherwise
308 * \ref hd_status_t::status_no.
310 unsigned configured
:3;
313 * Hardware availability.
314 * Set to \ref hd_status_t::status_yes if the hardware has been detected or
315 * \ref hd_status_t::status_no if the hardware has not been found. You can set
316 * it to \ref hd_status_t::status_unknown to indicate that this hardware cannot
317 * be automatically detected (say, ISA cards).
318 * \note You can simulate all kinds of hardware on your system by
319 * creating entries in /var/lib/hardware/unique-keys/ that have
320 * \ref hd_status_t::available set to \ref hd_status_t::status_unknown.
322 unsigned available
:3;
325 * Hardware is needed.
326 * Set to \ref hd_status_t::status_yes if this hardware is really necessary to run
327 * your computer. The effect will be that some hardware %config dialog
328 * is run if the hardware item is not found.
329 * Typical examples are graphics cards and mice.
334 * (Internal) original value of \ref available;
335 * This is used to keep track of the original value of the \ref hd_status_t::available
336 * state as it was stored in /var/lib/hardware/unique-keys/. (\ref hd_status_t::available
337 * is automatically updated during the detection process.)
339 unsigned available_orig
:3;
342 * Hardware is active.
347 /* hardware config status values */
349 status_no
= 1, status_yes
, status_unknown
, status_new
353 * Various types of hotplug devices.
356 hp_none
, /**< Not a hotpluggable %device. */
357 hp_pcmcia
, /**< PCMCIA %device. */
358 hp_cardbus
, /**< Cardbus %device. */
359 hp_pci
, /**< PCI hotplug %device. */
360 hp_usb
, /**< USB %device. */
361 hp_ieee1394
/**< IEEE 1394 (FireWire) %device */
366 * Holds id/name pairs.
367 * Used for bus, class, vendor, %device and such.
370 unsigned id
; /**< Numeric id. */
371 char *name
; /**< Name (if any) that corresponds to \ref hd_id_t::id. */
376 * Used whenever we create a list of strings (e.g. file read).
378 typedef struct s_str_list_t
{
379 struct s_str_list_t
*next
; /**< Link to next member. */
380 char *str
; /**< Some string data. */
385 unsigned char bitmap
[16]; /* large enough for all uses */
386 unsigned bits
; /* real bitmap length in bits */
387 unsigned not_empty
:1; /* at least 1 bit is set */
388 str_list_t
*str
; /* interpreted bitmask */
396 unsigned start
, size
; /* base address & size */
397 unsigned char *data
; /* actual data */
402 * smp info according to Intel smp spec (ia32)
405 unsigned ok
:1; /* data are valid */
406 unsigned rev
; /* MP spec revision */
407 unsigned mpfp
; /* MP Floating Pointer struct */
408 unsigned mpconfig_ok
:1; /* MP config table valid */
409 unsigned mpconfig
; /* MP config table */
410 unsigned mpconfig_size
; /* dto, size */
411 unsigned char feature
[5]; /* MP feature info */
412 char oem_id
[9]; /* oem id */
413 char prod_id
[13]; /* product id */
414 unsigned cpus
, cpus_en
; /* number of cpus & ennabled cpus */
419 * vesa bios extensions info
421 typedef struct vbe_mode_info_s
{
422 unsigned number
; /* mode number */
423 unsigned attributes
; /* mode attributes */
424 unsigned width
, height
; /* mode size */
425 unsigned bytes_p_line
; /* line length */
426 unsigned pixel_size
; /* bits per pixel */
427 unsigned fb_start
; /* frame buffer start address (if any) */
428 unsigned win_A_start
; /* window A start address */
429 unsigned win_A_attr
; /* window A attributes */
430 unsigned win_B_start
; /* window B start address */
431 unsigned win_B_attr
; /* window B attributes */
432 unsigned win_size
; /* window size in bytes */
433 unsigned win_gran
; /* window granularity in bytes */
434 unsigned pixel_clock
; /* maximum pixel clock */
439 unsigned ok
:1; /* data are valid */
440 unsigned version
; /* vbe version */
441 unsigned oem_version
; /* oem version info */
442 unsigned memory
; /* in bytes */
443 unsigned fb_start
; /* != 0 if framebuffer is supported */
444 char *oem_name
; /* oem name */
445 char *vendor_name
; /* vendor name */
446 char *product_name
; /* product name */
447 char *product_revision
; /* product revision */
448 unsigned modes
; /* number of supported video modes */
449 vbe_mode_info_t
*mode
; /* video mode list */
450 unsigned current_mode
; /* current video mode */
451 unsigned char ddc
[0x80]; /* ddc monitor info */
456 * Compaq Controller Order EV (CQHORD) definition
468 unsigned ok
:1; /* data are valid */
469 unsigned entry
; /* entry point */
470 unsigned compaq
:1; /* is compaq system */
471 cpq_ctlorder_t cpq_ctrl
[32]; /* 32 == MAX_CONTROLLERS */
479 sm_biosinfo
, sm_sysinfo
, sm_boardinfo
, sm_chassis
,
480 sm_processor
, sm_memctrl
, sm_memmodule
, sm_cache
,
481 sm_connect
, sm_slot
, sm_onboard
, sm_oem
,
482 sm_config
, sm_lang
, sm_group
, sm_eventlog
,
483 sm_memarray
, sm_memdevice
, sm_memerror
, sm_memarraymap
,
484 sm_memdevicemap
, sm_mouse
, sm_battery
, sm_reset
,
485 sm_secure
, sm_power
, sm_voltage
, sm_cool
,
486 sm_temperature
, sm_current
, sm_outofband
, sm_bis
,
487 sm_boot
, sm_mem64error
, sm_mandev
, sm_mandevcomp
,
488 sm_mdtd
, sm_inactive
= 126, sm_end
= 127
492 /* common part of all smbios_* types */
494 union u_hd_smbios_t
*next
; /* link to next entry */
495 hd_smbios_type_t type
; /* BIOS info type */
496 int data_len
; /* formatted section length */
497 unsigned char *data
; /* formatted section */
498 str_list_t
*strings
; /* strings taken from the unformed section */
499 int handle
; /* handle, unique 16 bit number */
503 /* BIOS related information */
505 union u_hd_smbios_t
*next
;
506 hd_smbios_type_t type
;
511 char *vendor
; /* vendor name */
512 char *version
; /* version (free form) */
513 char *date
; /* date mm/dd/yyyy (old: yy) */
514 hd_bitmap_t feature
; /* BIOS characteristics */
515 unsigned start
; /* start address */
516 unsigned rom_size
; /* ROM size (in bytes) */
520 /* overall system related information */
522 union u_hd_smbios_t
*next
;
523 hd_smbios_type_t type
;
528 char *manuf
; /* manufacturer */
529 char *product
; /* product name */
530 char *version
; /* version */
531 char *serial
; /* serial number */
532 unsigned char uuid
[16]; /* universal unique id; all 0x00: undef, all 0xff: undef but settable */
533 hd_id_t wake_up
; /* wake-up type */
537 /* motherboard related information */
539 union u_hd_smbios_t
*next
;
540 hd_smbios_type_t type
;
545 char *manuf
; /* manufacturer */
546 char *product
; /* product name */
547 char *version
; /* version */
548 char *serial
; /* serial number */
549 char *asset
; /* asset tag */
550 hd_id_t board_type
; /* board type */
551 hd_bitmap_t feature
; /* board features */
552 char *location
; /* location in chassis */
553 int chassis
; /* handle of chassis */
554 int objects_len
; /* number of contained objects */
555 int *objects
; /* array of object handles */
556 } smbios_boardinfo_t
;
559 /* chassis information */
561 union u_hd_smbios_t
*next
;
562 hd_smbios_type_t type
;
567 char *manuf
; /* manufacturer */
568 char *version
; /* version */
569 char *serial
; /* serial number */
570 char *asset
; /* asset tag */
571 hd_id_t ch_type
; /* chassis type */
572 unsigned lock
; /* 1: lock present, 0: not present or unknown */
573 hd_id_t bootup
; /* bootup state */
574 hd_id_t power
; /* power supply state (at last boot) */
575 hd_id_t thermal
; /* thermal state (at last boot) */
576 hd_id_t security
; /* security state (at last boot) */
577 unsigned oem
; /* OEM-specific information */
581 /* processor information */
583 union u_hd_smbios_t
*next
;
584 hd_smbios_type_t type
;
589 char *socket
; /* socket */
590 hd_id_t upgrade
; /* socket type */
591 char *manuf
; /* manufacturer */
592 char *version
; /* version */
593 char *serial
; /* serial number */
594 char *asset
; /* asset tag */
595 char *part
; /* part number */
596 hd_id_t pr_type
; /* processor type */
597 hd_id_t family
; /* processor family */
598 uint64_t cpu_id
; /* processor id */
599 unsigned voltage
; /* in 0.1 V */
600 unsigned ext_clock
; /* MHz */
601 unsigned max_speed
; /* MHz */
602 unsigned current_speed
; /* MHz */
603 unsigned sock_status
; /* socket status (1: populated, 0: empty */
604 hd_id_t cpu_status
; /* cpu status */
605 int l1_cache
; /* handle of L1 cache */
606 int l2_cache
; /* handle of L2 cache */
607 int l3_cache
; /* handle of L3 cache */
608 } smbios_processor_t
;
611 /* cache information */
613 union u_hd_smbios_t
*next
;
614 hd_smbios_type_t type
;
619 char *socket
; /* socket designation */
620 unsigned max_size
; /* max cache size in kbytes */
621 unsigned current_size
; /* current size in kbytes */
622 unsigned speed
; /* cache speed in nanoseconds */
623 hd_id_t mode
; /* operational mode */
624 unsigned state
; /* 0/1: disabled/enabled */
625 hd_id_t location
; /* cache location */
626 unsigned socketed
; /* 0/1: not socketed/socketed */
627 unsigned level
; /* cache level (0 = L1, 1 = L2, ...) */
628 hd_id_t ecc
; /* error correction type */
629 hd_id_t cache_type
; /* logical cache type */
630 hd_id_t assoc
; /* cache associativity */
631 hd_bitmap_t supp_sram
; /* supported SRAM types */
632 hd_bitmap_t sram
; /* current SRAM type */
636 /* port connector information */
638 union u_hd_smbios_t
*next
;
639 hd_smbios_type_t type
;
644 hd_id_t port_type
; /* port type */
645 char *i_des
; /* internal reference designator */
646 hd_id_t i_type
; /* internal connector type */
647 char *x_des
; /* external reference designator */
648 hd_id_t x_type
; /* external connector type */
652 /* system slot information */
654 union u_hd_smbios_t
*next
;
655 hd_smbios_type_t type
;
660 char *desig
; /* slot designation */
661 hd_id_t slot_type
; /* slot type */
662 hd_id_t bus_width
; /* data bus width */
663 hd_id_t usage
; /* current usage */
664 hd_id_t length
; /* slot length */
665 unsigned id
; /* slot id */
666 hd_bitmap_t feature
; /* slot characteristics */
670 /* on board devices information */
672 union u_hd_smbios_t
*next
;
673 hd_smbios_type_t type
;
678 unsigned dev_len
; /* device list length */
680 char *name
; /* device name */
681 hd_id_t type
; /* device type */
682 unsigned status
; /* 0: disabled, 1: enabled */
683 } *dev
; /* device list */
687 /* OEM information */
689 union u_hd_smbios_t
*next
;
690 hd_smbios_type_t type
;
695 str_list_t
*oem_strings
; /* OEM strings */
699 /* system config options */
701 union u_hd_smbios_t
*next
;
702 hd_smbios_type_t type
;
707 str_list_t
*options
; /* system config options */
711 /* language information */
713 union u_hd_smbios_t
*next
;
714 hd_smbios_type_t type
;
717 str_list_t
*strings
; /* list of languages */
719 char *current
; /* current language */
723 /* group associations */
725 union u_hd_smbios_t
*next
;
726 hd_smbios_type_t type
;
731 char *name
; /* group name */
732 int items_len
; /* number of items in this group */
733 int *item_handles
; /* array of item handles */
737 /* physical memory array (consists of several memory devices) */
739 union u_hd_smbios_t
*next
;
740 hd_smbios_type_t type
;
745 hd_id_t location
; /* memory device location */
746 hd_id_t use
; /* memory usage */
747 hd_id_t ecc
; /* ECC types */
748 unsigned max_size
; /* maximum memory size in kB */
749 int error_handle
; /* points to error info record; 0xfffe: not supported, 0xffff: no error */
750 unsigned slots
; /* slots or sockets for this device */
756 union u_hd_smbios_t
*next
;
757 hd_smbios_type_t type
;
762 char *location
; /* device location */
763 char *bank
; /* bank location */
764 char *manuf
; /* manufacturer */
765 char *serial
; /* serial number */
766 char *asset
; /* asset tag */
767 char *part
; /* part number */
768 int array_handle
; /* memory array this device belongs to */
769 int error_handle
; /* points to error info record; 0xfffe: not supported, 0xffff: no error */
770 unsigned width
; /* data width in bits */
771 unsigned eccbits
; /* ecc bits */
772 unsigned size
; /* kB */
773 hd_id_t form
; /* form factor */
774 unsigned set
; /* 0: does not belong to a set; 1-0xfe: set number; 0xff: unknown */
775 hd_id_t mem_type
; /* memory type */
776 hd_bitmap_t type_detail
; /* memory type details */
777 unsigned speed
; /* in MHz */
778 } smbios_memdevice_t
;
781 /* 32-bit memory error information */
783 union u_hd_smbios_t
*next
;
784 hd_smbios_type_t type
;
789 hd_id_t err_type
; /* error type memory */
790 hd_id_t granularity
; /* memory array or memory partition */
791 hd_id_t operation
; /* mem operation causing the error */
792 unsigned syndrome
; /* vendor-specific ECC syndrome; 0: unknown */
793 unsigned array_addr
; /* fault address rel. to mem array; 0x80000000: unknown */
794 unsigned device_addr
; /* fault address rel to mem device; 0x80000000: unknown */
795 unsigned range
; /* range, within which the error can be determined; 0x80000000: unknown */
799 /* memory array mapped address */
801 union u_hd_smbios_t
*next
;
802 hd_smbios_type_t type
;
807 int array_handle
; /* memory array this mapping belongs to */
808 uint64_t start_addr
; /* memory range start address */
809 uint64_t end_addr
; /* end address */
810 unsigned part_width
; /* number of memory devices */
811 } smbios_memarraymap_t
;
814 /* memory device mapped address */
816 union u_hd_smbios_t
*next
;
817 hd_smbios_type_t type
;
822 int memdevice_handle
; /* memory device handle */
823 int arraymap_handle
; /* memory array mapping handle */
824 uint64_t start_addr
; /* memory range start address */
825 uint64_t end_addr
; /* end address */
826 unsigned row_pos
; /* position of the referenced memory device in a row of the address partition */
827 unsigned interleave_pos
; /* dto, in an interleave */
828 unsigned interleave_depth
; /* number of consecutive rows */
829 } smbios_memdevicemap_t
;
832 /* pointing device (aka 'mouse') information */
834 union u_hd_smbios_t
*next
;
835 hd_smbios_type_t type
;
840 hd_id_t mtype
; /* mouse type */
841 hd_id_t interface
; /* interface type */
842 unsigned buttons
; /* number of buttons */
846 /* hardware security */
848 union u_hd_smbios_t
*next
;
849 hd_smbios_type_t type
;
854 hd_id_t power
; /* power-on password status */
855 hd_id_t keyboard
; /* keyboard password status */
856 hd_id_t admin
; /* admin password status */
857 hd_id_t reset
; /* front panel reset status */
861 /* system power controls */
863 union u_hd_smbios_t
*next
;
864 hd_smbios_type_t type
;
869 unsigned month
; /* next scheduled power-on month */
870 unsigned day
; /* dto, day */
871 unsigned hour
; /* dto, hour */
872 unsigned minute
; /* dto, minute */
873 unsigned second
; /* dto, second */
877 /* 64-bit memory error information */
879 union u_hd_smbios_t
*next
;
880 hd_smbios_type_t type
;
885 hd_id_t err_type
; /* error type memory */
886 hd_id_t granularity
; /* memory array or memory partition */
887 hd_id_t operation
; /* mem operation causing the error */
888 unsigned syndrome
; /* vendor-specific ECC syndrome; 0: unknown */
889 uint64_t array_addr
; /* fault address rel. to mem array; 0x80000000: unknown */
890 uint64_t device_addr
; /* fault address rel to mem device; 0x80000000: unknown */
891 unsigned range
; /* range, within which the error can be determined; 0x80000000: unknown */
892 } smbios_mem64error_t
;
895 typedef union u_hd_smbios_t
{
896 union u_hd_smbios_t
*next
;
898 smbios_biosinfo_t biosinfo
;
899 smbios_sysinfo_t sysinfo
;
900 smbios_boardinfo_t boardinfo
;
901 smbios_chassis_t chassis
;
902 smbios_processor_t processor
;
903 smbios_cache_t cache
;
904 smbios_connect_t connect
;
906 smbios_onboard_t onboard
;
908 smbios_config_t config
;
910 smbios_group_t group
;
911 smbios_memarray_t memarray
;
912 smbios_memdevice_t memdevice
;
913 smbios_memerror_t memerror
;
914 smbios_memarraymap_t memarraymap
;
915 smbios_memdevicemap_t memdevicemap
;
916 smbios_mouse_t mouse
;
917 smbios_secure_t secure
;
918 smbios_power_t power
;
919 smbios_mem64error_t mem64error
;
926 typedef struct s_udevinfo_t
{
927 struct s_udevinfo_t
*next
;
938 typedef struct s_sysfsdrv_t
{
939 struct s_sysfsdrv_t
*next
;
946 * device number; type is either 0 or 'b' or 'c'.
948 * range: number of nodes
952 unsigned major
, minor
, range
;
957 * structure holding the (raw) PCI data
959 typedef struct s_pci_t
{
960 struct s_pci_t
*next
; /* linked list */
961 unsigned data_len
; /* the actual length of the data field */
962 unsigned data_ext_len
; /* max. accessed config byte; see code */
963 unsigned char data
[256]; /* the PCI data */
964 char *log
; /* log messages */
965 unsigned flags
, /* various info, see enum pci_flags */
966 cmd
, /* PCI_COMMAND */
967 hdr_type
, /* PCI_HEADER_TYPE */
968 secondary_bus
; /* > 0 for PCI & CB bridges */
969 unsigned bus
, /* PCI bus #, *nothing* to do with hw_t.bus */
970 slot
, func
; /* slot & function */
971 unsigned base_class
, sub_class
, prog_if
; /* PCI device classes */
972 unsigned dev
, vend
, sub_dev
, sub_vend
, rev
; /* vendor & device ids */
973 unsigned irq
; /* used irq, if any */
974 uint64_t base_addr
[7]; /* I/O or memory base */
975 uint64_t base_len
[7]; /* I/O or memory ranges */
976 unsigned addr_flags
[7]; /* I/O or memory address flags */
977 uint64_t rom_base_addr
; /* memory base for card ROM */
978 uint64_t rom_base_len
; /* memory range for card ROM */
979 char *sysfs_id
; /* sysfs path */
980 char *sysfs_bus_id
; /* sysfs bus id */
984 * pci related flags cf. (pci_t).flags
986 typedef enum pci_flags
{
987 pci_flag_ok
, pci_flag_pm
, pci_flag_agp
994 typedef struct usb_s
{
997 unsigned hd_base_idx
;
998 /* see Linux USB docs */
999 str_list_t
*c
, *d
, *e
, *i
, *p
, *s
, *t
;
1000 struct usb_s
*cloned
;
1001 int bus
, dev_nr
, lev
, parent
, port
, count
, conns
, used_conns
, ifdescr
;
1003 unsigned vendor
, device
, rev
;
1004 char *manufact
, *product
, *serial
;
1006 memory_range_t raw_descr
;
1007 int d_cls
, d_sub
, d_prot
;
1008 int i_alt
, i_cls
, i_sub
, i_prot
;
1013 *structures to hold the (raw) ISA-PnP data
1018 unsigned char *data
;
1024 unsigned char *serial
;
1025 unsigned char *card_regs
;
1026 unsigned char (*ldev_regs
)[0xd0];
1028 unsigned broken
:1; /* mark a broken card */
1035 isapnp_card_t
*card
;
1039 isapnp_card_t
*card
;
1041 unsigned flags
; /* cf. enum isapnp_flags */
1042 unsigned ref
:1; /* internally used flag */
1046 * ISA-PnP related flags; cf. (isapnp_dev_t).flags
1048 typedef enum isapnp_flags
{
1050 } hd_isapnp_flags_t
;
1056 typedef struct scsi_s
{
1057 struct scsi_s
*next
;
1062 char *guessed_dev_name
;
1064 unsigned host
, channel
, id
, lun
;
1065 char *vendor
, *model
, *rev
, *type_str
, *serial
;
1068 char *proc_dir
, *driver
;
1071 unsigned lgeo_c
, lgeo_h
, lgeo_s
;
1072 unsigned pgeo_c
, pgeo_h
, pgeo_s
;
1076 str_list_t
*host_info
;
1084 char *controller_id
;
1091 typedef struct devtree_s
{
1092 struct devtree_s
*next
;
1093 struct devtree_s
*parent
;
1095 char *path
, *filename
;
1097 char *name
, *model
, *device_type
, *compatible
;
1098 int class_code
; /* class : sub_class : prog-if */
1099 int vendor_id
, device_id
, subvendor_id
, subdevice_id
;
1100 int revision_id
, interrupt
;
1101 unsigned char *edid
; /* 128 bytes */
1105 * Device/CU model numbers for S/390
1107 typedef struct ccw_s
{
1109 unsigned char cu_model
;
1110 unsigned char dev_model
;
1114 * special CDROM entry
1116 typedef struct cdrom_info_s
{
1117 struct cdrom_info_s
*next
;
1120 unsigned cdr
:1, cdrw
:1, dvd
:1, dvdr
:1, dvdram
:1;
1121 unsigned cdrom
:1; /* cdrom in drive */
1124 char *volume
, *publisher
, *preparer
, *application
, *creation_date
;
1130 unsigned bootable
:1;
1131 unsigned media_type
; /* boot emulation type */
1132 unsigned load_address
;
1133 unsigned load_count
; /* sectors to load */
1134 unsigned start
; /* start sector */
1135 unsigned catalog
; /* boot catalog start */
1145 // note: obsolete, will be removed
1147 unsigned char block0
[512];
1154 unsigned apm_supported
:1;
1155 unsigned apm_enabled
:1;
1156 unsigned apm_ver
, apm_subver
;
1157 unsigned apm_bios_flags
;
1160 unsigned vbe_video_mem
;
1162 unsigned ser_port0
, ser_port1
, ser_port2
, ser_port3
;
1163 unsigned par_port0
, par_port1
, par_port2
;
1165 /* The id is still in big endian format! */
1166 unsigned is_pnp_bios
:1;
1168 unsigned lba_support
:1;
1170 unsigned low_mem_size
;
1174 unsigned smbios_ver
;
1187 unsigned compat_vend
;
1188 unsigned compat_dev
;
1193 unsigned scroll_lock
:1;
1194 unsigned num_lock
:1;
1195 unsigned caps_lock
:1;
1198 bios32_info_t bios32
;
1204 * prom data (ppc, sparc)
1207 unsigned has_color
:1;
1213 * general system data
1226 * monitor (DDC) data
1230 unsigned min_vsync
, max_vsync
; /* vsync range */
1231 unsigned min_hsync
, max_hsync
; /* hsync range */
1238 typedef enum cpu_arch
{
1242 arch_sparc
, arch_sparc64
,
1243 arch_ppc
, arch_ppc64
,
1246 arch_s390
, arch_s390x
,
1252 // ###### drop boot_arch at all?
1253 typedef enum boot_arch
{
1255 boot_lilo
, boot_milo
, boot_aboot
, boot_silo
, boot_ppc
, boot_elilo
, boot_s390
,
1256 boot_mips
, boot_grub
1259 /* special cpu entry */
1261 enum cpu_arch architecture
;
1262 unsigned family
; /* axp: cpu variation */
1263 unsigned model
; /* axp: cpu revision */
1267 unsigned units
; /* >1 "hyperthreading" */
1268 char *vend_name
; /* axp: system type */
1269 char *model_name
; /* axp: cpu model */
1270 char *platform
; /* x86: NULL */
1271 str_list_t
*features
; /* x86: flags */
1276 * enhanced disk data (cf. edd.c)
1281 unsigned cyls
, heads
, sectors
;
1284 unsigned cyls
, heads
, sectors
;
1286 unsigned ext_fixed_disk
:1;
1287 unsigned ext_lock_eject
:1;
1289 unsigned ext_64bit
:1;
1290 unsigned assigned
:1;
1300 unsigned data_len
, data_max
;
1302 unsigned names_len
, names_max
;
1306 typedef uint32_t hddb_entry_mask_t
;
1308 typedef struct hddb_list_s
{
1309 hddb_entry_mask_t key_mask
;
1310 hddb_entry_mask_t value_mask
;
1316 unsigned list_len
, list_max
;
1318 unsigned ids_len
, ids_max
;
1320 unsigned strings_len
, strings_max
;
1341 typedef enum resource_types
{
1342 res_any
, res_phys_mem
, res_mem
, res_io
, res_irq
, res_dma
, res_monitor
,
1343 res_size
, res_disk_geo
, res_cache
, res_baud
, res_init_strings
, res_pppd_option
,
1344 res_framebuffer
, res_hwaddr
, res_link
, res_wlan
1345 } hd_resource_types_t
;
1349 * size units (cf. (res_size_t).unit)
1351 typedef enum size_units
{
1352 size_unit_cm
, size_unit_cinch
, size_unit_byte
, size_unit_sectors
,
1353 size_unit_kbyte
, size_unit_mbyte
, size_unit_gbyte
1357 * access types for I/O and memory resources
1359 typedef enum access_flags
{
1360 acc_unknown
, acc_ro
, acc_wo
, acc_rw
/* unknown, read only, write only, read/write */
1361 } hd_access_flags_t
;
1364 typedef enum yes_no_flag
{
1365 flag_unknown
, flag_no
, flag_yes
/* unknown, no, yes */
1369 typedef enum geo_types
{
1370 geo_physical
= 0, geo_logical
, geo_bios_edd
, geo_bios_legacy
1375 * definitions for the various resource types
1378 union u_hd_res_t
*next
;
1379 enum resource_types type
;
1383 union u_hd_res_t
*next
;
1384 enum resource_types type
;
1385 uint64_t base
, range
;
1387 enabled
:1, /* 0: disabled, 1 enabled */
1388 access
:2, /* enum access_flags */
1389 prefetch
:2; /* enum yes_no_flag */
1393 union u_hd_res_t
*next
;
1394 enum resource_types type
;
1399 union u_hd_res_t
*next
;
1400 enum resource_types type
;
1401 uint64_t base
, range
;
1403 enabled
:1, /* 0: disabled, 1 enabled */
1404 access
:2; /* enum access_flags */
1408 union u_hd_res_t
*next
;
1409 enum resource_types type
;
1411 unsigned triggered
; /* # of interrupts */
1412 unsigned enabled
:1; /* 0: disabled, 1 enabled */
1416 union u_hd_res_t
*next
;
1417 enum resource_types type
;
1419 unsigned enabled
:1; /* 0: disabled, 1 enabled */
1423 union u_hd_res_t
*next
;
1424 enum resource_types type
;
1425 enum size_units unit
;
1426 uint64_t val1
, val2
; /* to allow for 2D values */
1430 union u_hd_res_t
*next
;
1431 enum resource_types type
;
1433 unsigned bits
, stopbits
;
1434 char parity
; /* n, e, o, s, m */
1435 char handshake
; /* -, h, s */
1439 union u_hd_res_t
*next
;
1440 enum resource_types type
;
1441 unsigned size
; /* in kbyte */
1445 union u_hd_res_t
*next
;
1446 enum resource_types type
;
1447 unsigned cyls
, heads
, sectors
;
1449 enum geo_types geotype
; /* 0-3: physical/logical/bios edd/bios legacy */
1453 union u_hd_res_t
*next
;
1454 enum resource_types type
;
1455 unsigned width
, height
; /* in pixel */
1456 unsigned vfreq
; /* in Hz */
1457 unsigned interlaced
:1; /* 0/1 */
1461 union u_hd_res_t
*next
;
1462 enum resource_types type
;
1465 } res_init_strings_t
;
1468 union u_hd_res_t
*next
;
1469 enum resource_types type
;
1471 } res_pppd_option_t
;
1474 union u_hd_res_t
*next
;
1475 enum resource_types type
;
1476 unsigned width
, height
; /* in pixel */
1477 unsigned bytes_p_line
; /* line length in bytes (do not confuse with 'width') */
1478 unsigned colorbits
; /* 4, 8, 15, 16, 24, 32 */
1479 unsigned mode
; /* mode number for kernel */
1480 } res_framebuffer_t
;
1483 union u_hd_res_t
*next
;
1484 enum resource_types type
;
1489 union u_hd_res_t
*next
;
1490 enum resource_types type
;
1491 unsigned state
:1; /* network link state: 0 - not connected, 1 - connected */
1494 /* wlan capabilities */
1496 union u_hd_res_t
*next
;
1497 enum resource_types type
;
1498 str_list_t
*channels
;
1499 str_list_t
*frequencies
; /* in GHz units */
1500 str_list_t
*bitrates
; /* in Mbps units */
1501 str_list_t
*auth_modes
; /* open, sharedkey, wpa-psk, wpa-eap, wpa-leap */
1502 str_list_t
*enc_modes
; /* WEP40, WEP104, WEP128, WEP232, TKIP, CCMP */
1505 typedef union u_hd_res_t
{
1506 union u_hd_res_t
*next
;
1510 res_phys_mem_t phys_mem
;
1516 res_disk_geo_t disk_geo
;
1517 res_monitor_t monitor
;
1518 res_init_strings_t init_strings
;
1519 res_pppd_option_t pppd_option
;
1520 res_framebuffer_t framebuffer
;
1521 res_hwaddr_t hwaddr
;
1528 * data gathered by the misc module; basically resources from /proc
1531 uint64_t addr
, size
;
1543 unsigned irq
, events
;
1550 unsigned io_len
, dma_len
, irq_len
;
1554 str_list_t
*proc_io
, *proc_dma
, *proc_irq
;
1557 typedef struct s_serial_t
{
1558 struct s_serial_t
*next
;
1561 unsigned line
, port
, irq
, baud
;
1564 typedef struct s_ser_device_t
{
1565 struct s_ser_device_t
*next
;
1568 str_list_t
*at_resp
;
1571 unsigned max_baud
, cur_baud
;
1572 unsigned is_mouse
:1;
1573 unsigned is_modem
:1;
1575 unsigned char buf
[0x1000];
1577 int garbage
, non_pnp
, pnp
;
1578 unsigned char pnp_id
[8];
1579 char *serial
, *class_name
, *dev_id
, *user_name
, *vend
, *init_string1
, *init_string2
, *pppd_option
;
1585 * Notes on isdn_parm_t:
1586 * - def_value is only relevant of alt_values != 0
1587 * - def_value should be a value out of alt_value[]
1588 * - see libihw docu for the meaning of name,type,flags,def_value
1590 typedef struct isdn_parm_s
{
1591 struct isdn_parm_s
*next
;
1592 char *name
; /* parameter name */
1593 unsigned valid
:1; /* 1: entry is valid, 0: some inconsistencies */
1594 unsigned conflict
:1; /* 1: ressource conflict (eg. no free irq) */
1595 uint64_t value
; /* value of the parameter */
1596 unsigned type
; /* CDBISDN type (P_...) */
1597 unsigned flags
; /* CDBISDN flags (P_...) */
1598 unsigned def_value
; /* default value */
1599 int alt_values
; /* length of alt_value[] */
1600 unsigned *alt_value
; /* possible values */
1603 /* device driver info types */
1604 typedef enum driver_info_type
{
1605 di_any
, di_display
, di_module
, di_mouse
, di_x11
, di_isdn
, di_kbd
, di_dsl
1608 /* unspecific info */
1610 union driver_info_u
*next
;
1611 enum driver_info_type type
; /* driver info type */
1612 str_list_t
*hddb0
, *hddb1
; /* the actual driver database entries */
1613 } driver_info_any_t
;
1615 /* display (monitor) info */
1617 union driver_info_u
*next
;
1618 enum driver_info_type type
; /* driver info type */
1619 str_list_t
*hddb0
, *hddb1
; /* the actual driver database entries */
1620 unsigned width
, height
; /* max. useful display geometry */
1621 unsigned min_vsync
, max_vsync
; /* vsync range */
1622 unsigned min_hsync
, max_hsync
; /* hsync range */
1623 unsigned bandwidth
; /* max. pixel clock */
1624 } driver_info_display_t
;
1628 union driver_info_u
*next
;
1629 enum driver_info_type type
; /* driver info type */
1630 str_list_t
*hddb0
, *hddb1
; /* the actual driver database entries */
1631 unsigned active
:1; /* if module is currently active */
1632 unsigned modprobe
:1; /* modprobe or insmod */
1633 str_list_t
*names
; /* (ordered) list of module names */
1634 str_list_t
*mod_args
; /* list of module args (corresponds to the module name list) */
1635 char *conf
; /* conf.modules entry, if any (e.g. for sb.o) */
1636 } driver_info_module_t
;
1638 /* mouse protocol info */
1640 union driver_info_u
*next
;
1641 enum driver_info_type type
; /* driver info type */
1642 str_list_t
*hddb0
, *hddb1
; /* the actual driver database entries */
1643 char *xf86
; /* the XF86 protocol name */
1644 char *gpm
; /* dto, gpm */
1645 int buttons
; /* number of buttons, -1 --> unknown */
1646 int wheels
; /* dto, wheels */
1647 } driver_info_mouse_t
;
1649 /* X11 server info */
1651 union driver_info_u
*next
;
1652 enum driver_info_type type
; /* driver info type */
1653 str_list_t
*hddb0
, *hddb1
; /* the actual driver database entries */
1654 char *server
; /* the server/module name */
1655 char *xf86_ver
; /* XFree86 version (3 or 4) */
1656 unsigned x3d
:1; /* has 3D support */
1658 unsigned all
:5; /* the next 5 entries combined */
1659 unsigned c8
:1, c15
:1, c16
:1, c24
:1, c32
:1;
1660 } colors
; /* supported color depths */
1661 unsigned dacspeed
; /* max. ramdac clock */
1662 str_list_t
*extensions
; /* additional X extensions to load ('Module' section) */
1663 str_list_t
*options
; /* special server options */
1664 str_list_t
*raw
; /* extra info to add to XF86Config */
1665 char *script
; /* 3d script to run */
1666 } driver_info_x11_t
;
1670 union driver_info_u
*next
;
1671 enum driver_info_type type
; /* driver info type */
1672 str_list_t
*hddb0
, *hddb1
; /* the actual driver database entries */
1673 int i4l_type
, i4l_subtype
; /* I4L types */
1674 char *i4l_name
; /* I4L card name */
1675 isdn_parm_t
*params
; /* isdn parameters */
1676 } driver_info_isdn_t
;
1680 union driver_info_u
*next
;
1681 enum driver_info_type type
; /* driver info type */
1682 str_list_t
*hddb0
, *hddb1
; /* the actual driver database entries */
1683 char *mode
; /* DSL driver types */
1684 char *name
; /* DSL driver name */
1685 } driver_info_dsl_t
;
1689 union driver_info_u
*next
;
1690 enum driver_info_type type
; /* driver info type */
1691 str_list_t
*hddb0
, *hddb1
; /* the actual driver database entries */
1692 char *XkbRules
; /* XF86Config entries */
1695 char *keymap
; /* console keymap */
1696 } driver_info_kbd_t
;
1699 * holds device driver info
1701 typedef union driver_info_u
{
1702 union driver_info_u
*next
;
1703 driver_info_any_t any
;
1704 driver_info_module_t module
;
1705 driver_info_mouse_t mouse
;
1706 driver_info_x11_t x11
;
1707 driver_info_display_t display
;
1708 driver_info_isdn_t isdn
;
1709 driver_info_dsl_t dsl
;
1710 driver_info_kbd_t kbd
;
1715 * Some hardware doesn't fit into the hd_t scheme or there is info we
1716 * gathered during the scan process but that no-one really cares about. Such
1717 * stuff is stored in hd_detail_t.
1719 typedef enum hd_detail_type
{
1720 hd_detail_pci
, hd_detail_usb
, hd_detail_isapnp
, hd_detail_cdrom
,
1721 hd_detail_floppy
, hd_detail_bios
, hd_detail_cpu
, hd_detail_prom
,
1722 hd_detail_monitor
, hd_detail_sys
, hd_detail_scsi
, hd_detail_devtree
,
1727 enum hd_detail_type type
;
1732 enum hd_detail_type type
;
1737 enum hd_detail_type type
;
1739 } hd_detail_isapnp_t
;
1742 enum hd_detail_type type
;
1744 } hd_detail_cdrom_t
;
1747 enum hd_detail_type type
;
1748 floppy_info_t
*data
;
1749 } hd_detail_floppy_t
;
1752 enum hd_detail_type type
;
1757 enum hd_detail_type type
;
1762 enum hd_detail_type type
;
1767 enum hd_detail_type type
;
1768 monitor_info_t
*data
;
1769 } hd_detail_monitor_t
;
1772 enum hd_detail_type type
;
1777 enum hd_detail_type type
;
1782 enum hd_detail_type type
;
1784 } hd_detail_devtree_t
;
1787 enum hd_detail_type type
;
1792 enum hd_detail_type type
;
1793 hd_detail_pci_t pci
;
1794 hd_detail_usb_t usb
;
1795 hd_detail_isapnp_t isapnp
;
1796 hd_detail_cdrom_t cdrom
;
1797 hd_detail_floppy_t floppy
;
1798 hd_detail_bios_t bios
;
1799 hd_detail_cpu_t cpu
;
1800 hd_detail_prom_t prom
;
1801 hd_detail_monitor_t monitor
;
1802 hd_detail_sys_t sys
;
1803 hd_detail_scsi_t scsi
;
1804 hd_detail_devtree_t devtree
;
1805 hd_detail_ccw_t ccw
;
1809 /* info about manually configured hardware (in /var/lib/hardware/) */
1810 typedef struct hd_manual_s
{
1811 struct hd_manual_s
*next
;
1820 char *config_string
;
1822 /* More or less free-form key, value pairs.
1823 * key should not contain '=', however.
1831 * Individual hardware item.
1832 * Every hardware component gets an \ref hd_t entry. A list of all hardware
1833 * items is in \ref hd_data_t::hd.
1835 typedef struct s_hd_t
{
1836 struct s_hd_t
*next
; /**< Link to next hardware item. */
1838 * Unique index, starting at 1.
1839 * Use \ref hd_get_device_by_idx() to look up an hardware entry by index. And don't
1845 * Hardware appears to be broken in some way.
1846 * This was used to indicate broken framebuffer support of some graphics cards.
1852 * Bus type (id and name).
1857 * Slot and bus number.
1858 * Bits 0-7: slot number, 8-31 bus number.
1868 * Base class (id and name).
1873 * Sub class (id and name).
1878 * (PCI) programming interface (id and name).
1883 * Vendor id and name.
1884 * Id is actually a combination of some tag to differentiate the
1885 * various id types and the real id. Use the \ref ID_VALUE macro to
1886 * get e.g. the real PCI id value for a PCI %device.
1891 * Device id and name.
1892 * Id is actually a combination of some tag to differentiate the
1893 * various id types and the real id. Use the \ref ID_VALUE macro to
1894 * get e.g. the real PCI id value for a PCI %device.
1895 * \note If you're looking or something printable, you might want to use \ref hd_t::model
1901 * Subvendor id and name.
1902 * Id is actually a combination of some tag to differentiate the
1903 * various id types and the real id. Use the \ref ID_VALUE macro to
1904 * get e.g. the real PCI id value for a PCI %device.
1909 * Subdevice id and name.
1910 * Id is actually a combination of some tag to differentiate the
1911 * various id types and the real id. Use the \ref ID_VALUE macro to
1912 * get e.g. the real PCI id value for a PCI %device.
1917 * Revision id or string.
1918 * If revision is numerical (e.g. PCI) \ref hd_id_t::id is used.
1919 * If revision is some char data (e.g. disk drives) it is stored in \ref hd_id_t::name.
1929 * Vendor id and name of some compatible hardware.
1930 * Used mainly for ISA-PnP devices.
1932 hd_id_t compat_vendor
;
1935 * Device id and name of some compatible hardware.
1936 * Used mainly for ISA-PnP devices.
1938 hd_id_t compat_device
;
1942 * Not to confuse with \ref base_class!
1944 hd_hw_item_t hw_class
;
1947 * Hardware class list.
1948 * A device may belong to more than one hardware class.
1950 unsigned char hw_class_list
[(hw_all
+ 7) / 8]; /**< (Internal) bitmask of hw classes. */
1954 * This is a combination of vendor and %device names. Some heuristics is used
1955 * to make it more presentable. Use this instead of \ref hd_t::vendor and
1956 * \ref hd_t::device.
1961 * Device this hardware is attached to.
1962 * Link to some 'parent' %device. Use \ref hd_get_device_by_idx() to get
1963 * the corresponding hardware entry.
1965 unsigned attached_to
;
1968 * sysfs entry for this hardware, if any.
1973 * sysfs bus id for this hardware, if any.
1978 * sysfs device link.
1980 char *sysfs_device_link
;
1983 * Special %device file.
1984 * Device file name to access this hardware. Normally something below /dev.
1985 * For network interfaces this is the interface name.
1987 char *unix_dev_name
;
1990 * Device type & number according to sysfs.
1992 hd_dev_num_t unix_dev_num
;
1995 * List of %device names.
1996 * Device file names to access this hardware. Normally something below /dev.
1997 * They should be all equivalent. The preferred name however is
1998 * \ref hd_t::unix_dev_name.
2000 str_list_t
*unix_dev_names
;
2003 * Special %device file.
2004 * Device file name to access this hardware. Most hardware only has one
2005 * %device name stored in \ref hd_t::unix_dev_name. But in some cases
2006 * there's an alternative name.
2008 char *unix_dev_name2
;
2011 * Device type & number according to sysfs.
2013 hd_dev_num_t unix_dev_num2
;
2017 * Where appropriate, this is a special BIOS/PROM id (e.g. "0x80" for
2018 * the first harddisk on Intel-PCs).
2024 * Unique id for this hardware.
2025 * A unique string identifying this hardware. The string consists
2026 * of two parts separated by a dot ("."). The part before the dot
2027 * describes the location (where the hardware is attached in the system).
2028 * The part after the dot identifies the hardware itself. The string
2029 * must not contain slashes ("/") because we're going to create files
2030 * with this id as name. Apart from this there are no restrictions on
2031 * the form of this string.
2036 str_list_t
*unique_ids
;
2039 * (Internal) Probing module that created this entry.
2044 * (Internal) Source code line where this entry was created.
2049 * (Internal) Counter, used in combination with \ref hd_t::module and \ref hd_t::line.
2059 * Special info associated with this hardware.
2060 * \note This is going to change!
2062 hd_detail_t
*detail
;
2065 * (Internal) Unspecific text info.
2066 * It is used to track IDE interfaces and assign them to the correct
2069 str_list_t
*extra_info
;
2072 * Hardware status (if available).
2073 * The status is stored in files below /var/lib/hardware/unique-keys/. Every
2074 * hardware item gets a file there with its unique id as file name.
2079 * Some %config info.
2080 * Every hardware item may get some string assigned. This string is stored
2081 * in files below /var/lib/hardware/unique-keys/. There is no meaning
2082 * associated with this string.
2084 char *config_string
;
2087 * Hotplug controller for this %device.
2088 * It indicates what kind of hotplug %device (if any) this is.
2090 hd_hotplug_t hotplug
;
2093 * Slot the hotplug device is connected to (e.g. PCMCIA socket).
2094 * \note \ref hotplug_slot counts 1-based (0: no information available).
2096 unsigned hotplug_slot
;
2099 unsigned agp
:1; /* AGP device */
2100 unsigned isapnp
:1; /* ISA-PnP device */
2101 unsigned notready
:1; /* block devices: no medium, other: device not configured */
2102 unsigned manual
:1; /* undetectable, manually configured hardware */
2103 unsigned softraiddisk
:1; /* disk belongs to some soft raid array */
2104 unsigned zip
:1; /* zip floppy */
2105 unsigned cdr
:1; /* CD-R */
2106 unsigned cdrw
:1; /* CD-RW */
2107 unsigned dvd
:1; /* DVD */
2108 unsigned dvdr
:1; /* DVD-R */
2109 unsigned dvdram
:1; /* DVD-RAM */
2110 unsigned pppoe
:1; /* PPPOE modem connected */
2111 unsigned wlan
:1; /* WLAN card */
2114 struct tag_s
{ /* this struct is for internal purposes only */
2115 unsigned remove
:1; /* schedule for removal */
2116 unsigned freeit
:1; /* for internal memory management */
2117 unsigned fixed
:1; /* fixed, do no longer modify this entry */
2118 unsigned ser_skip
:1; /* if serial line, don't scan for devices */
2119 unsigned ser_device
:2; /* if != 0: info about attached serial device; see serial.c */
2123 * (Internal) First 512 bytes of block devices.
2124 * To check accessibility of block devices we read the first block. The data
2125 * is used to identify the boot %device.
2127 unsigned char *block0
;
2130 * Currently active driver.
2135 * List of currently active drivers.
2137 str_list_t
*drivers
;
2140 * Old \ref unique_id for compatibility.
2141 * The calculation of unique ids has changed in libhd v3.17. Basically
2142 * we no longer use the vendor/%device names if there are vendor/%device
2143 * ids. (Otherwise a simple %device name database update would change the id,
2144 * which is really not what you want.)
2146 char *old_unique_id
;
2149 * \ref unique_id of parent (\ref attached_to).
2150 * \note Please do not use it for now.
2156 * \ref unique_ids of children (\ref parent_id).
2157 * \note Please do not use it for now.
2160 str_list_t
*child_ids
;
2163 * (Internal) location independent \ref unique_id part.
2164 * The speed up some internal searches, we store it here separately.
2169 * USB Global Unique Identifier.
2170 * Available for USB devices. This may even be set if \ref hd_t::bus is not
2171 * \ref bus_usb (e.g. USB storage devices will have \ref hd_t::bus set to
2172 * \ref bus_scsi due to SCSI emulation).
2176 driver_info_t
*driver_info
; /* device driver info */
2178 str_list_t
*requires
; /* packages/programs required for this hardware */
2181 * These are used internally for memory management.
2182 * Do not even _think_ of modifying these!
2184 unsigned ref_cnt
; /**< (Internal) memory reference count. */
2185 struct s_hd_t
*ref
; /**< (Internal) if set, this is only a reference. */
2190 * Holds all data accumulated during hardware probing.
2194 * Current hardware list.
2195 * The list of all currently probed hardware. This is not identical with
2196 * the result of \ref hd_list(). (But a superset of it.)
2201 * A progress indicator.
2202 * If this callback function is not NULL, it is called at various points and can
2203 * be used to give some user feedback what we are actually doing.
2204 * If the debug flag HD_DEB_PROGRESS is set, progress messages are logged.
2205 * \param pos Indicates where we are.
2206 * \param msg Indicates what we are going to do.
2208 void (*progress
)(char *pos
, char *msg
);
2211 * All messages logged during hardware probing accumulate here.
2216 * Although there exist some debug flag defines this scheme is currently
2217 * not followed consistently. It is guaranteed however that -1 will give
2218 * the most log messages and 0 the least.
2224 * Influence hardware probing in some strange ways with these. You normally
2225 * do not want to use them.
2227 struct flag_struct
{
2228 unsigned internal
:1; /**< \ref hd_scan() has been called internally. */
2229 unsigned dformat
:2; /**< Alternative output format. */
2230 unsigned no_parport
:1; /**< Don't do parport probing: parport modules (used to) crash pmacs. */
2231 unsigned iseries
:1; /**< Set if we are on an iSeries machine. */
2232 unsigned list_all
:1; /**< Return even devices with status 'not available'. */
2233 unsigned fast
:1; /**< Don't check tricky hardware. */
2234 unsigned list_md
:1; /**< Report md & lvm devices from /proc/partitions */
2235 unsigned nofork
:1; /**< don't run potentially hanging code in a subprocess */
2236 unsigned nosysfs
:1; /**< don't ask sysfs */
2237 unsigned forked
:1; /**< we're running in a subprocess */
2238 unsigned cpuemu
:1; /**< use CPU emulation to run BIOS code (i386 only) */
2239 unsigned udev
:1; /**< return first udev symlink as device name */
2240 unsigned edd_used
:1; /**< internal: edd info has been used */
2241 unsigned keep_kmods
:2; /**< internal: don't reread kmods */
2245 /** Concentrate on these devices.
2246 * List of sysfs ids for devices to look for.
2251 * The following entries should *not* be accessed outside of libhd!
2253 unsigned char probe
[(pr_all
+ 7) / 8]; /**< (Internal) bitmask of probing features. */
2254 unsigned char probe_set
[(pr_all
+ 7) / 8]; /**< (Iternal) bitmask of probing features that will always be set. */
2255 unsigned char probe_clr
[(pr_all
+ 7) / 8]; /**< (Internal) bitmask of probing features that will always be reset. */
2256 unsigned last_idx
; /**< (Internal) index of the last hd entry generated */
2257 unsigned module
; /**< (Internal) the current probing module we are in */
2258 enum boot_arch boot
; /**< (Internal) boot method */
2259 hd_t
*old_hd
; /**< (Internal) old (outdated) entries (if you scan more than once) */
2260 pci_t
*pci
; /**< (Internal) raw PCI data */
2261 isapnp_t
*isapnp
; /**< (Internal) raw ISA-PnP data */
2262 cdrom_info_t
*cdrom
; /**< (Internal) CDROM devs from PROC_CDROM_INFO */
2263 str_list_t
*net
; /**< (Internal) list of network interfaces */
2264 str_list_t
*floppy
; /**< (Internal) contents of PROC_NVRAM, used by the floppy module */
2265 misc_t
*misc
; /**< (Internal) data gathered in the misc module */
2266 serial_t
*serial
; /**< (Internal) /proc's serial info */
2267 scsi_t
*scsi
; /**< (Internal) raw SCSI data */
2268 ser_device_t
*ser_mouse
; /**< (Internal) info about serial mice */
2269 ser_device_t
*ser_modem
; /**< (Internal) info about serial modems */
2270 str_list_t
*cpu
; /**< (Internal) /proc/cpuinfo */
2271 str_list_t
*klog
; /**< (Internal) kernel log */
2272 str_list_t
*proc_usb
; /**< (Internal) /proc/bus/usb info */
2273 usb_t
*usb
; /**< (Internal) usb info */
2274 hddb_pci_t
*hddb_pci_hm
; /**< (Internal) pci module info */
2275 hddb_pci_t
*hddb_pci
; /**< (Internal) pci module info */
2276 hddb2_data_t
*hddb2
[2]; /**< (Internal) hardware database */
2277 str_list_t
*kmods
; /**< (Internal) list of active kernel modules */
2278 uint64_t used_irqs
; /**< (Internal) irq usage */
2279 uint64_t assigned_irqs
; /**< (Internal) irqs automatically assigned by libhd (for driver info) */
2280 memory_range_t bios_rom
; /**< (Internal) BIOS 0xc0000 - 0xfffff */
2281 memory_range_t bios_ram
; /**< (Internal) BIOS 0x00400 - 0x004ff */
2282 memory_range_t bios_ebda
; /**< (Internal) EBDA */
2283 unsigned display
; /**< (Internal) hd_idx of the active (vga) display */
2284 unsigned color_code
; /**< (Internal) color, if any */
2285 char *cmd_line
; /**< (Internal) kernel command line */
2286 str_list_t
*xtra_hd
; /**< (Internal) fake hd entries (for testing) */
2287 devtree_t
*devtree
; /**< (Internal) prom device tree on ppc */
2288 unsigned kernel_version
; /**< (Internal) kernel version */
2289 int in_vmware
; /**< (Internal) running in vmware */
2290 hd_manual_t
*manual
; /**< (Internal) hardware config info */
2291 str_list_t
*disks
; /**< (Internal) disks according to /proc/partitions */
2292 str_list_t
*partitions
; /**< (Internal) dto, partitions */
2293 str_list_t
*cdroms
; /**< (Internal) cdroms according to PROC_CDROM_INFO */
2294 hd_smbios_t
*smbios
; /**< (Internal) smbios data */
2302 } shm
; /**< (Internal) our shm segment */
2303 unsigned pci_config_type
; /**< (Internal) PCI config type (1 or 2), 0: unknown */
2304 hd_udevinfo_t
*udevinfo
; /**< (Internal) udev info */
2305 hd_sysfsdrv_t
*sysfsdrv
; /**< (Internal) sysfs driver info */
2306 uint64_t sysfsdrv_id
; /**< (Internal) sysfs driver info id */
2307 str_list_t
*scanner_db
; /**< (Internal) list of scanner modules */
2308 edd_info_t edd
[0x80]; /**< (Internal) enhanced disk drive data */
2312 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2314 * libhd interface functions
2316 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2319 /* implemented in hd.c */
2321 /* the actual hardware scan */
2322 void hd_scan(hd_data_t
*hd_data
);
2325 hd_data_t
*hd_free_hd_data(hd_data_t
*hd_data
);
2327 //! Free hardware items returned by e.g. \ref hd_list().
2328 hd_t
*hd_free_hd_list(hd_t
*hd
);
2330 void hd_set_probe_feature(hd_data_t
*hd_data
, enum probe_feature feature
);
2331 void hd_clear_probe_feature(hd_data_t
*hd_data
, enum probe_feature feature
);
2332 int hd_probe_feature(hd_data_t
*hd_data
, enum probe_feature feature
);
2333 void hd_set_probe_feature_hw(hd_data_t
*hd_data
, hd_hw_item_t item
);
2335 enum probe_feature
hd_probe_feature_by_name(char *name
);
2336 char *hd_probe_feature_by_value(enum probe_feature feature
);
2338 int hd_module_is_active(hd_data_t
*hd_data
, char *mod
);
2340 hd_t
*hd_base_class_list(hd_data_t
*hd_data
, unsigned base_class
);
2341 hd_t
*hd_sub_class_list(hd_data_t
*hd_data
, unsigned base_class
, unsigned sub_class
);
2342 hd_t
*hd_bus_list(hd_data_t
*hd_data
, unsigned bus
);
2343 const char* hd_busid_to_hwcfg(int busid
);
2344 hd_t
*hd_list(hd_data_t
*hd_data
, hd_hw_item_t item
, int rescan
, hd_t
*hd_old
);
2345 hd_t
*hd_list_with_status(hd_data_t
*hd_data
, hd_hw_item_t item
, hd_status_t status
);
2346 hd_t
*hd_list2(hd_data_t
*hd_data
, hd_hw_item_t
*items
, int rescan
);
2347 hd_t
*hd_list_with_status2(hd_data_t
*hd_data
, hd_hw_item_t
*items
, hd_status_t status
);
2349 int hd_has_pcmcia(hd_data_t
*hd_data
);
2350 // will be gone soon
2351 // int hd_apm_enabled(hd_data_t *hd_data);
2352 int hd_usb_support(hd_data_t
*hd_data
);
2353 int hd_smp_support(hd_data_t
*hd_data
);
2354 int hd_mac_color(hd_data_t
*hd_data
);
2355 int hd_color(hd_data_t
*hd_data
);
2356 int hd_is_uml(hd_data_t
*hd_data
);
2357 unsigned hd_display_adapter(hd_data_t
*hd_data
);
2358 unsigned hd_boot_disk(hd_data_t
*hd_data
, int *matches
);
2359 enum cpu_arch
hd_cpu_arch(hd_data_t
*hd_data
);
2360 enum boot_arch
hd_boot_arch(hd_data_t
*hd_data
);
2362 hd_t
*hd_get_device_by_idx(hd_data_t
*hd_data
, unsigned idx
);
2364 void hd_set_hw_class(hd_t
*hd
, hd_hw_item_t hw_class
);
2365 int hd_is_hw_class(hd_t
*hd
, hd_hw_item_t hw_class
);
2367 int hd_is_sgi_altix(hd_data_t
*hd_data
);
2369 char *hd_version(void);
2371 /* implemented in hddb.c */
2373 str_list_t
*get_hddb_packages(hd_data_t
*hd_data
);
2374 void hddb_add_info(hd_data_t
*hd_data
, hd_t
*hd
);
2376 void hddb_dump_raw(hddb2_data_t
*hddb
, FILE *f
);
2377 void hddb_dump(hddb2_data_t
*hddb
, FILE *f
);
2379 /* implemented in hdp.c */
2381 void hd_dump_entry(hd_data_t
*hd_data
, hd_t
*hd
, FILE *f
);
2384 /* implemented in cdrom.c */
2386 cdrom_info_t
*hd_read_cdrom_info(hd_data_t
*hd_data
, hd_t
*hd
);
2388 /* implemented in manual.c */
2389 hd_manual_t
*hd_manual_read_entry(hd_data_t
*hd_data
, const char *id
);
2390 int hd_manual_write_entry(hd_data_t
*hd_data
, hd_manual_t
*entry
);
2391 hd_manual_t
*hd_free_manual(hd_manual_t
*manual
);
2392 hd_t
*hd_read_config(hd_data_t
*hd_data
, const char *id
);
2393 int hd_write_config(hd_data_t
*hd_data
, hd_t
*hd
);
2394 char *hd_hw_item_name(hd_hw_item_t item
);
2395 char *hd_status_value_name(hd_status_value_t status
);
2396 int hd_change_status(const char *id
, hd_status_t status
, const char *config_string
);
2397 int hd_read_mmap(hd_data_t
*hd_data
, char *name
, unsigned char *buf
, off_t start
, unsigned size
);
2401 * - - - - - CDB ISDN interface - - - - -
2405 /* (C) 2003 kkeil@suse.de */
2407 #define CDBISDN_VERSION 0x0101
2410 #define PCI_ANY_ID 0xffff
2413 #define CDBISDN_P_NONE 0x0
2414 #define CDBISDN_P_IRQ 0x1
2415 #define CDBISDN_P_MEM 0x2
2416 #define CDBISDN_P_IO 0x3
2427 int handle
; /* internal identifier idx in database */
2428 int vhandle
; /* internal identifier to vendor database */
2429 char *name
; /* cardname */
2430 char *lname
; /* vendor short name + cardname */
2431 char *Class
; /* CLASS of the card */
2432 char *bus
; /* bus type */
2433 int revision
; /* revision used with USB */
2434 int vendor
; /* Vendor ID for ISAPNP and PCI cards */
2435 int device
; /* Device ID for ISAPNP and PCI cards */
2436 int subvendor
; /* Subvendor ID for PCI cards */
2437 /* A value of 0xffff is ANY_ID */
2438 int subdevice
; /* Subdevice ID for PCI cards */
2439 /* A value of 0xffff is ANY_ID */
2440 unsigned int features
; /* feature flags */
2441 int line_cnt
; /* count of ISDN ports */
2442 int vario_cnt
; /* count of driver varios */
2443 int vario
; /* referenz to driver vario record */
2447 int handle
; /* idx in database */
2448 int next_vario
; /* link to alternate vario */
2449 int drvid
; /* unique id of the driver vario */
2450 int typ
; /* Type to identify the driver */
2451 int subtyp
; /* Subtype of the driver type */
2452 int smp
; /* SMP supported ? */
2453 char *mod_name
; /* name of the driver module */
2454 char *para_str
; /* optional parameter string */
2455 char *mod_preload
; /* optional modules to preload */
2456 char *cfg_prog
; /* optional cfg prog */
2457 char *firmware
; /* optional firmware to load */
2458 char *description
; /* optional description */
2459 char *need_pkg
; /* list of packages needed for function */
2460 char *info
; /* optional additional info */
2461 char *protocol
; /* supported D-channel protocols */
2462 char *interface
; /* supported API interfaces */
2463 char *io
; /* possible IO ports with legacy ISA cards */
2464 char *irq
; /* possible interrupts with legacy ISA cards */
2465 char *membase
; /* possible membase with legacy ISA cards */
2466 char *features
; /* optional features*/
2467 int card_ref
; /* reference to a card */
2468 char *name
; /* driver name */
2472 extern cdb_isdn_vendor
*hd_cdbisdn_get_vendor(int);
2473 extern cdb_isdn_card
*hd_cdbisdn_get_card(int);
2474 extern cdb_isdn_vario
*hd_cdbisdn_get_vario_from_type(int, int);
2475 extern cdb_isdn_card
*hd_cdbisdn_get_card_from_type(int, int);
2476 extern cdb_isdn_card
*hd_cdbisdn_get_card_from_id(int, int, int, int);
2477 extern cdb_isdn_vario
*hd_cdbisdn_get_vario(int);
2478 extern int hd_cdbisdn_get_version(void);
2479 extern int hd_cdbisdn_get_db_version(void);
2480 extern char *hd_cdbisdn_get_db_date(void);
2482 /* CDB ISDN interface end */