Print this page
acpica-unix2-20130823
PANKOVs restructure
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/i86pc/sys/acpidev.h
+++ new/usr/src/uts/i86pc/sys/acpidev.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
↓ open down ↓ |
21 lines elided |
↑ open up ↑ |
22 22 * Copyright (c) 2009-2010, Intel Corporation.
23 23 * All rights reserved.
24 24 */
25 25
26 26 #ifndef _SYS_ACPIDEV_H
27 27 #define _SYS_ACPIDEV_H
28 28 #include <sys/types.h>
29 29 #include <sys/obpdefs.h>
30 30 #include <sys/sunddi.h>
31 31 #ifdef _KERNEL
32 -#include <sys/acpi/acpi.h>
32 +#include <acpica/include/acpi.h>
33 33 #include <sys/acpica.h>
34 34 #endif
35 35
36 36 #ifdef __cplusplus
37 37 extern "C" {
38 38 #endif
39 39
40 40 /* Maximum recursion levels when enumerating objects in ACPI namespace. */
41 41 #define ACPIDEV_MAX_ENUM_LEVELS 32
42 42
43 43 /* Maximum length of device name for ACPI object. */
44 44 #define ACPIDEV_MAX_NAMELEN OBP_MAXDRVNAME
45 45
46 46 /* Pseudo ACPI device HID for ACPI root object. */
47 47 #define ACPIDEV_HID_ROOTNEX "SOLA0001"
48 48 /* Pseudo ACPI device HID for ACPI virtual bus. */
49 49 #define ACPIDEV_HID_VIRTNEX "SOLA0002"
50 50 #define ACPIDEV_HID_SCOPE "SOLA0003"
51 51 #define ACPIDEV_HID_PROCESSOR "SOLA0004"
52 52
53 53 /* ACPI device HIDs/CIDs defined by ACPI specification. */
54 54 #define ACPIDEV_HID_CONTAINER1 "PNP0A05"
55 55 #define ACPIDEV_HID_CONTAINER2 "PNP0A06"
56 56 #define ACPIDEV_HID_MODULE "ACPI0004"
57 57 #define ACPIDEV_HID_CPU "ACPI0007"
58 58 #define ACPIDEV_HID_PCI_HOSTBRIDGE "PNP0A03"
59 59 #define ACPIDEV_HID_PCIE_HOSTBRIDGE "PNP0A08"
60 60 #define ACPIDEV_HID_PCIEX_HOSTBRIDGE "PNP0A08"
61 61 #define ACPIDEV_HID_MEMORY "PNP0C80"
62 62
63 63 /* Device names for ACPI objects. */
64 64 #define ACPIDEV_NODE_NAME_ROOT "fw"
65 65 #define ACPIDEV_NODE_NAME_ACPIDR "acpidr"
66 66 #define ACPIDEV_NODE_NAME_CONTAINER "container"
67 67 #define ACPIDEV_NODE_NAME_MODULE_SBD "sb"
68 68 #define ACPIDEV_NODE_NAME_MODULE_CPU "socket"
69 69 #define ACPIDEV_NODE_NAME_CPU "cpu"
70 70 #define ACPIDEV_NODE_NAME_PROCESSOR "cpus"
71 71 #define ACPIDEV_NODE_NAME_MEMORY "mem"
72 72 #define ACPIDEV_NODE_NAME_PCI "pci"
73 73
74 74 /* Device types for ACPI objects. */
75 75 #define ACPIDEV_TYPE_ROOTNEX "acpirootnex"
76 76 #define ACPIDEV_TYPE_VIRTNEX "acpivirtnex"
77 77 #define ACPIDEV_TYPE_SCOPE "acpiscope"
78 78 #define ACPIDEV_TYPE_DEVICE "acpidevice"
79 79 #define ACPIDEV_TYPE_CONTAINER "acpicontainer"
80 80 #define ACPIDEV_TYPE_CPU "acpicpu"
81 81 #define ACPIDEV_TYPE_MEMORY "acpimemory"
82 82 #define ACPIDEV_TYPE_PCI "pci"
83 83 #define ACPIDEV_TYPE_PCIEX "pciex"
84 84
85 85 /* Device property names for ACPI objects. */
86 86 #define ACPIDEV_PROP_NAME_UNIT_ADDR "unit-address"
87 87 #define ACPIDEV_PROP_NAME_ACPI_UID "acpi-uid"
88 88 #define ACPIDEV_PROP_NAME_PROCESSOR_ID "acpi-processor-id"
89 89 #define ACPIDEV_PROP_NAME_LOCALAPIC_ID "apic-id"
90 90 #define ACPIDEV_PROP_NAME_PROXIMITY_ID "proximity-id"
91 91
92 92 #define ACPIDEV_PROP_NAME_UID_FORMAT "acpidev-uid-format"
93 93
94 94 /* Miscellaneous strings. */
95 95 #define ACPIDEV_CMD_OST_PREFIX "acpi-update-status"
96 96 #define ACPIDEV_CMD_OST_INPROGRESS "acpi-update-status=inprogress"
97 97 #define ACPIDEV_CMD_OST_SUCCESS "acpi-update-status=success"
98 98 #define ACPIDEV_CMD_OST_FAILURE "acpi-update-status=failure"
99 99 #define ACPIDEV_CMD_OST_NOOP "acpi-update-status=noop"
100 100
101 101 #define ACPIDEV_EVENT_TYPE_ATTR_NAME "acpi-event-type"
102 102 #define ACPIDEV_EVENT_TYPE_BUS_CHECK "bus_check"
103 103 #define ACPIDEV_EVENT_TYPE_DEVICE_CHECK "device_check"
104 104 #define ACPIDEV_EVENT_TYPE_DEVICE_CHECK_LIGHT "device_check_light"
105 105 #define ACPIDEV_EVENT_TYPE_EJECT_REQUEST "eject_request"
106 106
107 107 /* ACPI device class Id. */
108 108 typedef enum acpidev_class_id {
109 109 ACPIDEV_CLASS_ID_INVALID = 0,
110 110 ACPIDEV_CLASS_ID_ROOTNEX = 1,
111 111 ACPIDEV_CLASS_ID_SCOPE = 2,
112 112 ACPIDEV_CLASS_ID_DEVICE = 3,
113 113 ACPIDEV_CLASS_ID_CONTAINER = 4,
114 114 ACPIDEV_CLASS_ID_CPU = 5,
115 115 ACPIDEV_CLASS_ID_MEMORY = 6,
116 116 ACPIDEV_CLASS_ID_PCI = 7,
117 117 ACPIDEV_CLASS_ID_PCIEX = 8,
118 118 ACPIDEV_CLASS_ID_MAX
119 119 } acpidev_class_id_t;
120 120
↓ open down ↓ |
78 lines elided |
↑ open up ↑ |
121 121 /* Flags for acpidev_options boot options. */
122 122 #define ACPIDEV_OUSER_NO_CPU 0x1
123 123 #define ACPIDEV_OUSER_NO_MEM 0x2
124 124 #define ACPIDEV_OUSER_NO_CONTAINER 0x4
125 125 #define ACPIDEV_OUSER_NO_PCI 0x8
126 126 #define ACPIDEV_OUSER_NO_CACHE 0x10000
127 127
128 128 #ifdef _KERNEL
129 129
130 130 /* Common ACPI object names. */
131 -#define ACPIDEV_OBJECT_NAME_SB ACPI_NS_SYSTEM_BUS
131 +#define ACPIDEV_OBJECT_NAME_SB METHOD_NAME__SB_
132 132 #define ACPIDEV_OBJECT_NAME_PR "_PR_"
133 133
134 134 /* Common ACPI method names. */
135 135 #define ACPIDEV_METHOD_NAME_MAT "_MAT"
136 136 #define ACPIDEV_METHOD_NAME_EJ0 "_EJ0"
137 137 #define ACPIDEV_METHOD_NAME_EDL "_EDL"
138 138 #define ACPIDEV_METHOD_NAME_EJD "_EJD"
139 139 #define ACPIDEV_METHOD_NAME_OST "_OST"
140 140 #define ACPIDEV_METHOD_NAME_PXM "_PXM"
141 141 #define ACPIDEV_METHOD_NAME_SLI "_SLI"
142 142
143 143 /* Source event code for _OST. */
144 144 #define ACPI_OST_EVENT_EJECTING 0x103
145 145 #define ACPI_OST_EVENT_INSERTING 0x200
146 146
147 147 /* Status code for _OST. */
148 148 #define ACPI_OST_STA_SUCCESS 0x0
149 149
150 150 /* Non-specific failure. */
151 151 #define ACPI_OST_STA_FAILURE 0x1
152 152
153 153 /* Unrecognized Notify Code. */
154 154 #define ACPI_OST_STA_NOT_SUPPORT 0x2
155 155
156 156 /* Device ejection not supported by OSPM. */
157 157 #define ACPI_OST_STA_EJECT_NOT_SUPPORT 0x80
158 158
159 159 /* Device in use by application. */
160 160 #define ACPI_OST_STA_EJECT_IN_USE 0x81
161 161
162 162 /* Device Busy. */
163 163 #define ACPI_OST_STA_EJECT_BUSY 0x82
164 164
165 165 /* Ejection dependency is busy or not supported for ejection by OSPM. */
166 166 #define ACPI_OST_STA_EJECT_DEPENDENCY 0x83
167 167
168 168 /* Ejection is in progress (pending). */
169 169 #define ACPI_OST_STA_EJECT_IN_PROGRESS 0x84
170 170
171 171 /* Device insertion in progress (pending). */
172 172 #define ACPI_OST_STA_INSERT_IN_PROGRESS 0x80
173 173
174 174 /* Device driver load failure. */
175 175 #define ACPI_OST_STA_INSERT_DRIVER 0x81
176 176
177 177 /* Device insertion not supported by OSPM. */
178 178 #define ACPI_OST_STA_INSERT_NOT_SUPPORT 0x82
179 179
180 180 /*
181 181 * Insertion failure
182 182 * Resources Unavailable as described by the following bit encodings:
183 183 * Bit[3] Bus Numbers
184 184 * Bit[2] Interrupts
185 185 * Bit[1] I/O
186 186 * Bit[0] Memory
187 187 */
188 188 #define ACPI_OST_STA_INSERT_NO_RESOURCE 0x90
189 189 #define ACPI_OST_STA_INSERT_NO_BUS 0x8
190 190 #define ACPI_OST_STA_INSERT_NO_INTR 0x4
191 191 #define ACPI_OST_STA_INSERT_NO_IO 0x2
192 192 #define ACPI_OST_STA_INSERT_NO_MEM 0x1
193 193
194 194 /*
195 195 * According to the ACPI specification, self latency (entry[n][n]) in the
196 196 * SLIT table should be 10.
197 197 */
198 198 #define ACPI_SLIT_SELF_LATENCY 10
199 199
200 200 /*
201 201 * The DR driver assigns a unique device id for each hot-added memory device.
202 202 * ACPI_MEMNODE_DEVID_BOOT is assigned to memory devices present at boot,
203 203 * which is distinguished from device ids assigned by the DR driver.
204 204 */
205 205 #define ACPI_MEMNODE_DEVID_BOOT UINT32_MAX
206 206
207 207 /* Forward declaration */
208 208 typedef struct acpidev_data_impl *acpidev_data_handle_t;
209 209 typedef struct acpidev_walk_info acpidev_walk_info_t;
210 210 typedef struct acpidev_filter_rule acpidev_filter_rule_t;
211 211 typedef struct acpidev_class acpidev_class_t;
212 212 typedef struct acpidev_class_list acpidev_class_list_t;
213 213
214 214 /* Type of ACPI device enumerating operation. */
215 215 typedef enum acpidev_op_type {
216 216 ACPIDEV_OP_BOOT_PROBE = 0, /* First pass probing at boot time. */
217 217 ACPIDEV_OP_BOOT_REPROBE, /* Second pass probing at boot time. */
218 218 ACPIDEV_OP_HOTPLUG_PROBE /* Probing for hotplug at runtime. */
219 219 } acpidev_op_type_t;
220 220
221 221 /*
222 222 * Structure to pass arguments when enumerating ACPI namespace.
223 223 */
224 224 struct acpidev_walk_info {
225 225 /* Always valid for all callbacks. */
226 226 acpidev_op_type_t awi_op_type;
227 227 int awi_level;
228 228 acpidev_walk_info_t *awi_parent;
229 229 acpidev_class_t *awi_class_curr;
230 230
231 231 /* Valid for all callbacks except pre_probe and post_probe. */
232 232 int awi_flags;
233 233 ACPI_HANDLE awi_hdl;
234 234 ACPI_DEVICE_INFO *awi_info;
235 235 char *awi_name;
236 236 acpidev_data_handle_t awi_data;
237 237
238 238 /* Need to validate it before access. */
239 239 dev_info_t *awi_dip;
240 240 acpidev_class_list_t **awi_class_list;
241 241
242 242 /* Used by class to store data temporarily. */
243 243 intptr_t awi_scratchpad[4];
244 244 };
245 245
246 246 /* Disable creating device nodes for ACPI objects. */
247 247 #define ACPIDEV_WI_DISABLE_CREATE 0x1
248 248 /* Device node has already been created for an ACPI object. */
249 249 #define ACPIDEV_WI_DEVICE_CREATED 0x2
250 250 /* Disable enumerating children of ACPI objects. */
251 251 #define ACPIDEV_WI_DISABLE_SCAN 0x10
252 252 /* Children of ACPI objects have already been enumerated. */
253 253 #define ACPIDEV_WI_CHILD_SCANNED 0x20
254 254
255 255 /*
256 256 * Device filtering result code.
257 257 * Device filtering logic will be applied to determine how to handle ACPI
258 258 * objects according to the filtering result code when enumerating ACPI objects.
259 259 */
260 260 typedef enum acpidev_filter_result {
261 261 ACPIDEV_FILTER_FAILED = -1, /* operation failed */
262 262 ACPIDEV_FILTER_CONTINUE = 0, /* continue to evaluate filter rules */
263 263 ACPIDEV_FILTER_DEFAULT, /* create node and scan child */
264 264 ACPIDEV_FILTER_SCAN, /* scan child of current node only */
265 265 ACPIDEV_FILTER_CREATE, /* create device node only */
266 266 ACPIDEV_FILTER_SKIP, /* skip current node */
267 267 } acpidev_filter_result_t;
268 268
269 269 typedef acpidev_filter_result_t (* acpidev_filter_func_t)(acpidev_walk_info_t *,
270 270 ACPI_HANDLE, acpidev_filter_rule_t *, char *, int);
271 271
272 272 /*
273 273 * Device filter rule data structure.
274 274 * User provided callback will be called if adf_filter_func is not NULL,
275 275 * otherwise default filtering algorithm will be applied.
276 276 */
277 277 struct acpidev_filter_rule {
278 278 acpidev_filter_func_t adf_filter_func;
279 279 intptr_t adf_filter_arg;
280 280 acpidev_filter_result_t adf_retcode;
281 281 acpidev_class_list_t **adf_class_list;
282 282 intptr_t adf_minlvl;
283 283 intptr_t adf_maxlvl;
284 284 char *adf_pattern;
285 285 char *adf_replace;
286 286 };
287 287
288 288 /* Callback function prototypes for ACPI device class driver. */
289 289 typedef ACPI_STATUS (* acpidev_pre_probe_t)(acpidev_walk_info_t *);
290 290 typedef ACPI_STATUS (* acpidev_post_probe_t)(acpidev_walk_info_t *);
291 291 typedef ACPI_STATUS (* acpidev_probe_t)(acpidev_walk_info_t *);
292 292 typedef acpidev_filter_result_t (* acpidev_filter_t)(acpidev_walk_info_t *,
293 293 char *, int);
294 294 typedef ACPI_STATUS (* acpidev_init_t)(acpidev_walk_info_t *);
295 295 typedef void (* acpidev_fini_t)(ACPI_HANDLE, acpidev_data_handle_t,
296 296 acpidev_class_t *);
297 297
298 298 /* Device class driver interface. */
299 299 struct acpidev_class {
300 300 volatile uint32_t adc_refcnt;
301 301 int adc_version;
302 302 acpidev_class_id_t adc_class_id;
303 303 /* Name of device class, used in log messages. */
304 304 char *adc_class_name;
305 305 /* Used as "device_type" property. */
306 306 char *adc_dev_type;
307 307 /* Private storage for device driver. */
308 308 void *adc_private;
309 309 /* Callback to setup environment before probing child objects. */
310 310 acpidev_pre_probe_t adc_pre_probe;
311 311 /* Callback to clean environment after probing child objects. */
312 312 acpidev_post_probe_t adc_post_probe;
313 313 /* Callback to probe child objects. */
314 314 acpidev_probe_t adc_probe;
315 315 /* Callback to figure out policy to handle objects. */
316 316 acpidev_filter_t adc_filter;
317 317 /* Callback to set device class specific device properties. */
318 318 acpidev_init_t adc_init;
319 319 /* Callback to clean up resources when destroying device nodes. */
320 320 acpidev_fini_t adc_fini;
321 321 };
322 322
323 323 /* Versions of the ACPI device class driver data structure. */
324 324 #define ACPIDEV_CLASS_REV1 1
325 325 #define ACPIDEV_CLASS_REV ACPIDEV_CLASS_REV1
326 326
327 327 /*
328 328 * Class drivers.
329 329 */
330 330 extern acpidev_class_t acpidev_class_scope;
331 331 extern acpidev_class_t acpidev_class_device;
332 332 extern acpidev_class_t acpidev_class_container;
333 333 extern acpidev_class_t acpidev_class_cpu;
334 334 extern acpidev_class_t acpidev_class_memory;
335 335 extern acpidev_class_t acpidev_class_pci;
336 336
337 337 /*
338 338 * Class driver lists.
339 339 */
340 340 extern acpidev_class_list_t *acpidev_class_list_root;
341 341 extern acpidev_class_list_t *acpidev_class_list_scope;
342 342 extern acpidev_class_list_t *acpidev_class_list_device;
343 343 extern acpidev_class_list_t *acpidev_class_list_cpu;
344 344 extern acpidev_class_list_t *acpidev_class_list_memory;
345 345
346 346 /*
347 347 * Register a device class driver onto a driver list. All class drivers on the
348 348 * same list will be called in order when processing an ACPI object.
349 349 * This interface can be used to support machine/platform specific object
350 350 * handling by registering special plug-in class drivers to override system
351 351 * default behaviors.
352 352 * listpp: pointer to driver list header
353 353 * clsp: device class driver to register
354 354 * tail: insert at tail of list if true
355 355 * Return values:
356 356 * AE_OK: success
357 357 * AE_BAD_PARAMETER: invalid parameter
358 358 * AE_BAD_DATA: driver version mismatch
359 359 * AE_ALREADY_EXISTS: class driver already exists on the list
360 360 */
361 361 extern ACPI_STATUS acpidev_register_class(acpidev_class_list_t **listpp,
362 362 acpidev_class_t *clsp, boolean_t tail);
363 363
364 364 /*
365 365 * Unregister a device class driver from a driver list.
366 366 * listpp: pointer to driver list header
367 367 * clsp: device class driver to unregister
368 368 * Return values:
369 369 * AE_OK: success
370 370 * AE_BAD_PARAMETER: invalid parameter
371 371 * AE_NOT_FOUND: class driver doesn't exist in list
372 372 * AE_ERROR: class driver is still in use.
373 373 */
374 374 extern ACPI_STATUS acpidev_unregister_class(acpidev_class_list_t **listpp,
375 375 acpidev_class_t *clsp);
376 376
377 377 /*
378 378 * Recursively enumerate child objects of an ACPI object.
379 379 * It does following things in turn:
380 380 * 1) Call pre_probe callback for each registered handler
381 381 * 2) Enumerate child objects and call probe callbacks for each object
382 382 * 3) Call post_probe callback for each registered handler
383 383 * Return AE_OK on success and error code on failure.
384 384 */
385 385 extern ACPI_STATUS acpidev_probe_child(acpidev_walk_info_t *infop);
386 386
387 387 /*
388 388 * Default handler to process ACPI objects.
389 389 * It creates a device node for an ACPI object and scans all child objects on
390 390 * demand.
391 391 * Return values:
392 392 * AE_OK: on success
393 393 * AE_NOT_EXIST: device doesn't exist according to _STA value.
394 394 * AE_ALREADY_EXISTS: object already handled by other handler.
395 395 * AE_ERROR: on other failure
396 396 */
397 397 extern ACPI_STATUS acpidev_process_object(acpidev_walk_info_t *infop,
398 398 int flags);
399 399
400 400 /* Flags for acpidev_process_device() */
401 401 #define ACPIDEV_PROCESS_FLAG_CREATE 0x1 /* Create device */
402 402 #define ACPIDEV_PROCESS_FLAG_SCAN 0x2 /* Scan child objects */
403 403 #define ACPIDEV_PROCESS_FLAG_CHECK 0x100 /* Check status */
404 404 #define ACPIDEV_PROCESS_FLAG_NOBIND 0x200 /* Skip binding driver */
405 405 #define ACPIDEV_PROCESS_FLAG_OFFLINE 0x400 /* Put device into offline. */
406 406 #define ACPIDEV_PROCESS_FLAG_NOTAG 0x800 /* Skip tag dip with object. */
407 407 #define ACPIDEV_PROCESS_FLAG_SYNCSTATUS 0x1000 /* Sync object status. */
408 408 #define ACPIDEV_PROCESS_FLAG_HOLDBRANCH 0x10000 /* Hold device branch. */
409 409
410 410 /*
411 411 * Filter ACPI objects according to filter rules, generate devname if needed.
412 412 * infop: pointer to walker information structure
413 413 * hdl: handle of ACPI object in question
414 414 * afrp: pointer to filter rule array
415 415 * entries: number of filter rules in array
416 416 * devname: buffer to store generated device name
417 417 * len: sizeof devname buffer
418 418 */
419 419 extern acpidev_filter_result_t acpidev_filter_device(acpidev_walk_info_t *infop,
420 420 ACPI_HANDLE hdl, acpidev_filter_rule_t *afrp, int entries,
421 421 char *devname, int len);
422 422
423 423 /* Default object filtering algorithm. */
424 424 extern acpidev_filter_result_t acpidev_filter_default(
425 425 acpidev_walk_info_t *infop, ACPI_HANDLE hdl, acpidev_filter_rule_t *afrp,
426 426 char *devname, int len);
427 427
428 428 /* Utility routines */
429 429 extern dev_info_t *acpidev_root_node(void);
430 430 extern char *acpidev_get_object_name(ACPI_HANDLE hdl);
431 431 extern void acpidev_free_object_name(char *objname);
432 432
433 433 extern acpidev_walk_info_t *acpidev_alloc_walk_info(acpidev_op_type_t op_type,
434 434 int lvl, ACPI_HANDLE hdl, acpidev_class_list_t **listpp,
435 435 acpidev_walk_info_t *pinfop);
436 436 extern void acpidev_free_walk_info(acpidev_walk_info_t *infop);
437 437 extern dev_info_t *acpidev_walk_info_get_pdip(acpidev_walk_info_t *infop);
438 438
439 439 /* Interfaces to access data associated with ACPI object. */
440 440 extern acpidev_data_handle_t acpidev_data_get_handle(ACPI_HANDLE hdl);
441 441 extern acpidev_data_handle_t acpidev_data_create_handle(ACPI_HANDLE hdl);
442 442 extern void acpidev_data_destroy_handle(ACPI_HANDLE hdl);
443 443 extern ACPI_HANDLE acpidev_data_get_object(acpidev_data_handle_t hdl);
444 444 extern dev_info_t *acpidev_data_get_devinfo(acpidev_data_handle_t hdl);
445 445 extern int acpidev_data_get_status(acpidev_data_handle_t hdl);
446 446 extern boolean_t acpidev_data_dr_capable(acpidev_data_handle_t hdl);
447 447 extern boolean_t acpidev_data_dr_ready(acpidev_data_handle_t hdl);
448 448 extern boolean_t acpidev_data_dr_failed(acpidev_data_handle_t hdl);
449 449 extern void acpidev_data_set_flag(acpidev_data_handle_t hdl, uint32_t flag);
450 450 extern void acpidev_data_clear_flag(acpidev_data_handle_t hdl, uint32_t flag);
451 451 extern uint32_t acpidev_data_get_flag(acpidev_data_handle_t hdl, uint32_t flag);
452 452
453 453 /* ACPI system event handler has been registered. */
454 454 #define ACPIDEV_DATA_HANDLER_READY 0x1
455 455
456 456 /*
457 457 * Try to generate meaningful device unit address from uid.
458 458 * Return buf on success and NULL on failure.
459 459 */
460 460 extern char *acpidev_generate_unitaddr(char *uid, char **fmts, size_t nfmt,
461 461 char *buf, size_t len);
462 462
463 463 /*
464 464 * Set device unit address property if _UID is available or unitaddr is valid.
465 465 * Return AE_OK on success and error code on failure.
466 466 * N.B.: it returns AE_OK if _UID is unavailable and unitaddr is NULL.
467 467 */
468 468 extern ACPI_STATUS acpidev_set_unitaddr(acpidev_walk_info_t *infop,
469 469 char **fmts, size_t nfmt, char *unitaddr);
470 470
471 471 /*
472 472 * Generate the device 'compatible' property list for a device based on:
473 473 * * Device HID if available
474 474 * * Device CIDs if available
475 475 * * property array passed in
476 476 * infop: pointer to walk information structure
477 477 * compat: pointer to property array
478 478 * acount: entries in property array
479 479 * Return AE_OK on success and error code on failure.
480 480 */
481 481 extern ACPI_STATUS acpidev_set_compatible(acpidev_walk_info_t *infop,
482 482 char **compat, int acount);
483 483
484 484 /*
485 485 * Query ACPI device status.
486 486 * N.B.: it returns with all status bits set if _STA is not available.
487 487 */
488 488 extern int acpidev_query_device_status(ACPI_HANDLE hdl);
489 489
490 490 /*
491 491 * Check whether device exists.
492 492 * Return false if device doesn't exist.
493 493 */
494 494 extern boolean_t acpidev_check_device_present(int status);
495 495
496 496 /*
497 497 * Check whether device is enabled.
498 498 * Return false if device doesn't exist or hasn't been enabled.
499 499 */
500 500 extern boolean_t acpidev_check_device_enabled(int status);
501 501
502 502 /*
503 503 * Match device ids with ACPI object's _HID and _CIDs.
504 504 * infop: ACPI object information structure
505 505 * ids: array of ACPI HIDs and CIDs
506 506 * count: entries in array
507 507 * Return TRUE if one item matches or num is zero, else FALSE.
508 508 */
509 509 extern boolean_t acpidev_match_device_id(ACPI_DEVICE_INFO *infop,
510 510 char **ids, int count);
511 511
512 512 /*
513 513 * Implement almost the same function as AcpiGetDevices() with the following
514 514 * changes/enhancements:
515 515 * 1) Support limiting recursive levels.
516 516 * 2) Support matching multiple ids instead of one.
517 517 * 3) Report device without ACPI_STA_DEVICE_PRESENT flag which will be ignored
518 518 * by AcpiGetDevices().
519 519 */
520 520 extern ACPI_STATUS acpidev_get_device_by_id(ACPI_HANDLE hdl,
521 521 char **ids, int count, int maxdepth, boolean_t skip_non_exist,
522 522 ACPI_WALK_CALLBACK userfunc, void *userarg, void** retval);
523 523
524 524 /* Callback for APIC entry walker. */
525 525 typedef ACPI_STATUS (* acpidev_apic_walker_t)(ACPI_SUBTABLE_HEADER *, void *);
526 526
527 527 /*
528 528 * Walk ACPI APIC entries from the first source available in following order:
529 529 * 1) ACPI buffer passed in if bufp isn't NULL.
530 530 * 2) Buffer returned by evaluating method if it isn't NULL.
531 531 * 3) MADT table as last resort.
532 532 */
533 533 extern ACPI_STATUS acpidev_walk_apic(ACPI_BUFFER *bufp, ACPI_HANDLE hdl,
534 534 char *method, acpidev_apic_walker_t func, void *context);
535 535
536 536 /*
537 537 * Evaluate _OST method under object, which is used to support hotplug event.
538 538 * hdl: object handle
539 539 * code: _OST source event code
540 540 * stauts: _OST result status code
541 541 * bufp and len: optional third parameter for _OST.
542 542 */
543 543 extern ACPI_STATUS acpidev_eval_ost(ACPI_HANDLE hdl, uint32_t code,
544 544 uint32_t status, char *bufp, size_t len);
545 545
546 546 /*
547 547 * Evaluate _EJ0 method under object.
548 548 */
549 549 extern ACPI_STATUS acpidev_eval_ej0(ACPI_HANDLE hdl);
550 550
551 551 /*
552 552 * Evaluate _PXM method under object.
553 553 */
554 554 extern ACPI_STATUS acpidev_eval_pxm(ACPI_HANDLE hdl, uint32_t *idp);
555 555
556 556 #endif /* _KERNEL */
557 557
558 558 #ifdef __cplusplus
559 559 }
560 560 #endif
561 561
562 562 #endif /* _SYS_ACPIDEV_H */
↓ open down ↓ |
421 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX