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