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