libhd  5.0
hd.h
Go to the documentation of this file.
1 #ifndef _HD_H
2 #define _HD_H
3 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 
14 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
15  *
16  * libhd data structures
17  *
18  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
19  */
20 
22 #define HD_VERSION 16
23 
31 #define HD_DEB_SHOW_LOG (1 << 0)
32 #define HD_DEB_PROGRESS (1 << 1)
33 #define HD_DEB_CREATION (1 << 2)
34 #define HD_DEB_DRIVER_INFO (1 << 3)
35 #define HD_DEB_PCI (1 << 4)
36 #define HD_DEB_ISAPNP (1 << 5)
37 #define HD_DEB_CDROM (1 << 6)
38 #define HD_DEB_NET (1 << 7)
39 #define HD_DEB_FLOPPY (1 << 8)
40 #define HD_DEB_MISC (1 << 9)
41 #define HD_DEB_SERIAL (1 << 10)
42 #define HD_DEB_MONITOR (1 << 11)
43 #define HD_DEB_CPU (1 << 12)
44 #define HD_DEB_BIOS (1 << 13)
45 #define HD_DEB_MOUSE (1 << 14)
46 #define HD_DEB_IDE (1 << 15)
47 #define HD_DEB_SCSI (1 << 16)
48 #define HD_DEB_USB (1 << 17)
49 #define HD_DEB_ADB (1 << 18)
50 #define HD_DEB_MODEM (1 << 19)
51 #define HD_DEB_PARALLEL (1 << 20)
52 #define HD_DEB_ISA (1 << 21)
53 #define HD_DEB_BOOT (1 << 22)
54 #define HD_DEB_HDDB (1 << 23)
55 
57 #include <stdio.h>
58 #include <inttypes.h>
59 #include <termios.h>
60 #include <sys/types.h>
61 
65 #define HARDWARE_DIR "/var/lib/hardware"
66 
81 #define TAG_PCI 1
82 #define TAG_EISA 2
83 #define TAG_USB 3
84 #define TAG_SPECIAL 4
85 #define TAG_PCMCIA 5
90 #define ID_VALUE(id) ((id) & 0xffff)
91 
95 #define ID_TAG(id) (((id) >> 16) & 0xf)
96 
100 #define MAKE_ID(tag, id_val) ((tag << 16) | (id_val))
101 
107 typedef enum probe_feature {
125 
134 typedef enum hw_item {
146 } hd_hw_item_t;
147 
155 typedef enum base_classes {
156  // these *must* match standard PCI class numbers
160 
161  // add our own classes here (starting at 0x100 as PCI values are 8 bit)
167 
169 typedef enum sc_monitor {
172 
174 typedef enum sc_storage {
178 
180 typedef enum sc_display {
183 
185 typedef enum sc_framebuffer {
188 
190 typedef enum sc_bridge {
195 
197 typedef enum sc_comm {
199 } hd_sc_comm_t;
200 
202 typedef enum sc_system {
205 
207 typedef enum sc_input {
209 } hd_sc_input_t;
210 
212 typedef enum sc_serial {
216 
218 typedef enum sc_internal {
222 
224 typedef enum sc_mouse {
227 } hd_sc_mouse_t;
228 
230 typedef enum sc_std {
233 } hd_sc_std_t;
234 
236 typedef enum sc_net_if {
242 
244 typedef enum sc_multimedia {
247 
249 typedef enum sc_keyboard {
252 
254 typedef enum sc_hub {
256 } hd_sc_hub_t;
257 
259 typedef enum sc_camera {
262 
264 typedef enum sc_modem {
266 } hd_sc_modem_t;
267 
269 typedef enum sc_dsl {
271 } hd_sc_dsl_t;
272 
274 typedef enum pif_usb_e {
277 } hd_pif_usb_t;
278 
280 typedef enum pif_cdrom {
282 } hd_pif_cdrom_t ;
283 
285 typedef enum pif_s390disk {
288 
290 typedef enum bus_types {
293 
299 
308 typedef struct {
312  unsigned invalid:1;
313 
323  unsigned reconfig:3;
324 
330  unsigned configured:3;
331 
342  unsigned available:3;
343 
351  unsigned needed:3;
352 
359  unsigned available_orig:3;
360 
364  unsigned active:3;
365 } hd_status_t;
366 
368 typedef enum {
371 
375 typedef enum {
382 } hd_hotplug_t;
383 
394 typedef struct {
395  unsigned id;
396  char *name;
397 } hd_id_t;
398 
399 
404 typedef struct s_str_list_t {
405  struct s_str_list_t *next;
406  char *str;
407 } str_list_t;
408 
409 
413 typedef struct {
414  unsigned char bitmap[16];
415  unsigned bits;
416  unsigned not_empty:1;
418 } hd_bitmap_t;
419 
436 typedef struct {
437  unsigned start, size;
438  unsigned char *data;
440 
441 
445 typedef struct {
446  unsigned ok:1;
447  unsigned rev;
448  unsigned mpfp;
449  unsigned mpconfig_ok:1;
450  unsigned mpconfig;
451  unsigned mpconfig_size;
452  unsigned char feature[5];
453  char oem_id[9];
454  char prod_id[13];
455  unsigned cpus, cpus_en;
456 } smp_info_t;
457 
458 
462 typedef struct vbe_mode_info_s {
463  unsigned number;
464  unsigned attributes;
465  unsigned width, height;
466  unsigned bytes_p_line;
467  unsigned pixel_size;
468  unsigned fb_start;
469  unsigned win_A_start;
470  unsigned win_A_attr;
471  unsigned win_B_start;
472  unsigned win_B_attr;
473  unsigned win_size;
474  unsigned win_gran;
475  unsigned pixel_clock;
477 
483 typedef struct {
484  unsigned ok:1;
485  unsigned version;
486  unsigned oem_version;
487  unsigned memory;
488  unsigned fb_start;
489  char *oem_name;
490  char *vendor_name;
491  char *product_name;
493  unsigned modes;
495  unsigned current_mode;
496  unsigned ddc_ports;
497  unsigned char ddc_port[4][0x80];
498 } vbe_info_t;
499 
500 
504 typedef struct {
505  unsigned id;
506  unsigned char slot;
507  unsigned char bus;
508  unsigned char devfn;
509  unsigned char misc;
510 } cpq_ctlorder_t;
511 
512 
513 typedef struct {
514  unsigned ok:1;
515  unsigned entry;
516  unsigned compaq:1;
517  cpq_ctlorder_t cpq_ctrl[32];
518 } bios32_info_t;
519 
529 typedef enum {
539  sm_mdtd, sm_inactive = 126, sm_end = 127
541 
542 
544 typedef struct {
547  int data_len;
548  unsigned char *data;
550  int handle;
551 } smbios_any_t;
552 
553 
555 typedef struct {
558  int data_len;
559  unsigned char *data;
561  int handle;
562  char *vendor;
563  char *version;
564  char *date;
566  unsigned start;
567  unsigned rom_size;
569 
570 
572 typedef struct {
575  int data_len;
576  unsigned char *data;
578  int handle;
579  char *manuf;
580  char *product;
581  char *version;
582  char *serial;
583  unsigned char uuid[16];
586 
587 
589 typedef struct {
592  int data_len;
593  unsigned char *data;
595  int handle;
596  char *manuf;
597  char *product;
598  char *version;
599  char *serial;
600  char *asset;
603  char *location;
604  int chassis;
606  int *objects;
608 
609 
611 typedef struct {
614  int data_len;
615  unsigned char *data;
617  int handle;
618  char *manuf;
619  char *version;
620  char *serial;
621  char *asset;
623  unsigned lock;
628  unsigned oem;
630 
631 
633 typedef struct {
636  int data_len;
637  unsigned char *data;
639  int handle;
640  char *socket;
642  char *manuf;
643  char *version;
644  char *serial;
645  char *asset;
646  char *part;
649  uint64_t cpu_id;
650  unsigned voltage;
651  unsigned ext_clock;
652  unsigned max_speed;
653  unsigned current_speed;
654  unsigned sock_status;
656  int l1_cache;
657  int l2_cache;
658  int l3_cache;
660 
661 
663 typedef struct {
666  int data_len;
667  unsigned char *data;
669  int handle;
670  char *socket;
671  unsigned max_size;
672  unsigned current_size;
673  unsigned speed;
675  unsigned state;
677  unsigned socketed;
678  unsigned level;
685 
686 
688 typedef struct {
691  int data_len;
692  unsigned char *data;
694  int handle;
696  char *i_des;
698  char *x_des;
701 
702 
704 typedef struct {
707  int data_len;
708  unsigned char *data;
710  int handle;
711  char *desig;
716  unsigned id;
718 } smbios_slot_t;
719 
720 
722 typedef struct {
725  int data_len;
726  unsigned char *data;
728  int handle;
729  unsigned dev_len;
730  struct {
731  char *name;
733  unsigned status;
734  } *dev;
736 
737 
739 typedef struct {
742  int data_len;
743  unsigned char *data;
745  int handle;
747 } smbios_oem_t;
748 
749 
751 typedef struct {
754  int data_len;
755  unsigned char *data;
757  int handle;
760 
761 
763 typedef struct {
766  int data_len;
767  unsigned char *data;
769  int handle;
770  char *current;
771 } smbios_lang_t;
772 
773 
775 typedef struct {
778  int data_len;
779  unsigned char *data;
781  int handle;
782  char *name;
783  int items_len;
786 
787 
789 typedef struct {
792  int data_len;
793  unsigned char *data;
795  int handle;
799  unsigned max_size;
801  unsigned slots;
803 
804 
806 typedef struct {
809  int data_len;
810  unsigned char *data;
812  int handle;
813  char *location;
814  char *bank;
815  char *manuf;
816  char *serial;
817  char *asset;
818  char *part;
821  unsigned width;
822  unsigned eccbits;
823  unsigned size;
825  unsigned set;
828  unsigned speed;
830 
831 
833 typedef struct {
836  int data_len;
837  unsigned char *data;
839  int handle;
843  unsigned syndrome;
844  unsigned array_addr;
845  unsigned device_addr;
846  unsigned range;
848 
849 
851 typedef struct {
854  int data_len;
855  unsigned char *data;
857  int handle;
859  uint64_t start_addr;
860  uint64_t end_addr;
861  unsigned part_width;
863 
864 
866 typedef struct {
869  int data_len;
870  unsigned char *data;
872  int handle;
875  uint64_t start_addr;
876  uint64_t end_addr;
877  unsigned row_pos;
878  unsigned interleave_pos;
879  unsigned interleave_depth;
881 
882 
884 typedef struct {
887  int data_len;
888  unsigned char *data;
890  int handle;
893  unsigned buttons;
895 
896 
898 typedef struct {
901  int data_len;
902  unsigned char *data;
904  int handle;
910 
911 
913 typedef struct {
916  int data_len;
917  unsigned char *data;
919  int handle;
920  unsigned month;
921  unsigned day;
922  unsigned hour;
923  unsigned minute;
924  unsigned second;
926 
927 
929 typedef struct {
932  int data_len;
933  unsigned char *data;
935  int handle;
939  unsigned syndrome;
940  uint64_t array_addr;
941  uint64_t device_addr;
942  unsigned range;
944 
945 
947 typedef union u_hd_smbios_t {
972 } hd_smbios_t;
973 
981 typedef struct s_udevinfo_t {
983  char *sysfs;
984  char *name;
986 } hd_udevinfo_t;
987 
988 
992 typedef struct s_sysfsdrv_t {
994  char *driver;
995  char *device;
996  char *module;
997 } hd_sysfsdrv_t;
998 
999 
1005 typedef struct {
1006  int type;
1007  unsigned major, minor, range;
1008 } hd_dev_num_t;
1009 
1010 
1025 typedef struct s_pci_t {
1026  struct s_pci_t *next;
1027  unsigned data_len;
1028  unsigned data_ext_len;
1029  unsigned char data[256];
1030  char *log;
1031  unsigned flags,
1032  cmd,
1033  hdr_type,
1034  secondary_bus;
1035  unsigned bus,
1036  slot, func;
1038  unsigned dev, vend, sub_dev, sub_vend, rev;
1039  unsigned irq;
1040  uint64_t base_addr[7];
1041  uint64_t base_len[7];
1042  unsigned addr_flags[7];
1043  uint64_t rom_base_addr;
1044  uint64_t rom_base_len;
1045  char *sysfs_id;
1047  char *modalias;
1048  unsigned edid_len[4];
1049  unsigned char edid_data[4][0x80];
1050 } pci_t;
1051 
1056 typedef enum pci_flags {
1058 } hd_pci_flags_t;
1059 
1060 
1065 typedef struct usb_s {
1066  struct usb_s *next;
1067  unsigned hd_idx;
1068  unsigned hd_base_idx;
1069  str_list_t *c, *d, *e, *i, *p, *s, *t;
1070  struct usb_s *cloned;
1072  unsigned speed;
1073  unsigned vendor, device, rev;
1075  char *driver;
1079  unsigned country;
1080 } usb_t;
1081 
1082 
1086 typedef struct {
1087  int len;
1088  int type;
1089  unsigned char *data;
1090 } isapnp_res_t;
1091 
1095 typedef struct {
1096  int csn;
1098  unsigned char *serial;
1099  unsigned char *card_regs;
1100  unsigned char (*ldev_regs)[0xd0];
1101  int res_len;
1102  unsigned broken:1;
1104 } isapnp_card_t;
1105 
1109 typedef struct {
1111  int cards;
1113 } isapnp_t;
1114 
1118 typedef struct {
1120  int dev;
1121  unsigned flags;
1122  unsigned ref:1;
1123 } isapnp_dev_t;
1124 
1129 typedef enum isapnp_flags {
1132 
1133 
1137 typedef struct scsi_s {
1138  struct scsi_s *next;
1139  unsigned deleted:1;
1140  unsigned generic:1;
1141  unsigned fake:1;
1142  unsigned wwpn_ok:1;
1143  unsigned fcp_lun_ok:1;
1144  char *dev_name;
1147  unsigned host, channel, id, lun;
1148  char *vendor, *model, *rev, *type_str, *serial;
1149  int type;
1150  unsigned inode_low;
1151  char *proc_dir, *driver;
1152  unsigned unique;
1153  char *info;
1154  unsigned lgeo_c, lgeo_h, lgeo_s;
1155  unsigned pgeo_c, pgeo_h, pgeo_s;
1156  uint64_t size;
1157  unsigned sec_size;
1158  unsigned cache;
1160  char *usb_guid;
1161  unsigned pci_info;
1162  unsigned pci_bus;
1163  unsigned pci_slot;
1164  unsigned pci_func;
1165  uint64_t wwpn;
1166  uint64_t fcp_lun;
1168 } scsi_t;
1169 
1170 
1174 typedef struct devtree_s {
1175  struct devtree_s *next;
1177  unsigned idx;
1178  char *path, *filename;
1179  unsigned pci:1;
1180  char *name, *model, *device_type, *compatible;
1183  int revision_id, interrupt;
1184  unsigned char *edid;
1185 } devtree_t;
1186 
1256 };
1260 struct pmac_mb_def {
1262  const char *string;
1263 };
1264 
1268 typedef struct ccw_s {
1269  unsigned char lcss;
1270  unsigned char cu_model;
1271  unsigned char dev_model;
1272 } ccw_t;
1273 
1274 
1278 typedef struct cdrom_info_s {
1280  char *name;
1281  unsigned speed;
1282  unsigned cdr:1, cdrw:1, dvd:1, dvdr:1, dvdram:1;
1283  unsigned cdrom:1;
1284  struct {
1285  unsigned ok:1;
1286  char *volume, *publisher, *preparer, *application, *creation_date;
1287  } iso9660;
1288  struct {
1289  unsigned ok:1;
1290  unsigned platform;
1291  char *id_string;
1292  unsigned bootable:1;
1293  unsigned media_type;
1294  unsigned load_address;
1295  unsigned load_count;
1296  unsigned start;
1297  unsigned catalog;
1298  struct {
1299  unsigned c, h, s;
1300  unsigned size;
1301  } geo;
1302  char *label;
1303  } el_torito;
1304 
1305 } cdrom_info_t;
1306 
1307 
1313 typedef struct {
1314  unsigned char block0[512];
1315 } floppy_info_t;
1316 
1317 
1321 typedef struct {
1322  unsigned apm_supported:1;
1323  unsigned apm_enabled:1;
1324  unsigned apm_ver, apm_subver;
1325  unsigned apm_bios_flags;
1326 
1327  unsigned vbe_ver;
1328  unsigned vbe_video_mem;
1329 
1330  unsigned ser_port0, ser_port1, ser_port2, ser_port3;
1331  unsigned par_port0, par_port1, par_port2;
1332 
1334  unsigned is_pnp_bios:1;
1335  unsigned pnp_id;
1336  unsigned lba_support:1;
1337 
1338  unsigned low_mem_size;
1341 
1342  unsigned smbios_ver;
1343 
1344  struct {
1345  unsigned width;
1346  unsigned height;
1347  unsigned xsize;
1348  unsigned ysize;
1349  char *vendor;
1350  char *name;
1351  } lcd;
1352 
1353  struct {
1354  char *vendor;
1355  char *type;
1356  unsigned bus;
1357  unsigned compat_vend;
1358  unsigned compat_dev;
1359  } mouse;
1360 
1361  struct {
1362  unsigned ok:1;
1363  unsigned scroll_lock:1;
1364  unsigned num_lock:1;
1365  unsigned caps_lock:1;
1366  } led;
1367 
1369 
1370 } bios_info_t;
1371 
1372 
1376 typedef struct {
1377  unsigned has_color:1;
1378  unsigned color;
1379 } prom_info_t;
1380 
1381 
1385 typedef struct {
1387  char *generation;
1388  char *vendor;
1389  char *model;
1390  char *serial;
1391  char *lang;
1392  char *formfactor;
1393 } sys_info_t;
1394 
1395 
1399 typedef struct {
1400  unsigned manu_year;
1401  unsigned min_vsync, max_vsync;
1402  unsigned min_hsync, max_hsync;
1403  unsigned clock;
1404  unsigned width, height;
1405  unsigned width_mm, height_mm;
1406  unsigned hdisp, hsyncstart, hsyncend, htotal;
1407  unsigned vdisp, vsyncstart, vsyncend, vtotal;
1408  char hflag,vflag;
1409  char *vendor;
1410  char *name;
1411  char *serial;
1412 } monitor_info_t;
1413 
1420 typedef enum cpu_arch {
1432 } hd_cpu_arch_t;
1433 
1437 typedef enum boot_arch {
1441 } hd_boot_arch_t;
1442 
1443 
1452 typedef struct {
1454  unsigned family;
1455  unsigned model;
1456  unsigned stepping;
1457  unsigned cache;
1458  unsigned clock;
1459  unsigned units;
1460  char *vend_name;
1461  char *model_name;
1462  char *platform;
1464  double bogo;
1465 } cpu_info_t;
1466 
1467 
1472 typedef struct {
1473  uint64_t sectors;
1474  struct {
1475  unsigned cyls, heads, sectors;
1476  } edd;
1477  struct {
1478  unsigned cyls, heads, sectors;
1479  } legacy;
1480  unsigned ext_fixed_disk:1;
1481  unsigned ext_lock_eject:1;
1482  unsigned ext_edd:1;
1483  unsigned ext_64bit:1;
1484  unsigned assigned:1;
1485  unsigned valid:1;
1486  char *sysfs_id;
1487  unsigned hd_idx;
1488  unsigned signature;
1489 } edd_info_t;
1490 
1496 typedef struct {
1497  unsigned data_len, data_max;
1498  unsigned *data;
1499  unsigned names_len, names_max;
1500  char *names;
1501 } hddb_data_t;
1502 
1506 typedef uint32_t hddb_entry_mask_t;
1507 
1511 typedef struct hddb_list_s {
1512  hddb_entry_mask_t key_mask;
1513  hddb_entry_mask_t value_mask;
1514  unsigned key;
1515  unsigned value;
1516 } hddb_list_t;
1517 
1521 typedef struct {
1522  unsigned list_len, list_max;
1524  unsigned ids_len, ids_max;
1525  unsigned *ids;
1526  unsigned strings_len, strings_max;
1527  char *strings;
1528 } hddb2_data_t;
1529 
1530 
1535 
1539 typedef struct {
1540  char *module;
1541  char *alias;
1543  union {
1544  struct {
1545  struct {
1546  unsigned vendor:1;
1547  unsigned device:1;
1548  unsigned sub_vendor:1;
1549  unsigned sub_device:1;
1550  unsigned base_class:1;
1551  unsigned sub_class:1;
1552  unsigned prog_if:1;
1553  } has;
1554  unsigned vendor;
1555  unsigned device;
1556  unsigned sub_vendor;
1557  unsigned sub_device;
1558  unsigned base_class;
1559  unsigned sub_class;
1560  unsigned prog_if;
1561  } pci;
1562 
1563  struct {
1564  struct {
1565  unsigned vendor:1;
1566  unsigned product:1;
1567  unsigned device_class:1;
1568  unsigned device_subclass:1;
1569  } has;
1570  unsigned vendor;
1571  unsigned product;
1572  unsigned device_class;
1573  unsigned device_subclass;
1574  } usb;
1575  };
1576 } modinfo_t;
1577 
1578 
1582 typedef enum {
1584 } hal_prop_type_t;
1585 
1586 
1590 typedef struct hal_prop_s {
1591  struct hal_prop_s *next;
1593  char *key;
1594  union {
1595  char *str;
1596  int32_t int32;
1597  uint64_t uint64;
1598  double d;
1599  int b;
1601  } val;
1602 } hal_prop_t;
1603 
1604 
1608 typedef struct hal_device_s {
1610  char *udi;
1611  unsigned used:1;
1613 } hal_device_t;
1614 
1615 
1619 typedef enum resource_types {
1624 
1625 
1629 typedef enum size_units {
1632 } hd_size_units_t;
1633 
1637 typedef enum access_flags {
1643 
1644 
1645 typedef enum yes_no_flag {
1650 
1651 
1652 typedef enum geo_types {
1657 } hd_geo_types_t;
1658 
1659 
1666 typedef struct {
1669 } res_any_t;
1670 
1671 typedef struct {
1674  uint64_t base, range;
1675  unsigned
1676  enabled:1,
1677  access:2,
1678  prefetch:2;
1679 } res_mem_t;
1680 
1681 typedef struct {
1684  uint64_t range;
1685 } res_phys_mem_t;
1686 
1687 typedef struct {
1690  uint64_t base, range;
1691  unsigned
1692  enabled:1,
1693  access:2;
1694 } res_io_t;
1695 
1696 typedef struct {
1699  unsigned base;
1700  unsigned triggered;
1701  unsigned enabled:1;
1702 } res_irq_t;
1703 
1704 typedef struct {
1707  unsigned base;
1708  unsigned enabled:1;
1709 } res_dma_t;
1710 
1711 typedef struct {
1715  uint64_t val1, val2;
1716 } res_size_t;
1717 
1718 typedef struct {
1721  unsigned speed;
1722  unsigned bits, stopbits;
1723  char parity;
1724  char handshake;
1725 } res_baud_t;
1726 
1727 typedef struct {
1730  unsigned size;
1731 } res_cache_t;
1732 
1733 typedef struct {
1736  unsigned cyls, heads, sectors;
1737  uint64_t size;
1739 } res_disk_geo_t;
1740 
1741 typedef struct {
1744  unsigned width, height;
1745  unsigned vfreq;
1746  unsigned interlaced:1;
1747 } res_monitor_t;
1748 
1749 typedef struct {
1752  char *init1;
1753  char *init2;
1755 
1756 typedef struct {
1759  char *option;
1761 
1762 typedef struct {
1765  unsigned width, height;
1766  unsigned bytes_p_line;
1767  unsigned colorbits;
1768  unsigned mode;
1770 
1771 typedef struct {
1774  char *addr;
1775 } res_hwaddr_t;
1776 
1777 typedef struct {
1780  unsigned state:1;
1781 } res_link_t;
1782 
1784 typedef struct {
1792 } res_wlan_t;
1793 
1794 typedef struct {
1797  unsigned wwpn_ok:1;
1798  unsigned fcp_lun_ok:1;
1799  unsigned port_id_ok:1;
1800  uint64_t wwpn;
1801  uint64_t fcp_lun;
1802  unsigned port_id;
1804 } res_fc_t;
1805 
1807 typedef union u_hd_res_t {
1808  union u_hd_res_t *next;
1827 } hd_res_t;
1828 
1837 typedef struct {
1838  uint64_t addr, size;
1839  char *dev;
1840  unsigned tag;
1841 } misc_io_t;
1842 
1843 typedef struct {
1844  unsigned channel;
1845  char *dev;
1846  unsigned tag;
1847 } misc_dma_t;
1848 
1849 typedef struct {
1850  unsigned irq, events;
1851  int devs;
1852  char **dev;
1853  unsigned tag;
1854 } misc_irq_t;
1855 
1856 typedef struct {
1857  unsigned io_len, dma_len, irq_len;
1861  str_list_t *proc_io, *proc_dma, *proc_irq;
1862 } misc_t;
1863 
1869 typedef struct s_serial_t {
1870  struct s_serial_t *next;
1871  char *name;
1872  char *device;
1873  unsigned line, port, irq, baud;
1874 } serial_t;
1875 
1879 typedef struct s_ser_device_t {
1881  unsigned hd_idx;
1882  char *dev_name;
1884  int fd;
1885  struct termios tio;
1886  unsigned max_baud, cur_baud;
1887  unsigned is_mouse:1;
1888  unsigned is_modem:1;
1889  unsigned do_io:1;
1890  unsigned char buf[0x1000];
1891  int buf_len;
1892  int garbage, non_pnp, pnp;
1893  unsigned char pnp_id[8];
1894  char *serial, *class_name, *dev_id, *user_name, *vend, *init_string1, *init_string2, *pppd_option;
1895  unsigned pnp_rev;
1896  unsigned bits;
1897 } ser_device_t;
1898 
1912 typedef struct isdn_parm_s {
1914  char *name;
1915  unsigned valid:1;
1916  unsigned conflict:1;
1917  uint64_t value;
1918  unsigned type;
1919  unsigned flags;
1920  unsigned def_value;
1922  unsigned *alt_value;
1923 } isdn_parm_t;
1924 
1926 typedef enum driver_info_type {
1929 
1931 typedef struct {
1934  str_list_t *hddb0, *hddb1;
1936 
1938 typedef struct {
1941  str_list_t *hddb0, *hddb1;
1942  unsigned width, height;
1943  unsigned min_vsync, max_vsync;
1944  unsigned min_hsync, max_hsync;
1945  unsigned bandwidth;
1946  unsigned hdisp, hsyncstart, hsyncend, htotal;
1947  unsigned vdisp, vsyncstart, vsyncend, vtotal;
1948  char hflag,vflag;
1950 
1952 typedef struct {
1955  str_list_t *hddb0, *hddb1;
1956  unsigned active:1;
1957  unsigned modprobe:1;
1960  char *conf;
1962 
1964 typedef struct {
1967  str_list_t *hddb0, *hddb1;
1968  char *xf86;
1969  char *gpm;
1970  int buttons;
1971  int wheels;
1973 
1975 typedef struct {
1978  str_list_t *hddb0, *hddb1;
1979  char *server;
1980  char *xf86_ver;
1981  unsigned x3d:1;
1982  struct {
1983  unsigned all:5;
1984  unsigned c8:1, c15:1, c16:1, c24:1, c32:1;
1985  } colors;
1986  unsigned dacspeed;
1990  char *script;
1992 
1994 typedef struct {
1997  str_list_t *hddb0, *hddb1;
1998  int i4l_type, i4l_subtype;
1999  char *i4l_name;
2002 
2004 typedef struct {
2007  str_list_t *hddb0, *hddb1;
2008  char *mode;
2009  char *name;
2011 
2013 typedef struct {
2016  str_list_t *hddb0, *hddb1;
2017  char *XkbRules;
2018  char *XkbModel;
2019  char *XkbLayout;
2020  char *keymap;
2022 
2023 /*
2024  * holds device driver info
2025  */
2026 typedef union driver_info_u {
2036 } driver_info_t;
2037 
2048 typedef enum hd_detail_type {
2054 
2055 typedef struct {
2058 } hd_detail_pci_t;
2059 
2060 typedef struct {
2063 } hd_detail_usb_t;
2064 
2065 typedef struct {
2069 
2070 typedef struct {
2074 
2075 typedef struct {
2079 
2080 typedef struct {
2084 
2085 typedef struct {
2088 } hd_detail_cpu_t;
2089 
2090 typedef struct {
2094 
2095 typedef struct hd_detail_monitor_s {
2100 
2101 typedef struct {
2104 } hd_detail_sys_t;
2105 
2106 typedef struct {
2110 
2111 typedef struct {
2115 
2116 typedef struct {
2119 } hd_detail_ccw_t;
2120 
2121 typedef union {
2136 } hd_detail_t;
2137 
2150 typedef struct hd_manual_s {
2152 
2153  char *unique_id;
2154  char *parent_id;
2155  char *child_ids;
2156  unsigned hw_class;
2157  char *model;
2158 
2161 
2162  /* More or less free-form key, value pairs.
2163  * key should not contain '=', however.
2164  */
2167 } hd_manual_t;
2168 
2169 
2175 typedef struct s_hd_t {
2176  struct s_hd_t *next;
2182  unsigned idx;
2183 
2189  unsigned broken:1;
2190 
2195 
2200  unsigned slot;
2201 
2205  unsigned func;
2206 
2211 
2216 
2221 
2229 
2239 
2247 
2255 
2262 
2266  char *serial;
2267 
2273 
2279 
2285 
2290  unsigned char hw_class_list[(hw_all + 7) / 8];
2298  char *model;
2299 
2305  unsigned attached_to;
2306 
2310  char *sysfs_id;
2311 
2316 
2321 
2328 
2333 
2341 
2349 
2354 
2361  char *rom_id;
2362 
2366  char *udi;
2367 
2371  char *parent_udi;
2372 
2383  char *unique_id;
2384 
2387 
2391  unsigned module;
2392 
2396  unsigned line;
2397 
2401  unsigned count;
2402 
2407 
2413 
2420 
2427 
2435 
2441 
2446  unsigned hotplug_slot;
2447 
2448  struct is_s {
2449  unsigned agp:1;
2450  unsigned isapnp:1;
2451  unsigned notready:1;
2452  unsigned manual:1;
2453  unsigned softraiddisk:1;
2454  unsigned zip:1;
2455  unsigned cdr:1;
2456  unsigned cdrw:1;
2457  unsigned dvd:1;
2458  unsigned dvdr:1;
2459  unsigned dvdrw:1;
2460  unsigned dvdpr:1;
2461  unsigned dvdprw:1;
2462  unsigned dvdprdl:1;
2463  unsigned dvdram:1;
2464  unsigned pppoe:1;
2465  unsigned wlan:1;
2466  unsigned with_acpi:1;
2467  unsigned hotpluggable:1;
2468  unsigned dualport:1;
2469  } is;
2470 
2471  struct tag_s {
2472  unsigned remove:1;
2473  unsigned freeit:1;
2474  unsigned fixed:1;
2475  unsigned skip_mouse:1;
2476  unsigned skip_modem:1;
2477  unsigned skip_braille:1;
2478  unsigned ser_device:2;
2479  } tag;
2480 
2486  unsigned char *block0;
2487 
2491  char *driver;
2492 
2497 
2502 
2507 
2516 
2522  char *parent_id;
2523 
2530 
2535  char *unique_id1;
2536 
2543  char *usb_guid;
2544 
2553  char *modalias;
2555  /*
2556  * These are used internally for memory management.
2557  * Do not even _think_ of modifying these!
2558  */
2559  unsigned ref_cnt;
2560  struct s_hd_t *ref;
2561 } hd_t;
2562 
2563 
2567 typedef struct {
2574 
2583  void (*progress)(char *pos, char *msg);
2584 
2589  char *log;
2590 
2598  unsigned debug;
2599 
2605  struct flag_struct {
2606  unsigned internal:1;
2607  unsigned dformat:2;
2608  unsigned no_parport:1;
2609  unsigned iseries:1;
2610  unsigned list_all:1;
2611  unsigned fast:1;
2612  unsigned list_md:1;
2613  unsigned nofork:1;
2614  unsigned nosysfs:1;
2615  unsigned forked:1;
2616  unsigned cpuemu:1;
2617  unsigned udev:1;
2618  unsigned edd_used:1;
2619  unsigned keep_kmods:2;
2620  unsigned nobioscrc:1;
2621  unsigned biosvram:1;
2622  unsigned nowpa:1;
2623  unsigned pata:1;
2624  unsigned vbox:1;
2625  unsigned vmware:1;
2626  unsigned vmware_mouse:1;
2627  } flags;
2628 
2629 
2635 
2636  /*
2637  * The following entries should *not* be accessed outside of libhd!
2638  */
2639  unsigned char probe[(pr_all + 7) / 8];
2640  unsigned char probe_set[(pr_all + 7) / 8];
2641  unsigned char probe_clr[(pr_all + 7) / 8];
2643  unsigned last_idx;
2644  unsigned module;
2663  hddb2_data_t *hddb2[2];
2665  uint64_t used_irqs;
2666  uint64_t assigned_irqs;
2670  unsigned display;
2671  unsigned color_code;
2672  char *cmd_line;
2675  unsigned kernel_version;
2681  struct {
2682  unsigned ok:1;
2683  unsigned size;
2684  unsigned used;
2685  void *data;
2686  int id;
2687  int updated;
2688  } shm;
2689  unsigned pci_config_type;
2692  uint64_t sysfsdrv_id;
2694  edd_info_t edd[0x80];
2697 } hd_data_t;
2698 
2699 
2700 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2701  *
2702  * libhd interface functions
2703  *
2704  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2705  */
2706 
2707 /* implemented in hd.c */
2708 
2710 void hd_scan(hd_data_t *hd_data);
2711 
2714 
2716 hd_t *hd_free_hd_list(hd_t *hd);
2717 
2722 
2723 enum probe_feature hd_probe_feature_by_name(char *name);
2725 
2726 int hd_module_is_active(hd_data_t *hd_data, char *mod);
2727 
2728 hd_t *hd_base_class_list(hd_data_t *hd_data, unsigned base_class);
2729 hd_t *hd_sub_class_list(hd_data_t *hd_data, unsigned base_class, unsigned sub_class);
2730 hd_t *hd_bus_list(hd_data_t *hd_data, unsigned bus);
2731 const char* hd_busid_to_hwcfg(int busid);
2732 hd_t *hd_list(hd_data_t *hd_data, hd_hw_item_t item, int rescan, hd_t *hd_old);
2734 hd_t *hd_list2(hd_data_t *hd_data, hd_hw_item_t *items, int rescan);
2736 
2738 
2740 #if 0
2741 
2746 #endif
2750 int hd_color(hd_data_t *hd_data);
2754 unsigned hd_boot_disk(hd_data_t *hd_data, int *matches);
2757 
2758 hd_t *hd_get_device_by_idx(hd_data_t *hd_data, unsigned idx);
2759 
2760 void hd_set_hw_class(hd_t *hd, hd_hw_item_t hw_class);
2761 int hd_is_hw_class(hd_t *hd, hd_hw_item_t hw_class);
2762 
2764 
2765 char *hd_version(void);
2766 
2768 hal_prop_t *hd_read_properties(const char *udi);
2769 int hd_write_properties(const char *udi, hal_prop_t *prop);
2770 
2771 int hd_change_status(const char *id, hd_status_t status, const char *config_string);
2772 int hd_change_config_status(hd_data_t *hd_data, const char *id, hd_status_t status, const char *config_string);
2773 int hd_read_mmap(hd_data_t *hd_data, char *name, unsigned char *buf, off_t start, unsigned size);
2774 
2775 /* implemented in hddb.c */
2776 
2781 void hddb_add_info(hd_data_t *hd_data, hd_t *hd);
2782 
2783 void hddb_dump_raw(hddb2_data_t *hddb, FILE *f);
2784 void hddb_dump(hddb2_data_t *hddb, FILE *f);
2785 
2786 
2787 /* implemented in hdp.c */
2788 void hd_dump_entry(hd_data_t *hd_data, hd_t *hd, FILE *f);
2789 
2790 /* implemented in cdrom.c */
2792 
2803 hd_t *hd_read_config(hd_data_t *hd_data, const char *id);
2805 char *hd_hw_item_name(hd_hw_item_t item);
2806 hd_hw_item_t hd_hw_item_type(char *name);
2808 
2819 #define CDBISDN_VERSION 0x0101
2820 
2821 #ifndef PCI_ANY_ID
2822 #define PCI_ANY_ID 0xffff
2823 #endif
2824 
2825 #define CDBISDN_P_NONE 0x0
2826 #define CDBISDN_P_IRQ 0x1
2827 #define CDBISDN_P_MEM 0x2
2828 #define CDBISDN_P_IO 0x3
2829 
2831 typedef struct {
2832  char *name;
2833  char *shortname;
2834  int vnr;
2835  int refcnt;
2836 } cdb_isdn_vendor;
2837 
2838 typedef struct {
2839  int handle;
2840  int vhandle;
2841  char *name;
2842  char *lname;
2843  char *Class;
2844  char *bus;
2845  int revision;
2846  int vendor;
2847  int device;
2848  int subvendor;
2850  int subdevice;
2852  unsigned int features;
2853  int line_cnt;
2855  int vario;
2856 } cdb_isdn_card;
2857 
2858 typedef struct {
2859  int handle;
2861  int drvid;
2862  int typ;
2863  int subtyp;
2864  int smp;
2865  char *mod_name;
2866  char *para_str;
2867  char *mod_preload;
2868  char *cfg_prog;
2869  char *firmware;
2870  char *description;
2871  char *need_pkg;
2872  char *info;
2873  char *protocol;
2874  char *interface;
2875  char *io;
2876  char *irq;
2877  char *membase;
2878  char *features;
2879  int card_ref;
2880  char *name;
2881 } cdb_isdn_vario;
2882 
2883 
2885 extern cdb_isdn_card *hd_cdbisdn_get_card(int);
2888 extern cdb_isdn_card *hd_cdbisdn_get_card_from_id(int, int, int, int);
2890 extern int hd_cdbisdn_get_version(void);
2891 extern int hd_cdbisdn_get_db_version(void);
2892 extern char *hd_cdbisdn_get_db_date(void);
2893 
2899 #ifdef __cplusplus
2900 }
2901 #endif
2902 
2905 #endif /* _HD_H */