diff options
-rw-r--r-- | drivers/acpi/acpica/aclocal.h | 22 | ||||
-rw-r--r-- | drivers/acpi/acpica/acmacros.h | 29 | ||||
-rw-r--r-- | drivers/acpi/acpica/utxface.c | 87 | ||||
-rw-r--r-- | include/acpi/acbuffer.h | 192 | ||||
-rw-r--r-- | include/acpi/acnames.h | 1 | ||||
-rw-r--r-- | include/acpi/acpixf.h | 5 | ||||
-rw-r--r-- | include/acpi/actbl.h | 12 | ||||
-rw-r--r-- | include/acpi/actbl1.h | 12 | ||||
-rw-r--r-- | include/acpi/actbl2.h | 12 | ||||
-rw-r--r-- | include/acpi/actbl3.h | 12 |
10 files changed, 360 insertions, 24 deletions
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h index 493529a3500..c816ee67509 100644 --- a/drivers/acpi/acpica/aclocal.h +++ b/drivers/acpi/acpica/aclocal.h | |||
@@ -707,15 +707,18 @@ union acpi_parse_value { | |||
707 | u8 disasm_opcode; /* Subtype used for disassembly */\ | 707 | u8 disasm_opcode; /* Subtype used for disassembly */\ |
708 | char aml_op_name[16]) /* Op name (debug only) */ | 708 | char aml_op_name[16]) /* Op name (debug only) */ |
709 | 709 | ||
710 | #define ACPI_DASM_BUFFER 0x00 | 710 | /* Flags for disasm_flags field above */ |
711 | #define ACPI_DASM_RESOURCE 0x01 | 711 | |
712 | #define ACPI_DASM_STRING 0x02 | 712 | #define ACPI_DASM_BUFFER 0x00 /* Buffer is a simple data buffer */ |
713 | #define ACPI_DASM_UNICODE 0x03 | 713 | #define ACPI_DASM_RESOURCE 0x01 /* Buffer is a Resource Descriptor */ |
714 | #define ACPI_DASM_EISAID 0x04 | 714 | #define ACPI_DASM_STRING 0x02 /* Buffer is a ASCII string */ |
715 | #define ACPI_DASM_MATCHOP 0x05 | 715 | #define ACPI_DASM_UNICODE 0x03 /* Buffer is a Unicode string */ |
716 | #define ACPI_DASM_LNOT_PREFIX 0x06 | 716 | #define ACPI_DASM_PLD_METHOD 0x04 /* Buffer is a _PLD method bit-packed buffer */ |
717 | #define ACPI_DASM_LNOT_SUFFIX 0x07 | 717 | #define ACPI_DASM_EISAID 0x05 /* Integer is an EISAID */ |
718 | #define ACPI_DASM_IGNORE 0x08 | 718 | #define ACPI_DASM_MATCHOP 0x06 /* Parent opcode is a Match() operator */ |
719 | #define ACPI_DASM_LNOT_PREFIX 0x07 /* Start of a Lnot_equal (etc.) pair of opcodes */ | ||
720 | #define ACPI_DASM_LNOT_SUFFIX 0x08 /* End of a Lnot_equal (etc.) pair of opcodes */ | ||
721 | #define ACPI_DASM_IGNORE 0x09 /* Not used at this time */ | ||
719 | 722 | ||
720 | /* | 723 | /* |
721 | * Generic operation (for example: If, While, Store) | 724 | * Generic operation (for example: If, While, Store) |
@@ -1025,6 +1028,7 @@ struct acpi_port_info { | |||
1025 | ****************************************************************************/ | 1028 | ****************************************************************************/ |
1026 | 1029 | ||
1027 | struct acpi_db_method_info { | 1030 | struct acpi_db_method_info { |
1031 | acpi_handle method; | ||
1028 | acpi_handle main_thread_gate; | 1032 | acpi_handle main_thread_gate; |
1029 | acpi_handle thread_complete_gate; | 1033 | acpi_handle thread_complete_gate; |
1030 | acpi_thread_id *threads; | 1034 | acpi_thread_id *threads; |
diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h index 832b6198652..a7f68c47f51 100644 --- a/drivers/acpi/acpica/acmacros.h +++ b/drivers/acpi/acpica/acmacros.h | |||
@@ -277,10 +277,33 @@ | |||
277 | 277 | ||
278 | /* Bitfields within ACPI registers */ | 278 | /* Bitfields within ACPI registers */ |
279 | 279 | ||
280 | #define ACPI_REGISTER_PREPARE_BITS(val, pos, mask) ((val << pos) & mask) | 280 | #define ACPI_REGISTER_PREPARE_BITS(val, pos, mask) \ |
281 | #define ACPI_REGISTER_INSERT_VALUE(reg, pos, mask, val) reg = (reg & (~(mask))) | ACPI_REGISTER_PREPARE_BITS(val, pos, mask) | 281 | ((val << pos) & mask) |
282 | 282 | ||
283 | #define ACPI_INSERT_BITS(target, mask, source) target = ((target & (~(mask))) | (source & mask)) | 283 | #define ACPI_REGISTER_INSERT_VALUE(reg, pos, mask, val) \ |
284 | reg = (reg & (~(mask))) | ACPI_REGISTER_PREPARE_BITS(val, pos, mask) | ||
285 | |||
286 | #define ACPI_INSERT_BITS(target, mask, source) \ | ||
287 | target = ((target & (~(mask))) | (source & mask)) | ||
288 | |||
289 | /* Generic bitfield macros and masks */ | ||
290 | |||
291 | #define ACPI_GET_BITS(source_ptr, position, mask) \ | ||
292 | ((*source_ptr >> position) & mask) | ||
293 | |||
294 | #define ACPI_SET_BITS(target_ptr, position, mask, value) \ | ||
295 | (*target_ptr |= ((value & mask) << position)) | ||
296 | |||
297 | #define ACPI_1BIT_MASK 0x00000001 | ||
298 | #define ACPI_2BIT_MASK 0x00000003 | ||
299 | #define ACPI_3BIT_MASK 0x00000007 | ||
300 | #define ACPI_4BIT_MASK 0x0000000F | ||
301 | #define ACPI_5BIT_MASK 0x0000001F | ||
302 | #define ACPI_6BIT_MASK 0x0000003F | ||
303 | #define ACPI_7BIT_MASK 0x0000007F | ||
304 | #define ACPI_8BIT_MASK 0x000000FF | ||
305 | #define ACPI_16BIT_MASK 0x0000FFFF | ||
306 | #define ACPI_24BIT_MASK 0x00FFFFFF | ||
284 | 307 | ||
285 | /* | 308 | /* |
286 | * An object of type struct acpi_namespace_node can appear in some contexts | 309 | * An object of type struct acpi_namespace_node can appear in some contexts |
diff --git a/drivers/acpi/acpica/utxface.c b/drivers/acpi/acpica/utxface.c index 667229dbcba..b09632b4f5b 100644 --- a/drivers/acpi/acpica/utxface.c +++ b/drivers/acpi/acpica/utxface.c | |||
@@ -418,3 +418,90 @@ acpi_check_address_range(acpi_adr_space_type space_id, | |||
418 | 418 | ||
419 | ACPI_EXPORT_SYMBOL(acpi_check_address_range) | 419 | ACPI_EXPORT_SYMBOL(acpi_check_address_range) |
420 | #endif /* !ACPI_ASL_COMPILER */ | 420 | #endif /* !ACPI_ASL_COMPILER */ |
421 | /******************************************************************************* | ||
422 | * | ||
423 | * FUNCTION: acpi_decode_pld_buffer | ||
424 | * | ||
425 | * PARAMETERS: in_buffer - Buffer returned by _PLD method | ||
426 | * length - Length of the in_buffer | ||
427 | * return_buffer - Where the decode buffer is returned | ||
428 | * | ||
429 | * RETURN: Status and the decoded _PLD buffer. User must deallocate | ||
430 | * the buffer via ACPI_FREE. | ||
431 | * | ||
432 | * DESCRIPTION: Decode the bit-packed buffer returned by the _PLD method into | ||
433 | * a local struct that is much more useful to an ACPI driver. | ||
434 | * | ||
435 | ******************************************************************************/ | ||
436 | acpi_status | ||
437 | acpi_decode_pld_buffer(u8 *in_buffer, | ||
438 | acpi_size length, struct acpi_pld_info ** return_buffer) | ||
439 | { | ||
440 | struct acpi_pld_info *pld_info; | ||
441 | u32 *buffer = ACPI_CAST_PTR(u32, in_buffer); | ||
442 | u32 dword; | ||
443 | |||
444 | /* Parameter validation */ | ||
445 | |||
446 | if (!in_buffer || !return_buffer || (length < 16)) { | ||
447 | return (AE_BAD_PARAMETER); | ||
448 | } | ||
449 | |||
450 | pld_info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pld_info)); | ||
451 | if (!pld_info) { | ||
452 | return (AE_NO_MEMORY); | ||
453 | } | ||
454 | |||
455 | /* First 32-bit DWord */ | ||
456 | |||
457 | ACPI_MOVE_32_TO_32(&dword, &buffer[0]); | ||
458 | pld_info->revision = ACPI_PLD_GET_REVISION(&dword); | ||
459 | pld_info->ignore_color = ACPI_PLD_GET_IGNORE_COLOR(&dword); | ||
460 | pld_info->color = ACPI_PLD_GET_COLOR(&dword); | ||
461 | |||
462 | /* Second 32-bit DWord */ | ||
463 | |||
464 | ACPI_MOVE_32_TO_32(&dword, &buffer[1]); | ||
465 | pld_info->width = ACPI_PLD_GET_WIDTH(&dword); | ||
466 | pld_info->height = ACPI_PLD_GET_HEIGHT(&dword); | ||
467 | |||
468 | /* Third 32-bit DWord */ | ||
469 | |||
470 | ACPI_MOVE_32_TO_32(&dword, &buffer[2]); | ||
471 | pld_info->user_visible = ACPI_PLD_GET_USER_VISIBLE(&dword); | ||
472 | pld_info->dock = ACPI_PLD_GET_DOCK(&dword); | ||
473 | pld_info->lid = ACPI_PLD_GET_LID(&dword); | ||
474 | pld_info->panel = ACPI_PLD_GET_PANEL(&dword); | ||
475 | pld_info->vertical_position = ACPI_PLD_GET_VERTICAL(&dword); | ||
476 | pld_info->horizontal_position = ACPI_PLD_GET_HORIZONTAL(&dword); | ||
477 | pld_info->shape = ACPI_PLD_GET_SHAPE(&dword); | ||
478 | pld_info->group_orientation = ACPI_PLD_GET_ORIENTATION(&dword); | ||
479 | pld_info->group_token = ACPI_PLD_GET_TOKEN(&dword); | ||
480 | pld_info->group_position = ACPI_PLD_GET_POSITION(&dword); | ||
481 | pld_info->bay = ACPI_PLD_GET_BAY(&dword); | ||
482 | |||
483 | /* Fourth 32-bit DWord */ | ||
484 | |||
485 | ACPI_MOVE_32_TO_32(&dword, &buffer[3]); | ||
486 | pld_info->ejectable = ACPI_PLD_GET_EJECTABLE(&dword); | ||
487 | pld_info->ospm_eject_required = ACPI_PLD_GET_OSPM_EJECT(&dword); | ||
488 | pld_info->cabinet_number = ACPI_PLD_GET_CABINET(&dword); | ||
489 | pld_info->card_cage_number = ACPI_PLD_GET_CARD_CAGE(&dword); | ||
490 | pld_info->reference = ACPI_PLD_GET_REFERENCE(&dword); | ||
491 | pld_info->rotation = ACPI_PLD_GET_ROTATION(&dword); | ||
492 | pld_info->order = ACPI_PLD_GET_ORDER(&dword); | ||
493 | |||
494 | if (length >= ACPI_PLD_BUFFER_SIZE) { | ||
495 | |||
496 | /* Fifth 32-bit DWord (Revision 2 of _PLD) */ | ||
497 | |||
498 | ACPI_MOVE_32_TO_32(&dword, &buffer[4]); | ||
499 | pld_info->vertical_offset = ACPI_PLD_GET_VERT_OFFSET(&dword); | ||
500 | pld_info->horizontal_offset = ACPI_PLD_GET_HORIZ_OFFSET(&dword); | ||
501 | } | ||
502 | |||
503 | *return_buffer = pld_info; | ||
504 | return (AE_OK); | ||
505 | } | ||
506 | |||
507 | ACPI_EXPORT_SYMBOL(acpi_decode_pld_buffer) | ||
diff --git a/include/acpi/acbuffer.h b/include/acpi/acbuffer.h new file mode 100644 index 00000000000..2c3b44789f9 --- /dev/null +++ b/include/acpi/acbuffer.h | |||
@@ -0,0 +1,192 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: acbuffer.h - Support for buffers returned by ACPI predefined names | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2012, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #ifndef __ACBUFFER_H__ | ||
45 | #define __ACBUFFER_H__ | ||
46 | |||
47 | /* | ||
48 | * Note: C bitfields are not used for this reason: | ||
49 | * | ||
50 | * "Bitfields are great and easy to read, but unfortunately the C language | ||
51 | * does not specify the layout of bitfields in memory, which means they are | ||
52 | * essentially useless for dealing with packed data in on-disk formats or | ||
53 | * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me, | ||
54 | * this decision was a design error in C. Ritchie could have picked an order | ||
55 | * and stuck with it." Norman Ramsey. | ||
56 | * See http://stackoverflow.com/a/1053662/41661 | ||
57 | */ | ||
58 | |||
59 | /* | ||
60 | * Formatted _PLD return value. The minimum size is a package containing | ||
61 | * one buffer. | ||
62 | * Revision 1: Buffer is 16 bytes (128 bits) | ||
63 | * Revision 2: Buffer is 20 bytes (160 bits) | ||
64 | * | ||
65 | * Note: This structure is returned from the acpi_decode_pld_buffer | ||
66 | * interface. | ||
67 | */ | ||
68 | struct acpi_pld_info { | ||
69 | u8 revision; | ||
70 | u8 ignore_color; | ||
71 | u32 color; | ||
72 | u16 width; | ||
73 | u16 height; | ||
74 | u8 user_visible; | ||
75 | u8 dock; | ||
76 | u8 lid; | ||
77 | u8 panel; | ||
78 | u8 vertical_position; | ||
79 | u8 horizontal_position; | ||
80 | u8 shape; | ||
81 | u8 group_orientation; | ||
82 | u8 group_token; | ||
83 | u8 group_position; | ||
84 | u8 bay; | ||
85 | u8 ejectable; | ||
86 | u8 ospm_eject_required; | ||
87 | u8 cabinet_number; | ||
88 | u8 card_cage_number; | ||
89 | u8 reference; | ||
90 | u8 rotation; | ||
91 | u8 order; | ||
92 | u8 reserved; | ||
93 | u16 vertical_offset; | ||
94 | u16 horizontal_offset; | ||
95 | }; | ||
96 | |||
97 | /* | ||
98 | * Macros to: | ||
99 | * 1) Convert a _PLD buffer to internal struct acpi_pld_info format - ACPI_PLD_GET* | ||
100 | * (Used by acpi_decode_pld_buffer) | ||
101 | * 2) Construct a _PLD buffer - ACPI_PLD_SET* | ||
102 | * (Intended for BIOS use only) | ||
103 | */ | ||
104 | #define ACPI_PLD_REV1_BUFFER_SIZE 16 /* For Revision 1 of the buffer (From ACPI spec) */ | ||
105 | #define ACPI_PLD_BUFFER_SIZE 20 /* For Revision 2 of the buffer (From ACPI spec) */ | ||
106 | |||
107 | /* First 32-bit dword, bits 0:32 */ | ||
108 | |||
109 | #define ACPI_PLD_GET_REVISION(dword) ACPI_GET_BITS (dword, 0, ACPI_7BIT_MASK) | ||
110 | #define ACPI_PLD_SET_REVISION(dword,value) ACPI_SET_BITS (dword, 0, ACPI_7BIT_MASK, value) /* Offset 0, Len 7 */ | ||
111 | |||
112 | #define ACPI_PLD_GET_IGNORE_COLOR(dword) ACPI_GET_BITS (dword, 7, ACPI_1BIT_MASK) | ||
113 | #define ACPI_PLD_SET_IGNORE_COLOR(dword,value) ACPI_SET_BITS (dword, 7, ACPI_1BIT_MASK, value) /* Offset 7, Len 1 */ | ||
114 | |||
115 | #define ACPI_PLD_GET_COLOR(dword) ACPI_GET_BITS (dword, 8, ACPI_24BIT_MASK) | ||
116 | #define ACPI_PLD_SET_COLOR(dword,value) ACPI_SET_BITS (dword, 8, ACPI_24BIT_MASK, value) /* Offset 8, Len 24 */ | ||
117 | |||
118 | /* Second 32-bit dword, bits 33:63 */ | ||
119 | |||
120 | #define ACPI_PLD_GET_WIDTH(dword) ACPI_GET_BITS (dword, 0, ACPI_16BIT_MASK) | ||
121 | #define ACPI_PLD_SET_WIDTH(dword,value) ACPI_SET_BITS (dword, 0, ACPI_16BIT_MASK, value) /* Offset 32+0=32, Len 16 */ | ||
122 | |||
123 | #define ACPI_PLD_GET_HEIGHT(dword) ACPI_GET_BITS (dword, 16, ACPI_16BIT_MASK) | ||
124 | #define ACPI_PLD_SET_HEIGHT(dword,value) ACPI_SET_BITS (dword, 16, ACPI_16BIT_MASK, value) /* Offset 32+16=48, Len 16 */ | ||
125 | |||
126 | /* Third 32-bit dword, bits 64:95 */ | ||
127 | |||
128 | #define ACPI_PLD_GET_USER_VISIBLE(dword) ACPI_GET_BITS (dword, 0, ACPI_1BIT_MASK) | ||
129 | #define ACPI_PLD_SET_USER_VISIBLE(dword,value) ACPI_SET_BITS (dword, 0, ACPI_1BIT_MASK, value) /* Offset 64+0=64, Len 1 */ | ||
130 | |||
131 | #define ACPI_PLD_GET_DOCK(dword) ACPI_GET_BITS (dword, 1, ACPI_1BIT_MASK) | ||
132 | #define ACPI_PLD_SET_DOCK(dword,value) ACPI_SET_BITS (dword, 1, ACPI_1BIT_MASK, value) /* Offset 64+1=65, Len 1 */ | ||
133 | |||
134 | #define ACPI_PLD_GET_LID(dword) ACPI_GET_BITS (dword, 2, ACPI_1BIT_MASK) | ||
135 | #define ACPI_PLD_SET_LID(dword,value) ACPI_SET_BITS (dword, 2, ACPI_1BIT_MASK, value) /* Offset 64+2=66, Len 1 */ | ||
136 | |||
137 | #define ACPI_PLD_GET_PANEL(dword) ACPI_GET_BITS (dword, 3, ACPI_3BIT_MASK) | ||
138 | #define ACPI_PLD_SET_PANEL(dword,value) ACPI_SET_BITS (dword, 3, ACPI_3BIT_MASK, value) /* Offset 64+3=67, Len 3 */ | ||
139 | |||
140 | #define ACPI_PLD_GET_VERTICAL(dword) ACPI_GET_BITS (dword, 6, ACPI_2BIT_MASK) | ||
141 | #define ACPI_PLD_SET_VERTICAL(dword,value) ACPI_SET_BITS (dword, 6, ACPI_2BIT_MASK, value) /* Offset 64+6=70, Len 2 */ | ||
142 | |||
143 | #define ACPI_PLD_GET_HORIZONTAL(dword) ACPI_GET_BITS (dword, 8, ACPI_2BIT_MASK) | ||
144 | #define ACPI_PLD_SET_HORIZONTAL(dword,value) ACPI_SET_BITS (dword, 8, ACPI_2BIT_MASK, value) /* Offset 64+8=72, Len 2 */ | ||
145 | |||
146 | #define ACPI_PLD_GET_SHAPE(dword) ACPI_GET_BITS (dword, 10, ACPI_4BIT_MASK) | ||
147 | #define ACPI_PLD_SET_SHAPE(dword,value) ACPI_SET_BITS (dword, 10, ACPI_4BIT_MASK, value) /* Offset 64+10=74, Len 4 */ | ||
148 | |||
149 | #define ACPI_PLD_GET_ORIENTATION(dword) ACPI_GET_BITS (dword, 14, ACPI_1BIT_MASK) | ||
150 | #define ACPI_PLD_SET_ORIENTATION(dword,value) ACPI_SET_BITS (dword, 14, ACPI_1BIT_MASK, value) /* Offset 64+14=78, Len 1 */ | ||
151 | |||
152 | #define ACPI_PLD_GET_TOKEN(dword) ACPI_GET_BITS (dword, 15, ACPI_8BIT_MASK) | ||
153 | #define ACPI_PLD_SET_TOKEN(dword,value) ACPI_SET_BITS (dword, 15, ACPI_8BIT_MASK, value) /* Offset 64+15=79, Len 8 */ | ||
154 | |||
155 | #define ACPI_PLD_GET_POSITION(dword) ACPI_GET_BITS (dword, 23, ACPI_8BIT_MASK) | ||
156 | #define ACPI_PLD_SET_POSITION(dword,value) ACPI_SET_BITS (dword, 23, ACPI_8BIT_MASK, value) /* Offset 64+23=87, Len 8 */ | ||
157 | |||
158 | #define ACPI_PLD_GET_BAY(dword) ACPI_GET_BITS (dword, 31, ACPI_1BIT_MASK) | ||
159 | #define ACPI_PLD_SET_BAY(dword,value) ACPI_SET_BITS (dword, 31, ACPI_1BIT_MASK, value) /* Offset 64+31=95, Len 1 */ | ||
160 | |||
161 | /* Fourth 32-bit dword, bits 96:127 */ | ||
162 | |||
163 | #define ACPI_PLD_GET_EJECTABLE(dword) ACPI_GET_BITS (dword, 0, ACPI_1BIT_MASK) | ||
164 | #define ACPI_PLD_SET_EJECTABLE(dword,value) ACPI_SET_BITS (dword, 0, ACPI_1BIT_MASK, value) /* Offset 96+0=96, Len 1 */ | ||
165 | |||
166 | #define ACPI_PLD_GET_OSPM_EJECT(dword) ACPI_GET_BITS (dword, 1, ACPI_1BIT_MASK) | ||
167 | #define ACPI_PLD_SET_OSPM_EJECT(dword,value) ACPI_SET_BITS (dword, 1, ACPI_1BIT_MASK, value) /* Offset 96+1=97, Len 1 */ | ||
168 | |||
169 | #define ACPI_PLD_GET_CABINET(dword) ACPI_GET_BITS (dword, 2, ACPI_8BIT_MASK) | ||
170 | #define ACPI_PLD_SET_CABINET(dword,value) ACPI_SET_BITS (dword, 2, ACPI_8BIT_MASK, value) /* Offset 96+2=98, Len 8 */ | ||
171 | |||
172 | #define ACPI_PLD_GET_CARD_CAGE(dword) ACPI_GET_BITS (dword, 10, ACPI_8BIT_MASK) | ||
173 | #define ACPI_PLD_SET_CARD_CAGE(dword,value) ACPI_SET_BITS (dword, 10, ACPI_8BIT_MASK, value) /* Offset 96+10=106, Len 8 */ | ||
174 | |||
175 | #define ACPI_PLD_GET_REFERENCE(dword) ACPI_GET_BITS (dword, 18, ACPI_1BIT_MASK) | ||
176 | #define ACPI_PLD_SET_REFERENCE(dword,value) ACPI_SET_BITS (dword, 18, ACPI_1BIT_MASK, value) /* Offset 96+18=114, Len 1 */ | ||
177 | |||
178 | #define ACPI_PLD_GET_ROTATION(dword) ACPI_GET_BITS (dword, 19, ACPI_4BIT_MASK) | ||
179 | #define ACPI_PLD_SET_ROTATION(dword,value) ACPI_SET_BITS (dword, 19, ACPI_4BIT_MASK, value) /* Offset 96+19=115, Len 4 */ | ||
180 | |||
181 | #define ACPI_PLD_GET_ORDER(dword) ACPI_GET_BITS (dword, 23, ACPI_5BIT_MASK) | ||
182 | #define ACPI_PLD_SET_ORDER(dword,value) ACPI_SET_BITS (dword, 23, ACPI_5BIT_MASK, value) /* Offset 96+23=119, Len 5 */ | ||
183 | |||
184 | /* Fifth 32-bit dword, bits 128:159 (Revision 2 of _PLD only) */ | ||
185 | |||
186 | #define ACPI_PLD_GET_VERT_OFFSET(dword) ACPI_GET_BITS (dword, 0, ACPI_16BIT_MASK) | ||
187 | #define ACPI_PLD_SET_VERT_OFFSET(dword,value) ACPI_SET_BITS (dword, 0, ACPI_16BIT_MASK, value) /* Offset 128+0=128, Len 16 */ | ||
188 | |||
189 | #define ACPI_PLD_GET_HORIZ_OFFSET(dword) ACPI_GET_BITS (dword, 16, ACPI_16BIT_MASK) | ||
190 | #define ACPI_PLD_SET_HORIZ_OFFSET(dword,value) ACPI_SET_BITS (dword, 16, ACPI_16BIT_MASK, value) /* Offset 128+16=144, Len 16 */ | ||
191 | |||
192 | #endif /* ACBUFFER_H */ | ||
diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h index d2f61dd2d72..745dd24e3cb 100644 --- a/include/acpi/acnames.h +++ b/include/acpi/acnames.h | |||
@@ -63,6 +63,7 @@ | |||
63 | #define METHOD_NAME__PRW "_PRW" | 63 | #define METHOD_NAME__PRW "_PRW" |
64 | #define METHOD_NAME__SRS "_SRS" | 64 | #define METHOD_NAME__SRS "_SRS" |
65 | #define METHOD_NAME__CBA "_CBA" | 65 | #define METHOD_NAME__CBA "_CBA" |
66 | #define METHOD_NAME__PLD "_PLD" | ||
66 | 67 | ||
67 | /* Method names - these methods must appear at the namespace root */ | 68 | /* Method names - these methods must appear at the namespace root */ |
68 | 69 | ||
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 26a92fc28a5..270517d6b1b 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h | |||
@@ -52,6 +52,7 @@ | |||
52 | #include "acconfig.h" | 52 | #include "acconfig.h" |
53 | #include "actypes.h" | 53 | #include "actypes.h" |
54 | #include "actbl.h" | 54 | #include "actbl.h" |
55 | #include "acbuffer.h" | ||
55 | 56 | ||
56 | extern u8 acpi_gbl_permanent_mmap; | 57 | extern u8 acpi_gbl_permanent_mmap; |
57 | 58 | ||
@@ -144,6 +145,10 @@ acpi_check_address_range(acpi_adr_space_type space_id, | |||
144 | acpi_physical_address address, | 145 | acpi_physical_address address, |
145 | acpi_size length, u8 warn); | 146 | acpi_size length, u8 warn); |
146 | 147 | ||
148 | acpi_status | ||
149 | acpi_decode_pld_buffer(u8 *in_buffer, | ||
150 | acpi_size length, struct acpi_pld_info **return_buffer); | ||
151 | |||
147 | /* | 152 | /* |
148 | * ACPI Memory management | 153 | * ACPI Memory management |
149 | */ | 154 | */ |
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h index d54e3580b7d..4f94b1d812d 100644 --- a/include/acpi/actbl.h +++ b/include/acpi/actbl.h | |||
@@ -79,9 +79,15 @@ | |||
79 | #pragma pack(1) | 79 | #pragma pack(1) |
80 | 80 | ||
81 | /* | 81 | /* |
82 | * Note about bitfields: The u8 type is used for bitfields in ACPI tables. | 82 | * Note: C bitfields are not used for this reason: |
83 | * This is the only type that is even remotely portable. Anything else is not | 83 | * |
84 | * portable, so do not use any other bitfield types. | 84 | * "Bitfields are great and easy to read, but unfortunately the C language |
85 | * does not specify the layout of bitfields in memory, which means they are | ||
86 | * essentially useless for dealing with packed data in on-disk formats or | ||
87 | * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me, | ||
88 | * this decision was a design error in C. Ritchie could have picked an order | ||
89 | * and stuck with it." Norman Ramsey. | ||
90 | * See http://stackoverflow.com/a/1053662/41661 | ||
85 | */ | 91 | */ |
86 | 92 | ||
87 | /******************************************************************************* | 93 | /******************************************************************************* |
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h index 300d14e7c5d..c41d6f96ed7 100644 --- a/include/acpi/actbl1.h +++ b/include/acpi/actbl1.h | |||
@@ -79,9 +79,15 @@ | |||
79 | #pragma pack(1) | 79 | #pragma pack(1) |
80 | 80 | ||
81 | /* | 81 | /* |
82 | * Note about bitfields: The u8 type is used for bitfields in ACPI tables. | 82 | * Note: C bitfields are not used for this reason: |
83 | * This is the only type that is even remotely portable. Anything else is not | 83 | * |
84 | * portable, so do not use any other bitfield types. | 84 | * "Bitfields are great and easy to read, but unfortunately the C language |
85 | * does not specify the layout of bitfields in memory, which means they are | ||
86 | * essentially useless for dealing with packed data in on-disk formats or | ||
87 | * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me, | ||
88 | * this decision was a design error in C. Ritchie could have picked an order | ||
89 | * and stuck with it." Norman Ramsey. | ||
90 | * See http://stackoverflow.com/a/1053662/41661 | ||
85 | */ | 91 | */ |
86 | 92 | ||
87 | /******************************************************************************* | 93 | /******************************************************************************* |
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h index b74476c0be8..1b2b356486d 100644 --- a/include/acpi/actbl2.h +++ b/include/acpi/actbl2.h | |||
@@ -98,9 +98,15 @@ | |||
98 | #pragma pack(1) | 98 | #pragma pack(1) |
99 | 99 | ||
100 | /* | 100 | /* |
101 | * Note about bitfields: The u8 type is used for bitfields in ACPI tables. | 101 | * Note: C bitfields are not used for this reason: |
102 | * This is the only type that is even remotely portable. Anything else is not | 102 | * |
103 | * portable, so do not use any other bitfield types. | 103 | * "Bitfields are great and easy to read, but unfortunately the C language |
104 | * does not specify the layout of bitfields in memory, which means they are | ||
105 | * essentially useless for dealing with packed data in on-disk formats or | ||
106 | * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me, | ||
107 | * this decision was a design error in C. Ritchie could have picked an order | ||
108 | * and stuck with it." Norman Ramsey. | ||
109 | * See http://stackoverflow.com/a/1053662/41661 | ||
104 | */ | 110 | */ |
105 | 111 | ||
106 | /******************************************************************************* | 112 | /******************************************************************************* |
diff --git a/include/acpi/actbl3.h b/include/acpi/actbl3.h index 37781ab806a..8c61b5fe42a 100644 --- a/include/acpi/actbl3.h +++ b/include/acpi/actbl3.h | |||
@@ -86,9 +86,15 @@ | |||
86 | #pragma pack(1) | 86 | #pragma pack(1) |
87 | 87 | ||
88 | /* | 88 | /* |
89 | * Note about bitfields: The u8 type is used for bitfields in ACPI tables. | 89 | * Note: C bitfields are not used for this reason: |
90 | * This is the only type that is even remotely portable. Anything else is not | 90 | * |
91 | * portable, so do not use any other bitfield types. | 91 | * "Bitfields are great and easy to read, but unfortunately the C language |
92 | * does not specify the layout of bitfields in memory, which means they are | ||
93 | * essentially useless for dealing with packed data in on-disk formats or | ||
94 | * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me, | ||
95 | * this decision was a design error in C. Ritchie could have picked an order | ||
96 | * and stuck with it." Norman Ramsey. | ||
97 | * See http://stackoverflow.com/a/1053662/41661 | ||
92 | */ | 98 | */ |
93 | 99 | ||
94 | /******************************************************************************* | 100 | /******************************************************************************* |