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 19
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 
62 //typedef struct vm_s vm_t;
63 
67 #define HARDWARE_DIR "/var/lib/hardware"
68 
83 #define TAG_PCI 1
84 #define TAG_EISA 2
85 #define TAG_USB 3
86 #define TAG_SPECIAL 4
87 #define TAG_PCMCIA 5
92 #define ID_VALUE(id) ((id) & 0xffff)
93 
97 #define ID_TAG(id) (((id) >> 16) & 0xf)
98 
102 #define MAKE_ID(tag, id_val) ((tag << 16) | (id_val))
103 
109 typedef enum probe_feature {
127 
136 typedef enum hw_item {
148 } hd_hw_item_t;
149 
157 typedef enum base_classes {
158  // these *must* match standard PCI class numbers
162 
163  // add our own classes here (starting at 0x100 as PCI values are 8 bit)
169 
171 typedef enum sc_monitor {
174 
176 typedef enum sc_storage {
180 
182 typedef enum sc_display {
185 
187 typedef enum sc_framebuffer {
190 
192 typedef enum sc_bridge {
197 
199 typedef enum sc_comm {
201 } hd_sc_comm_t;
202 
204 typedef enum sc_system {
207 
209 typedef enum sc_input {
211 } hd_sc_input_t;
212 
214 typedef enum sc_serial {
218 
220 typedef enum sc_internal {
224 
226 typedef enum sc_mouse {
229 } hd_sc_mouse_t;
230 
232 typedef enum sc_std {
235 } hd_sc_std_t;
236 
238 typedef enum sc_net_if {
244 
246 typedef enum sc_multimedia {
249 
251 typedef enum sc_keyboard {
254 
256 typedef enum sc_hub {
258 } hd_sc_hub_t;
259 
261 typedef enum sc_camera {
264 
266 typedef enum sc_modem {
268 } hd_sc_modem_t;
269 
271 typedef enum sc_dsl {
273 } hd_sc_dsl_t;
274 
276 typedef enum pif_usb_e {
279 } hd_pif_usb_t;
280 
282 typedef enum pif_cdrom {
284 } hd_pif_cdrom_t ;
285 
287 typedef enum pif_s390disk {
290 
292 typedef enum bus_types {
295 
301 
310 typedef struct {
314  unsigned invalid:1;
315 
325  unsigned reconfig:3;
326 
332  unsigned configured:3;
333 
344  unsigned available:3;
345 
353  unsigned needed:3;
354 
361  unsigned available_orig:3;
362 
366  unsigned active:3;
367 } hd_status_t;
368 
370 typedef enum {
373 
377 typedef enum {
384 } hd_hotplug_t;
385 
396 typedef struct {
397  unsigned id;
398  char *name;
399 } hd_id_t;
400 
401 
406 typedef struct s_str_list_t {
407  struct s_str_list_t *next;
408  char *str;
409 } str_list_t;
410 
411 
415 typedef struct {
416  unsigned char bitmap[16];
417  unsigned bits;
418  unsigned not_empty:1;
420 } hd_bitmap_t;
421 
438 typedef struct {
439  unsigned start, size;
440  unsigned char *data;
442 
443 
447 typedef struct {
448  unsigned ok:1;
449  unsigned rev;
450  unsigned mpfp;
451  unsigned mpconfig_ok:1;
452  unsigned mpconfig;
453  unsigned mpconfig_size;
454  unsigned char feature[5];
455  char oem_id[9];
456  char prod_id[13];
457  unsigned cpus, cpus_en;
458 } smp_info_t;
459 
460 
464 typedef struct vbe_mode_info_s {
465  unsigned number;
466  unsigned attributes;
467  unsigned width, height;
468  unsigned bytes_p_line;
469  unsigned pixel_size;
470  unsigned fb_start;
471  unsigned win_A_start;
472  unsigned win_A_attr;
473  unsigned win_B_start;
474  unsigned win_B_attr;
475  unsigned win_size;
476  unsigned win_gran;
477  unsigned pixel_clock;
479 
485 typedef struct {
486  unsigned ok:1;
487  unsigned version;
488  unsigned oem_version;
489  unsigned memory;
490  unsigned fb_start;
491  char *oem_name;
492  char *vendor_name;
493  char *product_name;
495  unsigned modes;
497  unsigned current_mode;
498  unsigned ddc_ports;
499  unsigned char ddc_port[4][0x80];
500 } vbe_info_t;
501 
502 
506 typedef struct {
507  unsigned id;
508  unsigned char slot;
509  unsigned char bus;
510  unsigned char devfn;
511  unsigned char misc;
512 } cpq_ctlorder_t;
513 
514 
515 typedef struct {
516  unsigned ok:1;
517  unsigned entry;
518  unsigned compaq:1;
519  cpq_ctlorder_t cpq_ctrl[32];
520 } bios32_info_t;
521 
531 typedef enum {
541  sm_mdtd, sm_inactive = 126, sm_end = 127
543 
544 
546 typedef struct {
549  int data_len;
550  unsigned char *data;
552  int handle;
553 } smbios_any_t;
554 
555 
557 typedef struct {
560  int data_len;
561  unsigned char *data;
563  int handle;
564  char *vendor;
565  char *version;
566  char *date;
568  unsigned start;
569  unsigned rom_size;
571 
572 
574 typedef struct {
577  int data_len;
578  unsigned char *data;
580  int handle;
581  char *manuf;
582  char *product;
583  char *version;
584  char *serial;
585  unsigned char uuid[16];
588 
589 
591 typedef struct {
594  int data_len;
595  unsigned char *data;
597  int handle;
598  char *manuf;
599  char *product;
600  char *version;
601  char *serial;
602  char *asset;
605  char *location;
606  int chassis;
608  int *objects;
610 
611 
613 typedef struct {
616  int data_len;
617  unsigned char *data;
619  int handle;
620  char *manuf;
621  char *version;
622  char *serial;
623  char *asset;
625  unsigned lock;
630  unsigned oem;
632 
633 
635 typedef struct {
638  int data_len;
639  unsigned char *data;
641  int handle;
642  char *socket;
644  char *manuf;
645  char *version;
646  char *serial;
647  char *asset;
648  char *part;
651  uint64_t cpu_id;
652  unsigned voltage;
653  unsigned ext_clock;
654  unsigned max_speed;
655  unsigned current_speed;
656  unsigned sock_status;
658  int l1_cache;
659  int l2_cache;
660  int l3_cache;
662 
663 
665 typedef struct {
668  int data_len;
669  unsigned char *data;
671  int handle;
672  char *socket;
673  unsigned max_size;
674  unsigned current_size;
675  unsigned speed;
677  unsigned state;
679  unsigned socketed;
680  unsigned level;
687 
688 
690 typedef struct {
693  int data_len;
694  unsigned char *data;
696  int handle;
698  char *i_des;
700  char *x_des;
703 
704 
706 typedef struct {
709  int data_len;
710  unsigned char *data;
712  int handle;
713  char *desig;
718  unsigned id;
720 } smbios_slot_t;
721 
722 
724 typedef struct {
727  int data_len;
728  unsigned char *data;
730  int handle;
731  unsigned dev_len;
732  struct {
733  char *name;
735  unsigned status;
736  } *dev;
738 
739 
741 typedef struct {
744  int data_len;
745  unsigned char *data;
747  int handle;
749 } smbios_oem_t;
750 
751 
753 typedef struct {
756  int data_len;
757  unsigned char *data;
759  int handle;
762 
763 
765 typedef struct {
768  int data_len;
769  unsigned char *data;
771  int handle;
772  char *current;
773 } smbios_lang_t;
774 
775 
777 typedef struct {
780  int data_len;
781  unsigned char *data;
783  int handle;
784  char *name;
785  int items_len;
788 
789 
791 typedef struct {
794  int data_len;
795  unsigned char *data;
797  int handle;
801  unsigned max_size;
803  unsigned slots;
805 
806 
808 typedef struct {
811  int data_len;
812  unsigned char *data;
814  int handle;
815  char *location;
816  char *bank;
817  char *manuf;
818  char *serial;
819  char *asset;
820  char *part;
823  unsigned width;
824  unsigned eccbits;
825  unsigned size;
827  unsigned set;
830  unsigned speed;
832 
833 
835 typedef struct {
838  int data_len;
839  unsigned char *data;
841  int handle;
845  unsigned syndrome;
846  unsigned array_addr;
847  unsigned device_addr;
848  unsigned range;
850 
851 
853 typedef struct {
856  int data_len;
857  unsigned char *data;
859  int handle;
861  uint64_t start_addr;
862  uint64_t end_addr;
863  unsigned part_width;
865 
866 
868 typedef struct {
871  int data_len;
872  unsigned char *data;
874  int handle;
877  uint64_t start_addr;
878  uint64_t end_addr;
879  unsigned row_pos;
880  unsigned interleave_pos;
881  unsigned interleave_depth;
883 
884 
886 typedef struct {
889  int data_len;
890  unsigned char *data;
892  int handle;
895  unsigned buttons;
897 
898 
900 typedef struct {
903  int data_len;
904  unsigned char *data;
906  int handle;
912 
913 
915 typedef struct {
918  int data_len;
919  unsigned char *data;
921  int handle;
922  unsigned month;
923  unsigned day;
924  unsigned hour;
925  unsigned minute;
926  unsigned second;
928 
929 
931 typedef struct {
934  int data_len;
935  unsigned char *data;
937  int handle;
941  unsigned syndrome;
942  uint64_t array_addr;
943  uint64_t device_addr;
944  unsigned range;
946 
947 
949 typedef union u_hd_smbios_t {
974 } hd_smbios_t;
975 
983 typedef struct s_udevinfo_t {
985  char *sysfs;
986  char *name;
988 } hd_udevinfo_t;
989 
990 
994 typedef struct s_sysfsdrv_t {
996  char *driver;
997  char *device;
998  char *module;
999 } hd_sysfsdrv_t;
1000 
1001 
1007 typedef struct {
1008  int type;
1009  unsigned major, minor, range;
1010 } hd_dev_num_t;
1011 
1012 
1027 typedef struct s_pci_t {
1028  struct s_pci_t *next;
1029  unsigned data_len;
1030  unsigned data_ext_len;
1031  unsigned char data[256];
1032  char *log;
1033  unsigned flags,
1034  cmd,
1035  hdr_type,
1036  secondary_bus;
1037  unsigned bus,
1038  slot, func;
1040  unsigned dev, vend, sub_dev, sub_vend, rev;
1041  unsigned irq;
1042  uint64_t base_addr[7];
1043  uint64_t base_len[7];
1044  unsigned addr_flags[7];
1045  uint64_t rom_base_addr;
1046  uint64_t rom_base_len;
1047  char *sysfs_id;
1049  char *modalias;
1050  unsigned edid_len[4];
1051  unsigned char edid_data[4][0x80];
1052 } pci_t;
1053 
1058 typedef enum pci_flags {
1060 } hd_pci_flags_t;
1061 
1062 
1067 typedef struct usb_s {
1068  struct usb_s *next;
1069  unsigned hd_idx;
1070  unsigned hd_base_idx;
1071  str_list_t *c, *d, *e, *i, *p, *s, *t;
1072  struct usb_s *cloned;
1074  unsigned speed;
1075  unsigned vendor, device, rev;
1077  char *driver;
1081  unsigned country;
1082 } usb_t;
1083 
1084 
1088 typedef struct {
1089  int len;
1090  int type;
1091  unsigned char *data;
1092 } isapnp_res_t;
1093 
1097 typedef struct {
1098  int csn;
1100  unsigned char *serial;
1101  unsigned char *card_regs;
1102  unsigned char (*ldev_regs)[0xd0];
1103  int res_len;
1104  unsigned broken:1;
1106 } isapnp_card_t;
1107 
1111 typedef struct {
1113  int cards;
1115 } isapnp_t;
1116 
1120 typedef struct {
1122  int dev;
1123  unsigned flags;
1124  unsigned ref:1;
1125 } isapnp_dev_t;
1126 
1131 typedef enum isapnp_flags {
1134 
1135 
1139 typedef struct scsi_s {
1140  struct scsi_s *next;
1141  unsigned deleted:1;
1142  unsigned generic:1;
1143  unsigned fake:1;
1144  unsigned wwpn_ok:1;
1145  unsigned fcp_lun_ok:1;
1146  char *dev_name;
1149  unsigned host, channel, id, lun;
1150  char *vendor, *model, *rev, *type_str, *serial;
1151  int type;
1152  unsigned inode_low;
1153  char *proc_dir, *driver;
1154  unsigned unique;
1155  char *info;
1156  unsigned lgeo_c, lgeo_h, lgeo_s;
1157  unsigned pgeo_c, pgeo_h, pgeo_s;
1158  uint64_t size;
1159  unsigned sec_size;
1160  unsigned cache;
1162  char *usb_guid;
1163  unsigned pci_info;
1164  unsigned pci_bus;
1165  unsigned pci_slot;
1166  unsigned pci_func;
1167  uint64_t wwpn;
1168  uint64_t fcp_lun;
1170 } scsi_t;
1171 
1172 
1176 typedef struct devtree_s {
1177  struct devtree_s *next;
1179  unsigned idx;
1180  char *path, *filename;
1181  unsigned pci:1;
1182  char *name, *model, *device_type, *compatible;
1185  int revision_id, interrupt;
1186  unsigned char *edid;
1187 } devtree_t;
1188 
1258 };
1262 struct pmac_mb_def {
1264  const char *string;
1265 };
1266 
1270 typedef struct ccw_s {
1271  unsigned char lcss;
1272  unsigned char cu_model;
1273  unsigned char dev_model;
1274 } ccw_t;
1275 
1279 typedef struct joystick_s {
1280  unsigned char buttons;
1281  unsigned char axes;
1282 } joystick_t;
1283 
1287 typedef struct cdrom_info_s {
1289  char *name;
1290  unsigned speed;
1291  unsigned cdr:1, cdrw:1, dvd:1, dvdr:1, dvdram:1;
1292  unsigned cdrom:1;
1293  struct {
1294  unsigned ok:1;
1295  char *volume, *publisher, *preparer, *application, *creation_date;
1296  } iso9660;
1297  struct {
1298  unsigned ok:1;
1299  unsigned platform;
1300  char *id_string;
1301  unsigned bootable:1;
1302  unsigned media_type;
1303  unsigned load_address;
1304  unsigned load_count;
1305  unsigned start;
1306  unsigned catalog;
1307  struct {
1308  unsigned c, h, s;
1309  unsigned size;
1310  } geo;
1311  char *label;
1312  } el_torito;
1313 
1314 } cdrom_info_t;
1315 
1316 
1322 typedef struct {
1323  unsigned char block0[512];
1324 } floppy_info_t;
1325 
1326 
1330 typedef struct {
1331  unsigned apm_supported:1;
1332  unsigned apm_enabled:1;
1333  unsigned apm_ver, apm_subver;
1334  unsigned apm_bios_flags;
1335 
1336  unsigned vbe_ver;
1337  unsigned vbe_video_mem;
1338 
1339  unsigned ser_port0, ser_port1, ser_port2, ser_port3;
1340  unsigned par_port0, par_port1, par_port2;
1341 
1343  unsigned is_pnp_bios:1;
1344  unsigned pnp_id;
1345  unsigned lba_support:1;
1346 
1347  unsigned low_mem_size;
1350 
1351  unsigned smbios_ver;
1352 
1353  struct {
1354  unsigned width;
1355  unsigned height;
1356  unsigned xsize;
1357  unsigned ysize;
1358  char *vendor;
1359  char *name;
1360  } lcd;
1361 
1362  struct {
1363  char *vendor;
1364  char *type;
1365  unsigned bus;
1366  unsigned compat_vend;
1367  unsigned compat_dev;
1368  } mouse;
1369 
1370  struct {
1371  unsigned ok:1;
1372  unsigned scroll_lock:1;
1373  unsigned num_lock:1;
1374  unsigned caps_lock:1;
1375  } led;
1376 
1378 
1379 } bios_info_t;
1380 
1381 
1385 typedef struct {
1386  unsigned has_color:1;
1387  unsigned color;
1388 } prom_info_t;
1389 
1390 
1394 typedef struct {
1396  char *generation;
1397  char *vendor;
1398  char *model;
1399  char *serial;
1400  char *lang;
1401  char *formfactor;
1402 } sys_info_t;
1403 
1404 
1408 typedef struct {
1409  unsigned manu_year;
1410  unsigned min_vsync, max_vsync;
1411  unsigned min_hsync, max_hsync;
1412  unsigned clock;
1413  unsigned width, height;
1414  unsigned width_mm, height_mm;
1415  unsigned hdisp, hsyncstart, hsyncend, htotal;
1416  unsigned vdisp, vsyncstart, vsyncend, vtotal;
1417  char hflag,vflag;
1418  char *vendor;
1419  char *name;
1420  char *serial;
1421 } monitor_info_t;
1422 
1429 typedef enum cpu_arch {
1441 } hd_cpu_arch_t;
1442 
1446 typedef enum boot_arch {
1450 } hd_boot_arch_t;
1451 
1452 
1461 typedef struct {
1463  unsigned family;
1464  unsigned model;
1465  unsigned stepping;
1466  unsigned cache;
1467  unsigned clock;
1468  unsigned units;
1469  char *vend_name;
1470  char *model_name;
1471  char *platform;
1473  double bogo;
1474 } cpu_info_t;
1475 
1476 
1481 typedef struct {
1482  uint64_t sectors;
1483  struct {
1484  unsigned cyls, heads, sectors;
1485  } edd;
1486  struct {
1487  unsigned cyls, heads, sectors;
1488  } legacy;
1489  unsigned ext_fixed_disk:1;
1490  unsigned ext_lock_eject:1;
1491  unsigned ext_edd:1;
1492  unsigned ext_64bit:1;
1493  unsigned assigned:1;
1494  unsigned valid:1;
1495  char *sysfs_id;
1496  unsigned hd_idx;
1497  unsigned signature;
1498 } edd_info_t;
1499 
1505 typedef struct {
1506  unsigned data_len, data_max;
1507  unsigned *data;
1508  unsigned names_len, names_max;
1509  char *names;
1510 } hddb_data_t;
1511 
1515 typedef uint32_t hddb_entry_mask_t;
1516 
1520 typedef struct hddb_list_s {
1521  hddb_entry_mask_t key_mask;
1522  hddb_entry_mask_t value_mask;
1523  unsigned key;
1524  unsigned value;
1525 } hddb_list_t;
1526 
1530 typedef struct {
1531  unsigned list_len, list_max;
1533  unsigned ids_len, ids_max;
1534  unsigned *ids;
1535  unsigned strings_len, strings_max;
1536  char *strings;
1537 } hddb2_data_t;
1538 
1539 
1544 
1548 typedef struct {
1549  char *module;
1550  char *alias;
1552  union {
1553  struct {
1554  struct {
1555  unsigned vendor:1;
1556  unsigned device:1;
1557  unsigned sub_vendor:1;
1558  unsigned sub_device:1;
1559  unsigned base_class:1;
1560  unsigned sub_class:1;
1561  unsigned prog_if:1;
1562  } has;
1563  unsigned vendor;
1564  unsigned device;
1565  unsigned sub_vendor;
1566  unsigned sub_device;
1567  unsigned base_class;
1568  unsigned sub_class;
1569  unsigned prog_if;
1570  } pci;
1571 
1572  struct {
1573  struct {
1574  unsigned vendor:1;
1575  unsigned product:1;
1576  unsigned device_class:1;
1577  unsigned device_subclass:1;
1578  } has;
1579  unsigned vendor;
1580  unsigned product;
1581  unsigned device_class;
1582  unsigned device_subclass;
1583  } usb;
1584  };
1585 } modinfo_t;
1586 
1587 
1591 typedef enum {
1593 } hal_prop_type_t;
1594 
1595 
1599 typedef struct hal_prop_s {
1600  struct hal_prop_s *next;
1602  char *key;
1603  union {
1604  char *str;
1605  int32_t int32;
1606  uint64_t uint64;
1607  double d;
1608  int b;
1610  } val;
1611 } hal_prop_t;
1612 
1613 
1617 typedef struct hal_device_s {
1619  char *udi;
1620  unsigned used:1;
1622 } hal_device_t;
1623 
1627 typedef enum resource_types {
1632 
1633 
1637 typedef enum size_units {
1640 } hd_size_units_t;
1641 
1645 typedef enum access_flags {
1651 
1652 
1653 typedef enum yes_no_flag {
1658 
1659 
1660 typedef enum geo_types {
1665 } hd_geo_types_t;
1666 
1667 
1674 typedef struct {
1677 } res_any_t;
1678 
1679 typedef struct {
1682  uint64_t base, range;
1683  unsigned
1684  enabled:1,
1685  access:2,
1686  prefetch:2;
1687 } res_mem_t;
1688 
1689 typedef struct {
1692  uint64_t range;
1693 } res_phys_mem_t;
1694 
1695 typedef struct {
1698  uint64_t base, range;
1699  unsigned
1700  enabled:1,
1701  access:2;
1702 } res_io_t;
1703 
1704 typedef struct {
1707  unsigned base;
1708  unsigned triggered;
1709  unsigned enabled:1;
1710 } res_irq_t;
1711 
1712 typedef struct {
1715  unsigned base;
1716  unsigned enabled:1;
1717 } res_dma_t;
1718 
1719 typedef struct {
1723  uint64_t val1, val2;
1724 } res_size_t;
1725 
1726 typedef struct {
1729  unsigned speed;
1730  unsigned bits, stopbits;
1731  char parity;
1732  char handshake;
1733 } res_baud_t;
1734 
1735 typedef struct {
1738  unsigned size;
1739 } res_cache_t;
1740 
1741 typedef struct {
1744  unsigned cyls, heads, sectors;
1745  uint64_t size;
1747 } res_disk_geo_t;
1748 
1749 typedef struct {
1752  unsigned width, height;
1753  unsigned vfreq;
1754  unsigned interlaced:1;
1755 } res_monitor_t;
1756 
1757 typedef struct {
1760  char *init1;
1761  char *init2;
1763 
1764 typedef struct {
1767  char *option;
1769 
1770 typedef struct {
1773  unsigned width, height;
1774  unsigned bytes_p_line;
1775  unsigned colorbits;
1776  unsigned mode;
1778 
1779 typedef struct {
1782  char *addr;
1783 } res_hwaddr_t;
1784 
1785 typedef struct {
1788  unsigned state:1;
1789 } res_link_t;
1790 
1792 typedef struct {
1800 } res_wlan_t;
1801 
1802 typedef struct {
1805  unsigned wwpn_ok:1;
1806  unsigned fcp_lun_ok:1;
1807  unsigned port_id_ok:1;
1808  uint64_t wwpn;
1809  uint64_t fcp_lun;
1810  unsigned port_id;
1812 } res_fc_t;
1813 
1815 typedef union u_hd_res_t {
1816  union u_hd_res_t *next;
1835 } hd_res_t;
1836 
1845 typedef struct {
1846  uint64_t addr, size;
1847  char *dev;
1848  unsigned tag;
1849 } misc_io_t;
1850 
1851 typedef struct {
1852  unsigned channel;
1853  char *dev;
1854  unsigned tag;
1855 } misc_dma_t;
1856 
1857 typedef struct {
1858  unsigned irq, events;
1859  int devs;
1860  char **dev;
1861  unsigned tag;
1862 } misc_irq_t;
1863 
1864 typedef struct {
1865  unsigned io_len, dma_len, irq_len;
1869  str_list_t *proc_io, *proc_dma, *proc_irq;
1870 } misc_t;
1871 
1877 typedef struct s_serial_t {
1878  struct s_serial_t *next;
1879  char *name;
1880  char *device;
1881  unsigned line, port, irq, baud;
1882 } serial_t;
1883 
1887 typedef struct s_ser_device_t {
1889  unsigned hd_idx;
1890  char *dev_name;
1892  int fd;
1893  struct termios tio;
1894  unsigned max_baud, cur_baud;
1895  unsigned is_mouse:1;
1896  unsigned is_modem:1;
1897  unsigned do_io:1;
1898  unsigned char buf[0x1000];
1899  int buf_len;
1900  int garbage, non_pnp, pnp;
1901  unsigned char pnp_id[8];
1902  char *serial, *class_name, *dev_id, *user_name, *vend, *init_string1, *init_string2, *pppd_option;
1903  unsigned pnp_rev;
1904  unsigned bits;
1905 } ser_device_t;
1906 
1920 typedef struct isdn_parm_s {
1922  char *name;
1923  unsigned valid:1;
1924  unsigned conflict:1;
1925  uint64_t value;
1926  unsigned type;
1927  unsigned flags;
1928  unsigned def_value;
1930  unsigned *alt_value;
1931 } isdn_parm_t;
1932 
1934 typedef enum driver_info_type {
1937 
1939 typedef struct {
1942  str_list_t *hddb0, *hddb1;
1944 
1946 typedef struct {
1949  str_list_t *hddb0, *hddb1;
1950  unsigned width, height;
1951  unsigned min_vsync, max_vsync;
1952  unsigned min_hsync, max_hsync;
1953  unsigned bandwidth;
1954  unsigned hdisp, hsyncstart, hsyncend, htotal;
1955  unsigned vdisp, vsyncstart, vsyncend, vtotal;
1956  char hflag,vflag;
1958 
1960 typedef struct {
1963  str_list_t *hddb0, *hddb1;
1964  unsigned active:1;
1965  unsigned modprobe:1;
1968  char *conf;
1970 
1972 typedef struct {
1975  str_list_t *hddb0, *hddb1;
1976  char *xf86;
1977  char *gpm;
1978  int buttons;
1979  int wheels;
1981 
1983 typedef struct {
1986  str_list_t *hddb0, *hddb1;
1987  char *server;
1988  char *xf86_ver;
1989  unsigned x3d:1;
1990  struct {
1991  unsigned all:5;
1992  unsigned c8:1, c15:1, c16:1, c24:1, c32:1;
1993  } colors;
1994  unsigned dacspeed;
1998  char *script;
2000 
2002 typedef struct {
2005  str_list_t *hddb0, *hddb1;
2006  int i4l_type, i4l_subtype;
2007  char *i4l_name;
2010 
2012 typedef struct {
2015  str_list_t *hddb0, *hddb1;
2016  char *mode;
2017  char *name;
2019 
2021 typedef struct {
2024  str_list_t *hddb0, *hddb1;
2025  char *XkbRules;
2026  char *XkbModel;
2027  char *XkbLayout;
2028  char *keymap;
2030 
2031 /*
2032  * holds device driver info
2033  */
2034 typedef union driver_info_u {
2044 } driver_info_t;
2045 
2056 typedef enum hd_detail_type {
2062 
2063 typedef struct {
2066 } hd_detail_pci_t;
2067 
2068 typedef struct {
2071 } hd_detail_usb_t;
2072 
2073 typedef struct {
2077 
2078 typedef struct {
2082 
2083 typedef struct {
2087 
2088 typedef struct {
2092 
2093 typedef struct {
2096 } hd_detail_cpu_t;
2097 
2098 typedef struct {
2102 
2103 typedef struct hd_detail_monitor_s {
2108 
2109 typedef struct {
2112 } hd_detail_sys_t;
2113 
2114 typedef struct {
2118 
2119 typedef struct {
2123 
2124 typedef struct {
2127 } hd_detail_ccw_t;
2128 
2129 typedef struct {
2133 
2134 typedef union {
2150 } hd_detail_t;
2151 
2164 typedef struct hd_manual_s {
2166 
2167  char *unique_id;
2168  char *parent_id;
2169  char *child_ids;
2170  unsigned hw_class;
2171  char *model;
2172 
2175 
2176  /* More or less free-form key, value pairs.
2177  * key should not contain '=', however.
2178  */
2181 } hd_manual_t;
2182 
2183 
2189 typedef struct s_hd_t {
2190  struct s_hd_t *next;
2196  unsigned idx;
2197 
2203  unsigned broken:1;
2204 
2209 
2214  unsigned slot;
2215 
2219  unsigned func;
2220 
2225 
2230 
2235 
2243 
2253 
2261 
2269 
2276 
2280  char *serial;
2281 
2287 
2293 
2299 
2304  unsigned char hw_class_list[(hw_all + 7) / 8];
2312  char *model;
2313 
2319  unsigned attached_to;
2320 
2324  char *sysfs_id;
2325 
2330 
2335 
2342 
2347 
2355 
2363 
2368 
2375  char *rom_id;
2376 
2380  char *udi;
2381 
2385  char *parent_udi;
2386 
2397  char *unique_id;
2398 
2401 
2405  unsigned module;
2406 
2410  unsigned line;
2411 
2415  unsigned count;
2416 
2421 
2427 
2434 
2441 
2449 
2455 
2460  unsigned hotplug_slot;
2461 
2462  struct is_s {
2463  unsigned agp:1;
2464  unsigned isapnp:1;
2465  unsigned notready:1;
2466  unsigned manual:1;
2467  unsigned softraiddisk:1;
2468  unsigned zip:1;
2469  unsigned cdr:1;
2470  unsigned cdrw:1;
2471  unsigned dvd:1;
2472  unsigned dvdr:1;
2473  unsigned dvdrw:1;
2474  unsigned dvdrdl:1;
2475  unsigned dvdpr:1;
2476  unsigned dvdprw:1;
2477  unsigned dvdprdl:1;
2478  unsigned dvdprwdl:1;
2479  unsigned bd:1;
2480  unsigned bdr:1;
2481  unsigned bdre:1;
2482  unsigned hd:1;
2483  unsigned hdr:1;
2484  unsigned hdrw:1;
2485  unsigned dvdram:1;
2486  unsigned mo:1;
2487  unsigned mrw:1;
2488  unsigned mrww:1;
2489  unsigned pppoe:1;
2490  unsigned wlan:1;
2491  unsigned with_acpi:1;
2492  unsigned hotpluggable:1;
2493  unsigned dualport:1;
2494  } is;
2495 
2496  struct tag_s {
2497  unsigned remove:1;
2498  unsigned freeit:1;
2499  unsigned fixed:1;
2500  unsigned skip_mouse:1;
2501  unsigned skip_modem:1;
2502  unsigned skip_braille:1;
2503  unsigned ser_device:2;
2504  } tag;
2505 
2511  unsigned char *block0;
2512 
2516  char *driver;
2517 
2522 
2527 
2532 
2541 
2547  char *parent_id;
2548 
2555 
2560  char *unique_id1;
2561 
2568  char *usb_guid;
2569 
2578  char *modalias;
2580  /*
2581  * These are used internally for memory management.
2582  * Do not even _think_ of modifying these!
2583  */
2584  unsigned ref_cnt;
2585  struct s_hd_t *ref;
2586 } hd_t;
2587 
2588 
2592 typedef struct {
2599 
2608  void (*progress)(char *pos, char *msg);
2609 
2614  char *log;
2615 
2623  unsigned debug;
2624 
2630  struct flag_struct {
2631  unsigned internal:1;
2632  unsigned dformat:2;
2633  unsigned no_parport:1;
2634  unsigned iseries:1;
2635  unsigned list_all:1;
2636  unsigned fast:1;
2637  unsigned list_md:1;
2638  unsigned nofork:1;
2639  unsigned nosysfs:1;
2640  unsigned forked:1;
2641  unsigned cpuemu:1;
2642  unsigned udev:1;
2643  unsigned edd_used:1;
2644  unsigned keep_kmods:2;
2645  unsigned nobioscrc:1;
2646  unsigned biosvram:1;
2647  unsigned nowpa:1;
2648  unsigned pata:1;
2649  unsigned vbox:1;
2650  unsigned vmware:1;
2651  unsigned vmware_mouse:1;
2652  } flags;
2653 
2654 
2660 
2661  /*
2662  * The following entries should *not* be accessed outside of libhd!
2663  */
2664  unsigned char probe[(pr_all + 7) / 8];
2665  unsigned char probe_set[(pr_all + 7) / 8];
2666  unsigned char probe_clr[(pr_all + 7) / 8];
2668  unsigned last_idx;
2669  unsigned module;
2688  hddb2_data_t *hddb2[2];
2690  uint64_t used_irqs;
2691  uint64_t assigned_irqs;
2695  unsigned display;
2696  unsigned color_code;
2697  char *cmd_line;
2700  unsigned kernel_version;
2706  struct {
2707  unsigned ok:1;
2708  unsigned size;
2709  unsigned used;
2710  void *data;
2711  int id;
2712  int updated;
2713  } shm;
2714  unsigned pci_config_type;
2717  uint64_t sysfsdrv_id;
2719  edd_info_t edd[0x80];
2722  struct vm_s *vm;
2723  size_t log_size;
2724  size_t log_max;
2726 } hd_data_t;
2727 
2728 
2729 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2730  *
2731  * libhd interface functions
2732  *
2733  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2734  */
2735 
2736 /* implemented in hd.c */
2737 
2739 void hd_scan(hd_data_t *hd_data);
2740 
2743 
2745 hd_t *hd_free_hd_list(hd_t *hd);
2746 
2751 
2752 enum probe_feature hd_probe_feature_by_name(char *name);
2754 
2755 int hd_module_is_active(hd_data_t *hd_data, char *mod);
2756 
2757 hd_t *hd_base_class_list(hd_data_t *hd_data, unsigned base_class);
2758 hd_t *hd_sub_class_list(hd_data_t *hd_data, unsigned base_class, unsigned sub_class);
2759 hd_t *hd_bus_list(hd_data_t *hd_data, unsigned bus);
2760 const char* hd_busid_to_hwcfg(int busid);
2761 hd_t *hd_list(hd_data_t *hd_data, hd_hw_item_t item, int rescan, hd_t *hd_old);
2763 hd_t *hd_list2(hd_data_t *hd_data, hd_hw_item_t *items, int rescan);
2765 
2767 
2769 #if 0
2770 
2775 #endif
2779 int hd_color(hd_data_t *hd_data);
2783 unsigned hd_boot_disk(hd_data_t *hd_data, int *matches);
2786 
2787 hd_t *hd_get_device_by_idx(hd_data_t *hd_data, unsigned idx);
2788 
2789 void hd_set_hw_class(hd_t *hd, hd_hw_item_t hw_class);
2790 int hd_is_hw_class(hd_t *hd, hd_hw_item_t hw_class);
2791 
2793 
2794 char *hd_version(void);
2795 
2797 hal_prop_t *hd_read_properties(const char *udi);
2798 int hd_write_properties(const char *udi, hal_prop_t *prop);
2799 
2800 int hd_change_status(const char *id, hd_status_t status, const char *config_string);
2801 int hd_change_config_status(hd_data_t *hd_data, const char *id, hd_status_t status, const char *config_string);
2802 int hd_read_mmap(hd_data_t *hd_data, char *name, unsigned char *buf, off_t start, unsigned size);
2803 
2804 /* implemented in hddb.c */
2805 
2810 void hddb_add_info(hd_data_t *hd_data, hd_t *hd);
2811 
2812 void hddb_dump_raw(hddb2_data_t *hddb, FILE *f);
2813 void hddb_dump(hddb2_data_t *hddb, FILE *f);
2814 
2815 
2816 /* implemented in hdp.c */
2817 void hd_dump_entry(hd_data_t *hd_data, hd_t *hd, FILE *f);
2818 
2819 /* implemented in cdrom.c */
2821 
2832 hd_t *hd_read_config(hd_data_t *hd_data, const char *id);
2835 hd_hw_item_t hd_hw_item_type(char *name);
2837 
2848 #define CDBISDN_VERSION 0x0101
2849 
2850 #ifndef PCI_ANY_ID
2851 #define PCI_ANY_ID 0xffff
2852 #endif
2853 
2854 #define CDBISDN_P_NONE 0x0
2855 #define CDBISDN_P_IRQ 0x1
2856 #define CDBISDN_P_MEM 0x2
2857 #define CDBISDN_P_IO 0x3
2858 
2860 typedef struct {
2861  char *name;
2862  char *shortname;
2863  int vnr;
2864  int refcnt;
2865 } cdb_isdn_vendor;
2866 
2867 typedef struct {
2868  int handle;
2869  int vhandle;
2870  char *name;
2871  char *lname;
2872  char *Class;
2873  char *bus;
2874  int revision;
2875  int vendor;
2876  int device;
2877  int subvendor;
2879  int subdevice;
2881  unsigned int features;
2882  int line_cnt;
2884  int vario;
2885 } cdb_isdn_card;
2886 
2887 typedef struct {
2888  int handle;
2890  int drvid;
2891  int typ;
2892  int subtyp;
2893  int smp;
2894  char *mod_name;
2895  char *para_str;
2896  char *mod_preload;
2897  char *cfg_prog;
2898  char *firmware;
2899  char *description;
2900  char *need_pkg;
2901  char *info;
2902  char *protocol;
2903  char *interface;
2904  char *io;
2905  char *irq;
2906  char *membase;
2907  char *features;
2908  int card_ref;
2909  char *name;
2910 } cdb_isdn_vario;
2911 
2912 
2914 extern cdb_isdn_card *hd_cdbisdn_get_card(int);
2917 extern cdb_isdn_card *hd_cdbisdn_get_card_from_id(int, int, int, int);
2919 extern int hd_cdbisdn_get_version(void);
2920 extern int hd_cdbisdn_get_db_version(void);
2921 extern char *hd_cdbisdn_get_db_date(void);
2922 
2928 #ifdef __cplusplus
2929 }
2930 #endif
2931 
2934 #endif /* _HD_H */