diff options
author | Tudor Florea <tudor.florea@enea.com> | 2015-10-08 22:42:49 +0200 |
---|---|---|
committer | Tudor Florea <tudor.florea@enea.com> | 2015-10-08 22:42:49 +0200 |
commit | 635d320abfa6dc3c0e1d00e3ceae567dd0e55a5b (patch) | |
tree | dcd42fafb9189d3be13ef3d95f9ce6f4f5cfa267 /recipes-kernel/linux/linux-hierofalcon/412-1-styx-linux-tracking.git-2a3f98071e81b66033f6272f6c632023d1dcb1d2.patch | |
download | meta-hierofalcon-635d320abfa6dc3c0e1d00e3ceae567dd0e55a5b.tar.gz |
initial commit for Enea Linux 5.0 arm
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'recipes-kernel/linux/linux-hierofalcon/412-1-styx-linux-tracking.git-2a3f98071e81b66033f6272f6c632023d1dcb1d2.patch')
-rw-r--r-- | recipes-kernel/linux/linux-hierofalcon/412-1-styx-linux-tracking.git-2a3f98071e81b66033f6272f6c632023d1dcb1d2.patch | 348 |
1 files changed, 348 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-hierofalcon/412-1-styx-linux-tracking.git-2a3f98071e81b66033f6272f6c632023d1dcb1d2.patch b/recipes-kernel/linux/linux-hierofalcon/412-1-styx-linux-tracking.git-2a3f98071e81b66033f6272f6c632023d1dcb1d2.patch new file mode 100644 index 0000000..1dcbb88 --- /dev/null +++ b/recipes-kernel/linux/linux-hierofalcon/412-1-styx-linux-tracking.git-2a3f98071e81b66033f6272f6c632023d1dcb1d2.patch | |||
@@ -0,0 +1,348 @@ | |||
1 | From 2f12ab9f8409067cd3a977994659c1a0e8f3088b Mon Sep 17 00:00:00 2001 | ||
2 | From: Adrian Calianu <adrian.calianu@enea.com> | ||
3 | Date: Mon, 10 Aug 2015 17:19:12 +0200 | ||
4 | Subject: [PATCH] Subject: [PATCH] ACPI / scan: Add support for ACPI _CLS | ||
5 | device matching | ||
6 | |||
7 | Patch ported from 3.19 kernel: | ||
8 | |||
9 | Device drivers typically use ACPI _HIDs/_CIDs listed in struct device_driver | ||
10 | acpi_match_table to match devices. However, for generic drivers, we do not | ||
11 | want to list _HID for all supported devices. Also, certain classes of devices | ||
12 | do not have _CID (e.g. SATA, USB). Instead, we can leverage ACPI _CLS, | ||
13 | which specifies PCI-defined class code (i.e. base-class, subclass and | ||
14 | programming interface). This patch adds support for matching ACPI devices using | ||
15 | the _CLS method. | ||
16 | |||
17 | To support loadable module, current design uses _HID or _CID to match device's | ||
18 | modalias. With the new way of matching with _CLS this would requires modification | ||
19 | to the current ACPI modalias key to include _CLS. This patch appends PCI-defined | ||
20 | class-code to the existing ACPI modalias as following. | ||
21 | |||
22 | acpi:<HID>:<CID1>:<CID2>:..:<CIDn>:<bbsspp>: | ||
23 | E.g: | ||
24 | # cat /sys/devices/platform/AMDI0600:00/modalias | ||
25 | acpi:AMDI0600:010601: | ||
26 | |||
27 | where bb is th base-class code, ss is te sub-class code, and pp is the | ||
28 | programming interface code | ||
29 | |||
30 | Since there would not be _HID/_CID in the ACPI matching table of the driver, | ||
31 | this patch adds a field to acpi_device_id to specify the matching _CLS. | ||
32 | |||
33 | static const struct acpi_device_id ahci_acpi_match[] = { | ||
34 | { "", 0, PCI_CLASS_STORAGE_SATA_AHCI }, | ||
35 | {}, | ||
36 | }; | ||
37 | |||
38 | In this case, the corresponded entry in modules.alias file would be: | ||
39 | |||
40 | alias acpi*:010601:* ahci_platform | ||
41 | |||
42 | Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> | ||
43 | |||
44 | Signed-off-by: Adrian Calianu <adrian.calianu@enea.com> | ||
45 | --- | ||
46 | drivers/acpi/acpica/acutils.h | 3 ++ | ||
47 | drivers/acpi/acpica/nsxfname.c | 21 ++++++++++-- | ||
48 | drivers/acpi/acpica/utids.c | 71 +++++++++++++++++++++++++++++++++++++++ | ||
49 | drivers/acpi/scan.c | 20 ++++++++--- | ||
50 | include/acpi/acnames.h | 1 + | ||
51 | include/acpi/actypes.h | 4 ++- | ||
52 | include/linux/mod_devicetable.h | 1 + | ||
53 | scripts/mod/devicetable-offsets.c | 1 + | ||
54 | scripts/mod/file2alias.c | 14 ++++++-- | ||
55 | 9 files changed, 126 insertions(+), 10 deletions(-) | ||
56 | |||
57 | diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h | ||
58 | index 2b3c5bd..218ddfd 100644 | ||
59 | --- a/drivers/acpi/acpica/acutils.h | ||
60 | +++ b/drivers/acpi/acpica/acutils.h | ||
61 | @@ -430,6 +430,9 @@ acpi_status | ||
62 | acpi_ut_execute_CID(struct acpi_namespace_node *device_node, | ||
63 | struct acpi_pnp_device_id_list ** return_cid_list); | ||
64 | |||
65 | +acpi_status | ||
66 | +acpi_ut_execute_CLS(struct acpi_namespace_node *device_node, | ||
67 | + struct acpi_pnp_device_id **return_id); | ||
68 | /* | ||
69 | * utlock - reader/writer locks | ||
70 | */ | ||
71 | diff --git a/drivers/acpi/acpica/nsxfname.c b/drivers/acpi/acpica/nsxfname.c | ||
72 | index d66c326..3754db5 100644 | ||
73 | --- a/drivers/acpi/acpica/nsxfname.c | ||
74 | +++ b/drivers/acpi/acpica/nsxfname.c | ||
75 | @@ -276,11 +276,12 @@ acpi_get_object_info(acpi_handle handle, | ||
76 | struct acpi_pnp_device_id *hid = NULL; | ||
77 | struct acpi_pnp_device_id *uid = NULL; | ||
78 | struct acpi_pnp_device_id *sub = NULL; | ||
79 | + struct acpi_pnp_device_id *cls = NULL; | ||
80 | char *next_id_string; | ||
81 | acpi_object_type type; | ||
82 | acpi_name name; | ||
83 | u8 param_count = 0; | ||
84 | - u8 valid = 0; | ||
85 | + u16 valid = 0; | ||
86 | u32 info_size; | ||
87 | u32 i; | ||
88 | acpi_status status; | ||
89 | @@ -320,7 +321,7 @@ acpi_get_object_info(acpi_handle handle, | ||
90 | if ((type == ACPI_TYPE_DEVICE) || (type == ACPI_TYPE_PROCESSOR)) { | ||
91 | /* | ||
92 | * Get extra info for ACPI Device/Processor objects only: | ||
93 | - * Run the Device _HID, _UID, _SUB, and _CID methods. | ||
94 | + * Run the Device _HID, _UID, _SUB, _CID and _CLS methods. | ||
95 | * | ||
96 | * Note: none of these methods are required, so they may or may | ||
97 | * not be present for this device. The Info->Valid bitfield is used | ||
98 | @@ -351,6 +352,14 @@ acpi_get_object_info(acpi_handle handle, | ||
99 | valid |= ACPI_VALID_SUB; | ||
100 | } | ||
101 | |||
102 | + /* Execute the Device._CLS method */ | ||
103 | + | ||
104 | + status = acpi_ut_execute_CLS(node, &cls); | ||
105 | + if (ACPI_SUCCESS(status)) { | ||
106 | + info_size += cls->length; | ||
107 | + valid |= ACPI_VALID_CLS; | ||
108 | + } | ||
109 | + | ||
110 | /* Execute the Device._CID method */ | ||
111 | |||
112 | status = acpi_ut_execute_CID(node, &cid_list); | ||
113 | @@ -468,6 +477,11 @@ acpi_get_object_info(acpi_handle handle, | ||
114 | sub, next_id_string); | ||
115 | } | ||
116 | |||
117 | + if (cls) { | ||
118 | + next_id_string = acpi_ns_copy_device_id(&info->cls, | ||
119 | + cls, next_id_string); | ||
120 | + } | ||
121 | + | ||
122 | if (cid_list) { | ||
123 | info->compatible_id_list.count = cid_list->count; | ||
124 | info->compatible_id_list.list_size = cid_list->list_size; | ||
125 | @@ -510,6 +524,9 @@ cleanup: | ||
126 | if (cid_list) { | ||
127 | ACPI_FREE(cid_list); | ||
128 | } | ||
129 | + if (cls) { | ||
130 | + ACPI_FREE(cls); | ||
131 | + } | ||
132 | return (status); | ||
133 | } | ||
134 | |||
135 | diff --git a/drivers/acpi/acpica/utids.c b/drivers/acpi/acpica/utids.c | ||
136 | index 27431cf..bc77122 100644 | ||
137 | --- a/drivers/acpi/acpica/utids.c | ||
138 | +++ b/drivers/acpi/acpica/utids.c | ||
139 | @@ -416,3 +416,74 @@ cleanup: | ||
140 | acpi_ut_remove_reference(obj_desc); | ||
141 | return_ACPI_STATUS(status); | ||
142 | } | ||
143 | + | ||
144 | +/******************************************************************************* | ||
145 | + * | ||
146 | + * FUNCTION: acpi_ut_execute_CLS | ||
147 | + * | ||
148 | + * PARAMETERS: device_node - Node for the device | ||
149 | + * return_id - Where the string UID is returned | ||
150 | + * | ||
151 | + * RETURN: Status | ||
152 | + * | ||
153 | + * DESCRIPTION: Executes the _CLS control method that returns PCI-defined | ||
154 | + * class code of the device. The ACPI spec define _CLS as a | ||
155 | + * package with three integers. The returned string has format: | ||
156 | + * | ||
157 | + * "bbsspp" | ||
158 | + * where: | ||
159 | + * bb = Base-class code | ||
160 | + * ss = Sub-class code | ||
161 | + * pp = Programming Interface code | ||
162 | + * | ||
163 | + ******************************************************************************/ | ||
164 | + | ||
165 | +acpi_status | ||
166 | +acpi_ut_execute_CLS(struct acpi_namespace_node *device_node, | ||
167 | + struct acpi_pnp_device_id **return_id) | ||
168 | +{ | ||
169 | + struct acpi_pnp_device_id *cls; | ||
170 | + union acpi_operand_object *obj_desc; | ||
171 | + union acpi_operand_object **cls_objects; | ||
172 | + acpi_status status; | ||
173 | + | ||
174 | + ACPI_FUNCTION_TRACE(ut_execute_CLS); | ||
175 | + status = acpi_ut_evaluate_object(device_node, METHOD_NAME__CLS, | ||
176 | + ACPI_BTYPE_PACKAGE, &obj_desc); | ||
177 | + if (ACPI_FAILURE(status)) | ||
178 | + return_ACPI_STATUS(status); | ||
179 | + | ||
180 | + cls_objects = obj_desc->package.elements; | ||
181 | + | ||
182 | + if (obj_desc->common.type == ACPI_TYPE_PACKAGE && | ||
183 | + obj_desc->package.count == 3 && | ||
184 | + cls_objects[0]->common.type == ACPI_TYPE_INTEGER && | ||
185 | + cls_objects[1]->common.type == ACPI_TYPE_INTEGER && | ||
186 | + cls_objects[2]->common.type == ACPI_TYPE_INTEGER) { | ||
187 | + | ||
188 | + /* Allocate a buffer for the CLS */ | ||
189 | + cls = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pnp_device_id) + | ||
190 | + (acpi_size) 7); | ||
191 | + if (!cls) { | ||
192 | + status = AE_NO_MEMORY; | ||
193 | + goto cleanup; | ||
194 | + } | ||
195 | + | ||
196 | + cls->string = | ||
197 | + ACPI_ADD_PTR(char, cls, sizeof(struct acpi_pnp_device_id)); | ||
198 | + | ||
199 | + sprintf(cls->string, "%02x%02x%02x", | ||
200 | + (u8)ACPI_TO_INTEGER(cls_objects[0]->integer.value), | ||
201 | + (u8)ACPI_TO_INTEGER(cls_objects[1]->integer.value), | ||
202 | + (u8)ACPI_TO_INTEGER(cls_objects[2]->integer.value)); | ||
203 | + cls->length = 7; | ||
204 | + *return_id = cls; | ||
205 | + } | ||
206 | + | ||
207 | +cleanup: | ||
208 | + | ||
209 | + /* On exit, we must delete the return object */ | ||
210 | + | ||
211 | + acpi_ut_remove_reference(obj_desc); | ||
212 | + return_ACPI_STATUS(status); | ||
213 | +} | ||
214 | diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c | ||
215 | index 03141aa..ca6297b1 100644 | ||
216 | --- a/drivers/acpi/scan.c | ||
217 | +++ b/drivers/acpi/scan.c | ||
218 | @@ -1031,11 +1031,18 @@ static const struct acpi_device_id *__acpi_match_device( | ||
219 | if (!device || !device->status.present) | ||
220 | return NULL; | ||
221 | |||
222 | - list_for_each_entry(hwid, &device->pnp.ids, list) { | ||
223 | - /* First, check the ACPI/PNP IDs provided by the caller. */ | ||
224 | - for (id = ids; id->id[0]; id++) | ||
225 | - if (!strcmp((char *) id->id, hwid->id)) | ||
226 | - return id; | ||
227 | + list_for_each_entry(hwid, &device->pnp.ids, list) { | ||
228 | + for (id = ids; id->id[0] || id->cls; id++) { | ||
229 | + if (id->id[0] && !strcmp((char *) id->id, hwid->id)) { | ||
230 | + return id; | ||
231 | + } else if (id->cls) { | ||
232 | + char buf[7]; | ||
233 | + | ||
234 | + sprintf(buf, "%06x", id->cls); | ||
235 | + if (!strcmp(buf, hwid->id)) | ||
236 | + return id; | ||
237 | + } | ||
238 | + } | ||
239 | |||
240 | /* | ||
241 | * Next, check the special "PRP0001" ID and try to match the | ||
242 | @@ -2057,6 +2064,9 @@ static void acpi_set_pnp_ids(acpi_handle handle, struct acpi_device_pnp *pnp, | ||
243 | pnp->unique_id = kstrdup(info->unique_id.string, | ||
244 | GFP_KERNEL); | ||
245 | |||
246 | + if (info->valid & ACPI_VALID_CLS) | ||
247 | + acpi_add_id(pnp, info->cls.string); | ||
248 | + | ||
249 | kfree(info); | ||
250 | |||
251 | /* | ||
252 | diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h | ||
253 | index 273de70..b52c0dc 100644 | ||
254 | --- a/include/acpi/acnames.h | ||
255 | +++ b/include/acpi/acnames.h | ||
256 | @@ -51,6 +51,7 @@ | ||
257 | #define METHOD_NAME__BBN "_BBN" | ||
258 | #define METHOD_NAME__CBA "_CBA" | ||
259 | #define METHOD_NAME__CID "_CID" | ||
260 | +#define METHOD_NAME__CLS "_CLS" | ||
261 | #define METHOD_NAME__CRS "_CRS" | ||
262 | #define METHOD_NAME__DDN "_DDN" | ||
263 | #define METHOD_NAME__HID "_HID" | ||
264 | diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h | ||
265 | index 1c3002e..0ad0c61 100644 | ||
266 | --- a/include/acpi/actypes.h | ||
267 | +++ b/include/acpi/actypes.h | ||
268 | @@ -1166,7 +1166,7 @@ struct acpi_device_info { | ||
269 | u32 name; /* ACPI object Name */ | ||
270 | acpi_object_type type; /* ACPI object Type */ | ||
271 | u8 param_count; /* If a method, required parameter count */ | ||
272 | - u8 valid; /* Indicates which optional fields are valid */ | ||
273 | + u16 valid; /* Indicates which optional fields are valid */ | ||
274 | u8 flags; /* Miscellaneous info */ | ||
275 | u8 highest_dstates[4]; /* _sx_d values: 0xFF indicates not valid */ | ||
276 | u8 lowest_dstates[5]; /* _sx_w values: 0xFF indicates not valid */ | ||
277 | @@ -1175,6 +1175,7 @@ struct acpi_device_info { | ||
278 | struct acpi_pnp_device_id hardware_id; /* _HID value */ | ||
279 | struct acpi_pnp_device_id unique_id; /* _UID value */ | ||
280 | struct acpi_pnp_device_id subsystem_id; /* _SUB value */ | ||
281 | + struct acpi_pnp_device_id cls; /* _CLS value */ | ||
282 | struct acpi_pnp_device_id_list compatible_id_list; /* _CID list <must be last> */ | ||
283 | }; | ||
284 | |||
285 | @@ -1192,6 +1193,7 @@ struct acpi_device_info { | ||
286 | #define ACPI_VALID_CID 0x20 | ||
287 | #define ACPI_VALID_SXDS 0x40 | ||
288 | #define ACPI_VALID_SXWS 0x80 | ||
289 | +#define ACPI_VALID_CLS 0x100 | ||
290 | |||
291 | /* Flags for _STA return value (current_status above) */ | ||
292 | |||
293 | diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h | ||
294 | index 3bfd567..8a958d1 100644 | ||
295 | --- a/include/linux/mod_devicetable.h | ||
296 | +++ b/include/linux/mod_devicetable.h | ||
297 | @@ -35,6 +35,7 @@ struct ieee1394_device_id { | ||
298 | __u32 specifier_id; | ||
299 | __u32 version; | ||
300 | kernel_ulong_t driver_data; | ||
301 | + __u32 cls; | ||
302 | }; | ||
303 | |||
304 | |||
305 | diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c | ||
306 | index fce36d0..aac0be3 100644 | ||
307 | --- a/scripts/mod/devicetable-offsets.c | ||
308 | +++ b/scripts/mod/devicetable-offsets.c | ||
309 | @@ -63,6 +63,7 @@ int main(void) | ||
310 | |||
311 | DEVID(acpi_device_id); | ||
312 | DEVID_FIELD(acpi_device_id, id); | ||
313 | + DEVID_FIELD(acpi_device_id, cls); | ||
314 | |||
315 | DEVID(pnp_device_id); | ||
316 | DEVID_FIELD(pnp_device_id, id); | ||
317 | diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c | ||
318 | index 78691d5..f5599ad 100644 | ||
319 | --- a/scripts/mod/file2alias.c | ||
320 | +++ b/scripts/mod/file2alias.c | ||
321 | @@ -511,12 +511,22 @@ static int do_serio_entry(const char *filename, | ||
322 | } | ||
323 | ADD_TO_DEVTABLE("serio", serio_device_id, do_serio_entry); | ||
324 | |||
325 | -/* looks like: "acpi:ACPI0003 or acpi:PNP0C0B" or "acpi:LNXVIDEO" */ | ||
326 | +/* looks like: "acpi:ACPI0003" or "acpi:PNP0C0B" or "acpi:LNXVIDEO" or | ||
327 | + * "acpi:bbsspp" (bb=base-class, ss=sub-class, pp=prog-if) | ||
328 | + * | ||
329 | + * NOTE: * Each driver should use one of the following : _HID, _CIDs or _CLS. | ||
330 | + */ | ||
331 | static int do_acpi_entry(const char *filename, | ||
332 | void *symval, char *alias) | ||
333 | { | ||
334 | DEF_FIELD_ADDR(symval, acpi_device_id, id); | ||
335 | - sprintf(alias, "acpi*:%s:*", *id); | ||
336 | + DEF_FIELD_ADDR(symval, acpi_device_id, cls); | ||
337 | + | ||
338 | + if (id && strlen((const char *)*id)) | ||
339 | + sprintf(alias, "acpi*:%s:*", *id); | ||
340 | + else if (cls) | ||
341 | + sprintf(alias, "acpi*:%06x:*", *cls); | ||
342 | + | ||
343 | return 1; | ||
344 | } | ||
345 | ADD_TO_DEVTABLE("acpi", acpi_device_id, do_acpi_entry); | ||
346 | -- | ||
347 | 1.9.1 | ||
348 | |||