1 /* SPDX-License-Identifier: BSD-3-Clause OR GP << 2 /********************************************* 1 /****************************************************************************** 3 * 2 * 4 * Name: acbuffer.h - Support for buffers retu 3 * Name: acbuffer.h - Support for buffers returned by ACPI predefined names 5 * 4 * 6 * Copyright (C) 2000 - 2023, Intel Corp. << 7 * << 8 ********************************************* 5 *****************************************************************************/ 9 6 >> 7 /* >> 8 * Copyright (C) 2000 - 2017, 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 10 #ifndef __ACBUFFER_H__ 44 #ifndef __ACBUFFER_H__ 11 #define __ACBUFFER_H__ 45 #define __ACBUFFER_H__ 12 46 13 /* 47 /* 14 * Contains buffer structures for these predef 48 * Contains buffer structures for these predefined names: 15 * _FDE, _GRT, _GTM, _PLD, _SRT 49 * _FDE, _GRT, _GTM, _PLD, _SRT 16 */ 50 */ 17 51 18 /* 52 /* 19 * Note: C bitfields are not used for this rea 53 * Note: C bitfields are not used for this reason: 20 * 54 * 21 * "Bitfields are great and easy to read, but 55 * "Bitfields are great and easy to read, but unfortunately the C language 22 * does not specify the layout of bitfields in 56 * does not specify the layout of bitfields in memory, which means they are 23 * essentially useless for dealing with packed 57 * essentially useless for dealing with packed data in on-disk formats or 24 * binary wire protocols." (Or ACPI tables and 58 * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me, 25 * this decision was a design error in C. Ritc 59 * this decision was a design error in C. Ritchie could have picked an order 26 * and stuck with it." Norman Ramsey. 60 * and stuck with it." Norman Ramsey. 27 * See http://stackoverflow.com/a/1053662/4166 61 * See http://stackoverflow.com/a/1053662/41661 28 */ 62 */ 29 63 30 /* _FDE return value */ 64 /* _FDE return value */ 31 65 32 struct acpi_fde_info { 66 struct acpi_fde_info { 33 u32 floppy0; 67 u32 floppy0; 34 u32 floppy1; 68 u32 floppy1; 35 u32 floppy2; 69 u32 floppy2; 36 u32 floppy3; 70 u32 floppy3; 37 u32 tape; 71 u32 tape; 38 }; 72 }; 39 73 40 /* 74 /* 41 * _GRT return value 75 * _GRT return value 42 * _SRT input value 76 * _SRT input value 43 */ 77 */ 44 struct acpi_grt_info { 78 struct acpi_grt_info { 45 u16 year; 79 u16 year; 46 u8 month; 80 u8 month; 47 u8 day; 81 u8 day; 48 u8 hour; 82 u8 hour; 49 u8 minute; 83 u8 minute; 50 u8 second; 84 u8 second; 51 u8 valid; 85 u8 valid; 52 u16 milliseconds; 86 u16 milliseconds; 53 u16 timezone; 87 u16 timezone; 54 u8 daylight; 88 u8 daylight; 55 u8 reserved[3]; 89 u8 reserved[3]; 56 }; 90 }; 57 91 58 /* _GTM return value */ 92 /* _GTM return value */ 59 93 60 struct acpi_gtm_info { 94 struct acpi_gtm_info { 61 u32 pio_speed0; 95 u32 pio_speed0; 62 u32 dma_speed0; 96 u32 dma_speed0; 63 u32 pio_speed1; 97 u32 pio_speed1; 64 u32 dma_speed1; 98 u32 dma_speed1; 65 u32 flags; 99 u32 flags; 66 }; 100 }; 67 101 68 /* 102 /* 69 * Formatted _PLD return value. The minimum si 103 * Formatted _PLD return value. The minimum size is a package containing 70 * one buffer. 104 * one buffer. 71 * Revision 1: Buffer is 16 bytes (128 bits) 105 * Revision 1: Buffer is 16 bytes (128 bits) 72 * Revision 2: Buffer is 20 bytes (160 bits) 106 * Revision 2: Buffer is 20 bytes (160 bits) 73 * 107 * 74 * Note: This structure is returned from the a 108 * Note: This structure is returned from the acpi_decode_pld_buffer 75 * interface. 109 * interface. 76 */ 110 */ 77 struct acpi_pld_info { 111 struct acpi_pld_info { 78 u8 revision; 112 u8 revision; 79 u8 ignore_color; 113 u8 ignore_color; 80 u8 red; 114 u8 red; 81 u8 green; 115 u8 green; 82 u8 blue; 116 u8 blue; 83 u16 width; 117 u16 width; 84 u16 height; 118 u16 height; 85 u8 user_visible; 119 u8 user_visible; 86 u8 dock; 120 u8 dock; 87 u8 lid; 121 u8 lid; 88 u8 panel; 122 u8 panel; 89 u8 vertical_position; 123 u8 vertical_position; 90 u8 horizontal_position; 124 u8 horizontal_position; 91 u8 shape; 125 u8 shape; 92 u8 group_orientation; 126 u8 group_orientation; 93 u8 group_token; 127 u8 group_token; 94 u8 group_position; 128 u8 group_position; 95 u8 bay; 129 u8 bay; 96 u8 ejectable; 130 u8 ejectable; 97 u8 ospm_eject_required; 131 u8 ospm_eject_required; 98 u8 cabinet_number; 132 u8 cabinet_number; 99 u8 card_cage_number; 133 u8 card_cage_number; 100 u8 reference; 134 u8 reference; 101 u8 rotation; 135 u8 rotation; 102 u8 order; 136 u8 order; 103 u8 reserved; 137 u8 reserved; 104 u16 vertical_offset; 138 u16 vertical_offset; 105 u16 horizontal_offset; 139 u16 horizontal_offset; 106 }; 140 }; 107 141 108 /* 142 /* 109 * Macros to: 143 * Macros to: 110 * 1) Convert a _PLD buffer to internal st 144 * 1) Convert a _PLD buffer to internal struct acpi_pld_info format - ACPI_PLD_GET* 111 * (Used by acpi_decode_pld_buffer) 145 * (Used by acpi_decode_pld_buffer) 112 * 2) Construct a _PLD buffer - ACPI_PLD_S 146 * 2) Construct a _PLD buffer - ACPI_PLD_SET* 113 * (Intended for BIOS use only) 147 * (Intended for BIOS use only) 114 */ 148 */ 115 #define ACPI_PLD_REV1_BUFFER_SIZE 149 #define ACPI_PLD_REV1_BUFFER_SIZE 16 /* For Revision 1 of the buffer (From ACPI spec) */ 116 #define ACPI_PLD_REV2_BUFFER_SIZE 150 #define ACPI_PLD_REV2_BUFFER_SIZE 20 /* For Revision 2 of the buffer (From ACPI spec) */ 117 #define ACPI_PLD_BUFFER_SIZE 151 #define ACPI_PLD_BUFFER_SIZE 20 /* For Revision 2 of the buffer (From ACPI spec) */ 118 152 119 /* First 32-bit dword, bits 0:32 */ 153 /* First 32-bit dword, bits 0:32 */ 120 154 121 #define ACPI_PLD_GET_REVISION(dword) 155 #define ACPI_PLD_GET_REVISION(dword) ACPI_GET_BITS (dword, 0, ACPI_7BIT_MASK) 122 #define ACPI_PLD_SET_REVISION(dword,value) 156 #define ACPI_PLD_SET_REVISION(dword,value) ACPI_SET_BITS (dword, 0, ACPI_7BIT_MASK, value) /* Offset 0, Len 7 */ 123 157 124 #define ACPI_PLD_GET_IGNORE_COLOR(dword) 158 #define ACPI_PLD_GET_IGNORE_COLOR(dword) ACPI_GET_BITS (dword, 7, ACPI_1BIT_MASK) 125 #define ACPI_PLD_SET_IGNORE_COLOR(dword,value) 159 #define ACPI_PLD_SET_IGNORE_COLOR(dword,value) ACPI_SET_BITS (dword, 7, ACPI_1BIT_MASK, value) /* Offset 7, Len 1 */ 126 160 127 #define ACPI_PLD_GET_RED(dword) 161 #define ACPI_PLD_GET_RED(dword) ACPI_GET_BITS (dword, 8, ACPI_8BIT_MASK) 128 #define ACPI_PLD_SET_RED(dword,value) 162 #define ACPI_PLD_SET_RED(dword,value) ACPI_SET_BITS (dword, 8, ACPI_8BIT_MASK, value) /* Offset 8, Len 8 */ 129 163 130 #define ACPI_PLD_GET_GREEN(dword) 164 #define ACPI_PLD_GET_GREEN(dword) ACPI_GET_BITS (dword, 16, ACPI_8BIT_MASK) 131 #define ACPI_PLD_SET_GREEN(dword,value) 165 #define ACPI_PLD_SET_GREEN(dword,value) ACPI_SET_BITS (dword, 16, ACPI_8BIT_MASK, value) /* Offset 16, Len 8 */ 132 166 133 #define ACPI_PLD_GET_BLUE(dword) 167 #define ACPI_PLD_GET_BLUE(dword) ACPI_GET_BITS (dword, 24, ACPI_8BIT_MASK) 134 #define ACPI_PLD_SET_BLUE(dword,value) 168 #define ACPI_PLD_SET_BLUE(dword,value) ACPI_SET_BITS (dword, 24, ACPI_8BIT_MASK, value) /* Offset 24, Len 8 */ 135 169 136 /* Second 32-bit dword, bits 33:63 */ 170 /* Second 32-bit dword, bits 33:63 */ 137 171 138 #define ACPI_PLD_GET_WIDTH(dword) 172 #define ACPI_PLD_GET_WIDTH(dword) ACPI_GET_BITS (dword, 0, ACPI_16BIT_MASK) 139 #define ACPI_PLD_SET_WIDTH(dword,value) 173 #define ACPI_PLD_SET_WIDTH(dword,value) ACPI_SET_BITS (dword, 0, ACPI_16BIT_MASK, value) /* Offset 32+0=32, Len 16 */ 140 174 141 #define ACPI_PLD_GET_HEIGHT(dword) 175 #define ACPI_PLD_GET_HEIGHT(dword) ACPI_GET_BITS (dword, 16, ACPI_16BIT_MASK) 142 #define ACPI_PLD_SET_HEIGHT(dword,value) 176 #define ACPI_PLD_SET_HEIGHT(dword,value) ACPI_SET_BITS (dword, 16, ACPI_16BIT_MASK, value) /* Offset 32+16=48, Len 16 */ 143 177 144 /* Third 32-bit dword, bits 64:95 */ 178 /* Third 32-bit dword, bits 64:95 */ 145 179 146 #define ACPI_PLD_GET_USER_VISIBLE(dword) 180 #define ACPI_PLD_GET_USER_VISIBLE(dword) ACPI_GET_BITS (dword, 0, ACPI_1BIT_MASK) 147 #define ACPI_PLD_SET_USER_VISIBLE(dword,value) 181 #define ACPI_PLD_SET_USER_VISIBLE(dword,value) ACPI_SET_BITS (dword, 0, ACPI_1BIT_MASK, value) /* Offset 64+0=64, Len 1 */ 148 182 149 #define ACPI_PLD_GET_DOCK(dword) 183 #define ACPI_PLD_GET_DOCK(dword) ACPI_GET_BITS (dword, 1, ACPI_1BIT_MASK) 150 #define ACPI_PLD_SET_DOCK(dword,value) 184 #define ACPI_PLD_SET_DOCK(dword,value) ACPI_SET_BITS (dword, 1, ACPI_1BIT_MASK, value) /* Offset 64+1=65, Len 1 */ 151 185 152 #define ACPI_PLD_GET_LID(dword) 186 #define ACPI_PLD_GET_LID(dword) ACPI_GET_BITS (dword, 2, ACPI_1BIT_MASK) 153 #define ACPI_PLD_SET_LID(dword,value) 187 #define ACPI_PLD_SET_LID(dword,value) ACPI_SET_BITS (dword, 2, ACPI_1BIT_MASK, value) /* Offset 64+2=66, Len 1 */ 154 188 155 #define ACPI_PLD_GET_PANEL(dword) 189 #define ACPI_PLD_GET_PANEL(dword) ACPI_GET_BITS (dword, 3, ACPI_3BIT_MASK) 156 #define ACPI_PLD_SET_PANEL(dword,value) 190 #define ACPI_PLD_SET_PANEL(dword,value) ACPI_SET_BITS (dword, 3, ACPI_3BIT_MASK, value) /* Offset 64+3=67, Len 3 */ 157 191 158 #define ACPI_PLD_GET_VERTICAL(dword) 192 #define ACPI_PLD_GET_VERTICAL(dword) ACPI_GET_BITS (dword, 6, ACPI_2BIT_MASK) 159 #define ACPI_PLD_SET_VERTICAL(dword,value) 193 #define ACPI_PLD_SET_VERTICAL(dword,value) ACPI_SET_BITS (dword, 6, ACPI_2BIT_MASK, value) /* Offset 64+6=70, Len 2 */ 160 194 161 #define ACPI_PLD_GET_HORIZONTAL(dword) 195 #define ACPI_PLD_GET_HORIZONTAL(dword) ACPI_GET_BITS (dword, 8, ACPI_2BIT_MASK) 162 #define ACPI_PLD_SET_HORIZONTAL(dword,value) 196 #define ACPI_PLD_SET_HORIZONTAL(dword,value) ACPI_SET_BITS (dword, 8, ACPI_2BIT_MASK, value) /* Offset 64+8=72, Len 2 */ 163 197 164 #define ACPI_PLD_GET_SHAPE(dword) 198 #define ACPI_PLD_GET_SHAPE(dword) ACPI_GET_BITS (dword, 10, ACPI_4BIT_MASK) 165 #define ACPI_PLD_SET_SHAPE(dword,value) 199 #define ACPI_PLD_SET_SHAPE(dword,value) ACPI_SET_BITS (dword, 10, ACPI_4BIT_MASK, value) /* Offset 64+10=74, Len 4 */ 166 200 167 #define ACPI_PLD_GET_ORIENTATION(dword) 201 #define ACPI_PLD_GET_ORIENTATION(dword) ACPI_GET_BITS (dword, 14, ACPI_1BIT_MASK) 168 #define ACPI_PLD_SET_ORIENTATION(dword,value) 202 #define ACPI_PLD_SET_ORIENTATION(dword,value) ACPI_SET_BITS (dword, 14, ACPI_1BIT_MASK, value) /* Offset 64+14=78, Len 1 */ 169 203 170 #define ACPI_PLD_GET_TOKEN(dword) 204 #define ACPI_PLD_GET_TOKEN(dword) ACPI_GET_BITS (dword, 15, ACPI_8BIT_MASK) 171 #define ACPI_PLD_SET_TOKEN(dword,value) 205 #define ACPI_PLD_SET_TOKEN(dword,value) ACPI_SET_BITS (dword, 15, ACPI_8BIT_MASK, value) /* Offset 64+15=79, Len 8 */ 172 206 173 #define ACPI_PLD_GET_POSITION(dword) 207 #define ACPI_PLD_GET_POSITION(dword) ACPI_GET_BITS (dword, 23, ACPI_8BIT_MASK) 174 #define ACPI_PLD_SET_POSITION(dword,value) 208 #define ACPI_PLD_SET_POSITION(dword,value) ACPI_SET_BITS (dword, 23, ACPI_8BIT_MASK, value) /* Offset 64+23=87, Len 8 */ 175 209 176 #define ACPI_PLD_GET_BAY(dword) 210 #define ACPI_PLD_GET_BAY(dword) ACPI_GET_BITS (dword, 31, ACPI_1BIT_MASK) 177 #define ACPI_PLD_SET_BAY(dword,value) 211 #define ACPI_PLD_SET_BAY(dword,value) ACPI_SET_BITS (dword, 31, ACPI_1BIT_MASK, value) /* Offset 64+31=95, Len 1 */ 178 212 179 /* Fourth 32-bit dword, bits 96:127 */ 213 /* Fourth 32-bit dword, bits 96:127 */ 180 214 181 #define ACPI_PLD_GET_EJECTABLE(dword) 215 #define ACPI_PLD_GET_EJECTABLE(dword) ACPI_GET_BITS (dword, 0, ACPI_1BIT_MASK) 182 #define ACPI_PLD_SET_EJECTABLE(dword,value) 216 #define ACPI_PLD_SET_EJECTABLE(dword,value) ACPI_SET_BITS (dword, 0, ACPI_1BIT_MASK, value) /* Offset 96+0=96, Len 1 */ 183 217 184 #define ACPI_PLD_GET_OSPM_EJECT(dword) 218 #define ACPI_PLD_GET_OSPM_EJECT(dword) ACPI_GET_BITS (dword, 1, ACPI_1BIT_MASK) 185 #define ACPI_PLD_SET_OSPM_EJECT(dword,value) 219 #define ACPI_PLD_SET_OSPM_EJECT(dword,value) ACPI_SET_BITS (dword, 1, ACPI_1BIT_MASK, value) /* Offset 96+1=97, Len 1 */ 186 220 187 #define ACPI_PLD_GET_CABINET(dword) 221 #define ACPI_PLD_GET_CABINET(dword) ACPI_GET_BITS (dword, 2, ACPI_8BIT_MASK) 188 #define ACPI_PLD_SET_CABINET(dword,value) 222 #define ACPI_PLD_SET_CABINET(dword,value) ACPI_SET_BITS (dword, 2, ACPI_8BIT_MASK, value) /* Offset 96+2=98, Len 8 */ 189 223 190 #define ACPI_PLD_GET_CARD_CAGE(dword) 224 #define ACPI_PLD_GET_CARD_CAGE(dword) ACPI_GET_BITS (dword, 10, ACPI_8BIT_MASK) 191 #define ACPI_PLD_SET_CARD_CAGE(dword,value) 225 #define ACPI_PLD_SET_CARD_CAGE(dword,value) ACPI_SET_BITS (dword, 10, ACPI_8BIT_MASK, value) /* Offset 96+10=106, Len 8 */ 192 226 193 #define ACPI_PLD_GET_REFERENCE(dword) 227 #define ACPI_PLD_GET_REFERENCE(dword) ACPI_GET_BITS (dword, 18, ACPI_1BIT_MASK) 194 #define ACPI_PLD_SET_REFERENCE(dword,value) 228 #define ACPI_PLD_SET_REFERENCE(dword,value) ACPI_SET_BITS (dword, 18, ACPI_1BIT_MASK, value) /* Offset 96+18=114, Len 1 */ 195 229 196 #define ACPI_PLD_GET_ROTATION(dword) 230 #define ACPI_PLD_GET_ROTATION(dword) ACPI_GET_BITS (dword, 19, ACPI_4BIT_MASK) 197 #define ACPI_PLD_SET_ROTATION(dword,value) 231 #define ACPI_PLD_SET_ROTATION(dword,value) ACPI_SET_BITS (dword, 19, ACPI_4BIT_MASK, value) /* Offset 96+19=115, Len 4 */ 198 232 199 #define ACPI_PLD_GET_ORDER(dword) 233 #define ACPI_PLD_GET_ORDER(dword) ACPI_GET_BITS (dword, 23, ACPI_5BIT_MASK) 200 #define ACPI_PLD_SET_ORDER(dword,value) 234 #define ACPI_PLD_SET_ORDER(dword,value) ACPI_SET_BITS (dword, 23, ACPI_5BIT_MASK, value) /* Offset 96+23=119, Len 5 */ 201 235 202 /* Fifth 32-bit dword, bits 128:159 (Revision 236 /* Fifth 32-bit dword, bits 128:159 (Revision 2 of _PLD only) */ 203 237 204 #define ACPI_PLD_GET_VERT_OFFSET(dword) 238 #define ACPI_PLD_GET_VERT_OFFSET(dword) ACPI_GET_BITS (dword, 0, ACPI_16BIT_MASK) 205 #define ACPI_PLD_SET_VERT_OFFSET(dword,value) 239 #define ACPI_PLD_SET_VERT_OFFSET(dword,value) ACPI_SET_BITS (dword, 0, ACPI_16BIT_MASK, value) /* Offset 128+0=128, Len 16 */ 206 240 207 #define ACPI_PLD_GET_HORIZ_OFFSET(dword) 241 #define ACPI_PLD_GET_HORIZ_OFFSET(dword) ACPI_GET_BITS (dword, 16, ACPI_16BIT_MASK) 208 #define ACPI_PLD_SET_HORIZ_OFFSET(dword,value) 242 #define ACPI_PLD_SET_HORIZ_OFFSET(dword,value) ACPI_SET_BITS (dword, 16, ACPI_16BIT_MASK, value) /* Offset 128+16=144, Len 16 */ 209 << 210 /* Panel position defined in _PLD section of A << 211 << 212 #define ACPI_PLD_PANEL_TOP 0 << 213 #define ACPI_PLD_PANEL_BOTTOM 1 << 214 #define ACPI_PLD_PANEL_LEFT 2 << 215 #define ACPI_PLD_PANEL_RIGHT 3 << 216 #define ACPI_PLD_PANEL_FRONT 4 << 217 #define ACPI_PLD_PANEL_BACK 5 << 218 #define ACPI_PLD_PANEL_UNKNOWN 6 << 219 243 220 #endif /* ACBUFFER_H 244 #endif /* ACBUFFER_H */ 221 245
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.