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 | extern struct DevPropString *string;␊ |
16 | extern uint8_t *stringdata;␊ |
17 | extern uint32_t stringlength;␊ |
18 | extern uint32_t devices_number;␊ |
19 | extern void setupDeviceProperties(Node *node);␊ |
20 | ␊ |
21 | #define DEV_PATH_HEADER␉␉\␊ |
22 | ␉uint8_t␉␉type;␉␉\␊ |
23 | ␉uint8_t␉␉subtype;␉\␊ |
24 | ␉uint16_t␉length;␊ |
25 | ␊ |
26 | struct ACPIDevPath {␊ |
27 | ␉//uint8_t␉␉type;␉␉// = 2 ACPI device-path␊ |
28 | ␉//uint8_t␉␉subtype;␉// = 1 ACPI Device-path␊ |
29 | ␉//uint16_t␉ length;␉␉// = 0x0c␊ |
30 | ␉DEV_PATH_HEADER␊ |
31 | ␉uint32_t␉_HID;␉␉// = 0xD041030A ?␊ |
32 | ␉uint32_t␉_UID;␉␉// = 0x00000000 PCI ROOT␊ |
33 | };␊ |
34 | ␊ |
35 | struct PCIDevPath {␊ |
36 | ␉//uint8_t␉␉type;␉␉// = 1 Hardware device-path␊ |
37 | ␉//uint8_t␉␉subtype;␉// = 1 PCI␊ |
38 | ␉//uint16_t␉ length;␉␉// = 6␊ |
39 | ␉DEV_PATH_HEADER␊ |
40 | ␉uint8_t␉␉function;␉// pci func number␊ |
41 | ␉uint8_t␉␉device;␉␉// pci dev number␊ |
42 | };␊ |
43 | ␊ |
44 | struct DevicePathEnd {␊ |
45 | ␉//uint8_t␉␉type;␉␉// = 0x7f␊ |
46 | ␉//uint8_t␉␉subtype;␉// = 0xff␊ |
47 | ␉//uint16_t␉␉length;␉␉// = 4;␊ |
48 | ␉DEV_PATH_HEADER␊ |
49 | };␊ |
50 | ␊ |
51 | struct DevPropDevice {␊ |
52 | ␉uint32_t length;␊ |
53 | ␉uint16_t numentries;␊ |
54 | ␉uint16_t WHAT2;␉␉␉␉␉␉␉␉␉␉// 0x0000 ?␊ |
55 | ␉struct ACPIDevPath acpi_dev_path;␉␉␉␉␉// = 0x02010c00 0xd041030a␊ |
56 | ␉struct PCIDevPath pci_dev_path[MAX_PCI_DEV_PATHS]; // = 0x01010600 func dev␊ |
57 | ␉struct DevicePathEnd path_end;␉␉␉␉␉␉// = 0x7fff0400␊ |
58 | ␉uint8_t *data;␊ |
59 | ␉␊ |
60 | ␉// ------------------------␊ |
61 | ␉uint8_t␉ num_pci_devpaths;␊ |
62 | ␉struct DevPropString *string;␊ |
63 | ␉// ------------------------␉␊ |
64 | };␊ |
65 | ␊ |
66 | struct DevPropString {␊ |
67 | ␉uint32_t length;␊ |
68 | ␉uint32_t WHAT2;␉␉␉// 0x01000000 ?␊ |
69 | ␉uint16_t numentries;␊ |
70 | ␉uint16_t WHAT3;␉␉␉// 0x0000 ?␊ |
71 | ␉struct DevPropDevice **entries;␊ |
72 | };␊ |
73 | ␊ |
74 | char␉␉␉*efi_inject_get_devprop_string(uint32_t *len);␊ |
75 | //int␉␉␉devprop_add_network_template(struct DevPropDevice *device, uint16_t vendor_id);␊ |
76 | struct DevPropString␉*devprop_create_string(void);␊ |
77 | struct DevPropDevice␉*devprop_add_device(struct DevPropString *string, char *path);␊ |
78 | int␉␉␉devprop_add_value(struct DevPropDevice *device, char *nm, uint8_t *vl, uint32_t len);␊ |
79 | char␉␉␉*devprop_generate_string(struct DevPropString *string);␊ |
80 | void␉␉␉devprop_free_string(struct DevPropString *string);␊ |
81 | ␊ |
82 | #endif /* !__LIBSAIO_DEVICE_INJECT_H */␊ |
83 | |