1 | /*␊ |
2 | *␉Copyright 2009 Jasmin Fazlic All rights reserved.␊ |
3 | */␊ |
4 | /*␊ |
5 | *␉Cleaned and merged by iNDi␊ |
6 | */␊ |
7 | ␊ |
8 | #ifndef __LIBSAIO_DEVICE_INJECT_H␊ |
9 | #define __LIBSAIO_DEVICE_INJECT_H␊ |
10 | ␊ |
11 | #define DP_ADD_TEMP_VAL(dev, val) devprop_add_value(dev, (char*)val[0], (uint8_t*)val[1], strlen(val[1]) + 1)␊ |
12 | #define DP_ADD_TEMP_VAL_DATA(dev, val) devprop_add_value(dev, (char*)val.name, (uint8_t*)val.data, val.size)␊ |
13 | #define MAX_PCI_DEV_PATHS 4␊ |
14 | ␊ |
15 | #define DEV_PROP_DEVICE_MAX_ENTRIES 64␊ |
16 | ␊ |
17 | extern void setupDeviceProperties(Node *node);␊ |
18 | ␊ |
19 | struct ACPIDevPath {␊ |
20 | ␉uint8_t␉␉type;␉␉// = 2 ACPI device-path␊ |
21 | ␉uint8_t␉␉subtype;␉// = 1 ACPI Device-path␊ |
22 | ␉uint16_t␉length;␉␉// = 0x0c␊ |
23 | ␉uint32_t␉_HID;␉␉// = 0xD041030A ?␊ |
24 | ␉uint32_t␉_UID;␉␉// = 0x00000000 PCI ROOT␊ |
25 | };␊ |
26 | ␊ |
27 | struct PCIDevPath {␊ |
28 | ␉uint8_t␉␉type;␉␉// = 1 Hardware device-path␊ |
29 | ␉uint8_t␉␉subtype;␉// = 1 PCI␊ |
30 | ␉uint16_t␉length;␉␉// = 6␊ |
31 | ␉uint8_t␉␉function;␉// pci func number␊ |
32 | ␉uint8_t␉␉device;␉␉// pci dev number␊ |
33 | };␊ |
34 | ␊ |
35 | struct DevicePathEnd {␊ |
36 | ␉uint8_t␉␉type;␉␉// = 0x7f␊ |
37 | ␉uint8_t␉␉subtype;␉// = 0xff␊ |
38 | ␉uint16_t␉length;␉␉// = 4;␊ |
39 | };␊ |
40 | ␊ |
41 | struct DevPropDevice {␊ |
42 | ␉uint32_t length;␊ |
43 | ␉uint16_t numentries;␊ |
44 | ␉uint16_t WHAT2;␉␉␉␉␉␉␉␉// 0x0000 ?␊ |
45 | ␉struct ACPIDevPath acpi_dev_path;␉␉␉␉␉// = 0x02010c00 0xd041030a␊ |
46 | ␉struct PCIDevPath pci_dev_path[MAX_PCI_DEV_PATHS]; // = 0x01010600 func dev␊ |
47 | ␉struct DevicePathEnd path_end;␉␉␉␉␉␉// = 0x7fff0400␊ |
48 | ␉uint8_t *data;␊ |
49 | ␉␊ |
50 | ␉// ------------------------␊ |
51 | ␉uint8_t␉ num_pci_devpaths;␊ |
52 | ␉struct DevPropString *string;␊ |
53 | ␉// ------------------------␉␊ |
54 | };␊ |
55 | ␊ |
56 | struct DevPropString {␊ |
57 | ␉uint32_t length;␊ |
58 | ␉uint32_t WHAT2;␉␉␉// 0x01000000 ?␊ |
59 | ␉uint16_t numentries;␊ |
60 | ␉uint16_t WHAT3;␉␉␉// 0x0000 ?␊ |
61 | ␉struct DevPropDevice **entries;␊ |
62 | };␊ |
63 | ␊ |
64 | extern struct DevPropString *string;␊ |
65 | extern uint8_t *stringdata;␊ |
66 | extern uint32_t stringlength;␊ |
67 | struct DevPropString␉*devprop_create_string(void);␊ |
68 | struct DevPropDevice␉*devprop_add_device(struct DevPropString *string, char *path);␊ |
69 | char␉␉␉*efi_inject_get_devprop_string(uint32_t *len);␊ |
70 | int␉␉␉devprop_add_value(struct DevPropDevice *device, char *nm, uint8_t *vl, uint32_t len);␊ |
71 | char␉␉␉*devprop_generate_string(struct DevPropString *string);␊ |
72 | void␉␉␉devprop_free_string(struct DevPropString *string);␊ |
73 | ␊ |
74 | int␉␉␉devprop_add_network_template(struct DevPropDevice *device, uint16_t vendor_id);␊ |
75 | int␉␉␉hex2bin(const char *hex, uint8_t *bin, int len);␊ |
76 | #endif /* !__LIBSAIO_DEVICE_INJECT_H */␊ |
77 | |