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 20
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  unsigned ext_fibre:1;
1496  unsigned ext_net:1;
1497  char *sysfs_id;
1498  unsigned hd_idx;
1499  unsigned signature;
1500 } edd_info_t;
1501 
1507 typedef struct {
1508  unsigned data_len, data_max;
1509  unsigned *data;
1510  unsigned names_len, names_max;
1511  char *names;
1512 } hddb_data_t;
1513 
1517 typedef uint32_t hddb_entry_mask_t;
1518 
1522 typedef struct hddb_list_s {
1523  hddb_entry_mask_t key_mask;
1524  hddb_entry_mask_t value_mask;
1525  unsigned key;
1526  unsigned value;
1527 } hddb_list_t;
1528 
1532 typedef struct {
1533  unsigned list_len, list_max;
1535  unsigned ids_len, ids_max;
1536  unsigned *ids;
1537  unsigned strings_len, strings_max;
1538  char *strings;
1539 } hddb2_data_t;
1540 
1541 
1546 
1550 typedef struct {
1551  char *module;
1552  char *alias;
1554  union {
1555  struct {
1556  struct {
1557  unsigned vendor:1;
1558  unsigned device:1;
1559  unsigned sub_vendor:1;
1560  unsigned sub_device:1;
1561  unsigned base_class:1;
1562  unsigned sub_class:1;
1563  unsigned prog_if:1;
1564  } has;
1565  unsigned vendor;
1566  unsigned device;
1567  unsigned sub_vendor;
1568  unsigned sub_device;
1569  unsigned base_class;
1570  unsigned sub_class;
1571  unsigned prog_if;
1572  } pci;
1573 
1574  struct {
1575  struct {
1576  unsigned vendor:1;
1577  unsigned product:1;
1578  unsigned device_class:1;
1579  unsigned device_subclass:1;
1580  } has;
1581  unsigned vendor;
1582  unsigned product;
1583  unsigned device_class;
1584  unsigned device_subclass;
1585  } usb;
1586  };
1587 } modinfo_t;
1588 
1589 
1593 typedef enum {
1595 } hal_prop_type_t;
1596 
1597 
1601 typedef struct hal_prop_s {
1602  struct hal_prop_s *next;
1604  char *key;
1605  union {
1606  char *str;
1607  int32_t int32;
1608  uint64_t uint64;
1609  double d;
1610  int b;
1612  } val;
1613 } hal_prop_t;
1614 
1615 
1619 typedef struct hal_device_s {
1621  char *udi;
1622  unsigned used:1;
1624 } hal_device_t;
1625 
1629 typedef enum resource_types {
1634 
1635 
1639 typedef enum size_units {
1642 } hd_size_units_t;
1643 
1647 typedef enum access_flags {
1653 
1654 
1655 typedef enum yes_no_flag {
1660 
1661 
1662 typedef enum geo_types {
1667 } hd_geo_types_t;
1668 
1669 
1676 typedef struct {
1679 } res_any_t;
1680 
1681 typedef struct {
1684  uint64_t base, range;
1685  unsigned
1686  enabled:1,
1687  access:2,
1688  prefetch:2;
1689 } res_mem_t;
1690 
1691 typedef struct {
1694  uint64_t range;
1695 } res_phys_mem_t;
1696 
1697 typedef struct {
1700  uint64_t base, range;
1701  unsigned
1702  enabled:1,
1703  access:2;
1704 } res_io_t;
1705 
1706 typedef struct {
1709  unsigned base;
1710  unsigned triggered;
1711  unsigned enabled:1;
1712 } res_irq_t;
1713 
1714 typedef struct {
1717  unsigned base;
1718  unsigned enabled:1;
1719 } res_dma_t;
1720 
1721 typedef struct {
1725  uint64_t val1, val2;
1726 } res_size_t;
1727 
1728 typedef struct {
1731  unsigned speed;
1732  unsigned bits, stopbits;
1733  char parity;
1734  char handshake;
1735 } res_baud_t;
1736 
1737 typedef struct {
1740  unsigned size;
1741 } res_cache_t;
1742 
1743 typedef struct {
1746  unsigned cyls, heads, sectors;
1747  uint64_t size;
1749 } res_disk_geo_t;
1750 
1751 typedef struct {
1754  unsigned width, height;
1755  unsigned vfreq;
1756  unsigned interlaced:1;
1757 } res_monitor_t;
1758 
1759 typedef struct {
1762  char *init1;
1763  char *init2;
1765 
1766 typedef struct {
1769  char *option;
1771 
1772 typedef struct {
1775  unsigned width, height;
1776  unsigned bytes_p_line;
1777  unsigned colorbits;
1778  unsigned mode;
1780 
1781 typedef struct {
1784  char *addr;
1785 } res_hwaddr_t;
1786 
1787 typedef struct {
1790  unsigned state:1;
1791 } res_link_t;
1792 
1794 typedef struct {
1802 } res_wlan_t;
1803 
1804 typedef struct {
1807  unsigned wwpn_ok:1;
1808  unsigned fcp_lun_ok:1;
1809  unsigned port_id_ok:1;
1810  uint64_t wwpn;
1811  uint64_t fcp_lun;
1812  unsigned port_id;
1814 } res_fc_t;
1815 
1817 typedef union u_hd_res_t {
1818  union u_hd_res_t *next;
1837 } hd_res_t;
1838 
1847 typedef struct {
1848  uint64_t addr, size;
1849  char *dev;
1850  unsigned tag;
1851 } misc_io_t;
1852 
1853 typedef struct {
1854  unsigned channel;
1855  char *dev;
1856  unsigned tag;
1857 } misc_dma_t;
1858 
1859 typedef struct {
1860  unsigned irq, events;
1861  int devs;
1862  char **dev;
1863  unsigned tag;
1864 } misc_irq_t;
1865 
1866 typedef struct {
1867  unsigned io_len, dma_len, irq_len;
1871  str_list_t *proc_io, *proc_dma, *proc_irq;
1872 } misc_t;
1873 
1879 typedef struct s_serial_t {
1880  struct s_serial_t *next;
1881  char *name;
1882  char *device;
1883  unsigned line, port, irq, baud;
1884 } serial_t;
1885 
1889 typedef struct s_ser_device_t {
1891  unsigned hd_idx;
1892  char *dev_name;
1894  int fd;
1895  struct termios tio;
1896  unsigned max_baud, cur_baud;
1897  unsigned is_mouse:1;
1898  unsigned is_modem:1;
1899  unsigned do_io:1;
1900  unsigned char buf[0x1000];
1901  int buf_len;
1902  int garbage, non_pnp, pnp;
1903  unsigned char pnp_id[8];
1904  char *serial, *class_name, *dev_id, *user_name, *vend, *init_string1, *init_string2, *pppd_option;
1905  unsigned pnp_rev;
1906  unsigned bits;
1907 } ser_device_t;
1908 
1922 typedef struct isdn_parm_s {
1924  char *name;
1925  unsigned valid:1;
1926  unsigned conflict:1;
1927  uint64_t value;
1928  unsigned type;
1929  unsigned flags;
1930  unsigned def_value;
1932  unsigned *alt_value;
1933 } isdn_parm_t;
1934 
1936 typedef enum driver_info_type {
1939 
1941 typedef struct {
1944  str_list_t *hddb0, *hddb1;
1946 
1948 typedef struct {
1951  str_list_t *hddb0, *hddb1;
1952  unsigned width, height;
1953  unsigned min_vsync, max_vsync;
1954  unsigned min_hsync, max_hsync;
1955  unsigned bandwidth;
1956  unsigned hdisp, hsyncstart, hsyncend, htotal;
1957  unsigned vdisp, vsyncstart, vsyncend, vtotal;
1958  char hflag,vflag;
1960 
1962 typedef struct {
1965  str_list_t *hddb0, *hddb1;
1966  unsigned active:1;
1967  unsigned modprobe:1;
1970  char *conf;
1972 
1974 typedef struct {
1977  str_list_t *hddb0, *hddb1;
1978  char *xf86;
1979  char *gpm;
1980  int buttons;
1981  int wheels;
1983 
1985 typedef struct {
1988  str_list_t *hddb0, *hddb1;
1989  char *server;
1990  char *xf86_ver;
1991  unsigned x3d:1;
1992  struct {
1993  unsigned all:5;
1994  unsigned c8:1, c15:1, c16:1, c24:1, c32:1;
1995  } colors;
1996  unsigned dacspeed;
2000  char *script;
2002 
2004 typedef struct {
2007  str_list_t *hddb0, *hddb1;
2008  int i4l_type, i4l_subtype;
2009  char *i4l_name;
2012 
2014 typedef struct {
2017  str_list_t *hddb0, *hddb1;
2018  char *mode;
2019  char *name;
2021 
2023 typedef struct {
2026  str_list_t *hddb0, *hddb1;
2027  char *XkbRules;
2028  char *XkbModel;
2029  char *XkbLayout;
2030  char *keymap;
2032 
2033 /*
2034  * holds device driver info
2035  */
2036 typedef union driver_info_u {
2046 } driver_info_t;
2047 
2058 typedef enum hd_detail_type {
2064 
2065 typedef struct {
2068 } hd_detail_pci_t;
2069 
2070 typedef struct {
2073 } hd_detail_usb_t;
2074 
2075 typedef struct {
2079 
2080 typedef struct {
2084 
2085 typedef struct {
2089 
2090 typedef struct {
2094 
2095 typedef struct {
2098 } hd_detail_cpu_t;
2099 
2100 typedef struct {
2104 
2105 typedef struct hd_detail_monitor_s {
2110 
2111 typedef struct {
2114 } hd_detail_sys_t;
2115 
2116 typedef struct {
2120 
2121 typedef struct {
2125 
2126 typedef struct {
2129 } hd_detail_ccw_t;
2130 
2131 typedef struct {
2135 
2136 typedef union {
2152 } hd_detail_t;
2153 
2166 typedef struct hd_manual_s {
2168 
2169  char *unique_id;
2170  char *parent_id;
2171  char *child_ids;
2172  unsigned hw_class;
2173  char *model;
2174 
2177 
2178  /* More or less free-form key, value pairs.
2179  * key should not contain '=', however.
2180  */
2183 } hd_manual_t;
2184 
2185 
2191 typedef struct s_hd_t {
2192  struct s_hd_t *next;
2198  unsigned idx;
2199 
2205  unsigned broken:1;
2206 
2211 
2216  unsigned slot;
2217 
2221  unsigned func;
2222 
2227 
2232 
2237 
2245 
2255 
2263 
2271 
2278 
2282  char *serial;
2283 
2289 
2295 
2301 
2306  unsigned char hw_class_list[(hw_all + 7) / 8];
2314  char *model;
2315 
2321  unsigned attached_to;
2322 
2326  char *sysfs_id;
2327 
2332 
2337 
2344 
2349 
2357 
2365 
2370 
2377  char *rom_id;
2378 
2382  char *udi;
2383 
2387  char *parent_udi;
2388 
2399  char *unique_id;
2400 
2403 
2407  unsigned module;
2408 
2412  unsigned line;
2413 
2417  unsigned count;
2418 
2423 
2429 
2436 
2443 
2451 
2457 
2462  unsigned hotplug_slot;
2463 
2464  struct is_s {
2465  unsigned agp:1;
2466  unsigned isapnp:1;
2467  unsigned notready:1;
2468  unsigned manual:1;
2469  unsigned softraiddisk:1;
2470  unsigned zip:1;
2471  unsigned cdr:1;
2472  unsigned cdrw:1;
2473  unsigned dvd:1;
2474  unsigned dvdr:1;
2475  unsigned dvdrw:1;
2476  unsigned dvdrdl:1;
2477  unsigned dvdpr:1;
2478  unsigned dvdprw:1;
2479  unsigned dvdprdl:1;
2480  unsigned dvdprwdl:1;
2481  unsigned bd:1;
2482  unsigned bdr:1;
2483  unsigned bdre:1;
2484  unsigned hd:1;
2485  unsigned hdr:1;
2486  unsigned hdrw:1;
2487  unsigned dvdram:1;
2488  unsigned mo:1;
2489  unsigned mrw:1;
2490  unsigned mrww:1;
2491  unsigned pppoe:1;
2492  unsigned wlan:1;
2493  unsigned with_acpi:1;
2494  unsigned hotpluggable:1;
2495  unsigned dualport:1;
2496  unsigned fcoe:1;
2497  } is;
2498 
2499  struct tag_s {
2500  unsigned remove:1;
2501  unsigned freeit:1;
2502  unsigned fixed:1;
2503  unsigned skip_mouse:1;
2504  unsigned skip_modem:1;
2505  unsigned skip_braille:1;
2506  unsigned ser_device:2;
2507  } tag;
2508 
2514  unsigned char *block0;
2515 
2519  char *driver;
2520 
2525 
2530 
2535 
2544 
2550  char *parent_id;
2551 
2558 
2563  char *unique_id1;
2564 
2571  char *usb_guid;
2572 
2581  char *modalias;
2583  /*
2584  * These are used internally for memory management.
2585  * Do not even _think_ of modifying these!
2586  */
2587  unsigned ref_cnt;
2588  struct s_hd_t *ref;
2589 } hd_t;
2590 
2591 
2595 typedef struct {
2602 
2611  void (*progress)(char *pos, char *msg);
2612 
2617  char *log;
2618 
2626  unsigned debug;
2627 
2633  struct flag_struct {
2634  unsigned internal:1;
2635  unsigned dformat:2;
2636  unsigned no_parport:1;
2637  unsigned iseries:1;
2638  unsigned list_all:1;
2639  unsigned fast:1;
2640  unsigned list_md:1;
2641  unsigned nofork:1;
2642  unsigned nosysfs:1;
2643  unsigned forked:1;
2644  unsigned cpuemu:1;
2645  unsigned udev:1;
2646  unsigned edd_used:1;
2647  unsigned keep_kmods:2;
2648  unsigned nobioscrc:1;
2649  unsigned biosvram:1;
2650  unsigned nowpa:1;
2651  unsigned pata:1;
2652  unsigned vbox:1;
2653  unsigned vmware:1;
2654  unsigned vmware_mouse:1;
2655  } flags;
2656 
2657 
2663 
2664  /*
2665  * The following entries should *not* be accessed outside of libhd!
2666  */
2667  unsigned char probe[(pr_all + 7) / 8];
2668  unsigned char probe_set[(pr_all + 7) / 8];
2669  unsigned char probe_clr[(pr_all + 7) / 8];
2671  unsigned last_idx;
2672  unsigned module;
2691  hddb2_data_t *hddb2[2];
2693  uint64_t used_irqs;
2694  uint64_t assigned_irqs;
2698  unsigned display;
2699  unsigned color_code;
2700  char *cmd_line;
2703  unsigned kernel_version;
2709  struct {
2710  unsigned ok:1;
2711  unsigned size;
2712  unsigned used;
2713  void *data;
2714  int id;
2715  int updated;
2716  } shm;
2717  unsigned pci_config_type;
2720  uint64_t sysfsdrv_id;
2722  edd_info_t edd[0x80];
2725  struct vm_s *vm;
2726  size_t log_size;
2727  size_t log_max;
2729 } hd_data_t;
2730 
2731 
2732 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2733  *
2734  * libhd interface functions
2735  *
2736  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2737  */
2738 
2739 /* implemented in hd.c */
2740 
2742 void hd_scan(hd_data_t *hd_data);
2743 
2746 
2748 hd_t *hd_free_hd_list(hd_t *hd);
2749 
2754 
2755 enum probe_feature hd_probe_feature_by_name(char *name);
2757 
2758 int hd_module_is_active(hd_data_t *hd_data, char *mod);
2759 
2760 hd_t *hd_base_class_list(hd_data_t *hd_data, unsigned base_class);
2761 hd_t *hd_sub_class_list(hd_data_t *hd_data, unsigned base_class, unsigned sub_class);
2762 hd_t *hd_bus_list(hd_data_t *hd_data, unsigned bus);
2763 const char* hd_busid_to_hwcfg(int busid);
2764 hd_t *hd_list(hd_data_t *hd_data, hd_hw_item_t item, int rescan, hd_t *hd_old);
2766 hd_t *hd_list2(hd_data_t *hd_data, hd_hw_item_t *items, int rescan);
2768 
2770 
2772 #if 0
2773 
2778 #endif
2782 int hd_color(hd_data_t *hd_data);
2786 unsigned hd_boot_disk(hd_data_t *hd_data, int *matches);
2789 
2790 hd_t *hd_get_device_by_idx(hd_data_t *hd_data, unsigned idx);
2791 
2792 void hd_set_hw_class(hd_t *hd, hd_hw_item_t hw_class);
2793 int hd_is_hw_class(hd_t *hd, hd_hw_item_t hw_class);
2794 
2796 
2797 char *hd_version(void);
2798 
2800 hal_prop_t *hd_read_properties(const char *udi);
2801 int hd_write_properties(const char *udi, hal_prop_t *prop);
2802 
2803 int hd_change_status(const char *id, hd_status_t status, const char *config_string);
2804 int hd_change_config_status(hd_data_t *hd_data, const char *id, hd_status_t status, const char *config_string);
2805 int hd_read_mmap(hd_data_t *hd_data, char *name, unsigned char *buf, off_t start, unsigned size);
2806 
2807 /* implemented in hddb.c */
2808 
2813 void hddb_add_info(hd_data_t *hd_data, hd_t *hd);
2814 
2815 void hddb_dump_raw(hddb2_data_t *hddb, FILE *f);
2816 void hddb_dump(hddb2_data_t *hddb, FILE *f);
2817 
2818 
2819 /* implemented in hdp.c */
2820 void hd_dump_entry(hd_data_t *hd_data, hd_t *hd, FILE *f);
2821 
2822 /* implemented in cdrom.c */
2824 
2835 hd_t *hd_read_config(hd_data_t *hd_data, const char *id);
2838 hd_hw_item_t hd_hw_item_type(char *name);
2840 
2851 #define CDBISDN_VERSION 0x0101
2852 
2853 #ifndef PCI_ANY_ID
2854 #define PCI_ANY_ID 0xffff
2855 #endif
2856 
2857 #define CDBISDN_P_NONE 0x0
2858 #define CDBISDN_P_IRQ 0x1
2859 #define CDBISDN_P_MEM 0x2
2860 #define CDBISDN_P_IO 0x3
2861 
2863 typedef struct {
2864  char *name;
2865  char *shortname;
2866  int vnr;
2867  int refcnt;
2868 } cdb_isdn_vendor;
2869 
2870 typedef struct {
2871  int handle;
2872  int vhandle;
2873  char *name;
2874  char *lname;
2875  char *Class;
2876  char *bus;
2877  int revision;
2878  int vendor;
2879  int device;
2880  int subvendor;
2882  int subdevice;
2884  unsigned int features;
2885  int line_cnt;
2887  int vario;
2888 } cdb_isdn_card;
2889 
2890 typedef struct {
2891  int handle;
2893  int drvid;
2894  int typ;
2895  int subtyp;
2896  int smp;
2897  char *mod_name;
2898  char *para_str;
2899  char *mod_preload;
2900  char *cfg_prog;
2901  char *firmware;
2902  char *description;
2903  char *need_pkg;
2904  char *info;
2905  char *protocol;
2906  char *interface;
2907  char *io;
2908  char *irq;
2909  char *membase;
2910  char *features;
2911  int card_ref;
2912  char *name;
2913 } cdb_isdn_vario;
2914 
2915 
2917 extern cdb_isdn_card *hd_cdbisdn_get_card(int);
2920 extern cdb_isdn_card *hd_cdbisdn_get_card_from_id(int, int, int, int);
2922 extern int hd_cdbisdn_get_version(void);
2923 extern int hd_cdbisdn_get_db_version(void);
2924 extern char *hd_cdbisdn_get_db_date(void);
2925 
2931 #ifdef __cplusplus
2932 }
2933 #endif
2934 
2937 #endif /* _HD_H */