Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[ACPI] ACPICA 20051021

Implemented support for the EM64T and other x86_64
processors. This essentially entails recognizing
that these processors support non-aligned memory
transfers. Previously, all 64-bit processors were assumed
to lack hardware support for non-aligned transfers.

Completed conversion of the Resource Manager to nearly
full table-driven operation. Specifically, the resource
conversion code (convert AML to internal format and the
reverse) and the debug code to dump internal resource
descriptors are fully table-driven, reducing code and data
size and improving maintainability.

The OSL interfaces for Acquire and Release Lock now use a
64-bit flag word on 64-bit processors instead of a fixed
32-bit word. (Alexey Starikovskiy)

Implemented support within the resource conversion code
for the Type-Specific byte within the various ACPI 3.0
*WordSpace macros.

Fixed some issues within the resource conversion code for
the type-specific flags for both Memory and I/O address
resource descriptors. For Memory, implemented support
for the MTP and TTP flags. For I/O, split the TRS and TTP
flags into two separate fields.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>

authored by

Bob Moore and committed by
Len Brown
0897831b 50eca3eb

+2541 -3248
+1 -1
arch/ia64/pci/pci.c
··· 195 195 196 196 min = addr->minimum; 197 197 max = min + addr->address_length - 1; 198 - if (addr->attribute.io.translation_attribute == ACPI_SPARSE_TRANSLATION) 198 + if (addr->info.io.translation_type == ACPI_SPARSE_TRANSLATION) 199 199 sparse = 1; 200 200 201 201 space_nr = new_space(addr->translation_offset, sparse);
+6 -6
drivers/acpi/events/evgpe.c
··· 372 372 373 373 u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) 374 374 { 375 - u32 int_status = ACPI_INTERRUPT_NOT_HANDLED; 376 - u8 enabled_status_byte; 377 - struct acpi_gpe_register_info *gpe_register_info; 378 - u32 status_reg; 379 - u32 enable_reg; 380 - u32 flags; 381 375 acpi_status status; 382 376 struct acpi_gpe_block_info *gpe_block; 377 + struct acpi_gpe_register_info *gpe_register_info; 378 + u32 int_status = ACPI_INTERRUPT_NOT_HANDLED; 379 + u8 enabled_status_byte; 380 + u32 status_reg; 381 + u32 enable_reg; 382 + acpi_native_uint flags; 383 383 acpi_native_uint i; 384 384 acpi_native_uint j; 385 385
+5 -5
drivers/acpi/events/evgpeblk.c
··· 136 136 struct acpi_gpe_block_info *gpe_block; 137 137 struct acpi_gpe_xrupt_info *gpe_xrupt_info; 138 138 acpi_status status = AE_OK; 139 - u32 flags; 139 + acpi_native_uint flags; 140 140 141 141 ACPI_FUNCTION_TRACE("ev_walk_gpe_list"); 142 142 ··· 479 479 struct acpi_gpe_xrupt_info *next_gpe_xrupt; 480 480 struct acpi_gpe_xrupt_info *gpe_xrupt; 481 481 acpi_status status; 482 - u32 flags; 482 + acpi_native_uint flags; 483 483 484 484 ACPI_FUNCTION_TRACE("ev_get_gpe_xrupt_block"); 485 485 ··· 553 553 acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt) 554 554 { 555 555 acpi_status status; 556 - u32 flags; 556 + acpi_native_uint flags; 557 557 558 558 ACPI_FUNCTION_TRACE("ev_delete_gpe_xrupt"); 559 559 ··· 610 610 struct acpi_gpe_block_info *next_gpe_block; 611 611 struct acpi_gpe_xrupt_info *gpe_xrupt_block; 612 612 acpi_status status; 613 - u32 flags; 613 + acpi_native_uint flags; 614 614 615 615 ACPI_FUNCTION_TRACE("ev_install_gpe_block"); 616 616 ··· 663 663 acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block) 664 664 { 665 665 acpi_status status; 666 - u32 flags; 666 + acpi_native_uint flags; 667 667 668 668 ACPI_FUNCTION_TRACE("ev_install_gpe_block"); 669 669
+2 -2
drivers/acpi/events/evxface.c
··· 562 562 struct acpi_gpe_event_info *gpe_event_info; 563 563 struct acpi_handler_info *handler; 564 564 acpi_status status; 565 - u32 flags; 565 + acpi_native_uint flags; 566 566 567 567 ACPI_FUNCTION_TRACE("acpi_install_gpe_handler"); 568 568 ··· 653 653 struct acpi_gpe_event_info *gpe_event_info; 654 654 struct acpi_handler_info *handler; 655 655 acpi_status status; 656 - u32 flags; 656 + acpi_native_uint flags; 657 657 658 658 ACPI_FUNCTION_TRACE("acpi_remove_gpe_handler"); 659 659
+2 -3
drivers/acpi/executer/exmisc.c
··· 625 625 626 626 /* Lexicographic compare: compare the data bytes */ 627 627 628 - compare = ACPI_MEMCMP((const char *)operand0->buffer.pointer, 629 - (const char *)local_operand1->buffer. 630 - pointer, 628 + compare = ACPI_MEMCMP(operand0->buffer.pointer, 629 + local_operand1->buffer.pointer, 631 630 (length0 > length1) ? length1 : length0); 632 631 633 632 switch (opcode) {
+2 -2
drivers/acpi/executer/exregion.c
··· 77 77 struct acpi_mem_space_context *mem_info = region_context; 78 78 u32 length; 79 79 acpi_size window_size; 80 - #ifndef ACPI_MISALIGNED_TRANSFERS 80 + #ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED 81 81 u32 remainder; 82 82 #endif 83 83 ··· 109 109 return_ACPI_STATUS(AE_AML_OPERAND_VALUE); 110 110 } 111 111 112 - #ifndef ACPI_MISALIGNED_TRANSFERS 112 + #ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED 113 113 /* 114 114 * Hardware does not support non-aligned data transfers, we must verify 115 115 * the request.
+2 -4
drivers/acpi/osl.c
··· 1058 1058 * Acquire a spinlock. 1059 1059 * 1060 1060 * handle is a pointer to the spinlock_t. 1061 - * flags is *not* the result of save_flags - it is an ACPI-specific flag variable 1062 - * that indicates whether we are at interrupt level. 1063 1061 */ 1064 1062 1065 - unsigned long acpi_os_acquire_lock(acpi_handle handle) 1063 + acpi_native_uint acpi_os_acquire_lock(acpi_handle handle) 1066 1064 { 1067 1065 unsigned long flags; 1068 1066 spin_lock_irqsave((spinlock_t *) handle, flags); ··· 1071 1073 * Release a spinlock. See above. 1072 1074 */ 1073 1075 1074 - void acpi_os_release_lock(acpi_handle handle, unsigned long flags) 1076 + void acpi_os_release_lock(acpi_handle handle, acpi_native_uint flags) 1075 1077 { 1076 1078 spin_unlock_irqrestore((spinlock_t *) handle, flags); 1077 1079 }
+292 -641
drivers/acpi/resources/rsaddr.c
··· 47 47 #define _COMPONENT ACPI_RESOURCES 48 48 ACPI_MODULE_NAME("rsaddr") 49 49 50 - /* Local prototypes */ 51 - static void 52 - acpi_rs_decode_general_flags(union acpi_resource_data *resource, u8 flags); 50 + /******************************************************************************* 51 + * 52 + * acpi_rs_convert_address16 - All WORD (16-bit) address resources 53 + * 54 + ******************************************************************************/ 55 + struct acpi_rsconvert_info acpi_rs_convert_address16[5] = { 56 + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_ADDRESS16, 57 + ACPI_RS_SIZE(struct acpi_resource_address16), 58 + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_address16)}, 53 59 54 - static u8 acpi_rs_encode_general_flags(union acpi_resource_data *resource); 60 + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_ADDRESS16, 61 + sizeof(struct aml_resource_address16), 62 + 0}, 55 63 56 - static void 57 - acpi_rs_decode_specific_flags(union acpi_resource_data *resource, u8 flags); 64 + /* Resource Type, General Flags, and Type-Specific Flags */ 58 65 59 - static u8 acpi_rs_encode_specific_flags(union acpi_resource_data *resource); 66 + {ACPI_RSC_ADDRESS, 0, 0, 0}, 60 67 61 - static void 62 - acpi_rs_set_address_common(union aml_resource *aml, 63 - struct acpi_resource *resource); 68 + /* 69 + * These fields are contiguous in both the source and destination: 70 + * Address Granularity 71 + * Address Range Minimum 72 + * Address Range Maximum 73 + * Address Translation Offset 74 + * Address Length 75 + */ 76 + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.address16.granularity), 77 + AML_OFFSET(address16.granularity), 78 + 5}, 64 79 65 - static u8 80 + /* Optional resource_source (Index and String) */ 81 + 82 + {ACPI_RSC_SOURCE, ACPI_RS_OFFSET(data.address16.resource_source), 83 + 0, 84 + sizeof(struct aml_resource_address16)} 85 + }; 86 + 87 + /******************************************************************************* 88 + * 89 + * acpi_rs_convert_address32 - All DWORD (32-bit) address resources 90 + * 91 + ******************************************************************************/ 92 + 93 + struct acpi_rsconvert_info acpi_rs_convert_address32[5] = { 94 + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_ADDRESS32, 95 + ACPI_RS_SIZE(struct acpi_resource_address32), 96 + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_address32)}, 97 + 98 + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_ADDRESS32, 99 + sizeof(struct aml_resource_address32), 100 + 0}, 101 + 102 + /* Resource Type, General Flags, and Type-Specific Flags */ 103 + 104 + {ACPI_RSC_ADDRESS, 0, 0, 0}, 105 + 106 + /* 107 + * These fields are contiguous in both the source and destination: 108 + * Address Granularity 109 + * Address Range Minimum 110 + * Address Range Maximum 111 + * Address Translation Offset 112 + * Address Length 113 + */ 114 + {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.address32.granularity), 115 + AML_OFFSET(address32.granularity), 116 + 5}, 117 + 118 + /* Optional resource_source (Index and String) */ 119 + 120 + {ACPI_RSC_SOURCE, ACPI_RS_OFFSET(data.address32.resource_source), 121 + 0, 122 + sizeof(struct aml_resource_address32)} 123 + }; 124 + 125 + /******************************************************************************* 126 + * 127 + * acpi_rs_convert_address64 - All QWORD (64-bit) address resources 128 + * 129 + ******************************************************************************/ 130 + 131 + struct acpi_rsconvert_info acpi_rs_convert_address64[5] = { 132 + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_ADDRESS64, 133 + ACPI_RS_SIZE(struct acpi_resource_address64), 134 + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_address64)}, 135 + 136 + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_ADDRESS64, 137 + sizeof(struct aml_resource_address64), 138 + 0}, 139 + 140 + /* Resource Type, General Flags, and Type-Specific Flags */ 141 + 142 + {ACPI_RSC_ADDRESS, 0, 0, 0}, 143 + 144 + /* 145 + * These fields are contiguous in both the source and destination: 146 + * Address Granularity 147 + * Address Range Minimum 148 + * Address Range Maximum 149 + * Address Translation Offset 150 + * Address Length 151 + */ 152 + {ACPI_RSC_MOVE64, ACPI_RS_OFFSET(data.address64.granularity), 153 + AML_OFFSET(address64.granularity), 154 + 5}, 155 + 156 + /* Optional resource_source (Index and String) */ 157 + 158 + {ACPI_RSC_SOURCE, ACPI_RS_OFFSET(data.address64.resource_source), 159 + 0, 160 + sizeof(struct aml_resource_address64)} 161 + }; 162 + 163 + /******************************************************************************* 164 + * 165 + * acpi_rs_convert_ext_address64 - All Extended (64-bit) address resources 166 + * 167 + ******************************************************************************/ 168 + 169 + struct acpi_rsconvert_info acpi_rs_convert_ext_address64[5] = { 170 + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64, 171 + ACPI_RS_SIZE(struct acpi_resource_extended_address64), 172 + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_ext_address64)}, 173 + 174 + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64, 175 + sizeof(struct aml_resource_extended_address64), 176 + 0}, 177 + 178 + /* Resource Type, General Flags, and Type-Specific Flags */ 179 + 180 + {ACPI_RSC_ADDRESS, 0, 0, 0}, 181 + 182 + /* Revision ID */ 183 + 184 + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.ext_address64.revision_iD), 185 + AML_OFFSET(ext_address64.revision_iD), 186 + 1}, 187 + /* 188 + * These fields are contiguous in both the source and destination: 189 + * Address Granularity 190 + * Address Range Minimum 191 + * Address Range Maximum 192 + * Address Translation Offset 193 + * Address Length 194 + * Type-Specific Attribute 195 + */ 196 + {ACPI_RSC_MOVE64, ACPI_RS_OFFSET(data.ext_address64.granularity), 197 + AML_OFFSET(ext_address64.granularity), 198 + 6} 199 + }; 200 + 201 + /******************************************************************************* 202 + * 203 + * acpi_rs_convert_general_flags - Flags common to all address descriptors 204 + * 205 + ******************************************************************************/ 206 + 207 + static struct acpi_rsconvert_info acpi_rs_convert_general_flags[6] = { 208 + {ACPI_RSC_FLAGINIT, 0, AML_OFFSET(address.flags), 209 + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_general_flags)}, 210 + 211 + /* Resource Type (Memory, Io, bus_number, etc.) */ 212 + 213 + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.address.resource_type), 214 + AML_OFFSET(address.resource_type), 215 + 1}, 216 + 217 + /* General Flags - Consume, Decode, min_fixed, max_fixed */ 218 + 219 + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.producer_consumer), 220 + AML_OFFSET(address.flags), 221 + 0}, 222 + 223 + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.decode), 224 + AML_OFFSET(address.flags), 225 + 1}, 226 + 227 + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.min_address_fixed), 228 + AML_OFFSET(address.flags), 229 + 2}, 230 + 231 + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.max_address_fixed), 232 + AML_OFFSET(address.flags), 233 + 3} 234 + }; 235 + 236 + /******************************************************************************* 237 + * 238 + * acpi_rs_convert_mem_flags - Flags common to Memory address descriptors 239 + * 240 + ******************************************************************************/ 241 + 242 + static struct acpi_rsconvert_info acpi_rs_convert_mem_flags[5] = { 243 + {ACPI_RSC_FLAGINIT, 0, AML_OFFSET(address.specific_flags), 244 + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_mem_flags)}, 245 + 246 + /* Memory-specific flags */ 247 + 248 + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.info.mem.write_protect), 249 + AML_OFFSET(address.specific_flags), 250 + 0}, 251 + 252 + {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.address.info.mem.caching), 253 + AML_OFFSET(address.specific_flags), 254 + 1}, 255 + 256 + {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.address.info.mem.range_type), 257 + AML_OFFSET(address.specific_flags), 258 + 3}, 259 + 260 + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.info.mem.translation), 261 + AML_OFFSET(address.specific_flags), 262 + 5} 263 + }; 264 + 265 + /******************************************************************************* 266 + * 267 + * acpi_rs_convert_io_flags - Flags common to I/O address descriptors 268 + * 269 + ******************************************************************************/ 270 + 271 + static struct acpi_rsconvert_info acpi_rs_convert_io_flags[4] = { 272 + {ACPI_RSC_FLAGINIT, 0, AML_OFFSET(address.specific_flags), 273 + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_io_flags)}, 274 + 275 + /* I/O-specific flags */ 276 + 277 + {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.address.info.io.range_type), 278 + AML_OFFSET(address.specific_flags), 279 + 0}, 280 + 281 + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.info.io.translation), 282 + AML_OFFSET(address.specific_flags), 283 + 4}, 284 + 285 + {ACPI_RSC_1BITFLAG, 286 + ACPI_RS_OFFSET(data.address.info.io.translation_type), 287 + AML_OFFSET(address.specific_flags), 288 + 5} 289 + }; 290 + 291 + /******************************************************************************* 292 + * 293 + * FUNCTION: acpi_rs_get_address_common 294 + * 295 + * PARAMETERS: Resource - Pointer to the internal resource struct 296 + * Aml - Pointer to the AML resource descriptor 297 + * 298 + * RETURN: TRUE if the resource_type field is OK, FALSE otherwise 299 + * 300 + * DESCRIPTION: Convert common flag fields from a raw AML resource descriptor 301 + * to an internal resource descriptor 302 + * 303 + ******************************************************************************/ 304 + 305 + u8 66 306 acpi_rs_get_address_common(struct acpi_resource *resource, 67 - union aml_resource *aml); 68 - 69 - /******************************************************************************* 70 - * 71 - * FUNCTION: acpi_rs_decode_general_flags 72 - * 73 - * PARAMETERS: Resource - Address resource data struct 74 - * Flags - Raw AML flag byte 75 - * 76 - * RETURN: Decoded flag bits in resource struct 77 - * 78 - * DESCRIPTION: Decode a general flag byte to an address resource struct 79 - * 80 - ******************************************************************************/ 81 - 82 - static void 83 - acpi_rs_decode_general_flags(union acpi_resource_data *resource, u8 flags) 307 + union aml_resource *aml) 84 308 { 85 309 ACPI_FUNCTION_ENTRY(); 86 310 87 - /* Producer / Consumer - flag bit[0] */ 311 + /* Validate the Resource Type */ 88 312 89 - resource->address.producer_consumer = (u32) (flags & 0x01); 90 - 91 - /* Decode (_DEC) - flag bit[1] */ 92 - 93 - resource->address.decode = (u32) ((flags >> 1) & 0x01); 94 - 95 - /* Min Address Fixed (_MIF) - flag bit[2] */ 96 - 97 - resource->address.min_address_fixed = (u32) ((flags >> 2) & 0x01); 98 - 99 - /* Max Address Fixed (_MAF) - flag bit[3] */ 100 - 101 - resource->address.max_address_fixed = (u32) ((flags >> 3) & 0x01); 102 - } 103 - 104 - /******************************************************************************* 105 - * 106 - * FUNCTION: acpi_rs_encode_general_flags 107 - * 108 - * PARAMETERS: Resource - Address resource data struct 109 - * 110 - * RETURN: Encoded general flag byte 111 - * 112 - * DESCRIPTION: Construct a general flag byte from an address resource struct 113 - * 114 - ******************************************************************************/ 115 - 116 - static u8 acpi_rs_encode_general_flags(union acpi_resource_data *resource) 117 - { 118 - ACPI_FUNCTION_ENTRY(); 119 - 120 - return ((u8) 121 - 122 - /* Producer / Consumer - flag bit[0] */ 123 - ((resource->address.producer_consumer & 0x01) | 124 - /* Decode (_DEC) - flag bit[1] */ 125 - ((resource->address.decode & 0x01) << 1) | 126 - /* Min Address Fixed (_MIF) - flag bit[2] */ 127 - ((resource->address.min_address_fixed & 0x01) << 2) | 128 - /* Max Address Fixed (_MAF) - flag bit[3] */ 129 - ((resource->address.max_address_fixed & 0x01) << 3)) 130 - ); 131 - } 132 - 133 - /******************************************************************************* 134 - * 135 - * FUNCTION: acpi_rs_decode_specific_flags 136 - * 137 - * PARAMETERS: Resource - Address resource data struct 138 - * Flags - Raw AML flag byte 139 - * 140 - * RETURN: Decoded flag bits in attribute struct 141 - * 142 - * DESCRIPTION: Decode a type-specific flag byte to an attribute struct. 143 - * Type-specific flags are only defined for the Memory and IO 144 - * resource types. 145 - * 146 - ******************************************************************************/ 147 - 148 - static void 149 - acpi_rs_decode_specific_flags(union acpi_resource_data *resource, u8 flags) 150 - { 151 - ACPI_FUNCTION_ENTRY(); 152 - 153 - if (resource->address.resource_type == ACPI_MEMORY_RANGE) { 154 - /* Write Status (_RW) - flag bit[0] */ 155 - 156 - resource->address.attribute.memory.read_write_attribute = 157 - (u16) (flags & 0x01); 158 - 159 - /* Memory Attributes (_MEM) - flag bits[2:1] */ 160 - 161 - resource->address.attribute.memory.cache_attribute = 162 - (u16) ((flags >> 1) & 0x03); 163 - } else if (resource->address.resource_type == ACPI_IO_RANGE) { 164 - /* Ranges (_RNG) - flag bits[1:0] */ 165 - 166 - resource->address.attribute.io.range_attribute = 167 - (u16) (flags & 0x03); 168 - 169 - /* Translations (_TTP and _TRS) - flag bits[5:4] */ 170 - 171 - resource->address.attribute.io.translation_attribute = 172 - (u16) ((flags >> 4) & 0x03); 173 - } 174 - } 175 - 176 - /******************************************************************************* 177 - * 178 - * FUNCTION: acpi_rs_encode_specific_flags 179 - * 180 - * PARAMETERS: Resource - Address resource data struct 181 - * 182 - * RETURN: Encoded type-specific flag byte 183 - * 184 - * DESCRIPTION: Construct a type-specific flag byte from an attribute struct. 185 - * Type-specific flags are only defined for the Memory and IO 186 - * resource types. 187 - * 188 - ******************************************************************************/ 189 - 190 - static u8 acpi_rs_encode_specific_flags(union acpi_resource_data *resource) 191 - { 192 - ACPI_FUNCTION_ENTRY(); 193 - 194 - if (resource->address.resource_type == ACPI_MEMORY_RANGE) { 195 - return ((u8) 196 - 197 - /* Write Status (_RW) - flag bit[0] */ 198 - ((resource->address.attribute.memory. 199 - read_write_attribute & 0x01) | 200 - /* Memory Attributes (_MEM) - flag bits[2:1] */ 201 - ((resource->address.attribute.memory. 202 - cache_attribute & 0x03) << 1))); 203 - } else if (resource->address.resource_type == ACPI_IO_RANGE) { 204 - return ((u8) 205 - 206 - /* Ranges (_RNG) - flag bits[1:0] */ 207 - ((resource->address.attribute.io. 208 - range_attribute & 0x03) | 209 - /* Translations (_TTP and _TRS) - flag bits[5:4] */ 210 - ((resource->address.attribute.io. 211 - translation_attribute & 0x03) << 4))); 313 + if ((aml->address.resource_type > 2) 314 + && (aml->address.resource_type < 0xC0)) { 315 + return (FALSE); 212 316 } 213 317 214 - return (0); 318 + /* Get the Resource Type and General Flags */ 319 + 320 + (void)acpi_rs_convert_aml_to_resource(resource, aml, 321 + acpi_rs_convert_general_flags); 322 + 323 + /* Get the Type-Specific Flags (Memory and I/O descriptors only) */ 324 + 325 + if (resource->data.address.resource_type == ACPI_MEMORY_RANGE) { 326 + (void)acpi_rs_convert_aml_to_resource(resource, aml, 327 + acpi_rs_convert_mem_flags); 328 + } else if (resource->data.address.resource_type == ACPI_IO_RANGE) { 329 + (void)acpi_rs_convert_aml_to_resource(resource, aml, 330 + acpi_rs_convert_io_flags); 331 + } else { 332 + /* Generic resource type, just grab the type_specific byte */ 333 + 334 + resource->data.address.info.type_specific = 335 + aml->address.specific_flags; 336 + } 337 + 338 + return (TRUE); 215 339 } 216 340 217 341 /******************************************************************************* ··· 352 228 * 353 229 ******************************************************************************/ 354 230 355 - static void 231 + void 356 232 acpi_rs_set_address_common(union aml_resource *aml, 357 233 struct acpi_resource *resource) 358 234 { 359 235 ACPI_FUNCTION_ENTRY(); 360 236 361 - /* Set the Resource Type (Memory, Io, bus_number, etc.) */ 237 + /* Set the Resource Type and General Flags */ 362 238 363 - aml->address.resource_type = (u8) resource->data.address.resource_type; 239 + (void)acpi_rs_convert_resource_to_aml(resource, aml, 240 + acpi_rs_convert_general_flags); 364 241 365 - /* Set the general flags */ 242 + /* Set the Type-Specific Flags (Memory and I/O descriptors only) */ 366 243 367 - aml->address.flags = acpi_rs_encode_general_flags(&resource->data); 244 + if (resource->data.address.resource_type == ACPI_MEMORY_RANGE) { 245 + (void)acpi_rs_convert_resource_to_aml(resource, aml, 246 + acpi_rs_convert_mem_flags); 247 + } else if (resource->data.address.resource_type == ACPI_IO_RANGE) { 248 + (void)acpi_rs_convert_resource_to_aml(resource, aml, 249 + acpi_rs_convert_io_flags); 250 + } else { 251 + /* Generic resource type, just copy the type_specific byte */ 368 252 369 - /* Set the type-specific flags */ 370 - 371 - aml->address.specific_flags = 372 - acpi_rs_encode_specific_flags(&resource->data); 373 - } 374 - 375 - /******************************************************************************* 376 - * 377 - * FUNCTION: acpi_rs_get_address_common 378 - * 379 - * PARAMETERS: Resource - Pointer to the internal resource struct 380 - * Aml - Pointer to the AML resource descriptor 381 - * 382 - * RETURN: TRUE if the resource_type field is OK, FALSE otherwise 383 - * 384 - * DESCRIPTION: Convert common flag fields from a raw AML resource descriptor 385 - * to an internal resource descriptor 386 - * 387 - ******************************************************************************/ 388 - 389 - static u8 390 - acpi_rs_get_address_common(struct acpi_resource *resource, 391 - union aml_resource *aml) 392 - { 393 - ACPI_FUNCTION_ENTRY(); 394 - 395 - /* Validate resource type */ 396 - 397 - if ((aml->address.resource_type > 2) 398 - && (aml->address.resource_type < 0xC0)) { 399 - return (FALSE); 253 + aml->address.specific_flags = 254 + resource->data.address.info.type_specific; 400 255 } 401 - 402 - /* Get the Resource Type (Memory, Io, bus_number, etc.) */ 403 - 404 - resource->data.address.resource_type = aml->address.resource_type; 405 - 406 - /* Get the General Flags */ 407 - 408 - acpi_rs_decode_general_flags(&resource->data, aml->address.flags); 409 - 410 - /* Get the Type-Specific Flags */ 411 - 412 - acpi_rs_decode_specific_flags(&resource->data, 413 - aml->address.specific_flags); 414 - return (TRUE); 415 - } 416 - 417 - /******************************************************************************* 418 - * 419 - * FUNCTION: acpi_rs_get_address16 420 - * 421 - * PARAMETERS: Aml - Pointer to the AML resource descriptor 422 - * aml_resource_length - Length of the resource from the AML header 423 - * Resource - Where the internal resource is returned 424 - * 425 - * RETURN: Status 426 - * 427 - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding 428 - * internal resource descriptor, simplifying bitflags and handling 429 - * alignment and endian issues if necessary. 430 - * 431 - ******************************************************************************/ 432 - 433 - acpi_status 434 - acpi_rs_get_address16(union aml_resource * aml, 435 - u16 aml_resource_length, struct acpi_resource * resource) 436 - { 437 - ACPI_FUNCTION_TRACE("rs_get_address16"); 438 - 439 - /* Get the Resource Type, general flags, and type-specific flags */ 440 - 441 - if (!acpi_rs_get_address_common(resource, aml)) { 442 - return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); 443 - } 444 - 445 - /* 446 - * Get the following contiguous fields from the AML descriptor: 447 - * Address Granularity 448 - * Address Range Minimum 449 - * Address Range Maximum 450 - * Address Translation Offset 451 - * Address Length 452 - */ 453 - acpi_rs_move_data(&resource->data.address16.granularity, 454 - &aml->address16.granularity, 5, 455 - ACPI_MOVE_TYPE_16_TO_32); 456 - 457 - /* Get the optional resource_source (index and string) */ 458 - 459 - resource->length = 460 - ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16) + 461 - acpi_rs_get_resource_source(aml_resource_length, 462 - sizeof(struct aml_resource_address16), 463 - &resource->data.address16. 464 - resource_source, aml, NULL); 465 - 466 - /* Complete the resource header */ 467 - 468 - resource->type = ACPI_RESOURCE_TYPE_ADDRESS16; 469 - return_ACPI_STATUS(AE_OK); 470 - } 471 - 472 - /******************************************************************************* 473 - * 474 - * FUNCTION: acpi_rs_set_address16 475 - * 476 - * PARAMETERS: Resource - Pointer to the resource descriptor 477 - * Aml - Where the AML descriptor is returned 478 - * 479 - * RETURN: Status 480 - * 481 - * DESCRIPTION: Convert an internal resource descriptor to the corresponding 482 - * external AML resource descriptor. 483 - * 484 - ******************************************************************************/ 485 - 486 - acpi_status 487 - acpi_rs_set_address16(struct acpi_resource *resource, union aml_resource *aml) 488 - { 489 - acpi_size descriptor_length; 490 - 491 - ACPI_FUNCTION_TRACE("rs_set_address16"); 492 - 493 - /* Set the Resource Type, General Flags, and Type-Specific Flags */ 494 - 495 - acpi_rs_set_address_common(aml, resource); 496 - 497 - /* 498 - * Set the following contiguous fields in the AML descriptor: 499 - * Address Granularity 500 - * Address Range Minimum 501 - * Address Range Maximum 502 - * Address Translation Offset 503 - * Address Length 504 - */ 505 - acpi_rs_move_data(&aml->address16.granularity, 506 - &resource->data.address16.granularity, 5, 507 - ACPI_MOVE_TYPE_32_TO_16); 508 - 509 - /* Resource Source Index and Resource Source are optional */ 510 - 511 - descriptor_length = acpi_rs_set_resource_source(aml, 512 - sizeof(struct 513 - aml_resource_address16), 514 - &resource->data. 515 - address16. 516 - resource_source); 517 - 518 - /* Complete the AML descriptor header */ 519 - 520 - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_ADDRESS16, 521 - descriptor_length, aml); 522 - return_ACPI_STATUS(AE_OK); 523 - } 524 - 525 - /******************************************************************************* 526 - * 527 - * FUNCTION: acpi_rs_get_address32 528 - * 529 - * PARAMETERS: Aml - Pointer to the AML resource descriptor 530 - * aml_resource_length - Length of the resource from the AML header 531 - * Resource - Where the internal resource is returned 532 - * 533 - * RETURN: Status 534 - * 535 - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding 536 - * internal resource descriptor, simplifying bitflags and handling 537 - * alignment and endian issues if necessary. 538 - * 539 - ******************************************************************************/ 540 - 541 - acpi_status 542 - acpi_rs_get_address32(union aml_resource *aml, 543 - u16 aml_resource_length, struct acpi_resource *resource) 544 - { 545 - 546 - ACPI_FUNCTION_TRACE("rs_get_address32"); 547 - 548 - /* Get the Resource Type, general flags, and type-specific flags */ 549 - 550 - if (!acpi_rs_get_address_common(resource, (void *)aml)) { 551 - return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); 552 - } 553 - 554 - /* 555 - * Get the following contiguous fields from the AML descriptor: 556 - * Address Granularity 557 - * Address Range Minimum 558 - * Address Range Maximum 559 - * Address Translation Offset 560 - * Address Length 561 - */ 562 - acpi_rs_move_data(&resource->data.address32.granularity, 563 - &aml->address32.granularity, 5, 564 - ACPI_MOVE_TYPE_32_TO_32); 565 - 566 - /* Get the optional resource_source (index and string) */ 567 - 568 - resource->length = 569 - ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32) + 570 - acpi_rs_get_resource_source(aml_resource_length, 571 - sizeof(struct aml_resource_address32), 572 - &resource->data.address32. 573 - resource_source, aml, NULL); 574 - 575 - /* Complete the resource header */ 576 - 577 - resource->type = ACPI_RESOURCE_TYPE_ADDRESS32; 578 - return_ACPI_STATUS(AE_OK); 579 - } 580 - 581 - /******************************************************************************* 582 - * 583 - * FUNCTION: acpi_rs_set_address32 584 - * 585 - * PARAMETERS: Resource - Pointer to the resource descriptor 586 - * Aml - Where the AML descriptor is returned 587 - * 588 - * RETURN: Status 589 - * 590 - * DESCRIPTION: Convert an internal resource descriptor to the corresponding 591 - * external AML resource descriptor. 592 - * 593 - ******************************************************************************/ 594 - 595 - acpi_status 596 - acpi_rs_set_address32(struct acpi_resource *resource, union aml_resource *aml) 597 - { 598 - acpi_size descriptor_length; 599 - 600 - ACPI_FUNCTION_TRACE("rs_set_address32"); 601 - 602 - /* Set the Resource Type, General Flags, and Type-Specific Flags */ 603 - 604 - acpi_rs_set_address_common(aml, resource); 605 - 606 - /* 607 - * Set the following contiguous fields in the AML descriptor: 608 - * Address Granularity 609 - * Address Range Minimum 610 - * Address Range Maximum 611 - * Address Translation Offset 612 - * Address Length 613 - */ 614 - acpi_rs_move_data(&aml->address32.granularity, 615 - &resource->data.address32.granularity, 5, 616 - ACPI_MOVE_TYPE_32_TO_32); 617 - 618 - /* Resource Source Index and Resource Source are optional */ 619 - 620 - descriptor_length = acpi_rs_set_resource_source(aml, 621 - sizeof(struct 622 - aml_resource_address32), 623 - &resource->data. 624 - address32. 625 - resource_source); 626 - 627 - /* Complete the AML descriptor header */ 628 - 629 - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_ADDRESS32, 630 - descriptor_length, aml); 631 - return_ACPI_STATUS(AE_OK); 632 - } 633 - 634 - /******************************************************************************* 635 - * 636 - * FUNCTION: acpi_rs_get_address64 637 - * 638 - * PARAMETERS: Aml - Pointer to the AML resource descriptor 639 - * aml_resource_length - Length of the resource from the AML header 640 - * Resource - Where the internal resource is returned 641 - * 642 - * RETURN: Status 643 - * 644 - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding 645 - * internal resource descriptor, simplifying bitflags and handling 646 - * alignment and endian issues if necessary. 647 - * 648 - ******************************************************************************/ 649 - 650 - acpi_status 651 - acpi_rs_get_address64(union aml_resource *aml, 652 - u16 aml_resource_length, struct acpi_resource *resource) 653 - { 654 - ACPI_FUNCTION_TRACE("rs_get_address64"); 655 - 656 - /* Get the Resource Type, general Flags, and type-specific Flags */ 657 - 658 - if (!acpi_rs_get_address_common(resource, aml)) { 659 - return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); 660 - } 661 - 662 - /* 663 - * Get the following contiguous fields from the AML descriptor: 664 - * Address Granularity 665 - * Address Range Minimum 666 - * Address Range Maximum 667 - * Address Translation Offset 668 - * Address Length 669 - */ 670 - acpi_rs_move_data(&resource->data.address64.granularity, 671 - &aml->address64.granularity, 5, 672 - ACPI_MOVE_TYPE_64_TO_64); 673 - 674 - /* Get the optional resource_source (index and string) */ 675 - 676 - resource->length = 677 - ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64) + 678 - acpi_rs_get_resource_source(aml_resource_length, 679 - sizeof(struct aml_resource_address64), 680 - &resource->data.address64. 681 - resource_source, aml, NULL); 682 - 683 - /* Complete the resource header */ 684 - 685 - resource->type = ACPI_RESOURCE_TYPE_ADDRESS64; 686 - return_ACPI_STATUS(AE_OK); 687 - } 688 - 689 - /******************************************************************************* 690 - * 691 - * FUNCTION: acpi_rs_set_address64 692 - * 693 - * PARAMETERS: Resource - Pointer to the resource descriptor 694 - * Aml - Where the AML descriptor is returned 695 - * 696 - * RETURN: Status 697 - * 698 - * DESCRIPTION: Convert an internal resource descriptor to the corresponding 699 - * external AML resource descriptor. 700 - * 701 - ******************************************************************************/ 702 - 703 - acpi_status 704 - acpi_rs_set_address64(struct acpi_resource *resource, union aml_resource *aml) 705 - { 706 - acpi_size descriptor_length; 707 - 708 - ACPI_FUNCTION_TRACE("rs_set_address64"); 709 - 710 - /* Set the Resource Type, General Flags, and Type-Specific Flags */ 711 - 712 - acpi_rs_set_address_common(aml, resource); 713 - 714 - /* 715 - * Set the following contiguous fields in the AML descriptor: 716 - * Address Granularity 717 - * Address Range Minimum 718 - * Address Range Maximum 719 - * Address Translation Offset 720 - * Address Length 721 - */ 722 - acpi_rs_move_data(&aml->address64.granularity, 723 - &resource->data.address64.granularity, 5, 724 - ACPI_MOVE_TYPE_64_TO_64); 725 - 726 - /* Resource Source Index and Resource Source are optional */ 727 - 728 - descriptor_length = acpi_rs_set_resource_source(aml, 729 - sizeof(struct 730 - aml_resource_address64), 731 - &resource->data. 732 - address64. 733 - resource_source); 734 - 735 - /* Complete the AML descriptor header */ 736 - 737 - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_ADDRESS64, 738 - descriptor_length, aml); 739 - return_ACPI_STATUS(AE_OK); 740 - } 741 - 742 - /******************************************************************************* 743 - * 744 - * FUNCTION: acpi_rs_get_ext_address64 745 - * 746 - * PARAMETERS: Aml - Pointer to the AML resource descriptor 747 - * aml_resource_length - Length of the resource from the AML header 748 - * Resource - Where the internal resource is returned 749 - * 750 - * RETURN: Status 751 - * 752 - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding 753 - * internal resource descriptor, simplifying bitflags and handling 754 - * alignment and endian issues if necessary. 755 - * 756 - ******************************************************************************/ 757 - 758 - acpi_status 759 - acpi_rs_get_ext_address64(union aml_resource *aml, 760 - u16 aml_resource_length, 761 - struct acpi_resource *resource) 762 - { 763 - 764 - ACPI_FUNCTION_TRACE("rs_get_ext_address64"); 765 - 766 - /* Get the Resource Type, general flags, and type-specific flags */ 767 - 768 - if (!acpi_rs_get_address_common(resource, aml)) { 769 - return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); 770 - } 771 - 772 - /* 773 - * Get and validate the Revision ID 774 - * Note: Only one revision ID is currently supported 775 - */ 776 - resource->data.ext_address64.revision_iD = 777 - aml->ext_address64.revision_iD; 778 - if (aml->ext_address64.revision_iD != 779 - AML_RESOURCE_EXTENDED_ADDRESS_REVISION) { 780 - return_ACPI_STATUS(AE_SUPPORT); 781 - } 782 - 783 - /* 784 - * Get the following contiguous fields from the AML descriptor: 785 - * Address Granularity 786 - * Address Range Minimum 787 - * Address Range Maximum 788 - * Address Translation Offset 789 - * Address Length 790 - * Type-Specific Attribute 791 - */ 792 - acpi_rs_move_data(&resource->data.ext_address64.granularity, 793 - &aml->ext_address64.granularity, 6, 794 - ACPI_MOVE_TYPE_64_TO_64); 795 - 796 - /* Complete the resource header */ 797 - 798 - resource->type = ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64; 799 - resource->length = 800 - ACPI_SIZEOF_RESOURCE(struct acpi_resource_extended_address64); 801 - return_ACPI_STATUS(AE_OK); 802 - } 803 - 804 - /******************************************************************************* 805 - * 806 - * FUNCTION: acpi_rs_set_ext_address64 807 - * 808 - * PARAMETERS: Resource - Pointer to the resource descriptor 809 - * Aml - Where the AML descriptor is returned 810 - * 811 - * RETURN: Status 812 - * 813 - * DESCRIPTION: Convert an internal resource descriptor to the corresponding 814 - * external AML resource descriptor. 815 - * 816 - ******************************************************************************/ 817 - 818 - acpi_status 819 - acpi_rs_set_ext_address64(struct acpi_resource *resource, 820 - union aml_resource *aml) 821 - { 822 - ACPI_FUNCTION_TRACE("rs_set_ext_address64"); 823 - 824 - /* Set the Resource Type, General Flags, and Type-Specific Flags */ 825 - 826 - acpi_rs_set_address_common(aml, resource); 827 - 828 - /* Only one Revision ID is currently supported */ 829 - 830 - aml->ext_address64.revision_iD = AML_RESOURCE_EXTENDED_ADDRESS_REVISION; 831 - aml->ext_address64.reserved = 0; 832 - 833 - /* 834 - * Set the following contiguous fields in the AML descriptor: 835 - * Address Granularity 836 - * Address Range Minimum 837 - * Address Range Maximum 838 - * Address Translation Offset 839 - * Address Length 840 - * Type-Specific Attribute 841 - */ 842 - acpi_rs_move_data(&aml->ext_address64.granularity, 843 - &resource->data.address64.granularity, 6, 844 - ACPI_MOVE_TYPE_64_TO_64); 845 - 846 - /* Complete the AML descriptor header */ 847 - 848 - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64, 849 - sizeof(struct 850 - aml_resource_extended_address64), 851 - aml); 852 - return_ACPI_STATUS(AE_OK); 853 256 }
+35 -36
drivers/acpi/resources/rscalc.c
··· 52 52 /* Local prototypes */ 53 53 static u8 acpi_rs_count_set_bits(u16 bit_field); 54 54 55 - static acpi_size 55 + static acpi_rs_length 56 56 acpi_rs_struct_option_length(struct acpi_resource_source *resource_source); 57 57 58 58 static u32 ··· 100 100 * 101 101 ******************************************************************************/ 102 102 103 - static acpi_size 103 + static acpi_rs_length 104 104 acpi_rs_struct_option_length(struct acpi_resource_source *resource_source) 105 105 { 106 106 ACPI_FUNCTION_ENTRY(); ··· 111 111 * resource_source_index (1). 112 112 */ 113 113 if (resource_source->string_ptr) { 114 - return ((acpi_size) resource_source->string_length + 1); 114 + return ((acpi_rs_length) (resource_source->string_length + 1)); 115 115 } 116 116 117 117 return (0); ··· 184 184 acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) 185 185 { 186 186 acpi_size aml_size_needed = 0; 187 - acpi_size segment_size; 187 + acpi_rs_length total_size; 188 188 189 189 ACPI_FUNCTION_TRACE("rs_get_aml_length"); 190 190 ··· 199 199 200 200 /* Get the base size of the (external stream) resource descriptor */ 201 201 202 - segment_size = acpi_gbl_aml_resource_sizes[resource->type]; 202 + total_size = acpi_gbl_aml_resource_sizes[resource->type]; 203 203 204 204 /* 205 205 * Augment the base size for descriptors with optional and/or ··· 216 216 if (resource->data.vendor.byte_length > 7) { 217 217 /* Base size of a Large resource descriptor */ 218 218 219 - segment_size = 219 + total_size = 220 220 sizeof(struct aml_resource_large_header); 221 221 } 222 222 223 223 /* Add the size of the vendor-specific data */ 224 224 225 - segment_size += resource->data.vendor.byte_length; 225 + total_size = (acpi_rs_length) 226 + (total_size + resource->data.vendor.byte_length); 226 227 break; 227 228 228 229 case ACPI_RESOURCE_TYPE_END_TAG: ··· 231 230 * End Tag: 232 231 * We are done -- return the accumulated total size. 233 232 */ 234 - *size_needed = aml_size_needed + segment_size; 233 + *size_needed = aml_size_needed + total_size; 235 234 236 235 /* Normal exit */ 237 236 ··· 242 241 * 16-Bit Address Resource: 243 242 * Add the size of the optional resource_source info 244 243 */ 245 - segment_size += 246 - acpi_rs_struct_option_length(&resource->data. 247 - address16. 248 - resource_source); 244 + total_size = (acpi_rs_length) 245 + (total_size + 246 + acpi_rs_struct_option_length(&resource->data. 247 + address16. 248 + resource_source)); 249 249 break; 250 250 251 251 case ACPI_RESOURCE_TYPE_ADDRESS32: ··· 254 252 * 32-Bit Address Resource: 255 253 * Add the size of the optional resource_source info 256 254 */ 257 - segment_size += 258 - acpi_rs_struct_option_length(&resource->data. 259 - address32. 260 - resource_source); 255 + total_size = (acpi_rs_length) 256 + (total_size + 257 + acpi_rs_struct_option_length(&resource->data. 258 + address32. 259 + resource_source)); 261 260 break; 262 261 263 262 case ACPI_RESOURCE_TYPE_ADDRESS64: ··· 266 263 * 64-Bit Address Resource: 267 264 * Add the size of the optional resource_source info 268 265 */ 269 - segment_size += 270 - acpi_rs_struct_option_length(&resource->data. 271 - address64. 272 - resource_source); 266 + total_size = (acpi_rs_length) 267 + (total_size + 268 + acpi_rs_struct_option_length(&resource->data. 269 + address64. 270 + resource_source)); 273 271 break; 274 272 275 273 case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: ··· 279 275 * Add the size of each additional optional interrupt beyond the 280 276 * required 1 (4 bytes for each u32 interrupt number) 281 277 */ 282 - segment_size += (((acpi_size) 283 - resource->data.extended_irq. 284 - interrupt_count - 1) * 4); 285 - 286 - /* Add the size of the optional resource_source info */ 287 - 288 - segment_size += 289 - acpi_rs_struct_option_length(&resource->data. 290 - extended_irq. 291 - resource_source); 278 + total_size = (acpi_rs_length) 279 + (total_size + 280 + ((resource->data.extended_irq.interrupt_count - 281 + 1) * 4) + 282 + /* Add the size of the optional resource_source info */ 283 + acpi_rs_struct_option_length(&resource->data. 284 + extended_irq. 285 + resource_source)); 292 286 break; 293 287 294 288 default: ··· 295 293 296 294 /* Update the total */ 297 295 298 - aml_size_needed += segment_size; 296 + aml_size_needed += total_size; 299 297 300 298 /* Point to the next object */ 301 299 ··· 343 341 while (bytes_parsed < aml_buffer_length) { 344 342 /* The next byte in the stream is the resource descriptor type */ 345 343 346 - resource_type = acpi_rs_get_resource_type(*aml_buffer); 344 + resource_type = acpi_ut_get_resource_type(aml_buffer); 347 345 348 346 /* Get the base stream size and structure sizes for the descriptor */ 349 347 ··· 354 352 355 353 /* Get the Length field from the input resource descriptor */ 356 354 357 - resource_length = 358 - acpi_rs_get_resource_length(ACPI_CAST_PTR 359 - (union aml_resource, 360 - aml_buffer)); 355 + resource_length = acpi_ut_get_resource_length(aml_buffer); 361 356 362 357 /* Augment the size for descriptors with optional fields */ 363 358
+616 -867
drivers/acpi/resources/rsdump.c
··· 43 43 44 44 #include <acpi/acpi.h> 45 45 #include <acpi/acresrc.h> 46 + #include <acpi/acdisasm.h> 46 47 47 48 #define _COMPONENT ACPI_RESOURCES 48 49 ACPI_MODULE_NAME("rsdump") ··· 62 61 63 62 static void acpi_rs_out_title(char *title); 64 63 65 - static void acpi_rs_dump_byte_list(u32 length, u8 * data); 64 + static void acpi_rs_dump_byte_list(u16 length, u8 * data); 66 65 67 - static void acpi_rs_dump_dword_list(u32 length, u32 * data); 66 + static void acpi_rs_dump_dword_list(u8 length, u32 * data); 68 67 69 - static void acpi_rs_dump_short_byte_list(u32 length, u32 * data); 68 + static void acpi_rs_dump_short_byte_list(u8 length, u8 * data); 70 69 71 70 static void 72 71 acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source); 73 72 74 73 static void acpi_rs_dump_address_common(union acpi_resource_data *resource); 74 + 75 + static void 76 + acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table); 77 + 78 + #define ACPI_RSD_OFFSET(f) (u8) ACPI_OFFSET (union acpi_resource_data,f) 79 + #define ACPI_PRT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_pci_routing_table,f) 80 + #define ACPI_RSD_TABLE_SIZE(name) (sizeof(name) / sizeof (struct acpi_rsdump_info)) 81 + 82 + /******************************************************************************* 83 + * 84 + * Resource Descriptor info tables 85 + * 86 + * Note: The first table entry must be a Title or Literal and must contain 87 + * the table length (number of table entries) 88 + * 89 + ******************************************************************************/ 90 + 91 + struct acpi_rsdump_info acpi_rs_dump_irq[6] = { 92 + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_irq), "IRQ", NULL}, 93 + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.triggering), "Triggering", 94 + acpi_gbl_HEdecode}, 95 + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.polarity), "Polarity", 96 + acpi_gbl_LLdecode}, 97 + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.sharable), "Sharing", 98 + acpi_gbl_SHRdecode}, 99 + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(irq.interrupt_count), 100 + "Interrupt Count", NULL}, 101 + {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(irq.interrupts[0]), 102 + "Interrupt List", NULL} 103 + }; 104 + 105 + struct acpi_rsdump_info acpi_rs_dump_dma[6] = { 106 + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_dma), "DMA", NULL}, 107 + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.type), "Speed", 108 + acpi_gbl_TYPdecode}, 109 + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(dma.bus_master), "Mastering", 110 + acpi_gbl_BMdecode}, 111 + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.transfer), "Transfer Type", 112 + acpi_gbl_SIZdecode}, 113 + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(dma.channel_count), "Channel Count", 114 + NULL}, 115 + {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(dma.channels[0]), "Channel List", 116 + NULL} 117 + }; 118 + 119 + struct acpi_rsdump_info acpi_rs_dump_start_dpf[3] = { 120 + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_start_dpf), 121 + "Start-Dependent-Functions", NULL}, 122 + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(start_dpf.compatibility_priority), 123 + "Compatibility Priority", acpi_gbl_config_decode}, 124 + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(start_dpf.performance_robustness), 125 + "Performance/Robustness", acpi_gbl_config_decode} 126 + }; 127 + 128 + struct acpi_rsdump_info acpi_rs_dump_end_dpf[1] = { 129 + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_dpf), 130 + "End-Dependent-Functions", NULL} 131 + }; 132 + 133 + struct acpi_rsdump_info acpi_rs_dump_io[6] = { 134 + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io), "I/O", NULL}, 135 + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(io.io_decode), "Address Decoding", 136 + acpi_gbl_io_decode}, 137 + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(io.minimum), "Address Minimum", NULL}, 138 + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(io.maximum), "Address Maximum", NULL}, 139 + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(io.alignment), "Alignment", NULL}, 140 + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(io.address_length), "Address Length", 141 + NULL} 142 + }; 143 + 144 + struct acpi_rsdump_info acpi_rs_dump_fixed_io[3] = { 145 + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_io), 146 + "Fixed I/O", NULL}, 147 + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(fixed_io.address), "Address", NULL}, 148 + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(fixed_io.address_length), 149 + "Address Length", NULL} 150 + }; 151 + 152 + struct acpi_rsdump_info acpi_rs_dump_vendor[3] = { 153 + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_vendor), 154 + "Vendor Specific", NULL}, 155 + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(vendor.byte_length), "Length", NULL}, 156 + {ACPI_RSD_LONGLIST, ACPI_RSD_OFFSET(vendor.byte_data[0]), "Vendor Data", 157 + NULL} 158 + }; 159 + 160 + struct acpi_rsdump_info acpi_rs_dump_end_tag[1] = { 161 + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_tag), "end_tag", 162 + NULL} 163 + }; 164 + 165 + struct acpi_rsdump_info acpi_rs_dump_memory24[6] = { 166 + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory24), 167 + "24-Bit Memory Range", NULL}, 168 + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory24.write_protect), 169 + "Write Protect", acpi_gbl_RWdecode}, 170 + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.minimum), "Address Minimum", 171 + NULL}, 172 + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.maximum), "Address Maximum", 173 + NULL}, 174 + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.alignment), "Alignment", 175 + NULL}, 176 + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.address_length), 177 + "Address Length", NULL} 178 + }; 179 + 180 + struct acpi_rsdump_info acpi_rs_dump_memory32[6] = { 181 + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory32), 182 + "32-Bit Memory Range", NULL}, 183 + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory32.write_protect), 184 + "Write Protect", acpi_gbl_RWdecode}, 185 + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.minimum), "Address Minimum", 186 + NULL}, 187 + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.maximum), "Address Maximum", 188 + NULL}, 189 + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.alignment), "Alignment", 190 + NULL}, 191 + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.address_length), 192 + "Address Length", NULL} 193 + }; 194 + 195 + struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[4] = { 196 + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_memory32), 197 + "32-Bit Fixed Memory Range", NULL}, 198 + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(fixed_memory32.write_protect), 199 + "Write Protect", acpi_gbl_RWdecode}, 200 + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address), "Address", 201 + NULL}, 202 + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address_length), 203 + "Address Length", NULL} 204 + }; 205 + 206 + struct acpi_rsdump_info acpi_rs_dump_address16[8] = { 207 + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address16), 208 + "16-Bit WORD Address Space", NULL}, 209 + {ACPI_RSD_ADDRESS, 0, NULL, NULL}, 210 + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.granularity), "Granularity", 211 + NULL}, 212 + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.minimum), "Address Minimum", 213 + NULL}, 214 + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.maximum), "Address Maximum", 215 + NULL}, 216 + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.translation_offset), 217 + "Translation Offset", NULL}, 218 + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.address_length), 219 + "Address Length", NULL}, 220 + {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address16.resource_source), NULL, NULL} 221 + }; 222 + 223 + struct acpi_rsdump_info acpi_rs_dump_address32[8] = { 224 + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address32), 225 + "32-Bit DWORD Address Space", NULL}, 226 + {ACPI_RSD_ADDRESS, 0, NULL, NULL}, 227 + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.granularity), "Granularity", 228 + NULL}, 229 + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.minimum), "Address Minimum", 230 + NULL}, 231 + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.maximum), "Address Maximum", 232 + NULL}, 233 + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.translation_offset), 234 + "Translation Offset", NULL}, 235 + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.address_length), 236 + "Address Length", NULL}, 237 + {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address32.resource_source), NULL, NULL} 238 + }; 239 + 240 + struct acpi_rsdump_info acpi_rs_dump_address64[8] = { 241 + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address64), 242 + "64-Bit QWORD Address Space", NULL}, 243 + {ACPI_RSD_ADDRESS, 0, NULL, NULL}, 244 + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.granularity), "Granularity", 245 + NULL}, 246 + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.minimum), "Address Minimum", 247 + NULL}, 248 + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.maximum), "Address Maximum", 249 + NULL}, 250 + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.translation_offset), 251 + "Translation Offset", NULL}, 252 + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.address_length), 253 + "Address Length", NULL}, 254 + {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address64.resource_source), NULL, NULL} 255 + }; 256 + 257 + struct acpi_rsdump_info acpi_rs_dump_ext_address64[8] = { 258 + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_ext_address64), 259 + "64-Bit Extended Address Space", NULL}, 260 + {ACPI_RSD_ADDRESS, 0, NULL, NULL}, 261 + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.granularity), 262 + "Granularity", NULL}, 263 + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.minimum), 264 + "Address Minimum", NULL}, 265 + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.maximum), 266 + "Address Maximum", NULL}, 267 + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.translation_offset), 268 + "Translation Offset", NULL}, 269 + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.address_length), 270 + "Address Length", NULL}, 271 + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.type_specific), 272 + "Type-Specific Attribute", NULL} 273 + }; 274 + 275 + struct acpi_rsdump_info acpi_rs_dump_ext_irq[8] = { 276 + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_ext_irq), 277 + "Extended IRQ", NULL}, 278 + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.producer_consumer), 279 + "Type", acpi_gbl_consume_decode}, 280 + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.triggering), 281 + "Triggering", acpi_gbl_HEdecode}, 282 + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.polarity), "Polarity", 283 + acpi_gbl_LLdecode}, 284 + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.sharable), "Sharing", 285 + acpi_gbl_SHRdecode}, 286 + {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(extended_irq.resource_source), NULL, 287 + NULL}, 288 + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(extended_irq.interrupt_count), 289 + "Interrupt Count", NULL}, 290 + {ACPI_RSD_DWORDLIST, ACPI_RSD_OFFSET(extended_irq.interrupts[0]), 291 + "Interrupt List", NULL} 292 + }; 293 + 294 + struct acpi_rsdump_info acpi_rs_dump_generic_reg[6] = { 295 + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_generic_reg), 296 + "Generic Register", NULL}, 297 + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.space_id), "Space ID", 298 + NULL}, 299 + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.bit_width), "Bit Width", 300 + NULL}, 301 + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.bit_offset), "Bit Offset", 302 + NULL}, 303 + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.access_size), 304 + "Access Size", NULL}, 305 + {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(generic_reg.address), "Address", NULL} 306 + }; 307 + 308 + /* 309 + * Tables used for common address descriptor flag fields 310 + */ 311 + static struct acpi_rsdump_info acpi_rs_dump_general_flags[5] = { 312 + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_general_flags), NULL, 313 + NULL}, 314 + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.producer_consumer), 315 + "Consumer/Producer", acpi_gbl_consume_decode}, 316 + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.decode), "Address Decode", 317 + acpi_gbl_DECdecode}, 318 + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.min_address_fixed), 319 + "Min Relocatability", acpi_gbl_min_decode}, 320 + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.max_address_fixed), 321 + "Max Relocatability", acpi_gbl_max_decode} 322 + }; 323 + 324 + static struct acpi_rsdump_info acpi_rs_dump_memory_flags[5] = { 325 + {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory_flags), 326 + "Resource Type", "Memory Range"}, 327 + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.write_protect), 328 + "Write Protect", acpi_gbl_RWdecode}, 329 + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.caching), 330 + "Caching", acpi_gbl_MEMdecode}, 331 + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.range_type), 332 + "Range Type", acpi_gbl_MTPdecode}, 333 + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.translation), 334 + "Translation", acpi_gbl_TTPdecode} 335 + }; 336 + 337 + static struct acpi_rsdump_info acpi_rs_dump_io_flags[4] = { 338 + {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io_flags), 339 + "Resource Type", "I/O Range"}, 340 + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.io.range_type), 341 + "Range Type", acpi_gbl_RNGdecode}, 342 + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation), 343 + "Translation", acpi_gbl_TTPdecode}, 344 + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation_type), 345 + "Translation Type", acpi_gbl_TRSdecode} 346 + }; 347 + 348 + /* 349 + * Table used to dump _PRT contents 350 + */ 351 + static struct acpi_rsdump_info acpi_rs_dump_prt[5] = { 352 + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_prt), NULL, NULL}, 353 + {ACPI_RSD_UINT64, ACPI_PRT_OFFSET(address), "Address", NULL}, 354 + {ACPI_RSD_UINT32, ACPI_PRT_OFFSET(pin), "Pin", NULL}, 355 + {ACPI_RSD_STRING, ACPI_PRT_OFFSET(source[0]), "Source", NULL}, 356 + {ACPI_RSD_UINT32, ACPI_PRT_OFFSET(source_index), "Source Index", NULL} 357 + }; 358 + 359 + /******************************************************************************* 360 + * 361 + * FUNCTION: acpi_rs_dump_descriptor 362 + * 363 + * PARAMETERS: Resource 364 + * 365 + * RETURN: None 366 + * 367 + * DESCRIPTION: 368 + * 369 + ******************************************************************************/ 370 + 371 + static void 372 + acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table) 373 + { 374 + void *target = NULL; 375 + void *previous_target; 376 + char *name; 377 + u8 count; 378 + 379 + /* First table entry must contain the table length (# of table entries) */ 380 + 381 + count = table->offset; 382 + 383 + while (count) { 384 + previous_target = target; 385 + target = ((u8 *) resource) + table->offset; 386 + name = table->name; 387 + 388 + switch (table->opcode) { 389 + case ACPI_RSD_TITLE: 390 + /* 391 + * Optional resource title 392 + */ 393 + if (table->name) { 394 + acpi_os_printf("%s Resource\n", name); 395 + } 396 + break; 397 + 398 + /* Strings */ 399 + 400 + case ACPI_RSD_LITERAL: 401 + acpi_rs_out_string(name, (char *)table->pointer); 402 + break; 403 + 404 + case ACPI_RSD_STRING: 405 + acpi_rs_out_string(name, (char *)target); 406 + break; 407 + 408 + /* Data items, 8/16/32/64 bit */ 409 + 410 + case ACPI_RSD_UINT8: 411 + acpi_rs_out_integer8(name, *(u8 *) target); 412 + break; 413 + 414 + case ACPI_RSD_UINT16: 415 + acpi_rs_out_integer16(name, *(u16 *) target); 416 + break; 417 + 418 + case ACPI_RSD_UINT32: 419 + acpi_rs_out_integer32(name, *(u32 *) target); 420 + break; 421 + 422 + case ACPI_RSD_UINT64: 423 + acpi_rs_out_integer64(name, *(u64 *) target); 424 + break; 425 + 426 + /* Flags: 1-bit and 2-bit flags supported */ 427 + 428 + case ACPI_RSD_1BITFLAG: 429 + acpi_rs_out_string(name, (char *) 430 + ((const char **)table-> 431 + pointer)[(*(u8 *) target) & 0x01]); 432 + break; 433 + 434 + case ACPI_RSD_2BITFLAG: 435 + acpi_rs_out_string(name, (char *) 436 + ((const char **)table-> 437 + pointer)[(*(u8 *) target) & 0x03]); 438 + break; 439 + 440 + case ACPI_RSD_SHORTLIST: 441 + /* 442 + * Short byte list (single line output) for DMA and IRQ resources 443 + * Note: The list length is obtained from the previous table entry 444 + */ 445 + if (previous_target) { 446 + acpi_rs_out_title(name); 447 + acpi_rs_dump_short_byte_list(* 448 + ((u8 *) 449 + previous_target), 450 + (u8 *) target); 451 + } 452 + break; 453 + 454 + case ACPI_RSD_LONGLIST: 455 + /* 456 + * Long byte list for Vendor resource data 457 + * Note: The list length is obtained from the previous table entry 458 + */ 459 + if (previous_target) { 460 + acpi_rs_dump_byte_list(* 461 + ((u16 *) 462 + previous_target), 463 + (u8 *) target); 464 + } 465 + break; 466 + 467 + case ACPI_RSD_DWORDLIST: 468 + /* 469 + * Dword list for Extended Interrupt resources 470 + * Note: The list length is obtained from the previous table entry 471 + */ 472 + if (previous_target) { 473 + acpi_rs_dump_dword_list(* 474 + ((u8 *) 475 + previous_target), 476 + (u32 *) target); 477 + } 478 + break; 479 + 480 + case ACPI_RSD_ADDRESS: 481 + /* 482 + * Common flags for all Address resources 483 + */ 484 + acpi_rs_dump_address_common((union acpi_resource_data *) 485 + target); 486 + break; 487 + 488 + case ACPI_RSD_SOURCE: 489 + /* 490 + * Optional resource_source for Address resources 491 + */ 492 + acpi_rs_dump_resource_source((struct 493 + acpi_resource_source *) 494 + target); 495 + break; 496 + 497 + default: 498 + acpi_os_printf("**** Invalid table opcode [%X] ****\n", 499 + table->opcode); 500 + return; 501 + } 502 + 503 + table++; 504 + count--; 505 + } 506 + } 507 + 508 + /******************************************************************************* 509 + * 510 + * FUNCTION: acpi_rs_dump_resource_source 511 + * 512 + * PARAMETERS: resource_source - Pointer to a Resource Source struct 513 + * 514 + * RETURN: None 515 + * 516 + * DESCRIPTION: Common routine for dumping the optional resource_source and the 517 + * corresponding resource_source_index. 518 + * 519 + ******************************************************************************/ 520 + 521 + static void 522 + acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source) 523 + { 524 + ACPI_FUNCTION_ENTRY(); 525 + 526 + if (resource_source->index == 0xFF) { 527 + return; 528 + } 529 + 530 + acpi_rs_out_integer8("Resource Source Index", resource_source->index); 531 + 532 + acpi_rs_out_string("Resource Source", 533 + resource_source->string_ptr ? 534 + resource_source->string_ptr : "[Not Specified]"); 535 + } 536 + 537 + /******************************************************************************* 538 + * 539 + * FUNCTION: acpi_rs_dump_address_common 540 + * 541 + * PARAMETERS: Resource - Pointer to an internal resource descriptor 542 + * 543 + * RETURN: None 544 + * 545 + * DESCRIPTION: Dump the fields that are common to all Address resource 546 + * descriptors 547 + * 548 + ******************************************************************************/ 549 + 550 + static void acpi_rs_dump_address_common(union acpi_resource_data *resource) 551 + { 552 + ACPI_FUNCTION_ENTRY(); 553 + 554 + /* Decode the type-specific flags */ 555 + 556 + switch (resource->address.resource_type) { 557 + case ACPI_MEMORY_RANGE: 558 + 559 + acpi_rs_dump_descriptor(resource, acpi_rs_dump_memory_flags); 560 + break; 561 + 562 + case ACPI_IO_RANGE: 563 + 564 + acpi_rs_dump_descriptor(resource, acpi_rs_dump_io_flags); 565 + break; 566 + 567 + case ACPI_BUS_NUMBER_RANGE: 568 + 569 + acpi_rs_out_string("Resource Type", "Bus Number Range"); 570 + break; 571 + 572 + default: 573 + 574 + acpi_rs_out_integer8("Resource Type", 575 + (u8) resource->address.resource_type); 576 + break; 577 + } 578 + 579 + /* Decode the general flags */ 580 + 581 + acpi_rs_dump_descriptor(resource, acpi_rs_dump_general_flags); 582 + } 583 + 584 + /******************************************************************************* 585 + * 586 + * FUNCTION: acpi_rs_dump_resource_list 587 + * 588 + * PARAMETERS: resource_list - Pointer to a resource descriptor list 589 + * 590 + * RETURN: None 591 + * 592 + * DESCRIPTION: Dispatches the structure to the correct dump routine. 593 + * 594 + ******************************************************************************/ 595 + 596 + void acpi_rs_dump_resource_list(struct acpi_resource *resource_list) 597 + { 598 + u32 count = 0; 599 + u32 type; 600 + 601 + ACPI_FUNCTION_ENTRY(); 602 + 603 + if (!(acpi_dbg_level & ACPI_LV_RESOURCES) 604 + || !(_COMPONENT & acpi_dbg_layer)) { 605 + return; 606 + } 607 + 608 + /* Walk list and dump all resource descriptors (END_TAG terminates) */ 609 + 610 + do { 611 + acpi_os_printf("\n[%02X] ", count); 612 + count++; 613 + 614 + /* Validate Type before dispatch */ 615 + 616 + type = resource_list->type; 617 + if (type > ACPI_RESOURCE_TYPE_MAX) { 618 + acpi_os_printf 619 + ("Invalid descriptor type (%X) in resource list\n", 620 + resource_list->type); 621 + return; 622 + } 623 + 624 + /* Dump the resource descriptor */ 625 + 626 + acpi_rs_dump_descriptor(&resource_list->data, 627 + acpi_gbl_dump_resource_dispatch[type]); 628 + 629 + /* Point to the next resource structure */ 630 + 631 + resource_list = 632 + ACPI_PTR_ADD(struct acpi_resource, resource_list, 633 + resource_list->length); 634 + 635 + /* Exit when END_TAG descriptor is reached */ 636 + 637 + } while (type != ACPI_RESOURCE_TYPE_END_TAG); 638 + } 639 + 640 + /******************************************************************************* 641 + * 642 + * FUNCTION: acpi_rs_dump_irq_list 643 + * 644 + * PARAMETERS: route_table - Pointer to the routing table to dump. 645 + * 646 + * RETURN: None 647 + * 648 + * DESCRIPTION: Print IRQ routing table 649 + * 650 + ******************************************************************************/ 651 + 652 + void acpi_rs_dump_irq_list(u8 * route_table) 653 + { 654 + struct acpi_pci_routing_table *prt_element; 655 + u8 count; 656 + 657 + ACPI_FUNCTION_ENTRY(); 658 + 659 + if (!(acpi_dbg_level & ACPI_LV_RESOURCES) 660 + || !(_COMPONENT & acpi_dbg_layer)) { 661 + return; 662 + } 663 + 664 + prt_element = ACPI_CAST_PTR(struct acpi_pci_routing_table, route_table); 665 + 666 + /* Dump all table elements, Exit on zero length element */ 667 + 668 + for (count = 0; prt_element->length; count++) { 669 + acpi_os_printf("\n[%02X] PCI IRQ Routing Table Package\n", 670 + count); 671 + acpi_rs_dump_descriptor(prt_element, acpi_rs_dump_prt); 672 + 673 + prt_element = ACPI_CAST_PTR(struct acpi_pci_routing_table, 674 + ((u8 *) prt_element) + 675 + prt_element->length); 676 + } 677 + } 75 678 76 679 /******************************************************************************* 77 680 * ··· 734 129 * 735 130 ******************************************************************************/ 736 131 737 - static void acpi_rs_dump_byte_list(u32 length, u8 * data) 132 + static void acpi_rs_dump_byte_list(u16 length, u8 * data) 738 133 { 739 - u32 i; 134 + u8 i; 740 135 741 136 for (i = 0; i < length; i++) { 742 137 acpi_os_printf("%25s%2.2X : %2.2X\n", "Byte", i, data[i]); 743 138 } 744 139 } 745 140 746 - static void acpi_rs_dump_dword_list(u32 length, u32 * data) 141 + static void acpi_rs_dump_short_byte_list(u8 length, u8 * data) 747 142 { 748 - u32 i; 749 - 750 - for (i = 0; i < length; i++) { 751 - acpi_os_printf("%25s%2.2X : %8.8X\n", "Dword", i, data[i]); 752 - } 753 - } 754 - 755 - static void acpi_rs_dump_short_byte_list(u32 length, u32 * data) 756 - { 757 - u32 i; 143 + u8 i; 758 144 759 145 for (i = 0; i < length; i++) { 760 146 acpi_os_printf("%X ", data[i]); ··· 753 157 acpi_os_printf("\n"); 754 158 } 755 159 756 - static void acpi_rs_dump_memory_attribute(u32 read_write_attribute) 160 + static void acpi_rs_dump_dword_list(u8 length, u32 * data) 757 161 { 162 + u8 i; 758 163 759 - acpi_rs_out_string("Read/Write Attribute", 760 - ACPI_READ_WRITE_MEMORY == read_write_attribute ? 761 - "Read/Write" : "Read-Only"); 762 - } 763 - 764 - /******************************************************************************* 765 - * 766 - * FUNCTION: acpi_rs_dump_resource_source 767 - * 768 - * PARAMETERS: resource_source - Pointer to a Resource Source struct 769 - * 770 - * RETURN: None 771 - * 772 - * DESCRIPTION: Common routine for dumping the optional resource_source and the 773 - * corresponding resource_source_index. 774 - * 775 - ******************************************************************************/ 776 - 777 - static void 778 - acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source) 779 - { 780 - ACPI_FUNCTION_ENTRY(); 781 - 782 - if (resource_source->index == 0xFF) { 783 - return; 784 - } 785 - 786 - acpi_rs_out_integer8("Resource Source Index", 787 - (u8) resource_source->index); 788 - 789 - acpi_rs_out_string("Resource Source", 790 - resource_source->string_ptr ? 791 - resource_source->string_ptr : "[Not Specified]"); 792 - } 793 - 794 - /******************************************************************************* 795 - * 796 - * FUNCTION: acpi_rs_dump_address_common 797 - * 798 - * PARAMETERS: Resource - Pointer to an internal resource descriptor 799 - * 800 - * RETURN: None 801 - * 802 - * DESCRIPTION: Dump the fields that are common to all Address resource 803 - * descriptors 804 - * 805 - ******************************************************************************/ 806 - 807 - static void acpi_rs_dump_address_common(union acpi_resource_data *resource) 808 - { 809 - ACPI_FUNCTION_ENTRY(); 810 - 811 - /* Decode the type-specific flags */ 812 - 813 - switch (resource->address.resource_type) { 814 - case ACPI_MEMORY_RANGE: 815 - 816 - acpi_rs_out_string("Resource Type", "Memory Range"); 817 - 818 - acpi_rs_out_title("Type-Specific Flags"); 819 - 820 - switch (resource->address.attribute.memory.cache_attribute) { 821 - case ACPI_NON_CACHEABLE_MEMORY: 822 - acpi_os_printf("Noncacheable memory\n"); 823 - break; 824 - 825 - case ACPI_CACHABLE_MEMORY: 826 - acpi_os_printf("Cacheable memory\n"); 827 - break; 828 - 829 - case ACPI_WRITE_COMBINING_MEMORY: 830 - acpi_os_printf("Write-combining memory\n"); 831 - break; 832 - 833 - case ACPI_PREFETCHABLE_MEMORY: 834 - acpi_os_printf("Prefetchable memory\n"); 835 - break; 836 - 837 - default: 838 - acpi_os_printf("Invalid cache attribute\n"); 839 - break; 840 - } 841 - 842 - acpi_rs_dump_memory_attribute(resource->address.attribute. 843 - memory.read_write_attribute); 844 - break; 845 - 846 - case ACPI_IO_RANGE: 847 - 848 - acpi_rs_out_string("Resource Type", "I/O Range"); 849 - 850 - acpi_rs_out_title("Type-Specific Flags"); 851 - 852 - switch (resource->address.attribute.io.range_attribute) { 853 - case ACPI_NON_ISA_ONLY_RANGES: 854 - acpi_os_printf("Non-ISA I/O Addresses\n"); 855 - break; 856 - 857 - case ACPI_ISA_ONLY_RANGES: 858 - acpi_os_printf("ISA I/O Addresses\n"); 859 - break; 860 - 861 - case ACPI_ENTIRE_RANGE: 862 - acpi_os_printf("ISA and non-ISA I/O Addresses\n"); 863 - break; 864 - 865 - default: 866 - acpi_os_printf("Invalid range attribute\n"); 867 - break; 868 - } 869 - 870 - acpi_rs_out_string("Translation Attribute", 871 - ACPI_SPARSE_TRANSLATION == 872 - resource->address.attribute.io. 873 - translation_attribute ? "Sparse Translation" 874 - : "Dense Translation"); 875 - break; 876 - 877 - case ACPI_BUS_NUMBER_RANGE: 878 - 879 - acpi_rs_out_string("Resource Type", "Bus Number Range"); 880 - break; 881 - 882 - default: 883 - 884 - acpi_rs_out_integer8("Resource Type", 885 - (u8) resource->address.resource_type); 886 - break; 887 - } 888 - 889 - /* Decode the general flags */ 890 - 891 - acpi_rs_out_string("Resource", 892 - ACPI_CONSUMER == 893 - resource->address. 894 - producer_consumer ? "Consumer" : "Producer"); 895 - 896 - acpi_rs_out_string("Decode", 897 - ACPI_SUB_DECODE == resource->address.decode ? 898 - "Subtractive" : "Positive"); 899 - 900 - acpi_rs_out_string("Min Address", 901 - ACPI_ADDRESS_FIXED == 902 - resource->address. 903 - min_address_fixed ? "Fixed" : "Not Fixed"); 904 - 905 - acpi_rs_out_string("Max Address", 906 - ACPI_ADDRESS_FIXED == 907 - resource->address. 908 - max_address_fixed ? "Fixed" : "Not Fixed"); 909 - } 910 - 911 - /******************************************************************************* 912 - * 913 - * FUNCTION: acpi_rs_dump_resource_list 914 - * 915 - * PARAMETERS: resource_list - Pointer to a resource descriptor list 916 - * 917 - * RETURN: None 918 - * 919 - * DESCRIPTION: Dispatches the structure to the correct dump routine. 920 - * 921 - ******************************************************************************/ 922 - 923 - void acpi_rs_dump_resource_list(struct acpi_resource *resource_list) 924 - { 925 - u32 count = 0; 926 - 927 - ACPI_FUNCTION_ENTRY(); 928 - 929 - if (!(acpi_dbg_level & ACPI_LV_RESOURCES) 930 - || !(_COMPONENT & acpi_dbg_layer)) { 931 - return; 932 - } 933 - 934 - /* Dump all resource descriptors in the list */ 935 - 936 - while (resource_list) { 937 - acpi_os_printf("\n[%02X] ", count); 938 - 939 - /* Validate Type before dispatch */ 940 - 941 - if (resource_list->type > ACPI_RESOURCE_TYPE_MAX) { 942 - acpi_os_printf 943 - ("Invalid descriptor type (%X) in resource list\n", 944 - resource_list->type); 945 - return; 946 - } 947 - 948 - /* Dump the resource descriptor */ 949 - 950 - acpi_gbl_dump_resource_dispatch[resource_list-> 951 - type] (&resource_list->data); 952 - 953 - /* Exit on end tag */ 954 - 955 - if (resource_list->type == ACPI_RESOURCE_TYPE_END_TAG) { 956 - return; 957 - } 958 - 959 - /* Get the next resource structure */ 960 - 961 - resource_list = 962 - ACPI_PTR_ADD(struct acpi_resource, resource_list, 963 - resource_list->length); 964 - count++; 965 - } 966 - } 967 - 968 - /******************************************************************************* 969 - * 970 - * FUNCTION: acpi_rs_dump_irq 971 - * 972 - * PARAMETERS: Resource - Pointer to an internal resource descriptor 973 - * 974 - * RETURN: None 975 - * 976 - * DESCRIPTION: Dump the field names and values of the resource descriptor 977 - * 978 - ******************************************************************************/ 979 - 980 - void acpi_rs_dump_irq(union acpi_resource_data *resource) 981 - { 982 - ACPI_FUNCTION_ENTRY(); 983 - 984 - acpi_os_printf("IRQ Resource\n"); 985 - 986 - acpi_rs_out_string("Triggering", 987 - ACPI_LEVEL_SENSITIVE == 988 - resource->irq.triggering ? "Level" : "Edge"); 989 - 990 - acpi_rs_out_string("Active", 991 - ACPI_ACTIVE_LOW == 992 - resource->irq.polarity ? "Low" : "High"); 993 - 994 - acpi_rs_out_string("Sharing", 995 - ACPI_SHARED == 996 - resource->irq.sharable ? "Shared" : "Exclusive"); 997 - 998 - acpi_rs_out_integer8("Interrupt Count", 999 - (u8) resource->irq.interrupt_count); 1000 - 1001 - acpi_rs_out_title("Interrupt List"); 1002 - acpi_rs_dump_short_byte_list(resource->irq.interrupt_count, 1003 - resource->irq.interrupts); 1004 - } 1005 - 1006 - /******************************************************************************* 1007 - * 1008 - * FUNCTION: acpi_rs_dump_dma 1009 - * 1010 - * PARAMETERS: Resource - Pointer to an internal resource descriptor 1011 - * 1012 - * RETURN: None 1013 - * 1014 - * DESCRIPTION: Dump the field names and values of the resource descriptor 1015 - * 1016 - ******************************************************************************/ 1017 - 1018 - void acpi_rs_dump_dma(union acpi_resource_data *resource) 1019 - { 1020 - ACPI_FUNCTION_ENTRY(); 1021 - 1022 - acpi_os_printf("DMA Resource\n"); 1023 - 1024 - acpi_rs_out_title("DMA Type"); 1025 - switch (resource->dma.type) { 1026 - case ACPI_COMPATIBILITY: 1027 - acpi_os_printf("Compatibility mode\n"); 1028 - break; 1029 - 1030 - case ACPI_TYPE_A: 1031 - acpi_os_printf("Type A\n"); 1032 - break; 1033 - 1034 - case ACPI_TYPE_B: 1035 - acpi_os_printf("Type B\n"); 1036 - break; 1037 - 1038 - case ACPI_TYPE_F: 1039 - acpi_os_printf("Type F\n"); 1040 - break; 1041 - 1042 - default: 1043 - acpi_os_printf("**** Invalid DMA type\n"); 1044 - break; 1045 - } 1046 - 1047 - acpi_rs_out_string("Bus Master", 1048 - ACPI_BUS_MASTER == 1049 - resource->dma.bus_master ? "Yes" : "No"); 1050 - 1051 - acpi_rs_out_title("Transfer Type"); 1052 - switch (resource->dma.transfer) { 1053 - case ACPI_TRANSFER_8: 1054 - acpi_os_printf("8-bit transfers only\n"); 1055 - break; 1056 - 1057 - case ACPI_TRANSFER_8_16: 1058 - acpi_os_printf("8-bit and 16-bit transfers\n"); 1059 - break; 1060 - 1061 - case ACPI_TRANSFER_16: 1062 - acpi_os_printf("16-bit transfers only\n"); 1063 - break; 1064 - 1065 - default: 1066 - acpi_os_printf("**** Invalid transfer preference\n"); 1067 - break; 1068 - } 1069 - 1070 - acpi_rs_out_integer8("DMA Channel Count", 1071 - (u8) resource->dma.channel_count); 1072 - 1073 - acpi_rs_out_title("Channel List"); 1074 - acpi_rs_dump_short_byte_list(resource->dma.channel_count, 1075 - resource->dma.channels); 1076 - } 1077 - 1078 - /******************************************************************************* 1079 - * 1080 - * FUNCTION: acpi_rs_dump_start_dpf 1081 - * 1082 - * PARAMETERS: Resource - Pointer to an internal resource descriptor 1083 - * 1084 - * RETURN: None 1085 - * 1086 - * DESCRIPTION: Dump the field names and values of the resource descriptor 1087 - * 1088 - ******************************************************************************/ 1089 - 1090 - void acpi_rs_dump_start_dpf(union acpi_resource_data *resource) 1091 - { 1092 - ACPI_FUNCTION_ENTRY(); 1093 - 1094 - acpi_os_printf("Start Dependent Functions Resource\n"); 1095 - 1096 - acpi_rs_out_title("Compatibility Priority"); 1097 - switch (resource->start_dpf.compatibility_priority) { 1098 - case ACPI_GOOD_CONFIGURATION: 1099 - acpi_os_printf("Good configuration\n"); 1100 - break; 1101 - 1102 - case ACPI_ACCEPTABLE_CONFIGURATION: 1103 - acpi_os_printf("Acceptable configuration\n"); 1104 - break; 1105 - 1106 - case ACPI_SUB_OPTIMAL_CONFIGURATION: 1107 - acpi_os_printf("Sub-optimal configuration\n"); 1108 - break; 1109 - 1110 - default: 1111 - acpi_os_printf("**** Invalid compatibility priority\n"); 1112 - break; 1113 - } 1114 - 1115 - acpi_rs_out_title("Performance/Robustness"); 1116 - switch (resource->start_dpf.performance_robustness) { 1117 - case ACPI_GOOD_CONFIGURATION: 1118 - acpi_os_printf("Good configuration\n"); 1119 - break; 1120 - 1121 - case ACPI_ACCEPTABLE_CONFIGURATION: 1122 - acpi_os_printf("Acceptable configuration\n"); 1123 - break; 1124 - 1125 - case ACPI_SUB_OPTIMAL_CONFIGURATION: 1126 - acpi_os_printf("Sub-optimal configuration\n"); 1127 - break; 1128 - 1129 - default: 1130 - acpi_os_printf 1131 - ("**** Invalid performance robustness preference\n"); 1132 - break; 1133 - } 1134 - } 1135 - 1136 - /******************************************************************************* 1137 - * 1138 - * FUNCTION: acpi_rs_dump_io 1139 - * 1140 - * PARAMETERS: Resource - Pointer to an internal resource descriptor 1141 - * 1142 - * RETURN: None 1143 - * 1144 - * DESCRIPTION: Dump the field names and values of the resource descriptor 1145 - * 1146 - ******************************************************************************/ 1147 - 1148 - void acpi_rs_dump_io(union acpi_resource_data *resource) 1149 - { 1150 - ACPI_FUNCTION_ENTRY(); 1151 - 1152 - acpi_os_printf("I/O Resource\n"); 1153 - 1154 - acpi_rs_out_string("Decode", 1155 - ACPI_DECODE_16 == 1156 - resource->io.io_decode ? "16-bit" : "10-bit"); 1157 - 1158 - acpi_rs_out_integer32("Address Minimum", resource->io.minimum); 1159 - 1160 - acpi_rs_out_integer32("Address Maximum", resource->io.maximum); 1161 - 1162 - acpi_rs_out_integer32("Alignment", resource->io.alignment); 1163 - 1164 - acpi_rs_out_integer32("Address Length", resource->io.address_length); 1165 - } 1166 - 1167 - /******************************************************************************* 1168 - * 1169 - * FUNCTION: acpi_rs_dump_fixed_io 1170 - * 1171 - * PARAMETERS: Resource - Pointer to an internal resource descriptor 1172 - * 1173 - * RETURN: None 1174 - * 1175 - * DESCRIPTION: Dump the field names and values of the resource descriptor 1176 - * 1177 - ******************************************************************************/ 1178 - 1179 - void acpi_rs_dump_fixed_io(union acpi_resource_data *resource) 1180 - { 1181 - ACPI_FUNCTION_ENTRY(); 1182 - 1183 - acpi_os_printf("Fixed I/O Resource\n"); 1184 - 1185 - acpi_rs_out_integer32("Address", resource->fixed_io.address); 1186 - 1187 - acpi_rs_out_integer32("Address Length", 1188 - resource->fixed_io.address_length); 1189 - } 1190 - 1191 - /******************************************************************************* 1192 - * 1193 - * FUNCTION: acpi_rs_dump_vendor 1194 - * 1195 - * PARAMETERS: Resource - Pointer to an internal resource descriptor 1196 - * 1197 - * RETURN: None 1198 - * 1199 - * DESCRIPTION: Dump the field names and values of the resource descriptor 1200 - * 1201 - ******************************************************************************/ 1202 - 1203 - void acpi_rs_dump_vendor(union acpi_resource_data *resource) 1204 - { 1205 - ACPI_FUNCTION_ENTRY(); 1206 - 1207 - acpi_os_printf("Vendor Specific Resource\n"); 1208 - 1209 - acpi_rs_out_integer16("Length", (u16) resource->vendor.byte_length); 1210 - 1211 - acpi_rs_dump_byte_list(resource->vendor.byte_length, 1212 - resource->vendor.byte_data); 1213 - } 1214 - 1215 - /******************************************************************************* 1216 - * 1217 - * FUNCTION: acpi_rs_dump_memory24 1218 - * 1219 - * PARAMETERS: Resource - Pointer to an internal resource descriptor 1220 - * 1221 - * RETURN: None 1222 - * 1223 - * DESCRIPTION: Dump the field names and values of the resource descriptor 1224 - * 1225 - ******************************************************************************/ 1226 - 1227 - void acpi_rs_dump_memory24(union acpi_resource_data *resource) 1228 - { 1229 - ACPI_FUNCTION_ENTRY(); 1230 - 1231 - acpi_os_printf("24-Bit Memory Range Resource\n"); 1232 - 1233 - acpi_rs_dump_memory_attribute(resource->memory24.read_write_attribute); 1234 - 1235 - acpi_rs_out_integer16("Address Minimum", 1236 - (u16) resource->memory24.minimum); 1237 - 1238 - acpi_rs_out_integer16("Address Maximum", 1239 - (u16) resource->memory24.maximum); 1240 - 1241 - acpi_rs_out_integer16("Alignment", (u16) resource->memory24.alignment); 1242 - 1243 - acpi_rs_out_integer16("Address Length", 1244 - (u16) resource->memory24.address_length); 1245 - } 1246 - 1247 - /******************************************************************************* 1248 - * 1249 - * FUNCTION: acpi_rs_dump_memory32 1250 - * 1251 - * PARAMETERS: Resource - Pointer to an internal resource descriptor 1252 - * 1253 - * RETURN: None 1254 - * 1255 - * DESCRIPTION: Dump the field names and values of the resource descriptor 1256 - * 1257 - ******************************************************************************/ 1258 - 1259 - void acpi_rs_dump_memory32(union acpi_resource_data *resource) 1260 - { 1261 - ACPI_FUNCTION_ENTRY(); 1262 - 1263 - acpi_os_printf("32-Bit Memory Range Resource\n"); 1264 - 1265 - acpi_rs_dump_memory_attribute(resource->memory32.read_write_attribute); 1266 - 1267 - acpi_rs_out_integer32("Address Minimum", resource->memory32.minimum); 1268 - 1269 - acpi_rs_out_integer32("Address Maximum", resource->memory32.maximum); 1270 - 1271 - acpi_rs_out_integer32("Alignment", resource->memory32.alignment); 1272 - 1273 - acpi_rs_out_integer32("Address Length", 1274 - resource->memory32.address_length); 1275 - } 1276 - 1277 - /******************************************************************************* 1278 - * 1279 - * FUNCTION: acpi_rs_dump_fixed_memory32 1280 - * 1281 - * PARAMETERS: Resource - Pointer to an internal resource descriptor 1282 - * 1283 - * RETURN: 1284 - * 1285 - * DESCRIPTION: Dump the field names and values of the resource descriptor 1286 - * 1287 - ******************************************************************************/ 1288 - 1289 - void acpi_rs_dump_fixed_memory32(union acpi_resource_data *resource) 1290 - { 1291 - ACPI_FUNCTION_ENTRY(); 1292 - 1293 - acpi_os_printf("32-Bit Fixed Location Memory Range Resource\n"); 1294 - 1295 - acpi_rs_dump_memory_attribute(resource->fixed_memory32. 1296 - read_write_attribute); 1297 - 1298 - acpi_rs_out_integer32("Address", resource->fixed_memory32.address); 1299 - 1300 - acpi_rs_out_integer32("Address Length", 1301 - resource->fixed_memory32.address_length); 1302 - } 1303 - 1304 - /******************************************************************************* 1305 - * 1306 - * FUNCTION: acpi_rs_dump_address16 1307 - * 1308 - * PARAMETERS: Resource - Pointer to an internal resource descriptor 1309 - * 1310 - * RETURN: None 1311 - * 1312 - * DESCRIPTION: Dump the field names and values of the resource descriptor 1313 - * 1314 - ******************************************************************************/ 1315 - 1316 - void acpi_rs_dump_address16(union acpi_resource_data *resource) 1317 - { 1318 - ACPI_FUNCTION_ENTRY(); 1319 - 1320 - acpi_os_printf("16-Bit WORD Address Space Resource\n"); 1321 - 1322 - acpi_rs_dump_address_common(resource); 1323 - 1324 - acpi_rs_out_integer16("Granularity", 1325 - (u16) resource->address16.granularity); 1326 - 1327 - acpi_rs_out_integer16("Address Minimum", 1328 - (u16) resource->address16.minimum); 1329 - 1330 - acpi_rs_out_integer16("Address Maximum", 1331 - (u16) resource->address16.maximum); 1332 - 1333 - acpi_rs_out_integer16("Translation Offset", 1334 - (u16) resource->address16.translation_offset); 1335 - 1336 - acpi_rs_out_integer16("Address Length", 1337 - (u16) resource->address16.address_length); 1338 - 1339 - acpi_rs_dump_resource_source(&resource->address16.resource_source); 1340 - } 1341 - 1342 - /******************************************************************************* 1343 - * 1344 - * FUNCTION: acpi_rs_dump_address32 1345 - * 1346 - * PARAMETERS: Resource - Pointer to an internal resource descriptor 1347 - * 1348 - * RETURN: None 1349 - * 1350 - * DESCRIPTION: Dump the field names and values of the resource descriptor 1351 - * 1352 - ******************************************************************************/ 1353 - 1354 - void acpi_rs_dump_address32(union acpi_resource_data *resource) 1355 - { 1356 - ACPI_FUNCTION_ENTRY(); 1357 - 1358 - acpi_os_printf("32-Bit DWORD Address Space Resource\n"); 1359 - 1360 - acpi_rs_dump_address_common(resource); 1361 - 1362 - acpi_rs_out_integer32("Granularity", resource->address32.granularity); 1363 - 1364 - acpi_rs_out_integer32("Address Minimum", resource->address32.minimum); 1365 - 1366 - acpi_rs_out_integer32("Address Maximum", resource->address32.maximum); 1367 - 1368 - acpi_rs_out_integer32("Translation Offset", 1369 - resource->address32.translation_offset); 1370 - 1371 - acpi_rs_out_integer32("Address Length", 1372 - resource->address32.address_length); 1373 - 1374 - acpi_rs_dump_resource_source(&resource->address32.resource_source); 1375 - } 1376 - 1377 - /******************************************************************************* 1378 - * 1379 - * FUNCTION: acpi_rs_dump_address64 1380 - * 1381 - * PARAMETERS: Resource - Pointer to an internal resource descriptor 1382 - * 1383 - * RETURN: None 1384 - * 1385 - * DESCRIPTION: Dump the field names and values of the resource descriptor 1386 - * 1387 - ******************************************************************************/ 1388 - 1389 - void acpi_rs_dump_address64(union acpi_resource_data *resource) 1390 - { 1391 - ACPI_FUNCTION_ENTRY(); 1392 - 1393 - acpi_os_printf("64-Bit QWORD Address Space Resource\n"); 1394 - 1395 - acpi_rs_dump_address_common(resource); 1396 - 1397 - acpi_rs_out_integer64("Granularity", resource->address64.granularity); 1398 - 1399 - acpi_rs_out_integer64("Address Minimum", resource->address64.minimum); 1400 - 1401 - acpi_rs_out_integer64("Address Maximum", resource->address64.maximum); 1402 - 1403 - acpi_rs_out_integer64("Translation Offset", 1404 - resource->address64.translation_offset); 1405 - 1406 - acpi_rs_out_integer64("Address Length", 1407 - resource->address64.address_length); 1408 - 1409 - acpi_rs_dump_resource_source(&resource->address64.resource_source); 1410 - } 1411 - 1412 - /******************************************************************************* 1413 - * 1414 - * FUNCTION: acpi_rs_dump_ext_address64 1415 - * 1416 - * PARAMETERS: Resource - Pointer to an internal resource descriptor 1417 - * 1418 - * RETURN: None 1419 - * 1420 - * DESCRIPTION: Dump the field names and values of the resource descriptor 1421 - * 1422 - ******************************************************************************/ 1423 - 1424 - void acpi_rs_dump_ext_address64(union acpi_resource_data *resource) 1425 - { 1426 - ACPI_FUNCTION_ENTRY(); 1427 - 1428 - acpi_os_printf("64-Bit Extended Address Space Resource\n"); 1429 - 1430 - acpi_rs_dump_address_common(resource); 1431 - 1432 - acpi_rs_out_integer64("Granularity", 1433 - resource->ext_address64.granularity); 1434 - 1435 - acpi_rs_out_integer64("Address Minimum", 1436 - resource->ext_address64.minimum); 1437 - 1438 - acpi_rs_out_integer64("Address Maximum", 1439 - resource->ext_address64.maximum); 1440 - 1441 - acpi_rs_out_integer64("Translation Offset", 1442 - resource->ext_address64.translation_offset); 1443 - 1444 - acpi_rs_out_integer64("Address Length", 1445 - resource->ext_address64.address_length); 1446 - 1447 - acpi_rs_out_integer64("Type-Specific Attribute", 1448 - resource->ext_address64.type_specific_attributes); 1449 - } 1450 - 1451 - /******************************************************************************* 1452 - * 1453 - * FUNCTION: acpi_rs_dump_ext_irq 1454 - * 1455 - * PARAMETERS: Resource - Pointer to an internal resource descriptor 1456 - * 1457 - * RETURN: None 1458 - * 1459 - * DESCRIPTION: Dump the field names and values of the resource descriptor 1460 - * 1461 - ******************************************************************************/ 1462 - 1463 - void acpi_rs_dump_ext_irq(union acpi_resource_data *resource) 1464 - { 1465 - ACPI_FUNCTION_ENTRY(); 1466 - 1467 - acpi_os_printf("Extended IRQ Resource\n"); 1468 - 1469 - acpi_rs_out_string("Resource", 1470 - ACPI_CONSUMER == 1471 - resource->extended_irq. 1472 - producer_consumer ? "Consumer" : "Producer"); 1473 - 1474 - acpi_rs_out_string("Triggering", 1475 - ACPI_LEVEL_SENSITIVE == 1476 - resource->extended_irq. 1477 - triggering ? "Level" : "Edge"); 1478 - 1479 - acpi_rs_out_string("Active", 1480 - ACPI_ACTIVE_LOW == resource->extended_irq.polarity ? 1481 - "Low" : "High"); 1482 - 1483 - acpi_rs_out_string("Sharing", 1484 - ACPI_SHARED == resource->extended_irq.sharable ? 1485 - "Shared" : "Exclusive"); 1486 - 1487 - acpi_rs_dump_resource_source(&resource->extended_irq.resource_source); 1488 - 1489 - acpi_rs_out_integer8("Interrupts", 1490 - (u8) resource->extended_irq.interrupt_count); 1491 - 1492 - acpi_rs_dump_dword_list(resource->extended_irq.interrupt_count, 1493 - resource->extended_irq.interrupts); 1494 - } 1495 - 1496 - /******************************************************************************* 1497 - * 1498 - * FUNCTION: acpi_rs_dump_generic_reg 1499 - * 1500 - * PARAMETERS: Resource - Pointer to an internal resource descriptor 1501 - * 1502 - * RETURN: None 1503 - * 1504 - * DESCRIPTION: Dump the field names and values of the resource descriptor 1505 - * 1506 - ******************************************************************************/ 1507 - 1508 - void acpi_rs_dump_generic_reg(union acpi_resource_data *resource) 1509 - { 1510 - ACPI_FUNCTION_ENTRY(); 1511 - 1512 - acpi_os_printf("Generic Register Resource\n"); 1513 - 1514 - acpi_rs_out_integer8("Space ID", (u8) resource->generic_reg.space_id); 1515 - 1516 - acpi_rs_out_integer8("Bit Width", (u8) resource->generic_reg.bit_width); 1517 - 1518 - acpi_rs_out_integer8("Bit Offset", 1519 - (u8) resource->generic_reg.bit_offset); 1520 - 1521 - acpi_rs_out_integer8("Access Size", 1522 - (u8) resource->generic_reg.access_size); 1523 - 1524 - acpi_rs_out_integer64("Address", resource->generic_reg.address); 1525 - } 1526 - 1527 - /******************************************************************************* 1528 - * 1529 - * FUNCTION: acpi_rs_dump_end_dpf 1530 - * 1531 - * PARAMETERS: Resource - Pointer to an internal resource descriptor 1532 - * 1533 - * RETURN: None 1534 - * 1535 - * DESCRIPTION: Print type, no data. 1536 - * 1537 - ******************************************************************************/ 1538 - 1539 - void acpi_rs_dump_end_dpf(union acpi_resource_data *resource) 1540 - { 1541 - ACPI_FUNCTION_ENTRY(); 1542 - 1543 - acpi_os_printf("end_dependent_functions Resource\n"); 1544 - } 1545 - 1546 - /******************************************************************************* 1547 - * 1548 - * FUNCTION: acpi_rs_dump_end_tag 1549 - * 1550 - * PARAMETERS: Resource - Pointer to an internal resource descriptor 1551 - * 1552 - * RETURN: None 1553 - * 1554 - * DESCRIPTION: Print type, no data. 1555 - * 1556 - ******************************************************************************/ 1557 - 1558 - void acpi_rs_dump_end_tag(union acpi_resource_data *resource) 1559 - { 1560 - ACPI_FUNCTION_ENTRY(); 1561 - 1562 - acpi_os_printf("end_tag Resource\n"); 1563 - } 1564 - 1565 - /******************************************************************************* 1566 - * 1567 - * FUNCTION: acpi_rs_dump_irq_list 1568 - * 1569 - * PARAMETERS: route_table - Pointer to the routing table to dump. 1570 - * 1571 - * RETURN: None 1572 - * 1573 - * DESCRIPTION: Print IRQ routing table 1574 - * 1575 - ******************************************************************************/ 1576 - 1577 - void acpi_rs_dump_irq_list(u8 * route_table) 1578 - { 1579 - u8 *buffer = route_table; 1580 - u8 count = 0; 1581 - struct acpi_pci_routing_table *prt_element; 1582 - 1583 - ACPI_FUNCTION_ENTRY(); 1584 - 1585 - if (!(acpi_dbg_level & ACPI_LV_RESOURCES) 1586 - || !(_COMPONENT & acpi_dbg_layer)) { 1587 - return; 1588 - } 1589 - 1590 - prt_element = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); 1591 - 1592 - /* Dump all table elements, Exit on null length element */ 1593 - 1594 - while (prt_element->length) { 1595 - acpi_os_printf("\n[%02X] PCI IRQ Routing Table Package\n", 1596 - count); 1597 - 1598 - acpi_rs_out_integer64("Address", prt_element->address); 1599 - 1600 - acpi_rs_out_integer32("Pin", prt_element->pin); 1601 - acpi_rs_out_string("Source", prt_element->source); 1602 - acpi_rs_out_integer32("Source Index", 1603 - prt_element->source_index); 1604 - 1605 - buffer += prt_element->length; 1606 - prt_element = 1607 - ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); 1608 - count++; 164 + for (i = 0; i < length; i++) { 165 + acpi_os_printf("%25s%2.2X : %8.8X\n", "Dword", i, data[i]); 1609 166 } 1610 167 } 1611 168
+57 -58
drivers/acpi/resources/rsinfo.c
··· 58 58 * descriptors are indexed by the acpi_resource_type field. 59 59 */ 60 60 /* Dispatch table for resource-to-AML (Set Resource) conversion functions */ 61 - ACPI_SET_RESOURCE_HANDLER acpi_gbl_set_resource_dispatch[] = { 61 + struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[] = { 62 62 acpi_rs_set_irq, /* 0x00, ACPI_RESOURCE_TYPE_IRQ */ 63 - acpi_rs_set_dma, /* 0x01, ACPI_RESOURCE_TYPE_DMA */ 63 + acpi_rs_convert_dma, /* 0x01, ACPI_RESOURCE_TYPE_DMA */ 64 64 acpi_rs_set_start_dpf, /* 0x02, ACPI_RESOURCE_TYPE_START_DEPENDENT */ 65 - acpi_rs_set_end_dpf, /* 0x03, ACPI_RESOURCE_TYPE_END_DEPENDENT */ 66 - acpi_rs_set_io, /* 0x04, ACPI_RESOURCE_TYPE_IO */ 67 - acpi_rs_set_fixed_io, /* 0x05, ACPI_RESOURCE_TYPE_FIXED_IO */ 65 + acpi_rs_convert_end_dpf, /* 0x03, ACPI_RESOURCE_TYPE_END_DEPENDENT */ 66 + acpi_rs_convert_io, /* 0x04, ACPI_RESOURCE_TYPE_IO */ 67 + acpi_rs_convert_fixed_io, /* 0x05, ACPI_RESOURCE_TYPE_FIXED_IO */ 68 68 acpi_rs_set_vendor, /* 0x06, ACPI_RESOURCE_TYPE_VENDOR */ 69 - acpi_rs_set_end_tag, /* 0x07, ACPI_RESOURCE_TYPE_END_TAG */ 70 - acpi_rs_set_memory24, /* 0x08, ACPI_RESOURCE_TYPE_MEMORY24 */ 71 - acpi_rs_set_memory32, /* 0x09, ACPI_RESOURCE_TYPE_MEMORY32 */ 72 - acpi_rs_set_fixed_memory32, /* 0x0A, ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */ 73 - acpi_rs_set_address16, /* 0x0B, ACPI_RESOURCE_TYPE_ADDRESS16 */ 74 - acpi_rs_set_address32, /* 0x0C, ACPI_RESOURCE_TYPE_ADDRESS32 */ 75 - acpi_rs_set_address64, /* 0x0D, ACPI_RESOURCE_TYPE_ADDRESS64 */ 76 - acpi_rs_set_ext_address64, /* 0x0E, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ 77 - acpi_rs_set_ext_irq, /* 0x0F, ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ 78 - acpi_rs_set_generic_reg /* 0x10, ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ 69 + acpi_rs_convert_end_tag, /* 0x07, ACPI_RESOURCE_TYPE_END_TAG */ 70 + acpi_rs_convert_memory24, /* 0x08, ACPI_RESOURCE_TYPE_MEMORY24 */ 71 + acpi_rs_convert_memory32, /* 0x09, ACPI_RESOURCE_TYPE_MEMORY32 */ 72 + acpi_rs_convert_fixed_memory32, /* 0x0A, ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */ 73 + acpi_rs_convert_address16, /* 0x0B, ACPI_RESOURCE_TYPE_ADDRESS16 */ 74 + acpi_rs_convert_address32, /* 0x0C, ACPI_RESOURCE_TYPE_ADDRESS32 */ 75 + acpi_rs_convert_address64, /* 0x0D, ACPI_RESOURCE_TYPE_ADDRESS64 */ 76 + acpi_rs_convert_ext_address64, /* 0x0E, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ 77 + acpi_rs_convert_ext_irq, /* 0x0F, ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ 78 + acpi_rs_convert_generic_reg /* 0x10, ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ 79 79 }; 80 80 81 81 /* Dispatch tables for AML-to-resource (Get Resource) conversion functions */ 82 82 83 - ACPI_GET_RESOURCE_HANDLER acpi_gbl_sm_get_resource_dispatch[] = { 83 + struct acpi_rsconvert_info *acpi_gbl_sm_get_resource_dispatch[] = { 84 84 NULL, /* 0x00, Reserved */ 85 85 NULL, /* 0x01, Reserved */ 86 86 NULL, /* 0x02, Reserved */ 87 87 NULL, /* 0x03, Reserved */ 88 88 acpi_rs_get_irq, /* 0x04, ACPI_RESOURCE_NAME_IRQ */ 89 - acpi_rs_get_dma, /* 0x05, ACPI_RESOURCE_NAME_DMA */ 89 + acpi_rs_convert_dma, /* 0x05, ACPI_RESOURCE_NAME_DMA */ 90 90 acpi_rs_get_start_dpf, /* 0x06, ACPI_RESOURCE_NAME_START_DEPENDENT */ 91 - acpi_rs_get_end_dpf, /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */ 92 - acpi_rs_get_io, /* 0x08, ACPI_RESOURCE_NAME_IO */ 93 - acpi_rs_get_fixed_io, /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO */ 91 + acpi_rs_convert_end_dpf, /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */ 92 + acpi_rs_convert_io, /* 0x08, ACPI_RESOURCE_NAME_IO */ 93 + acpi_rs_convert_fixed_io, /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO */ 94 94 NULL, /* 0x0A, Reserved */ 95 95 NULL, /* 0x0B, Reserved */ 96 96 NULL, /* 0x0C, Reserved */ 97 97 NULL, /* 0x0D, Reserved */ 98 - acpi_rs_get_vendor, /* 0x0E, ACPI_RESOURCE_NAME_VENDOR_SMALL */ 99 - acpi_rs_get_end_tag /* 0x0F, ACPI_RESOURCE_NAME_END_TAG */ 98 + acpi_rs_get_vendor_small, /* 0x0E, ACPI_RESOURCE_NAME_VENDOR_SMALL */ 99 + acpi_rs_convert_end_tag /* 0x0F, ACPI_RESOURCE_NAME_END_TAG */ 100 100 }; 101 101 102 - ACPI_GET_RESOURCE_HANDLER acpi_gbl_lg_get_resource_dispatch[] = { 102 + struct acpi_rsconvert_info *acpi_gbl_lg_get_resource_dispatch[] = { 103 103 NULL, /* 0x00, Reserved */ 104 - acpi_rs_get_memory24, /* 0x01, ACPI_RESOURCE_NAME_MEMORY24 */ 105 - acpi_rs_get_generic_reg, /* 0x02, ACPI_RESOURCE_NAME_GENERIC_REGISTER */ 104 + acpi_rs_convert_memory24, /* 0x01, ACPI_RESOURCE_NAME_MEMORY24 */ 105 + acpi_rs_convert_generic_reg, /* 0x02, ACPI_RESOURCE_NAME_GENERIC_REGISTER */ 106 106 NULL, /* 0x03, Reserved */ 107 - acpi_rs_get_vendor, /* 0x04, ACPI_RESOURCE_NAME_VENDOR_LARGE */ 108 - acpi_rs_get_memory32, /* 0x05, ACPI_RESOURCE_NAME_MEMORY32 */ 109 - acpi_rs_get_fixed_memory32, /* 0x06, ACPI_RESOURCE_NAME_FIXED_MEMORY32 */ 110 - acpi_rs_get_address32, /* 0x07, ACPI_RESOURCE_NAME_ADDRESS32 */ 111 - acpi_rs_get_address16, /* 0x08, ACPI_RESOURCE_NAME_ADDRESS16 */ 112 - acpi_rs_get_ext_irq, /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_IRQ */ 113 - acpi_rs_get_address64, /* 0x0A, ACPI_RESOURCE_NAME_ADDRESS64 */ 114 - acpi_rs_get_ext_address64 /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 */ 107 + acpi_rs_get_vendor_large, /* 0x04, ACPI_RESOURCE_NAME_VENDOR_LARGE */ 108 + acpi_rs_convert_memory32, /* 0x05, ACPI_RESOURCE_NAME_MEMORY32 */ 109 + acpi_rs_convert_fixed_memory32, /* 0x06, ACPI_RESOURCE_NAME_FIXED_MEMORY32 */ 110 + acpi_rs_convert_address32, /* 0x07, ACPI_RESOURCE_NAME_ADDRESS32 */ 111 + acpi_rs_convert_address16, /* 0x08, ACPI_RESOURCE_NAME_ADDRESS16 */ 112 + acpi_rs_convert_ext_irq, /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_IRQ */ 113 + acpi_rs_convert_address64, /* 0x0A, ACPI_RESOURCE_NAME_ADDRESS64 */ 114 + acpi_rs_convert_ext_address64 /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 */ 115 115 }; 116 116 117 117 #ifdef ACPI_FUTURE_USAGE ··· 119 119 120 120 /* Dispatch table for resource dump functions */ 121 121 122 - ACPI_DUMP_RESOURCE_HANDLER acpi_gbl_dump_resource_dispatch[] = { 122 + struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[] = { 123 123 acpi_rs_dump_irq, /* ACPI_RESOURCE_TYPE_IRQ */ 124 124 acpi_rs_dump_dma, /* ACPI_RESOURCE_TYPE_DMA */ 125 125 acpi_rs_dump_start_dpf, /* ACPI_RESOURCE_TYPE_START_DEPENDENT */ ··· 136 136 acpi_rs_dump_address64, /* ACPI_RESOURCE_TYPE_ADDRESS64 */ 137 137 acpi_rs_dump_ext_address64, /* ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ 138 138 acpi_rs_dump_ext_irq, /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ 139 - acpi_rs_dump_generic_reg /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ 139 + acpi_rs_dump_generic_reg, /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ 140 140 }; 141 + 141 142 #endif 142 143 #endif /* ACPI_FUTURE_USAGE */ 143 - 144 144 /* 145 145 * Base sizes for external AML resource descriptors, indexed by internal type. 146 146 * Includes size of the descriptor header (1 byte for small descriptors, 147 147 * 3 bytes for large descriptors) 148 148 */ 149 - u8 acpi_gbl_aml_resource_sizes[] = { 149 + const u8 acpi_gbl_aml_resource_sizes[] = { 150 150 sizeof(struct aml_resource_irq), /* ACPI_RESOURCE_TYPE_IRQ (optional Byte 3 always created) */ 151 151 sizeof(struct aml_resource_dma), /* ACPI_RESOURCE_TYPE_DMA */ 152 152 sizeof(struct aml_resource_start_dependent), /* ACPI_RESOURCE_TYPE_START_DEPENDENT (optional Byte 1 always created) */ ··· 168 168 169 169 /* Macros used in the tables below */ 170 170 171 - #define ACPI_RLARGE(r) sizeof (r) - sizeof (struct aml_resource_large_header) 172 - #define ACPI_RSMALL(r) sizeof (r) - sizeof (struct aml_resource_small_header) 171 + #define ACPI_RLARGE(r) (sizeof (r) - sizeof (struct aml_resource_large_header)) 172 + #define ACPI_RSMALL(r) (sizeof (r) - sizeof (struct aml_resource_small_header)) 173 173 174 174 /* 175 175 * Base sizes of resource descriptors, both the AML stream resource length ··· 182 182 {0, 0, 0}, 183 183 {0, 0, 0}, 184 184 {2, ACPI_RSMALL(struct aml_resource_irq), 185 - ACPI_SIZEOF_RESOURCE(struct acpi_resource_irq)}, 185 + ACPI_RS_SIZE(struct acpi_resource_irq)}, 186 186 {0, ACPI_RSMALL(struct aml_resource_dma), 187 - ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma)}, 187 + ACPI_RS_SIZE(struct acpi_resource_dma)}, 188 188 {2, ACPI_RSMALL(struct aml_resource_start_dependent), 189 - ACPI_SIZEOF_RESOURCE(struct acpi_resource_start_dependent)}, 190 - {0, ACPI_RSMALL(struct aml_resource_end_dependent), 191 - ACPI_RESOURCE_LENGTH}, 189 + ACPI_RS_SIZE(struct acpi_resource_start_dependent)}, 190 + {0, ACPI_RSMALL(struct aml_resource_end_dependent), ACPI_RS_SIZE_MIN}, 192 191 {0, ACPI_RSMALL(struct aml_resource_io), 193 - ACPI_SIZEOF_RESOURCE(struct acpi_resource_io)}, 192 + ACPI_RS_SIZE(struct acpi_resource_io)}, 194 193 {0, ACPI_RSMALL(struct aml_resource_fixed_io), 195 - ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io)}, 194 + ACPI_RS_SIZE(struct acpi_resource_fixed_io)}, 196 195 {0, 0, 0}, 197 196 {0, 0, 0}, 198 197 {0, 0, 0}, 199 198 {0, 0, 0}, 200 199 {1, ACPI_RSMALL(struct aml_resource_vendor_small), 201 - ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor)}, 202 - {0, ACPI_RSMALL(struct aml_resource_end_tag), ACPI_RESOURCE_LENGTH} 200 + ACPI_RS_SIZE(struct acpi_resource_vendor)}, 201 + {0, ACPI_RSMALL(struct aml_resource_end_tag), ACPI_RS_SIZE_MIN} 203 202 }; 204 203 205 204 struct acpi_resource_info acpi_gbl_lg_resource_info[] = { 206 205 {0, 0, 0}, 207 206 {0, ACPI_RLARGE(struct aml_resource_memory24), 208 - ACPI_SIZEOF_RESOURCE(struct acpi_resource_memory24)}, 207 + ACPI_RS_SIZE(struct acpi_resource_memory24)}, 209 208 {0, ACPI_RLARGE(struct aml_resource_generic_register), 210 - ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_register)}, 209 + ACPI_RS_SIZE(struct acpi_resource_generic_register)}, 211 210 {0, 0, 0}, 212 211 {1, ACPI_RLARGE(struct aml_resource_vendor_large), 213 - ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor)}, 212 + ACPI_RS_SIZE(struct acpi_resource_vendor)}, 214 213 {0, ACPI_RLARGE(struct aml_resource_memory32), 215 - ACPI_SIZEOF_RESOURCE(struct acpi_resource_memory32)}, 214 + ACPI_RS_SIZE(struct acpi_resource_memory32)}, 216 215 {0, ACPI_RLARGE(struct aml_resource_fixed_memory32), 217 - ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_memory32)}, 216 + ACPI_RS_SIZE(struct acpi_resource_fixed_memory32)}, 218 217 {1, ACPI_RLARGE(struct aml_resource_address32), 219 - ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32)}, 218 + ACPI_RS_SIZE(struct acpi_resource_address32)}, 220 219 {1, ACPI_RLARGE(struct aml_resource_address16), 221 - ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16)}, 220 + ACPI_RS_SIZE(struct acpi_resource_address16)}, 222 221 {1, ACPI_RLARGE(struct aml_resource_extended_irq), 223 - ACPI_SIZEOF_RESOURCE(struct acpi_resource_extended_irq)}, 222 + ACPI_RS_SIZE(struct acpi_resource_extended_irq)}, 224 223 {1, ACPI_RLARGE(struct aml_resource_address64), 225 - ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64)}, 224 + ACPI_RS_SIZE(struct acpi_resource_address64)}, 226 225 {0, ACPI_RLARGE(struct aml_resource_extended_address64), 227 - ACPI_SIZEOF_RESOURCE(struct acpi_resource_extended_address64)} 226 + ACPI_RS_SIZE(struct acpi_resource_extended_address64)} 228 227 };
+156 -219
drivers/acpi/resources/rsio.c
··· 49 49 50 50 /******************************************************************************* 51 51 * 52 - * FUNCTION: acpi_rs_get_io 53 - * 54 - * PARAMETERS: Aml - Pointer to the AML resource descriptor 55 - * aml_resource_length - Length of the resource from the AML header 56 - * Resource - Where the internal resource is returned 57 - * 58 - * RETURN: Status 59 - * 60 - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding 61 - * internal resource descriptor, simplifying bitflags and handling 62 - * alignment and endian issues if necessary. 52 + * acpi_rs_convert_io 63 53 * 64 54 ******************************************************************************/ 65 - acpi_status 66 - acpi_rs_get_io(union aml_resource *aml, 67 - u16 aml_resource_length, struct acpi_resource *resource) 68 - { 69 - ACPI_FUNCTION_TRACE("rs_get_io"); 55 + struct acpi_rsconvert_info acpi_rs_convert_io[5] = { 56 + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_IO, 57 + ACPI_RS_SIZE(struct acpi_resource_io), 58 + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_io)}, 70 59 71 - /* Get the Decode flag */ 60 + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_IO, 61 + sizeof(struct aml_resource_io), 62 + 0}, 72 63 73 - resource->data.io.io_decode = aml->io.information & 0x01; 64 + /* Decode flag */ 74 65 66 + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.io.io_decode), 67 + AML_OFFSET(io.flags), 68 + 0}, 75 69 /* 76 - * Get the following contiguous fields from the AML descriptor: 77 - * Minimum Base Address 78 - * Maximum Base Address 70 + * These fields are contiguous in both the source and destination: 79 71 * Address Alignment 80 72 * Length 73 + * Minimum Base Address 74 + * Maximum Base Address 81 75 */ 82 - ACPI_MOVE_16_TO_32(&resource->data.io.minimum, &aml->io.minimum); 83 - ACPI_MOVE_16_TO_32(&resource->data.io.maximum, &aml->io.maximum); 84 - resource->data.io.alignment = aml->io.alignment; 85 - resource->data.io.address_length = aml->io.address_length; 76 + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.io.alignment), 77 + AML_OFFSET(io.alignment), 78 + 2}, 86 79 87 - /* Complete the resource header */ 88 - 89 - resource->type = ACPI_RESOURCE_TYPE_IO; 90 - resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_io); 91 - return_ACPI_STATUS(AE_OK); 92 - } 80 + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.io.minimum), 81 + AML_OFFSET(io.minimum), 82 + 2} 83 + }; 93 84 94 85 /******************************************************************************* 95 86 * 96 - * FUNCTION: acpi_rs_set_io 97 - * 98 - * PARAMETERS: Resource - Pointer to the resource descriptor 99 - * Aml - Where the AML descriptor is returned 100 - * 101 - * RETURN: Status 102 - * 103 - * DESCRIPTION: Convert an internal resource descriptor to the corresponding 104 - * external AML resource descriptor. 87 + * acpi_rs_convert_fixed_io 105 88 * 106 89 ******************************************************************************/ 107 90 108 - acpi_status 109 - acpi_rs_set_io(struct acpi_resource *resource, union aml_resource *aml) 110 - { 111 - ACPI_FUNCTION_TRACE("rs_set_io"); 91 + struct acpi_rsconvert_info acpi_rs_convert_fixed_io[4] = { 92 + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_FIXED_IO, 93 + ACPI_RS_SIZE(struct acpi_resource_fixed_io), 94 + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_fixed_io)}, 112 95 113 - /* I/O Information Byte */ 114 - 115 - aml->io.information = (u8) (resource->data.io.io_decode & 0x01); 116 - 96 + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_FIXED_IO, 97 + sizeof(struct aml_resource_fixed_io), 98 + 0}, 117 99 /* 118 - * Set the following contiguous fields in the AML descriptor: 119 - * Minimum Base Address 120 - * Maximum Base Address 121 - * Address Alignment 122 - * Length 123 - */ 124 - ACPI_MOVE_32_TO_16(&aml->io.minimum, &resource->data.io.minimum); 125 - ACPI_MOVE_32_TO_16(&aml->io.maximum, &resource->data.io.maximum); 126 - aml->io.alignment = (u8) resource->data.io.alignment; 127 - aml->io.address_length = (u8) resource->data.io.address_length; 128 - 129 - /* Complete the AML descriptor header */ 130 - 131 - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_IO, 132 - sizeof(struct aml_resource_io), aml); 133 - return_ACPI_STATUS(AE_OK); 134 - } 135 - 136 - /******************************************************************************* 137 - * 138 - * FUNCTION: acpi_rs_get_fixed_io 139 - * 140 - * PARAMETERS: Aml - Pointer to the AML resource descriptor 141 - * aml_resource_length - Length of the resource from the AML header 142 - * Resource - Where the internal resource is returned 143 - * 144 - * RETURN: Status 145 - * 146 - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding 147 - * internal resource descriptor, simplifying bitflags and handling 148 - * alignment and endian issues if necessary. 149 - * 150 - ******************************************************************************/ 151 - 152 - acpi_status 153 - acpi_rs_get_fixed_io(union aml_resource *aml, 154 - u16 aml_resource_length, struct acpi_resource *resource) 155 - { 156 - ACPI_FUNCTION_TRACE("rs_get_fixed_io"); 157 - 158 - /* 159 - * Get the following contiguous fields from the AML descriptor: 100 + * These fields are contiguous in both the source and destination: 160 101 * Base Address 161 102 * Length 162 103 */ 163 - ACPI_MOVE_16_TO_32(&resource->data.fixed_io.address, 164 - &aml->fixed_io.address); 165 - resource->data.fixed_io.address_length = aml->fixed_io.address_length; 104 + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.fixed_io.address_length), 105 + AML_OFFSET(fixed_io.address_length), 106 + 1}, 166 107 167 - /* Complete the resource header */ 168 - 169 - resource->type = ACPI_RESOURCE_TYPE_FIXED_IO; 170 - resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io); 171 - return_ACPI_STATUS(AE_OK); 172 - } 108 + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.fixed_io.address), 109 + AML_OFFSET(fixed_io.address), 110 + 1} 111 + }; 173 112 174 113 /******************************************************************************* 175 114 * 176 - * FUNCTION: acpi_rs_set_fixed_io 177 - * 178 - * PARAMETERS: Resource - Pointer to the resource descriptor 179 - * Aml - Where the AML descriptor is returned 180 - * 181 - * RETURN: Status 182 - * 183 - * DESCRIPTION: Convert an internal resource descriptor to the corresponding 184 - * external AML resource descriptor. 115 + * acpi_rs_convert_generic_reg 185 116 * 186 117 ******************************************************************************/ 187 118 188 - acpi_status 189 - acpi_rs_set_fixed_io(struct acpi_resource *resource, union aml_resource *aml) 190 - { 191 - ACPI_FUNCTION_TRACE("rs_set_fixed_io"); 119 + struct acpi_rsconvert_info acpi_rs_convert_generic_reg[4] = { 120 + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_GENERIC_REGISTER, 121 + ACPI_RS_SIZE(struct acpi_resource_generic_register), 122 + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_generic_reg)}, 123 + 124 + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_GENERIC_REGISTER, 125 + sizeof(struct aml_resource_generic_register), 126 + 0}, 127 + /* 128 + * These fields are contiguous in both the source and destination: 129 + * Address Space ID 130 + * Register Bit Width 131 + * Register Bit Offset 132 + * Access Size 133 + */ 134 + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.generic_reg.space_id), 135 + AML_OFFSET(generic_reg.address_space_id), 136 + 4}, 137 + 138 + /* Get the Register Address */ 139 + 140 + {ACPI_RSC_MOVE64, ACPI_RS_OFFSET(data.generic_reg.address), 141 + AML_OFFSET(generic_reg.address), 142 + 1} 143 + }; 144 + 145 + /******************************************************************************* 146 + * 147 + * acpi_rs_convert_end_dpf 148 + * 149 + ******************************************************************************/ 150 + 151 + struct acpi_rsconvert_info acpi_rs_convert_end_dpf[2] = { 152 + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_END_DEPENDENT, 153 + ACPI_RS_SIZE_MIN, 154 + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_end_dpf)}, 155 + 156 + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_END_DEPENDENT, 157 + sizeof(struct aml_resource_end_dependent), 158 + 0} 159 + }; 160 + 161 + /******************************************************************************* 162 + * 163 + * acpi_rs_convert_end_tag 164 + * 165 + ******************************************************************************/ 166 + 167 + struct acpi_rsconvert_info acpi_rs_convert_end_tag[2] = { 168 + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_END_TAG, 169 + ACPI_RS_SIZE_MIN, 170 + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_end_tag)}, 192 171 193 172 /* 194 - * Set the following contiguous fields in the AML descriptor: 195 - * Base Address 196 - * Length 173 + * Note: The checksum field is set to zero, meaning that the resource 174 + * data is treated as if the checksum operation succeeded. 175 + * (ACPI Spec 1.0b Section 6.4.2.8) 197 176 */ 198 - ACPI_MOVE_32_TO_16(&aml->fixed_io.address, 199 - &resource->data.fixed_io.address); 200 - aml->fixed_io.address_length = 201 - (u8) resource->data.fixed_io.address_length; 202 - 203 - /* Complete the AML descriptor header */ 204 - 205 - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_FIXED_IO, 206 - sizeof(struct aml_resource_fixed_io), aml); 207 - return_ACPI_STATUS(AE_OK); 208 - } 177 + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_END_TAG, 178 + sizeof(struct aml_resource_end_tag), 179 + 0} 180 + }; 209 181 210 182 /******************************************************************************* 211 183 * 212 - * FUNCTION: acpi_rs_get_dma 213 - * 214 - * PARAMETERS: Aml - Pointer to the AML resource descriptor 215 - * aml_resource_length - Length of the resource from the AML header 216 - * Resource - Where the internal resource is returned 217 - * 218 - * RETURN: Status 219 - * 220 - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding 221 - * internal resource descriptor, simplifying bitflags and handling 222 - * alignment and endian issues if necessary. 184 + * acpi_rs_get_start_dpf 223 185 * 224 186 ******************************************************************************/ 225 187 226 - acpi_status 227 - acpi_rs_get_dma(union aml_resource *aml, 228 - u16 aml_resource_length, struct acpi_resource *resource) 229 - { 230 - u32 channel_count = 0; 231 - u32 i; 232 - u8 temp8; 188 + struct acpi_rsconvert_info acpi_rs_get_start_dpf[5] = { 189 + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_START_DEPENDENT, 190 + ACPI_RS_SIZE(struct acpi_resource_start_dependent), 191 + ACPI_RSC_TABLE_SIZE(acpi_rs_get_start_dpf)}, 233 192 234 - ACPI_FUNCTION_TRACE("rs_get_dma"); 193 + /* Defaults for Compatibility and Performance priorities */ 235 194 236 - /* Decode the DMA channel bits */ 195 + {ACPI_RSC_SET8, ACPI_RS_OFFSET(data.start_dpf.compatibility_priority), 196 + ACPI_ACCEPTABLE_CONFIGURATION, 197 + 2}, 237 198 238 - for (i = 0; i < 8; i++) { 239 - if ((aml->dma.dma_channel_mask >> i) & 0x01) { 240 - resource->data.dma.channels[channel_count] = i; 241 - channel_count++; 242 - } 243 - } 199 + /* All done if there is no flag byte present in the descriptor */ 244 200 245 - resource->length = 0; 246 - resource->data.dma.channel_count = channel_count; 201 + {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 1}, 247 202 203 + /* Flag byte is present, get the flags */ 204 + 205 + {ACPI_RSC_2BITFLAG, 206 + ACPI_RS_OFFSET(data.start_dpf.compatibility_priority), 207 + AML_OFFSET(start_dpf.flags), 208 + 0}, 209 + 210 + {ACPI_RSC_2BITFLAG, 211 + ACPI_RS_OFFSET(data.start_dpf.performance_robustness), 212 + AML_OFFSET(start_dpf.flags), 213 + 2} 214 + }; 215 + 216 + /******************************************************************************* 217 + * 218 + * acpi_rs_set_start_dpf 219 + * 220 + ******************************************************************************/ 221 + 222 + struct acpi_rsconvert_info acpi_rs_set_start_dpf[6] = { 223 + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_START_DEPENDENT, 224 + sizeof(struct aml_resource_start_dependent), 225 + ACPI_RSC_TABLE_SIZE(acpi_rs_set_start_dpf)}, 226 + 227 + /* Set the default flag values */ 228 + 229 + {ACPI_RSC_2BITFLAG, 230 + ACPI_RS_OFFSET(data.start_dpf.compatibility_priority), 231 + AML_OFFSET(start_dpf.flags), 232 + 0}, 233 + 234 + {ACPI_RSC_2BITFLAG, 235 + ACPI_RS_OFFSET(data.start_dpf.performance_robustness), 236 + AML_OFFSET(start_dpf.flags), 237 + 2}, 248 238 /* 249 - * Calculate the structure size based upon the number of channels 250 - * Note: Zero DMA channels is valid 239 + * All done if flags byte is necessary -- if either priority value 240 + * is not ACPI_ACCEPTABLE_CONFIGURATION 251 241 */ 252 - if (channel_count > 0) { 253 - resource->length = (u32) (channel_count - 1) * 4; 254 - } 242 + {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, 243 + ACPI_RS_OFFSET(data.start_dpf.compatibility_priority), 244 + ACPI_ACCEPTABLE_CONFIGURATION}, 255 245 256 - /* Get the flags: transfer preference, bus mastering, channel speed */ 246 + {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, 247 + ACPI_RS_OFFSET(data.start_dpf.performance_robustness), 248 + ACPI_ACCEPTABLE_CONFIGURATION}, 257 249 258 - temp8 = aml->dma.flags; 259 - resource->data.dma.transfer = temp8 & 0x03; 260 - resource->data.dma.bus_master = (temp8 >> 2) & 0x01; 261 - resource->data.dma.type = (temp8 >> 5) & 0x03; 250 + /* Flag byte is not necessary */ 262 251 263 - if (resource->data.dma.transfer == 0x03) { 264 - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 265 - "Invalid DMA.Transfer preference (3)\n")); 266 - return_ACPI_STATUS(AE_BAD_DATA); 267 - } 268 - 269 - /* Complete the resource header */ 270 - 271 - resource->type = ACPI_RESOURCE_TYPE_DMA; 272 - resource->length += ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma); 273 - return_ACPI_STATUS(AE_OK); 274 - } 275 - 276 - /******************************************************************************* 277 - * 278 - * FUNCTION: acpi_rs_set_dma 279 - * 280 - * PARAMETERS: Resource - Pointer to the resource descriptor 281 - * Aml - Where the AML descriptor is returned 282 - * 283 - * RETURN: Status 284 - * 285 - * DESCRIPTION: Convert an internal resource descriptor to the corresponding 286 - * external AML resource descriptor. 287 - * 288 - ******************************************************************************/ 289 - 290 - acpi_status 291 - acpi_rs_set_dma(struct acpi_resource *resource, union aml_resource *aml) 292 - { 293 - u8 i; 294 - 295 - ACPI_FUNCTION_TRACE("rs_set_dma"); 296 - 297 - /* Convert channel list to 8-bit DMA channel bitmask */ 298 - 299 - aml->dma.dma_channel_mask = 0; 300 - for (i = 0; i < resource->data.dma.channel_count; i++) { 301 - aml->dma.dma_channel_mask |= 302 - (1 << resource->data.dma.channels[i]); 303 - } 304 - 305 - /* Set the DMA Flag bits */ 306 - 307 - aml->dma.flags = (u8) 308 - (((resource->data.dma.type & 0x03) << 5) | 309 - ((resource->data.dma.bus_master & 0x01) << 2) | 310 - (resource->data.dma.transfer & 0x03)); 311 - 312 - /* Complete the AML descriptor header */ 313 - 314 - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_DMA, 315 - sizeof(struct aml_resource_dma), aml); 316 - return_ACPI_STATUS(AE_OK); 317 - } 252 + {ACPI_RSC_LENGTH, 0, 0, 253 + sizeof(struct aml_resource_start_dependent_noprio)} 254 + };
+117 -260
drivers/acpi/resources/rsirq.c
··· 49 49 50 50 /******************************************************************************* 51 51 * 52 - * FUNCTION: acpi_rs_get_irq 53 - * 54 - * PARAMETERS: Aml - Pointer to the AML resource descriptor 55 - * aml_resource_length - Length of the resource from the AML header 56 - * Resource - Where the internal resource is returned 57 - * 58 - * RETURN: Status 59 - * 60 - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding 61 - * internal resource descriptor, simplifying bitflags and handling 62 - * alignment and endian issues if necessary. 52 + * acpi_rs_get_irq 63 53 * 64 54 ******************************************************************************/ 65 - acpi_status 66 - acpi_rs_get_irq(union aml_resource *aml, 67 - u16 aml_resource_length, struct acpi_resource *resource) 68 - { 69 - u16 temp16 = 0; 70 - u32 interrupt_count = 0; 71 - u32 i; 72 - u32 resource_length; 73 - 74 - ACPI_FUNCTION_TRACE("rs_get_irq"); 55 + struct acpi_rsconvert_info acpi_rs_get_irq[7] = { 56 + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_IRQ, 57 + ACPI_RS_SIZE(struct acpi_resource_irq), 58 + ACPI_RSC_TABLE_SIZE(acpi_rs_get_irq)}, 75 59 76 60 /* Get the IRQ mask (bytes 1:2) */ 77 61 78 - ACPI_MOVE_16_TO_16(&temp16, &aml->irq.irq_mask); 62 + {ACPI_RSC_BITMASK16, ACPI_RS_OFFSET(data.irq.interrupts[0]), 63 + AML_OFFSET(irq.irq_mask), 64 + ACPI_RS_OFFSET(data.irq.interrupt_count)}, 79 65 80 - /* Decode the IRQ bits (up to 16 possible) */ 66 + /* Set default flags (others are zero) */ 81 67 82 - for (i = 0; i < 16; i++) { 83 - if ((temp16 >> i) & 0x01) { 84 - resource->data.irq.interrupts[interrupt_count] = i; 85 - interrupt_count++; 86 - } 87 - } 68 + {ACPI_RSC_SET8, ACPI_RS_OFFSET(data.irq.triggering), 69 + ACPI_EDGE_SENSITIVE, 70 + 1}, 88 71 89 - /* Zero interrupts is valid */ 72 + /* All done if no flag byte present in descriptor */ 90 73 91 - resource_length = 0; 92 - resource->data.irq.interrupt_count = interrupt_count; 93 - if (interrupt_count > 0) { 94 - /* Calculate the structure size based upon the number of interrupts */ 74 + {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 3}, 95 75 96 - resource_length = (u32) (interrupt_count - 1) * 4; 97 - } 76 + /* Get flags: Triggering[0], Polarity[3], Sharing[4] */ 98 77 99 - /* Get Flags (Byte 3) if it is used */ 78 + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.triggering), 79 + AML_OFFSET(irq.flags), 80 + 0}, 100 81 101 - if (aml_resource_length == 3) { 102 - /* Check for HE, LL interrupts */ 82 + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.polarity), 83 + AML_OFFSET(irq.flags), 84 + 3}, 103 85 104 - switch (aml->irq.flags & 0x09) { 105 - case 0x01: /* HE */ 106 - resource->data.irq.triggering = ACPI_EDGE_SENSITIVE; 107 - resource->data.irq.polarity = ACPI_ACTIVE_HIGH; 108 - break; 109 - 110 - case 0x08: /* LL */ 111 - resource->data.irq.triggering = ACPI_LEVEL_SENSITIVE; 112 - resource->data.irq.polarity = ACPI_ACTIVE_LOW; 113 - break; 114 - 115 - default: 116 - /* 117 - * Only _LL and _HE polarity/trigger interrupts 118 - * are allowed (ACPI spec, section "IRQ Format") 119 - * so 0x00 and 0x09 are illegal. 120 - */ 121 - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 122 - "Invalid interrupt polarity/trigger in resource list, %X\n", 123 - aml->irq.flags)); 124 - return_ACPI_STATUS(AE_BAD_DATA); 125 - } 126 - 127 - /* Get Sharing flag */ 128 - 129 - resource->data.irq.sharable = (aml->irq.flags >> 3) & 0x01; 130 - } else { 131 - /* 132 - * Default configuration: assume Edge Sensitive, Active High, 133 - * Non-Sharable as per the ACPI Specification 134 - */ 135 - resource->data.irq.triggering = ACPI_EDGE_SENSITIVE; 136 - resource->data.irq.polarity = ACPI_ACTIVE_HIGH; 137 - resource->data.irq.sharable = ACPI_EXCLUSIVE; 138 - } 139 - 140 - /* Complete the resource header */ 141 - 142 - resource->type = ACPI_RESOURCE_TYPE_IRQ; 143 - resource->length = 144 - resource_length + ACPI_SIZEOF_RESOURCE(struct acpi_resource_irq); 145 - return_ACPI_STATUS(AE_OK); 146 - } 86 + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.sharable), 87 + AML_OFFSET(irq.flags), 88 + 4} 89 + }; 147 90 148 91 /******************************************************************************* 149 92 * 150 - * FUNCTION: acpi_rs_set_irq 151 - * 152 - * PARAMETERS: Resource - Pointer to the resource descriptor 153 - * Aml - Where the AML descriptor is returned 154 - * 155 - * RETURN: Status 156 - * 157 - * DESCRIPTION: Convert an internal resource descriptor to the corresponding 158 - * external AML resource descriptor. 93 + * acpi_rs_set_irq 159 94 * 160 95 ******************************************************************************/ 161 96 162 - acpi_status 163 - acpi_rs_set_irq(struct acpi_resource *resource, union aml_resource *aml) 164 - { 165 - acpi_size descriptor_length; 166 - u16 irq_mask; 167 - u8 i; 168 - 169 - ACPI_FUNCTION_TRACE("rs_set_irq"); 97 + struct acpi_rsconvert_info acpi_rs_set_irq[9] = { 98 + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_IRQ, 99 + sizeof(struct aml_resource_irq), 100 + ACPI_RSC_TABLE_SIZE(acpi_rs_set_irq)}, 170 101 171 102 /* Convert interrupt list to 16-bit IRQ bitmask */ 172 103 173 - irq_mask = 0; 174 - for (i = 0; i < resource->data.irq.interrupt_count; i++) { 175 - irq_mask |= (1 << resource->data.irq.interrupts[i]); 176 - } 104 + {ACPI_RSC_BITMASK16, ACPI_RS_OFFSET(data.irq.interrupts[0]), 105 + AML_OFFSET(irq.irq_mask), 106 + ACPI_RS_OFFSET(data.irq.interrupt_count)}, 177 107 178 - /* Set the interrupt mask */ 108 + /* Set the flags byte by default */ 179 109 180 - ACPI_MOVE_16_TO_16(&aml->irq.irq_mask, &irq_mask); 110 + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.triggering), 111 + AML_OFFSET(irq.flags), 112 + 0}, 181 113 114 + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.polarity), 115 + AML_OFFSET(irq.flags), 116 + 3}, 117 + 118 + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.sharable), 119 + AML_OFFSET(irq.flags), 120 + 4}, 182 121 /* 183 - * The descriptor field is set based upon whether a third byte is 184 - * needed to contain the IRQ Information. 122 + * Check if the flags byte is necessary. Not needed if the flags are: 123 + * ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_HIGH, ACPI_EXCLUSIVE 185 124 */ 186 - if ((resource->data.irq.triggering == ACPI_EDGE_SENSITIVE) && 187 - (resource->data.irq.polarity == ACPI_ACTIVE_HIGH) && 188 - (resource->data.irq.sharable == ACPI_EXCLUSIVE)) { 189 - /* irq_no_flags() descriptor can be used */ 125 + {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, 126 + ACPI_RS_OFFSET(data.irq.triggering), 127 + ACPI_EDGE_SENSITIVE}, 190 128 191 - descriptor_length = sizeof(struct aml_resource_irq_noflags); 192 - } else { 193 - /* Irq() descriptor must be used */ 129 + {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, 130 + ACPI_RS_OFFSET(data.irq.polarity), 131 + ACPI_ACTIVE_HIGH}, 194 132 195 - descriptor_length = sizeof(struct aml_resource_irq); 133 + {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, 134 + ACPI_RS_OFFSET(data.irq.sharable), 135 + ACPI_EXCLUSIVE}, 196 136 197 - /* Set the IRQ Info byte */ 137 + /* irq_no_flags() descriptor can be used */ 198 138 199 - aml->irq.flags = (u8) 200 - ((resource->data.irq.sharable & 0x01) << 4); 201 - 202 - if (ACPI_LEVEL_SENSITIVE == resource->data.irq.triggering && 203 - ACPI_ACTIVE_LOW == resource->data.irq.polarity) { 204 - aml->irq.flags |= 0x08; 205 - } else { 206 - aml->irq.flags |= 0x01; 207 - } 208 - } 209 - 210 - /* Complete the AML descriptor header */ 211 - 212 - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_IRQ, descriptor_length, 213 - aml); 214 - return_ACPI_STATUS(AE_OK); 215 - } 139 + {ACPI_RSC_LENGTH, 0, 0, sizeof(struct aml_resource_irq_noflags)} 140 + }; 216 141 217 142 /******************************************************************************* 218 143 * 219 - * FUNCTION: acpi_rs_get_ext_irq 220 - * 221 - * PARAMETERS: Aml - Pointer to the AML resource descriptor 222 - * aml_resource_length - Length of the resource from the AML header 223 - * Resource - Where the internal resource is returned 224 - * 225 - * RETURN: Status 226 - * 227 - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding 228 - * internal resource descriptor, simplifying bitflags and handling 229 - * alignment and endian issues if necessary. 144 + * acpi_rs_convert_ext_irq 230 145 * 231 146 ******************************************************************************/ 232 147 233 - acpi_status 234 - acpi_rs_get_ext_irq(union aml_resource *aml, 235 - u16 aml_resource_length, struct acpi_resource *resource) 236 - { 237 - char *out_resource_string; 238 - u8 temp8; 148 + struct acpi_rsconvert_info acpi_rs_convert_ext_irq[9] = { 149 + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_EXTENDED_IRQ, 150 + ACPI_RS_SIZE(struct acpi_resource_extended_irq), 151 + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_ext_irq)}, 239 152 240 - ACPI_FUNCTION_TRACE("rs_get_ext_irq"); 153 + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_EXTENDED_IRQ, 154 + sizeof(struct aml_resource_extended_irq), 155 + 0}, 241 156 242 - /* Get the flag bits */ 157 + /* Flag bits */ 243 158 244 - temp8 = aml->extended_irq.flags; 245 - resource->data.extended_irq.producer_consumer = temp8 & 0x01; 246 - resource->data.extended_irq.polarity = (temp8 >> 2) & 0x01; 247 - resource->data.extended_irq.sharable = (temp8 >> 3) & 0x01; 159 + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.producer_consumer), 160 + AML_OFFSET(extended_irq.flags), 161 + 0}, 248 162 249 - /* 250 - * Check for Interrupt Mode 251 - * 252 - * The definition of an Extended IRQ changed between ACPI spec v1.0b 253 - * and ACPI spec 2.0 (section 6.4.3.6 in both). 254 - * 255 - * - Edge/Level are defined opposite in the table vs the headers 256 - */ 257 - resource->data.extended_irq.triggering = 258 - (temp8 & 0x2) ? ACPI_EDGE_SENSITIVE : ACPI_LEVEL_SENSITIVE; 163 + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.triggering), 164 + AML_OFFSET(extended_irq.flags), 165 + 1}, 259 166 260 - /* Get the IRQ Table length (Byte4) */ 167 + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.polarity), 168 + AML_OFFSET(extended_irq.flags), 169 + 2}, 261 170 262 - temp8 = aml->extended_irq.table_length; 263 - resource->data.extended_irq.interrupt_count = temp8; 264 - if (temp8 < 1) { 265 - /* Must have at least one IRQ */ 171 + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.sharable), 172 + AML_OFFSET(extended_irq.flags), 173 + 3}, 266 174 267 - return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); 268 - } 175 + /* IRQ Table length (Byte4) */ 269 176 270 - /* 271 - * Add any additional structure size to properly calculate 272 - * the next pointer at the end of this function 273 - */ 274 - resource->length = (temp8 - 1) * 4; 275 - out_resource_string = ACPI_CAST_PTR(char, 276 - (&resource->data.extended_irq. 277 - interrupts[0] + temp8)); 177 + {ACPI_RSC_COUNT, ACPI_RS_OFFSET(data.extended_irq.interrupt_count), 178 + AML_OFFSET(extended_irq.interrupt_count), 179 + sizeof(u32)} 180 + , 278 181 279 - /* Get every IRQ in the table, each is 32 bits */ 182 + /* Copy every IRQ in the table, each is 32 bits */ 280 183 281 - acpi_rs_move_data(resource->data.extended_irq.interrupts, 282 - aml->extended_irq.interrupt_number, 283 - (u16) temp8, ACPI_MOVE_TYPE_32_TO_32); 184 + {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.extended_irq.interrupts[0]), 185 + AML_OFFSET(extended_irq.interrupts[0]), 186 + 0} 187 + , 284 188 285 - /* Get the optional resource_source (index and string) */ 189 + /* Optional resource_source (Index and String) */ 286 190 287 - resource->length += 288 - acpi_rs_get_resource_source(aml_resource_length, 289 - (acpi_size) resource->length + 290 - sizeof(struct 291 - aml_resource_extended_irq), 292 - &resource->data.extended_irq. 293 - resource_source, aml, 294 - out_resource_string); 295 - 296 - /* Complete the resource header */ 297 - 298 - resource->type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ; 299 - resource->length += 300 - ACPI_SIZEOF_RESOURCE(struct acpi_resource_extended_irq); 301 - return_ACPI_STATUS(AE_OK); 302 - } 191 + {ACPI_RSC_SOURCEX, ACPI_RS_OFFSET(data.extended_irq.resource_source), 192 + ACPI_RS_OFFSET(data.extended_irq.interrupts[0]), 193 + sizeof(struct aml_resource_extended_irq)} 194 + }; 303 195 304 196 /******************************************************************************* 305 197 * 306 - * FUNCTION: acpi_rs_set_ext_irq 307 - * 308 - * PARAMETERS: Resource - Pointer to the resource descriptor 309 - * Aml - Where the AML descriptor is returned 310 - * 311 - * RETURN: Status 312 - * 313 - * DESCRIPTION: Convert an internal resource descriptor to the corresponding 314 - * external AML resource descriptor. 198 + * acpi_rs_convert_dma 315 199 * 316 200 ******************************************************************************/ 317 201 318 - acpi_status 319 - acpi_rs_set_ext_irq(struct acpi_resource *resource, union aml_resource *aml) 320 - { 321 - acpi_size descriptor_length; 202 + struct acpi_rsconvert_info acpi_rs_convert_dma[6] = { 203 + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_DMA, 204 + ACPI_RS_SIZE(struct acpi_resource_dma), 205 + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_dma)}, 322 206 323 - ACPI_FUNCTION_TRACE("rs_set_ext_irq"); 207 + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_DMA, 208 + sizeof(struct aml_resource_dma), 209 + 0}, 324 210 325 - /* Set the Interrupt vector flags */ 211 + /* Flags: transfer preference, bus mastering, channel speed */ 326 212 327 - aml->extended_irq.flags = (u8) 328 - ((resource->data.extended_irq.producer_consumer & 0x01) | 329 - ((resource->data.extended_irq.sharable & 0x01) << 3) | 330 - ((resource->data.extended_irq.polarity & 0x1) << 2)); 213 + {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.dma.transfer), 214 + AML_OFFSET(dma.flags), 215 + 0}, 331 216 332 - /* 333 - * Set the Interrupt Mode 334 - * 335 - * The definition of an Extended IRQ changed between ACPI spec v1.0b 336 - * and ACPI spec 2.0 (section 6.4.3.6 in both). This code does not 337 - * implement the more restrictive definition of 1.0b 338 - * 339 - * - Edge/Level are defined opposite in the table vs the headers 340 - */ 341 - if (resource->data.extended_irq.triggering == ACPI_EDGE_SENSITIVE) { 342 - aml->extended_irq.flags |= 0x02; 343 - } 217 + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.dma.bus_master), 218 + AML_OFFSET(dma.flags), 219 + 2}, 344 220 345 - /* Set the Interrupt table length */ 221 + {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.dma.type), 222 + AML_OFFSET(dma.flags), 223 + 5}, 346 224 347 - aml->extended_irq.table_length = (u8) 348 - resource->data.extended_irq.interrupt_count; 225 + /* DMA channel mask bits */ 349 226 350 - descriptor_length = (sizeof(struct aml_resource_extended_irq) - 4) + 351 - ((acpi_size) resource->data.extended_irq.interrupt_count * 352 - sizeof(u32)); 353 - 354 - /* Set each interrupt value */ 355 - 356 - acpi_rs_move_data(aml->extended_irq.interrupt_number, 357 - resource->data.extended_irq.interrupts, 358 - (u16) resource->data.extended_irq.interrupt_count, 359 - ACPI_MOVE_TYPE_32_TO_32); 360 - 361 - /* Resource Source Index and Resource Source are optional */ 362 - 363 - descriptor_length = acpi_rs_set_resource_source(aml, descriptor_length, 364 - &resource->data. 365 - extended_irq. 366 - resource_source); 367 - 368 - /* Complete the AML descriptor header */ 369 - 370 - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_EXTENDED_IRQ, 371 - descriptor_length, aml); 372 - return_ACPI_STATUS(AE_OK); 373 - } 227 + {ACPI_RSC_BITMASK, ACPI_RS_OFFSET(data.dma.channels[0]), 228 + AML_OFFSET(dma.dma_channel_mask), 229 + ACPI_RS_OFFSET(data.dma.channel_count)} 230 + };
+47 -45
drivers/acpi/resources/rslist.c
··· 48 48 ACPI_MODULE_NAME("rslist") 49 49 50 50 /* Local prototypes */ 51 - static ACPI_GET_RESOURCE_HANDLER acpi_rs_get_resource_handler(u8 resource_type); 51 + static struct acpi_rsconvert_info *acpi_rs_get_conversion_info(u8 52 + resource_type); 52 53 53 54 static acpi_status acpi_rs_validate_resource_length(union aml_resource *aml); 54 55 ··· 84 83 return (AE_AML_INVALID_RESOURCE_TYPE); 85 84 } 86 85 87 - resource_length = acpi_rs_get_resource_length(aml); 86 + resource_length = acpi_ut_get_resource_length(aml); 88 87 minimum_aml_resource_length = 89 88 resource_info->minimum_aml_resource_length; 90 89 ··· 116 115 117 116 /******************************************************************************* 118 117 * 119 - * FUNCTION: acpi_rs_get_resource_handler 118 + * FUNCTION: acpi_rs_get_conversion_info 120 119 * 121 120 * PARAMETERS: resource_type - Byte 0 of a resource descriptor 122 121 * 123 - * RETURN: Pointer to the resource conversion handler 122 + * RETURN: Pointer to the resource conversion info table 124 123 * 125 - * DESCRIPTION: Extract the Resource Type/Name from the first byte of 126 - * a resource descriptor. 124 + * DESCRIPTION: Get the conversion table associated with this resource type 127 125 * 128 126 ******************************************************************************/ 129 127 130 - static ACPI_GET_RESOURCE_HANDLER acpi_rs_get_resource_handler(u8 resource_type) 128 + static struct acpi_rsconvert_info *acpi_rs_get_conversion_info(u8 resource_type) 131 129 { 132 130 ACPI_FUNCTION_ENTRY(); 133 131 ··· 174 174 acpi_status status; 175 175 acpi_size bytes_parsed = 0; 176 176 struct acpi_resource *resource; 177 - u16 resource_length; 178 - u32 descriptor_length; 179 - ACPI_GET_RESOURCE_HANDLER handler; 177 + acpi_rsdesc_size descriptor_length; 178 + struct acpi_rsconvert_info *info; 180 179 181 180 ACPI_FUNCTION_TRACE("rs_convert_aml_to_resources"); 182 181 183 182 /* Loop until end-of-buffer or an end_tag is found */ 184 183 185 184 while (bytes_parsed < aml_buffer_length) { 186 - /* Get the handler associated with this Descriptor Type */ 185 + /* Get the conversion table associated with this Descriptor Type */ 187 186 188 - handler = acpi_rs_get_resource_handler(*aml_buffer); 189 - if (!handler) { 190 - /* No handler indicates invalid resource type */ 187 + info = acpi_rs_get_conversion_info(*aml_buffer); 188 + if (!info) { 189 + /* No table indicates an invalid resource type */ 191 190 192 191 return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); 193 192 } 194 193 195 - resource_length = 196 - acpi_rs_get_resource_length(ACPI_CAST_PTR 197 - (union aml_resource, 198 - aml_buffer)); 199 - 200 - descriptor_length = 201 - acpi_rs_get_descriptor_length(ACPI_CAST_PTR 202 - (union aml_resource, 203 - aml_buffer)); 194 + descriptor_length = acpi_ut_get_descriptor_length(aml_buffer); 204 195 205 196 /* 206 197 * Perform limited validation of the resource length, based upon ··· 205 214 return_ACPI_STATUS(status); 206 215 } 207 216 208 - /* Convert a byte stream resource to local resource struct */ 217 + /* Convert the AML byte stream resource to a local resource struct */ 209 218 210 - status = handler(ACPI_CAST_PTR(union aml_resource, aml_buffer), 211 - resource_length, 212 - ACPI_CAST_PTR(struct acpi_resource, buffer)); 219 + status = 220 + acpi_rs_convert_aml_to_resource(ACPI_CAST_PTR 221 + (struct acpi_resource, 222 + buffer), 223 + ACPI_CAST_PTR(union 224 + aml_resource, 225 + aml_buffer), 226 + info); 213 227 if (ACPI_FAILURE(status)) { 214 228 ACPI_REPORT_ERROR(("Could not convert AML resource (type %X) to resource, %s\n", *aml_buffer, acpi_format_exception(status))); 215 229 return_ACPI_STATUS(status); ··· 228 232 229 233 /* Normal exit on completion of an end_tag resource descriptor */ 230 234 231 - if (acpi_rs_get_resource_type(*aml_buffer) == 235 + if (acpi_ut_get_resource_type(aml_buffer) == 232 236 ACPI_RESOURCE_NAME_END_TAG) { 233 237 return_ACPI_STATUS(AE_OK); 234 238 } ··· 272 276 acpi_size aml_size_needed, u8 * output_buffer) 273 277 { 274 278 u8 *aml_buffer = output_buffer; 279 + u8 *end_aml_buffer = output_buffer + aml_size_needed; 275 280 acpi_status status; 276 281 277 282 ACPI_FUNCTION_TRACE("rs_convert_resources_to_aml"); 278 283 279 - /* Convert each resource descriptor in the list */ 284 + /* Walk the resource descriptor list, convert each descriptor */ 280 285 281 - while (1) { 282 - /* Validate Resource Descriptor Type before dispatch */ 286 + while (aml_buffer < end_aml_buffer) { 287 + /* Validate the Resource Type */ 283 288 284 289 if (resource->type > ACPI_RESOURCE_TYPE_MAX) { 285 290 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ··· 289 292 return_ACPI_STATUS(AE_BAD_DATA); 290 293 } 291 294 292 - /* Perform the conversion per resource type */ 295 + /* Perform the conversion */ 293 296 294 - status = 295 - acpi_gbl_set_resource_dispatch[resource->type] (resource, 296 - ACPI_CAST_PTR 297 - (union 298 - aml_resource, 299 - aml_buffer)); 297 + status = acpi_rs_convert_resource_to_aml(resource, 298 + ACPI_CAST_PTR(union 299 + aml_resource, 300 + aml_buffer), 301 + acpi_gbl_set_resource_dispatch 302 + [resource->type]); 300 303 if (ACPI_FAILURE(status)) { 301 304 ACPI_REPORT_ERROR(("Could not convert resource (type %X) to AML, %s\n", resource->type, acpi_format_exception(status))); 302 305 return_ACPI_STATUS(status); ··· 320 323 return_ACPI_STATUS(AE_OK); 321 324 } 322 325 323 - /* Extract the total length of the new descriptor */ 324 - /* Set the aml_buffer to point to the next (output) resource descriptor */ 325 - 326 - aml_buffer += 327 - acpi_rs_get_descriptor_length(ACPI_CAST_PTR 328 - (union aml_resource, 329 - aml_buffer)); 326 + /* 327 + * Extract the total length of the new descriptor and set the 328 + * aml_buffer to point to the next (output) resource descriptor 329 + */ 330 + aml_buffer += acpi_ut_get_descriptor_length(aml_buffer); 330 331 331 332 /* Point to the next input resource descriptor */ 332 333 333 334 resource = 334 335 ACPI_PTR_ADD(struct acpi_resource, resource, 335 336 resource->length); 337 + 338 + /* Check for end-of-list, normal exit */ 339 + 336 340 } 341 + 342 + /* Completed buffer, but did not find an end_tag resource descriptor */ 343 + 344 + return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); 337 345 }
+132 -205
drivers/acpi/resources/rsmemory.c
··· 49 49 50 50 /******************************************************************************* 51 51 * 52 - * FUNCTION: acpi_rs_get_memory24 53 - * 54 - * PARAMETERS: Aml - Pointer to the AML resource descriptor 55 - * aml_resource_length - Length of the resource from the AML header 56 - * Resource - Where the internal resource is returned 57 - * 58 - * RETURN: Status 59 - * 60 - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding 61 - * internal resource descriptor, simplifying bitflags and handling 62 - * alignment and endian issues if necessary. 52 + * acpi_rs_convert_memory24 63 53 * 64 54 ******************************************************************************/ 65 - acpi_status 66 - acpi_rs_get_memory24(union aml_resource * aml, 67 - u16 aml_resource_length, struct acpi_resource * resource) 68 - { 69 - ACPI_FUNCTION_TRACE("rs_get_memory24"); 55 + struct acpi_rsconvert_info acpi_rs_convert_memory24[4] = { 56 + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_MEMORY24, 57 + ACPI_RS_SIZE(struct acpi_resource_memory24), 58 + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_memory24)}, 70 59 71 - /* Get the Read/Write bit */ 60 + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_MEMORY24, 61 + sizeof(struct aml_resource_memory24), 62 + 0}, 72 63 73 - resource->data.memory24.read_write_attribute = 74 - (aml->memory24.information & 0x01); 64 + /* Read/Write bit */ 75 65 66 + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.memory24.write_protect), 67 + AML_OFFSET(memory24.flags), 68 + 0}, 76 69 /* 77 - * Get the following contiguous fields from the AML descriptor: 70 + * These fields are contiguous in both the source and destination: 78 71 * Minimum Base Address 79 72 * Maximum Base Address 80 73 * Address Base Alignment 81 74 * Range Length 82 75 */ 83 - acpi_rs_move_data(&resource->data.memory24.minimum, 84 - &aml->memory24.minimum, 4, ACPI_MOVE_TYPE_16_TO_32); 85 - 86 - /* Complete the resource header */ 87 - 88 - resource->type = ACPI_RESOURCE_TYPE_MEMORY24; 89 - resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_memory24); 90 - return_ACPI_STATUS(AE_OK); 91 - } 76 + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.memory24.minimum), 77 + AML_OFFSET(memory24.minimum), 78 + 4} 79 + }; 92 80 93 81 /******************************************************************************* 94 82 * 95 - * FUNCTION: acpi_rs_set_memory24 96 - * 97 - * PARAMETERS: Resource - Pointer to the resource descriptor 98 - * Aml - Where the AML descriptor is returned 99 - * 100 - * RETURN: Status 101 - * 102 - * DESCRIPTION: Convert an internal resource descriptor to the corresponding 103 - * external AML resource descriptor. 83 + * acpi_rs_convert_memory32 104 84 * 105 85 ******************************************************************************/ 106 86 107 - acpi_status 108 - acpi_rs_set_memory24(struct acpi_resource *resource, union aml_resource *aml) 109 - { 110 - ACPI_FUNCTION_TRACE("rs_set_memory24"); 87 + struct acpi_rsconvert_info acpi_rs_convert_memory32[4] = { 88 + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_MEMORY32, 89 + ACPI_RS_SIZE(struct acpi_resource_memory32), 90 + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_memory32)}, 111 91 112 - /* Set the Information Byte */ 92 + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_MEMORY32, 93 + sizeof(struct aml_resource_memory32), 94 + 0}, 113 95 114 - aml->memory24.information = (u8) 115 - (resource->data.memory24.read_write_attribute & 0x01); 96 + /* Read/Write bit */ 116 97 98 + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.memory32.write_protect), 99 + AML_OFFSET(memory32.flags), 100 + 0}, 117 101 /* 118 - * Set the following contiguous fields in the AML descriptor: 102 + * These fields are contiguous in both the source and destination: 119 103 * Minimum Base Address 120 104 * Maximum Base Address 121 105 * Address Base Alignment 122 106 * Range Length 123 107 */ 124 - acpi_rs_move_data(&aml->memory24.minimum, 125 - &resource->data.memory24.minimum, 4, 126 - ACPI_MOVE_TYPE_32_TO_16); 127 - 128 - /* Complete the AML descriptor header */ 129 - 130 - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_MEMORY24, 131 - sizeof(struct aml_resource_memory24), aml); 132 - return_ACPI_STATUS(AE_OK); 133 - } 108 + {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.memory32.minimum), 109 + AML_OFFSET(memory32.minimum), 110 + 4} 111 + }; 134 112 135 113 /******************************************************************************* 136 114 * 137 - * FUNCTION: acpi_rs_get_memory32 138 - * 139 - * PARAMETERS: Aml - Pointer to the AML resource descriptor 140 - * aml_resource_length - Length of the resource from the AML header 141 - * Resource - Where the internal resource is returned 142 - * 143 - * RETURN: Status 144 - * 145 - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding 146 - * internal resource descriptor, simplifying bitflags and handling 147 - * alignment and endian issues if necessary. 115 + * acpi_rs_convert_fixed_memory32 148 116 * 149 117 ******************************************************************************/ 150 118 151 - acpi_status 152 - acpi_rs_get_memory32(union aml_resource *aml, 153 - u16 aml_resource_length, struct acpi_resource *resource) 154 - { 155 - ACPI_FUNCTION_TRACE("rs_get_memory32"); 119 + struct acpi_rsconvert_info acpi_rs_convert_fixed_memory32[4] = { 120 + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_FIXED_MEMORY32, 121 + ACPI_RS_SIZE(struct acpi_resource_fixed_memory32), 122 + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_fixed_memory32)}, 156 123 157 - /* Get the Read/Write bit */ 124 + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_FIXED_MEMORY32, 125 + sizeof(struct aml_resource_fixed_memory32), 126 + 0}, 158 127 159 - resource->data.memory32.read_write_attribute = 160 - (aml->memory32.information & 0x01); 128 + /* Read/Write bit */ 161 129 130 + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.fixed_memory32.write_protect), 131 + AML_OFFSET(fixed_memory32.flags), 132 + 0}, 162 133 /* 163 - * Get the following contiguous fields from the AML descriptor: 164 - * Minimum Base Address 165 - * Maximum Base Address 166 - * Address Base Alignment 167 - * Range Length 168 - */ 169 - acpi_rs_move_data(&resource->data.memory32.minimum, 170 - &aml->memory32.minimum, 4, ACPI_MOVE_TYPE_32_TO_32); 171 - 172 - /* Complete the resource header */ 173 - 174 - resource->type = ACPI_RESOURCE_TYPE_MEMORY32; 175 - resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_memory32); 176 - return_ACPI_STATUS(AE_OK); 177 - } 178 - 179 - /******************************************************************************* 180 - * 181 - * FUNCTION: acpi_rs_set_memory32 182 - * 183 - * PARAMETERS: Resource - Pointer to the resource descriptor 184 - * Aml - Where the AML descriptor is returned 185 - * 186 - * RETURN: Status 187 - * 188 - * DESCRIPTION: Convert an internal resource descriptor to the corresponding 189 - * external AML resource descriptor. 190 - * 191 - ******************************************************************************/ 192 - 193 - acpi_status 194 - acpi_rs_set_memory32(struct acpi_resource *resource, union aml_resource *aml) 195 - { 196 - ACPI_FUNCTION_TRACE("rs_set_memory32"); 197 - 198 - /* Set the Information Byte */ 199 - 200 - aml->memory32.information = (u8) 201 - (resource->data.memory32.read_write_attribute & 0x01); 202 - 203 - /* 204 - * Set the following contiguous fields in the AML descriptor: 205 - * Minimum Base Address 206 - * Maximum Base Address 207 - * Address Base Alignment 208 - * Range Length 209 - */ 210 - acpi_rs_move_data(&aml->memory32.minimum, 211 - &resource->data.memory32.minimum, 4, 212 - ACPI_MOVE_TYPE_32_TO_32); 213 - 214 - /* Complete the AML descriptor header */ 215 - 216 - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_MEMORY32, 217 - sizeof(struct aml_resource_memory32), aml); 218 - return_ACPI_STATUS(AE_OK); 219 - } 220 - 221 - /******************************************************************************* 222 - * 223 - * FUNCTION: acpi_rs_get_fixed_memory32 224 - * 225 - * PARAMETERS: Aml - Pointer to the AML resource descriptor 226 - * aml_resource_length - Length of the resource from the AML header 227 - * Resource - Where the internal resource is returned 228 - * 229 - * RETURN: Status 230 - * 231 - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding 232 - * internal resource descriptor, simplifying bitflags and handling 233 - * alignment and endian issues if necessary. 234 - * 235 - ******************************************************************************/ 236 - 237 - acpi_status 238 - acpi_rs_get_fixed_memory32(union aml_resource *aml, 239 - u16 aml_resource_length, 240 - struct acpi_resource *resource) 241 - { 242 - ACPI_FUNCTION_TRACE("rs_get_fixed_memory32"); 243 - 244 - /* Get the Read/Write bit */ 245 - 246 - resource->data.fixed_memory32.read_write_attribute = 247 - (aml->fixed_memory32.information & 0x01); 248 - 249 - /* 250 - * Get the following contiguous fields from the AML descriptor: 134 + * These fields are contiguous in both the source and destination: 251 135 * Base Address 252 136 * Range Length 253 137 */ 254 - ACPI_MOVE_32_TO_32(&resource->data.fixed_memory32.address, 255 - &aml->fixed_memory32.address); 256 - ACPI_MOVE_32_TO_32(&resource->data.fixed_memory32.address_length, 257 - &aml->fixed_memory32.address_length); 258 - 259 - /* Complete the resource header */ 260 - 261 - resource->type = ACPI_RESOURCE_TYPE_FIXED_MEMORY32; 262 - resource->length = 263 - ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_memory32); 264 - return_ACPI_STATUS(AE_OK); 265 - } 138 + {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.fixed_memory32.address), 139 + AML_OFFSET(fixed_memory32.address), 140 + 2} 141 + }; 266 142 267 143 /******************************************************************************* 268 144 * 269 - * FUNCTION: acpi_rs_set_fixed_memory32 270 - * 271 - * PARAMETERS: Resource - Pointer to the resource descriptor 272 - * Aml - Where the AML descriptor is returned 273 - * 274 - * RETURN: Status 275 - * 276 - * DESCRIPTION: Convert an internal resource descriptor to the corresponding 277 - * external AML resource descriptor. 145 + * acpi_rs_get_vendor_small 278 146 * 279 147 ******************************************************************************/ 280 148 281 - acpi_status 282 - acpi_rs_set_fixed_memory32(struct acpi_resource *resource, 283 - union aml_resource *aml) 284 - { 285 - ACPI_FUNCTION_TRACE("rs_set_fixed_memory32"); 149 + struct acpi_rsconvert_info acpi_rs_get_vendor_small[3] = { 150 + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_VENDOR, 151 + ACPI_RS_SIZE(struct acpi_resource_vendor), 152 + ACPI_RSC_TABLE_SIZE(acpi_rs_get_vendor_small)}, 286 153 287 - /* Set the Information Byte */ 154 + /* Length of the vendor data (byte count) */ 288 155 289 - aml->fixed_memory32.information = (u8) 290 - (resource->data.fixed_memory32.read_write_attribute & 0x01); 156 + {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length), 157 + 0, 158 + sizeof(u8)} 159 + , 160 + 161 + /* Vendor data */ 162 + 163 + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]), 164 + sizeof(struct aml_resource_small_header), 165 + 0} 166 + }; 167 + 168 + /******************************************************************************* 169 + * 170 + * acpi_rs_get_vendor_large 171 + * 172 + ******************************************************************************/ 173 + 174 + struct acpi_rsconvert_info acpi_rs_get_vendor_large[3] = { 175 + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_VENDOR, 176 + ACPI_RS_SIZE(struct acpi_resource_vendor), 177 + ACPI_RSC_TABLE_SIZE(acpi_rs_get_vendor_large)}, 178 + 179 + /* Length of the vendor data (byte count) */ 180 + 181 + {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length), 182 + 0, 183 + sizeof(u8)} 184 + , 185 + 186 + /* Vendor data */ 187 + 188 + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]), 189 + sizeof(struct aml_resource_large_header), 190 + 0} 191 + }; 192 + 193 + /******************************************************************************* 194 + * 195 + * acpi_rs_set_vendor 196 + * 197 + ******************************************************************************/ 198 + 199 + struct acpi_rsconvert_info acpi_rs_set_vendor[7] = { 200 + /* Default is a small vendor descriptor */ 201 + 202 + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_VENDOR_SMALL, 203 + sizeof(struct aml_resource_small_header), 204 + ACPI_RSC_TABLE_SIZE(acpi_rs_set_vendor)}, 205 + 206 + /* Get the length and copy the data */ 207 + 208 + {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length), 209 + 0, 210 + 0}, 211 + 212 + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]), 213 + sizeof(struct aml_resource_small_header), 214 + 0}, 291 215 292 216 /* 293 - * Set the following contiguous fields in the AML descriptor: 294 - * Base Address 295 - * Range Length 217 + * All done if the Vendor byte length is 7 or less, meaning that it will 218 + * fit within a small descriptor 296 219 */ 297 - ACPI_MOVE_32_TO_32(&aml->fixed_memory32.address, 298 - &resource->data.fixed_memory32.address); 299 - ACPI_MOVE_32_TO_32(&aml->fixed_memory32.address_length, 300 - &resource->data.fixed_memory32.address_length); 220 + {ACPI_RSC_EXIT_LE, 0, 0, 7}, 301 221 302 - /* Complete the AML descriptor header */ 222 + /* Must create a large vendor descriptor */ 303 223 304 - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_FIXED_MEMORY32, 305 - sizeof(struct aml_resource_fixed_memory32), 306 - aml); 307 - return_ACPI_STATUS(AE_OK); 308 - } 224 + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_VENDOR_LARGE, 225 + sizeof(struct aml_resource_large_header), 226 + 0}, 227 + 228 + {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length), 229 + 0, 230 + 0}, 231 + 232 + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]), 233 + sizeof(struct aml_resource_large_header), 234 + 0} 235 + };
+442 -370
drivers/acpi/resources/rsmisc.c
··· 47 47 #define _COMPONENT ACPI_RESOURCES 48 48 ACPI_MODULE_NAME("rsmisc") 49 49 50 + #define INIT_RESOURCE_TYPE(i) i->resource_offset 51 + #define INIT_RESOURCE_LENGTH(i) i->aml_offset 52 + #define INIT_TABLE_LENGTH(i) i->value 53 + #define COMPARE_OPCODE(i) i->resource_offset 54 + #define COMPARE_TARGET(i) i->aml_offset 55 + #define COMPARE_VALUE(i) i->value 50 56 /******************************************************************************* 51 57 * 52 - * FUNCTION: acpi_rs_get_generic_reg 53 - * 54 - * PARAMETERS: Aml - Pointer to the AML resource descriptor 55 - * aml_resource_length - Length of the resource from the AML header 56 - * Resource - Where the internal resource is returned 57 - * 58 - * RETURN: Status 59 - * 60 - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding 61 - * internal resource descriptor, simplifying bitflags and handling 62 - * alignment and endian issues if necessary. 63 - * 64 - ******************************************************************************/ 65 - acpi_status 66 - acpi_rs_get_generic_reg(union aml_resource *aml, 67 - u16 aml_resource_length, struct acpi_resource *resource) 68 - { 69 - ACPI_FUNCTION_TRACE("rs_get_generic_reg"); 70 - 71 - /* 72 - * Get the following fields from the AML descriptor: 73 - * Address Space ID 74 - * Register Bit Width 75 - * Register Bit Offset 76 - * Access Size 77 - * Register Address 78 - */ 79 - resource->data.generic_reg.space_id = aml->generic_reg.address_space_id; 80 - resource->data.generic_reg.bit_width = aml->generic_reg.bit_width; 81 - resource->data.generic_reg.bit_offset = aml->generic_reg.bit_offset; 82 - resource->data.generic_reg.access_size = aml->generic_reg.access_size; 83 - ACPI_MOVE_64_TO_64(&resource->data.generic_reg.address, 84 - &aml->generic_reg.address); 85 - 86 - /* Complete the resource header */ 87 - 88 - resource->type = ACPI_RESOURCE_TYPE_GENERIC_REGISTER; 89 - resource->length = 90 - ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_register); 91 - return_ACPI_STATUS(AE_OK); 92 - } 93 - 94 - /******************************************************************************* 95 - * 96 - * FUNCTION: acpi_rs_set_generic_reg 58 + * FUNCTION: acpi_rs_convert_aml_to_resource 97 59 * 98 60 * PARAMETERS: Resource - Pointer to the resource descriptor 99 61 * Aml - Where the AML descriptor is returned 62 + * Info - Pointer to appropriate conversion table 100 63 * 101 64 * RETURN: Status 102 65 * 103 - * DESCRIPTION: Convert an internal resource descriptor to the corresponding 104 - * external AML resource descriptor. 66 + * DESCRIPTION: Convert an external AML resource descriptor to the corresponding 67 + * internal resource descriptor 105 68 * 106 69 ******************************************************************************/ 107 - 108 70 acpi_status 109 - acpi_rs_set_generic_reg(struct acpi_resource *resource, union aml_resource *aml) 71 + acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, 72 + union aml_resource *aml, 73 + struct acpi_rsconvert_info *info) 110 74 { 111 - ACPI_FUNCTION_TRACE("rs_set_generic_reg"); 75 + acpi_rs_length aml_resource_length; 76 + void *source; 77 + void *destination; 78 + char *target; 79 + u8 count; 80 + u8 flags_mode = FALSE; 81 + u16 item_count = 0; 82 + u16 temp16 = 0; 112 83 113 - /* 114 - * Set the following fields in the AML descriptor: 115 - * Address Space ID 116 - * Register Bit Width 117 - * Register Bit Offset 118 - * Access Size 119 - * Register Address 120 - */ 121 - aml->generic_reg.address_space_id = 122 - (u8) resource->data.generic_reg.space_id; 123 - aml->generic_reg.bit_width = (u8) resource->data.generic_reg.bit_width; 124 - aml->generic_reg.bit_offset = 125 - (u8) resource->data.generic_reg.bit_offset; 126 - aml->generic_reg.access_size = 127 - (u8) resource->data.generic_reg.access_size; 128 - ACPI_MOVE_64_TO_64(&aml->generic_reg.address, 129 - &resource->data.generic_reg.address); 84 + ACPI_FUNCTION_TRACE("rs_get_resource"); 130 85 131 - /* Complete the AML descriptor header */ 132 - 133 - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_GENERIC_REGISTER, 134 - sizeof(struct 135 - aml_resource_generic_register), aml); 136 - return_ACPI_STATUS(AE_OK); 137 - } 138 - 139 - /******************************************************************************* 140 - * 141 - * FUNCTION: acpi_rs_get_vendor 142 - * 143 - * PARAMETERS: Aml - Pointer to the AML resource descriptor 144 - * aml_resource_length - Length of the resource from the AML header 145 - * Resource - Where the internal resource is returned 146 - * 147 - * RETURN: Status 148 - * 149 - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding 150 - * internal resource descriptor, simplifying bitflags and handling 151 - * alignment and endian issues if necessary. 152 - * 153 - ******************************************************************************/ 154 - 155 - acpi_status 156 - acpi_rs_get_vendor(union aml_resource *aml, 157 - u16 aml_resource_length, struct acpi_resource *resource) 158 - { 159 - u8 *aml_byte_data; 160 - 161 - ACPI_FUNCTION_TRACE("rs_get_vendor"); 162 - 163 - /* Determine if this is a large or small vendor specific item */ 164 - 165 - if (aml->large_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { 166 - /* Large item, Point to the first vendor byte */ 167 - 168 - aml_byte_data = 169 - ((u8 *) aml) + sizeof(struct aml_resource_large_header); 170 - } else { 171 - /* Small item, Point to the first vendor byte */ 172 - 173 - aml_byte_data = 174 - ((u8 *) aml) + sizeof(struct aml_resource_small_header); 86 + if (((acpi_native_uint) resource) & 0x3) { 87 + acpi_os_printf 88 + ("**** GET: Misaligned resource pointer: %p Type %2.2X Len %X\n", 89 + resource, resource->type, resource->length); 175 90 } 176 91 177 - /* Copy the vendor-specific bytes */ 92 + /* Extract the resource Length field (does not include header length) */ 178 93 179 - ACPI_MEMCPY(resource->data.vendor.byte_data, 180 - aml_byte_data, aml_resource_length); 181 - resource->data.vendor.byte_length = aml_resource_length; 94 + aml_resource_length = acpi_ut_get_resource_length(aml); 182 95 183 96 /* 184 - * In order for the struct_size to fall on a 32-bit boundary, 185 - * calculate the length of the vendor string and expand the 186 - * struct_size to the next 32-bit boundary. 97 + * First table entry must be ACPI_RSC_INITxxx and must contain the 98 + * table length (# of table entries) 187 99 */ 188 - resource->type = ACPI_RESOURCE_TYPE_VENDOR; 189 - resource->length = ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor) + 190 - ACPI_ROUND_UP_to_32_bITS(aml_resource_length); 191 - return_ACPI_STATUS(AE_OK); 192 - } 100 + count = INIT_TABLE_LENGTH(info); 193 101 194 - /******************************************************************************* 195 - * 196 - * FUNCTION: acpi_rs_set_vendor 197 - * 198 - * PARAMETERS: Resource - Pointer to the resource descriptor 199 - * Aml - Where the AML descriptor is returned 200 - * 201 - * RETURN: Status 202 - * 203 - * DESCRIPTION: Convert an internal resource descriptor to the corresponding 204 - * external AML resource descriptor. 205 - * 206 - ******************************************************************************/ 102 + while (count) { 103 + /* 104 + * Source is the external AML byte stream buffer, 105 + * destination is the internal resource descriptor 106 + */ 107 + source = ((u8 *) aml) + info->aml_offset; 108 + destination = ((u8 *) resource) + info->resource_offset; 207 109 208 - acpi_status 209 - acpi_rs_set_vendor(struct acpi_resource *resource, union aml_resource *aml) 210 - { 211 - u32 resource_length; 212 - u8 *source; 213 - u8 *destination; 110 + switch (info->opcode) { 111 + case ACPI_RSC_INITGET: 112 + /* 113 + * Get the resource type and the initial (minimum) length 114 + */ 115 + ACPI_MEMSET(resource, 0, INIT_RESOURCE_LENGTH(info)); 116 + resource->type = INIT_RESOURCE_TYPE(info); 117 + resource->length = INIT_RESOURCE_LENGTH(info); 118 + break; 214 119 215 - ACPI_FUNCTION_TRACE("rs_set_vendor"); 120 + case ACPI_RSC_INITSET: 121 + break; 216 122 217 - resource_length = resource->data.vendor.byte_length; 218 - source = ACPI_CAST_PTR(u8, resource->data.vendor.byte_data); 123 + case ACPI_RSC_FLAGINIT: 219 124 220 - /* Length determines if this is a large or small resource */ 125 + flags_mode = TRUE; 126 + break; 221 127 222 - if (resource_length > 7) { 223 - /* Large item, get pointer to the data part of the descriptor */ 128 + case ACPI_RSC_1BITFLAG: 129 + /* 130 + * Mask and shift the flag bit 131 + */ 132 + *((u8 *) destination) = (u8) 133 + ((*((u8 *) source) >> info->value) & 0x01); 134 + break; 224 135 225 - destination = 226 - ((u8 *) aml) + sizeof(struct aml_resource_large_header); 136 + case ACPI_RSC_2BITFLAG: 137 + /* 138 + * Mask and shift the flag bits 139 + */ 140 + *((u8 *) destination) = (u8) 141 + ((*((u8 *) source) >> info->value) & 0x03); 142 + break; 227 143 228 - /* Complete the AML descriptor header */ 144 + case ACPI_RSC_COUNT: 229 145 230 - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_VENDOR_LARGE, 231 - (u32) (resource_length + 232 - sizeof(struct 233 - aml_resource_large_header)), 234 - aml); 235 - } else { 236 - /* Small item, get pointer to the data part of the descriptor */ 146 + item_count = *((u8 *) source); 147 + *((u8 *) destination) = (u8) item_count; 237 148 238 - destination = 239 - ((u8 *) aml) + sizeof(struct aml_resource_small_header); 149 + resource->length = resource->length + 150 + (info->value * (item_count - 1)); 151 + break; 240 152 241 - /* Complete the AML descriptor header */ 153 + case ACPI_RSC_COUNT16: 242 154 243 - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_VENDOR_SMALL, 244 - (u32) (resource_length + 245 - sizeof(struct 246 - aml_resource_small_header)), 247 - aml); 248 - } 155 + item_count = aml_resource_length; 156 + *((u16 *) destination) = item_count; 249 157 250 - /* Copy the vendor-specific bytes */ 158 + resource->length = resource->length + 159 + (info->value * (item_count - 1)); 160 + break; 251 161 252 - ACPI_MEMCPY(destination, source, resource_length); 253 - return_ACPI_STATUS(AE_OK); 254 - } 162 + case ACPI_RSC_LENGTH: 255 163 256 - /******************************************************************************* 257 - * 258 - * FUNCTION: acpi_rs_get_start_dpf 259 - * 260 - * PARAMETERS: Aml - Pointer to the AML resource descriptor 261 - * aml_resource_length - Length of the resource from the AML header 262 - * Resource - Where the internal resource is returned 263 - * 264 - * RETURN: Status 265 - * 266 - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding 267 - * internal resource descriptor, simplifying bitflags and handling 268 - * alignment and endian issues if necessary. 269 - * 270 - ******************************************************************************/ 164 + resource->length = resource->length + info->value; 165 + break; 271 166 272 - acpi_status 273 - acpi_rs_get_start_dpf(union aml_resource *aml, 274 - u16 aml_resource_length, struct acpi_resource *resource) 275 - { 276 - ACPI_FUNCTION_TRACE("rs_get_start_dpf"); 167 + case ACPI_RSC_MOVE8: 168 + case ACPI_RSC_MOVE16: 169 + case ACPI_RSC_MOVE32: 170 + case ACPI_RSC_MOVE64: 171 + /* 172 + * Raw data move. Use the Info value field unless item_count has 173 + * been previously initialized via a COUNT opcode 174 + */ 175 + if (info->value) { 176 + item_count = info->value; 177 + } 178 + acpi_rs_move_data(destination, source, item_count, 179 + info->opcode); 180 + break; 277 181 278 - /* Get the flags byte if present */ 182 + case ACPI_RSC_SET8: 279 183 280 - if (aml_resource_length == 1) { 281 - /* Get the Compatibility priority */ 184 + ACPI_MEMSET(destination, info->aml_offset, info->value); 185 + break; 282 186 283 - resource->data.start_dpf.compatibility_priority = 284 - (aml->start_dpf.flags & 0x03); 187 + case ACPI_RSC_DATA8: 285 188 286 - if (resource->data.start_dpf.compatibility_priority >= 3) { 287 - return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE); 189 + target = ((char *)resource) + info->value; 190 + ACPI_MEMCPY(destination, source, 191 + *(ACPI_CAST_PTR(u16, target))); 192 + break; 193 + 194 + case ACPI_RSC_ADDRESS: 195 + /* 196 + * Common handler for address descriptor flags 197 + */ 198 + if (!acpi_rs_get_address_common(resource, aml)) { 199 + return_ACPI_STATUS 200 + (AE_AML_INVALID_RESOURCE_TYPE); 201 + } 202 + break; 203 + 204 + case ACPI_RSC_SOURCE: 205 + /* 206 + * Optional resource_source (Index and String) 207 + */ 208 + resource->length += 209 + acpi_rs_get_resource_source(aml_resource_length, 210 + info->value, 211 + destination, aml, NULL); 212 + break; 213 + 214 + case ACPI_RSC_SOURCEX: 215 + /* 216 + * Optional resource_source (Index and String). This is the more 217 + * complicated case used by the Interrupt() macro 218 + */ 219 + target = 220 + ((char *)resource) + info->aml_offset + 221 + (item_count * 4); 222 + 223 + resource->length += 224 + acpi_rs_get_resource_source(aml_resource_length, 225 + (acpi_rs_length) (((item_count - 1) * sizeof(u32)) + info->value), destination, aml, target); 226 + break; 227 + 228 + case ACPI_RSC_BITMASK: 229 + /* 230 + * 8-bit encoded bitmask (DMA macro) 231 + */ 232 + item_count = 233 + acpi_rs_decode_bitmask(*((u8 *) source), 234 + destination); 235 + if (item_count) { 236 + resource->length += 237 + resource->length + (item_count - 1); 238 + } 239 + 240 + target = ((char *)resource) + info->value; 241 + *((u8 *) target) = (u8) item_count; 242 + break; 243 + 244 + case ACPI_RSC_BITMASK16: 245 + /* 246 + * 16-bit encoded bitmask (IRQ macro) 247 + */ 248 + ACPI_MOVE_16_TO_16(&temp16, source); 249 + 250 + item_count = 251 + acpi_rs_decode_bitmask(temp16, destination); 252 + if (item_count) { 253 + resource->length = 254 + resource->length + (item_count - 1); 255 + } 256 + 257 + target = ((char *)resource) + info->value; 258 + *((u8 *) target) = (u8) item_count; 259 + break; 260 + 261 + case ACPI_RSC_EXIT_NE: 262 + /* 263 + * Control - Exit conversion if not equal 264 + */ 265 + switch (info->resource_offset) { 266 + case ACPI_RSC_COMPARE_AML_LENGTH: 267 + if (aml_resource_length != info->value) { 268 + goto exit; 269 + } 270 + break; 271 + 272 + case ACPI_RSC_COMPARE_VALUE: 273 + if (*((u8 *) source) != info->value) { 274 + goto exit; 275 + } 276 + break; 277 + 278 + default: 279 + acpi_os_printf 280 + ("*** Invalid conversion sub-opcode\n"); 281 + return_ACPI_STATUS(AE_BAD_PARAMETER); 282 + } 283 + break; 284 + 285 + default: 286 + 287 + acpi_os_printf("*** Invalid conversion opcode\n"); 288 + return_ACPI_STATUS(AE_BAD_PARAMETER); 288 289 } 289 290 290 - /* Get the Performance/Robustness preference */ 291 + count--; 292 + info++; 293 + } 291 294 292 - resource->data.start_dpf.performance_robustness = 293 - ((aml->start_dpf.flags >> 2) & 0x03); 295 + exit: 296 + if (!flags_mode) { 297 + /* Round the resource struct length up to the next 32-bit boundary */ 294 298 295 - if (resource->data.start_dpf.performance_robustness >= 3) { 296 - return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE); 299 + resource->length = ACPI_ROUND_UP_to_32_bITS(resource->length); 300 + } 301 + return_ACPI_STATUS(AE_OK); 302 + } 303 + 304 + /******************************************************************************* 305 + * 306 + * FUNCTION: acpi_rs_convert_resource_to_aml 307 + * 308 + * PARAMETERS: Resource - Pointer to the resource descriptor 309 + * Aml - Where the AML descriptor is returned 310 + * Info - Pointer to appropriate conversion table 311 + * 312 + * RETURN: Status 313 + * 314 + * DESCRIPTION: Convert an internal resource descriptor to the corresponding 315 + * external AML resource descriptor. 316 + * 317 + ******************************************************************************/ 318 + 319 + acpi_status 320 + acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, 321 + union aml_resource *aml, 322 + struct acpi_rsconvert_info *info) 323 + { 324 + void *source = NULL; 325 + void *destination; 326 + acpi_rsdesc_size aml_length = 0; 327 + u8 count; 328 + u16 temp16 = 0; 329 + u16 item_count = 0; 330 + 331 + ACPI_FUNCTION_TRACE("rs_convert_resource_to_aml"); 332 + 333 + /* Validate the Resource pointer, must be 32-bit aligned */ 334 + 335 + if (((acpi_native_uint) resource) & 0x3) { 336 + acpi_os_printf 337 + ("**** SET: Misaligned resource pointer: %p Type %2.2X Len %X\n", 338 + resource, resource->type, resource->length); 339 + } 340 + 341 + /* 342 + * First table entry must be ACPI_RSC_INITxxx and must contain the 343 + * table length (# of table entries) 344 + */ 345 + count = INIT_TABLE_LENGTH(info); 346 + 347 + while (count) { 348 + /* 349 + * Source is the internal resource descriptor, 350 + * destination is the external AML byte stream buffer 351 + */ 352 + source = ((u8 *) resource) + info->resource_offset; 353 + destination = ((u8 *) aml) + info->aml_offset; 354 + 355 + switch (info->opcode) { 356 + case ACPI_RSC_INITSET: 357 + 358 + ACPI_MEMSET(aml, 0, INIT_RESOURCE_LENGTH(info)); 359 + aml_length = INIT_RESOURCE_LENGTH(info); 360 + acpi_rs_set_resource_header(INIT_RESOURCE_TYPE(info), 361 + aml_length, aml); 362 + break; 363 + 364 + case ACPI_RSC_INITGET: 365 + break; 366 + 367 + case ACPI_RSC_FLAGINIT: 368 + /* 369 + * Clear the flag byte 370 + */ 371 + *((u8 *) destination) = 0; 372 + break; 373 + 374 + case ACPI_RSC_1BITFLAG: 375 + /* 376 + * Mask and shift the flag bit 377 + */ 378 + *((u8 *) destination) |= (u8) 379 + ((*((u8 *) source) & 0x01) << info->value); 380 + break; 381 + 382 + case ACPI_RSC_2BITFLAG: 383 + /* 384 + * Mask and shift the flag bits 385 + */ 386 + *((u8 *) destination) |= (u8) 387 + ((*((u8 *) source) & 0x03) << info->value); 388 + break; 389 + 390 + case ACPI_RSC_COUNT: 391 + 392 + item_count = *((u8 *) source); 393 + *((u8 *) destination) = (u8) item_count; 394 + 395 + aml_length = (u16) (aml_length + 396 + (info->value * (item_count - 1))); 397 + break; 398 + 399 + case ACPI_RSC_COUNT16: 400 + 401 + item_count = *((u16 *) source); 402 + aml_length = (u16) (aml_length + item_count); 403 + acpi_rs_set_resource_length(aml_length, aml); 404 + break; 405 + 406 + case ACPI_RSC_LENGTH: 407 + 408 + acpi_rs_set_resource_length(info->value, aml); 409 + break; 410 + 411 + case ACPI_RSC_MOVE8: 412 + case ACPI_RSC_MOVE16: 413 + case ACPI_RSC_MOVE32: 414 + case ACPI_RSC_MOVE64: 415 + 416 + if (info->value) { 417 + item_count = info->value; 418 + } 419 + acpi_rs_move_data(destination, source, item_count, 420 + info->opcode); 421 + break; 422 + 423 + case ACPI_RSC_ADDRESS: 424 + 425 + /* Set the Resource Type, General Flags, and Type-Specific Flags */ 426 + 427 + acpi_rs_set_address_common(aml, resource); 428 + break; 429 + 430 + case ACPI_RSC_SOURCEX: 431 + /* 432 + * Optional resource_source (Index and String) 433 + */ 434 + aml_length = 435 + acpi_rs_set_resource_source(aml, 436 + (acpi_rs_length) 437 + aml_length, source); 438 + acpi_rs_set_resource_length(aml_length, aml); 439 + break; 440 + 441 + case ACPI_RSC_SOURCE: 442 + /* 443 + * Optional resource_source (Index and String). This is the more 444 + * complicated case used by the Interrupt() macro 445 + */ 446 + aml_length = 447 + acpi_rs_set_resource_source(aml, info->value, 448 + source); 449 + acpi_rs_set_resource_length(aml_length, aml); 450 + break; 451 + 452 + case ACPI_RSC_BITMASK: 453 + /* 454 + * 8-bit encoded bitmask (DMA macro) 455 + */ 456 + *((u8 *) destination) = (u8) 457 + acpi_rs_encode_bitmask(source, 458 + *(((u8 *) resource) + 459 + info->value)); 460 + break; 461 + 462 + case ACPI_RSC_BITMASK16: 463 + /* 464 + * 16-bit encoded bitmask (IRQ macro) 465 + */ 466 + temp16 = 467 + acpi_rs_encode_bitmask(source, 468 + *(((u8 *) resource) + 469 + info->value)); 470 + ACPI_MOVE_16_TO_16(destination, &temp16); 471 + break; 472 + 473 + case ACPI_RSC_EXIT_LE: 474 + /* 475 + * Control - Exit conversion if less than or equal 476 + */ 477 + if (item_count <= info->value) { 478 + goto exit; 479 + } 480 + break; 481 + 482 + case ACPI_RSC_EXIT_NE: 483 + /* 484 + * Control - Exit conversion if not equal 485 + */ 486 + switch (COMPARE_OPCODE(info)) { 487 + case ACPI_RSC_COMPARE_VALUE: 488 + if (* 489 + ((u8 *) (((u8 *) resource) + 490 + COMPARE_TARGET(info))) != 491 + COMPARE_VALUE(info)) { 492 + goto exit; 493 + } 494 + break; 495 + 496 + default: 497 + acpi_os_printf 498 + ("*** Invalid conversion sub-opcode\n"); 499 + return_ACPI_STATUS(AE_BAD_PARAMETER); 500 + } 501 + break; 502 + 503 + default: 504 + 505 + acpi_os_printf("*** Invalid conversion opcode\n"); 506 + return_ACPI_STATUS(AE_BAD_PARAMETER); 297 507 } 298 - } else { 299 - /* start_dependent_no_pri(), no flags byte, set defaults */ 300 508 301 - resource->data.start_dpf.compatibility_priority = 302 - ACPI_ACCEPTABLE_CONFIGURATION; 303 - 304 - resource->data.start_dpf.performance_robustness = 305 - ACPI_ACCEPTABLE_CONFIGURATION; 509 + count--; 510 + info++; 306 511 } 307 512 308 - /* Complete the resource header */ 309 - 310 - resource->type = ACPI_RESOURCE_TYPE_START_DEPENDENT; 311 - resource->length = 312 - ACPI_SIZEOF_RESOURCE(struct acpi_resource_start_dependent); 513 + exit: 313 514 return_ACPI_STATUS(AE_OK); 314 515 } 315 516 316 - /******************************************************************************* 317 - * 318 - * FUNCTION: acpi_rs_set_start_dpf 319 - * 320 - * PARAMETERS: Resource - Pointer to the resource descriptor 321 - * Aml - Where the AML descriptor is returned 322 - * 323 - * RETURN: Status 324 - * 325 - * DESCRIPTION: Convert an internal resource descriptor to the corresponding 326 - * external AML resource descriptor. 327 - * 328 - ******************************************************************************/ 517 + #if 0 518 + /* Previous resource validations */ 329 519 330 - acpi_status 331 - acpi_rs_set_start_dpf(struct acpi_resource *resource, union aml_resource *aml) 332 - { 333 - ACPI_FUNCTION_TRACE("rs_set_start_dpf"); 520 + if (aml->ext_address64.revision_iD != AML_RESOURCE_EXTENDED_ADDRESS_REVISION) { 521 + return_ACPI_STATUS(AE_SUPPORT); 522 + } 334 523 524 + if (resource->data.start_dpf.performance_robustness >= 3) { 525 + return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE); 526 + } 527 + 528 + if (((aml->irq.flags & 0x09) == 0x00) || ((aml->irq.flags & 0x09) == 0x09)) { 335 529 /* 336 - * The descriptor type field is set based upon whether a byte is needed 337 - * to contain Priority data. 530 + * Only [active_high, edge_sensitive] or [active_low, level_sensitive] 531 + * polarity/trigger interrupts are allowed (ACPI spec, section 532 + * "IRQ Format"), so 0x00 and 0x09 are illegal. 338 533 */ 339 - if (ACPI_ACCEPTABLE_CONFIGURATION == 340 - resource->data.start_dpf.compatibility_priority && 341 - ACPI_ACCEPTABLE_CONFIGURATION == 342 - resource->data.start_dpf.performance_robustness) { 343 - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_START_DEPENDENT, 344 - sizeof(struct 345 - aml_resource_start_dependent_noprio), 346 - aml); 347 - } else { 348 - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_START_DEPENDENT, 349 - sizeof(struct 350 - aml_resource_start_dependent), 351 - aml); 352 - 353 - /* Set the Flags byte */ 354 - 355 - aml->start_dpf.flags = (u8) 356 - (((resource->data.start_dpf. 357 - performance_robustness & 0x03) << 2) | (resource->data. 358 - start_dpf. 359 - compatibility_priority 360 - & 0x03)); 361 - } 362 - return_ACPI_STATUS(AE_OK); 534 + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 535 + "Invalid interrupt polarity/trigger in resource list, %X\n", 536 + aml->irq.flags)); 537 + return_ACPI_STATUS(AE_BAD_DATA); 363 538 } 364 539 365 - /******************************************************************************* 366 - * 367 - * FUNCTION: acpi_rs_get_end_dpf 368 - * 369 - * PARAMETERS: Aml - Pointer to the AML resource descriptor 370 - * aml_resource_length - Length of the resource from the AML header 371 - * Resource - Where the internal resource is returned 372 - * 373 - * RETURN: Status 374 - * 375 - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding 376 - * internal resource descriptor, simplifying bitflags and handling 377 - * alignment and endian issues if necessary. 378 - * 379 - ******************************************************************************/ 540 + resource->data.extended_irq.interrupt_count = temp8; 541 + if (temp8 < 1) { 542 + /* Must have at least one IRQ */ 380 543 381 - acpi_status 382 - acpi_rs_get_end_dpf(union aml_resource *aml, 383 - u16 aml_resource_length, struct acpi_resource *resource) 384 - { 385 - ACPI_FUNCTION_TRACE("rs_get_end_dpf"); 386 - 387 - /* Complete the resource header */ 388 - 389 - resource->type = ACPI_RESOURCE_TYPE_END_DEPENDENT; 390 - resource->length = (u32) ACPI_RESOURCE_LENGTH; 391 - return_ACPI_STATUS(AE_OK); 544 + return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); 392 545 } 393 546 394 - /******************************************************************************* 395 - * 396 - * FUNCTION: acpi_rs_set_end_dpf 397 - * 398 - * PARAMETERS: Resource - Pointer to the resource descriptor 399 - * Aml - Where the AML descriptor is returned 400 - * 401 - * RETURN: Status 402 - * 403 - * DESCRIPTION: Convert an internal resource descriptor to the corresponding 404 - * external AML resource descriptor. 405 - * 406 - ******************************************************************************/ 407 - 408 - acpi_status 409 - acpi_rs_set_end_dpf(struct acpi_resource *resource, union aml_resource *aml) 410 - { 411 - ACPI_FUNCTION_TRACE("rs_set_end_dpf"); 412 - 413 - /* Complete the AML descriptor header */ 414 - 415 - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_END_DEPENDENT, 416 - sizeof(struct aml_resource_end_dependent), 417 - aml); 418 - return_ACPI_STATUS(AE_OK); 547 + if (resource->data.dma.transfer == 0x03) { 548 + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 549 + "Invalid DMA.Transfer preference (3)\n")); 550 + return_ACPI_STATUS(AE_BAD_DATA); 419 551 } 420 - 421 - /******************************************************************************* 422 - * 423 - * FUNCTION: acpi_rs_get_end_tag 424 - * 425 - * PARAMETERS: Aml - Pointer to the AML resource descriptor 426 - * aml_resource_length - Length of the resource from the AML header 427 - * Resource - Where the internal resource is returned 428 - * 429 - * RETURN: Status 430 - * 431 - * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding 432 - * internal resource descriptor, simplifying bitflags and handling 433 - * alignment and endian issues if necessary. 434 - * 435 - ******************************************************************************/ 436 - 437 - acpi_status 438 - acpi_rs_get_end_tag(union aml_resource *aml, 439 - u16 aml_resource_length, struct acpi_resource *resource) 440 - { 441 - ACPI_FUNCTION_TRACE("rs_get_end_tag"); 442 - 443 - /* Complete the resource header */ 444 - 445 - resource->type = ACPI_RESOURCE_TYPE_END_TAG; 446 - resource->length = ACPI_RESOURCE_LENGTH; 447 - return_ACPI_STATUS(AE_OK); 448 - } 449 - 450 - /******************************************************************************* 451 - * 452 - * FUNCTION: acpi_rs_set_end_tag 453 - * 454 - * PARAMETERS: Resource - Pointer to the resource descriptor 455 - * Aml - Where the AML descriptor is returned 456 - * 457 - * RETURN: Status 458 - * 459 - * DESCRIPTION: Convert an internal resource descriptor to the corresponding 460 - * external AML resource descriptor. 461 - * 462 - ******************************************************************************/ 463 - 464 - acpi_status 465 - acpi_rs_set_end_tag(struct acpi_resource *resource, union aml_resource *aml) 466 - { 467 - ACPI_FUNCTION_TRACE("rs_set_end_tag"); 468 - 469 - /* 470 - * Set the Checksum - zero means that the resource data is treated as if 471 - * the checksum operation succeeded (ACPI Spec 1.0b Section 6.4.2.8) 472 - */ 473 - aml->end_tag.checksum = 0; 474 - 475 - /* Complete the AML descriptor header */ 476 - 477 - acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_END_TAG, 478 - sizeof(struct aml_resource_end_tag), aml); 479 - return_ACPI_STATUS(AE_OK); 480 - } 552 + #endif
+137 -140
drivers/acpi/resources/rsutils.c
··· 50 50 51 51 /******************************************************************************* 52 52 * 53 + * FUNCTION: acpi_rs_decode_bitmask 54 + * 55 + * PARAMETERS: Mask - Bitmask to decode 56 + * List - Where the converted list is returned 57 + * 58 + * RETURN: Count of bits set (length of list) 59 + * 60 + * DESCRIPTION: Convert a bit mask into a list of values 61 + * 62 + ******************************************************************************/ 63 + u8 acpi_rs_decode_bitmask(u16 mask, u8 * list) 64 + { 65 + acpi_native_uint i; 66 + u8 bit_count; 67 + 68 + /* Decode the mask bits */ 69 + 70 + for (i = 0, bit_count = 0; mask; i++) { 71 + if (mask & 0x0001) { 72 + list[bit_count] = (u8) i; 73 + bit_count++; 74 + } 75 + 76 + mask >>= 1; 77 + } 78 + 79 + return (bit_count); 80 + } 81 + 82 + /******************************************************************************* 83 + * 84 + * FUNCTION: acpi_rs_encode_bitmask 85 + * 86 + * PARAMETERS: List - List of values to encode 87 + * Count - Length of list 88 + * 89 + * RETURN: Encoded bitmask 90 + * 91 + * DESCRIPTION: Convert a list of values to an encoded bitmask 92 + * 93 + ******************************************************************************/ 94 + 95 + u16 acpi_rs_encode_bitmask(u8 * list, u8 count) 96 + { 97 + acpi_native_uint i; 98 + u16 mask; 99 + 100 + /* Encode the list into a single bitmask */ 101 + 102 + for (i = 0, mask = 0; i < count; i++) { 103 + mask |= (0x0001 << list[i]); 104 + } 105 + 106 + return (mask); 107 + } 108 + 109 + /******************************************************************************* 110 + * 53 111 * FUNCTION: acpi_rs_move_data 54 112 * 55 113 * PARAMETERS: Destination - Pointer to the destination descriptor ··· 122 64 * via the ACPI_MOVE_* macros. (This is why a memcpy is not used) 123 65 * 124 66 ******************************************************************************/ 67 + 125 68 void 126 69 acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type) 127 70 { ··· 132 73 133 74 for (i = 0; i < item_count; i++) { 134 75 switch (move_type) { 135 - case ACPI_MOVE_TYPE_16_TO_32: 136 - ACPI_MOVE_16_TO_32(&((u32 *) destination)[i], 76 + /* 77 + * For the 8-bit case, we can perform the move all at once 78 + * since there are no alignment or endian issues 79 + */ 80 + case ACPI_RSC_MOVE8: 81 + ACPI_MEMCPY(destination, source, item_count); 82 + return; 83 + 84 + /* 85 + * 16-, 32-, and 64-bit cases must use the move macros that perform 86 + * endian conversion and/or accomodate hardware that cannot perform 87 + * misaligned memory transfers 88 + */ 89 + case ACPI_RSC_MOVE16: 90 + ACPI_MOVE_16_TO_16(&((u16 *) destination)[i], 137 91 &((u16 *) source)[i]); 138 92 break; 139 93 140 - case ACPI_MOVE_TYPE_32_TO_16: 141 - ACPI_MOVE_32_TO_16(&((u16 *) destination)[i], 142 - &((u32 *) source)[i]); 143 - break; 144 - 145 - case ACPI_MOVE_TYPE_32_TO_32: 94 + case ACPI_RSC_MOVE32: 146 95 ACPI_MOVE_32_TO_32(&((u32 *) destination)[i], 147 96 &((u32 *) source)[i]); 148 97 break; 149 98 150 - case ACPI_MOVE_TYPE_64_TO_64: 99 + case ACPI_RSC_MOVE64: 151 100 ACPI_MOVE_64_TO_64(&((u64 *) destination)[i], 152 101 &((u64 *) source)[i]); 153 102 break; ··· 215 148 216 149 /******************************************************************************* 217 150 * 218 - * FUNCTION: acpi_rs_get_resource_length 151 + * FUNCTION: acpi_rs_set_resource_length 219 152 * 220 - * PARAMETERS: Aml - Pointer to the raw AML resource descriptor 153 + * PARAMETERS: total_length - Length of the AML descriptor, including 154 + * the header and length fields. 155 + * Aml - Pointer to the raw AML descriptor 221 156 * 222 - * RETURN: Byte Length 157 + * RETURN: None 223 158 * 224 - * DESCRIPTION: Get the "Resource Length" of a raw AML descriptor. By 225 - * definition, this does not include the size of the descriptor 226 - * header or the length field itself. 159 + * DESCRIPTION: Set the resource_length field of an AML 160 + * resource descriptor, both Large and Small descriptors are 161 + * supported automatically. Note: Descriptor Type field must 162 + * be valid. 227 163 * 228 164 ******************************************************************************/ 229 165 230 - u16 acpi_rs_get_resource_length(union aml_resource * aml) 166 + void 167 + acpi_rs_set_resource_length(acpi_rsdesc_size total_length, 168 + union aml_resource *aml) 231 169 { 232 - u16 resource_length; 170 + acpi_rs_length resource_length; 233 171 234 172 ACPI_FUNCTION_ENTRY(); 235 173 236 174 /* Determine if this is a small or large resource */ 237 175 238 - if (aml->large_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { 176 + if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { 239 177 /* Large Resource type -- bytes 1-2 contain the 16-bit length */ 240 178 241 - ACPI_MOVE_16_TO_16(&resource_length, 242 - &aml->large_header.resource_length); 179 + resource_length = (acpi_rs_length) 180 + (total_length - sizeof(struct aml_resource_large_header)); 243 181 182 + /* Insert length into the Large descriptor length field */ 183 + 184 + ACPI_MOVE_16_TO_16(&aml->large_header.resource_length, 185 + &resource_length); 244 186 } else { 245 187 /* Small Resource type -- bits 2:0 of byte 0 contain the length */ 246 188 247 - resource_length = (u16) (aml->small_header.descriptor_type & 248 - ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK); 189 + resource_length = (acpi_rs_length) 190 + (total_length - sizeof(struct aml_resource_small_header)); 191 + 192 + /* Insert length into the descriptor type byte */ 193 + 194 + aml->small_header.descriptor_type = (u8) 195 + 196 + /* Clear any existing length, preserving descriptor type bits */ 197 + ((aml->small_header. 198 + descriptor_type & ~ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK) 199 + 200 + | resource_length); 249 201 } 250 - 251 - return (resource_length); 252 - } 253 - 254 - /******************************************************************************* 255 - * 256 - * FUNCTION: acpi_rs_get_descriptor_length 257 - * 258 - * PARAMETERS: Aml - Pointer to the raw AML resource descriptor 259 - * 260 - * RETURN: Byte length 261 - * 262 - * DESCRIPTION: Get the total byte length of a raw AML descriptor, including the 263 - * length of the descriptor header and the length field itself. 264 - * Used to walk descriptor lists. 265 - * 266 - ******************************************************************************/ 267 - 268 - u32 acpi_rs_get_descriptor_length(union aml_resource * aml) 269 - { 270 - u32 descriptor_length; 271 - 272 - ACPI_FUNCTION_ENTRY(); 273 - 274 - /* Determine if this is a small or large resource */ 275 - 276 - if (aml->large_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { 277 - /* Large Resource type -- bytes 1-2 contain the 16-bit length */ 278 - 279 - ACPI_MOVE_16_TO_32(&descriptor_length, 280 - &aml->large_header.resource_length); 281 - descriptor_length += sizeof(struct aml_resource_large_header); 282 - 283 - } else { 284 - /* Small Resource type -- bits 2:0 of byte 0 contain the length */ 285 - 286 - descriptor_length = (u32) (aml->small_header.descriptor_type & 287 - ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK); 288 - descriptor_length += sizeof(struct aml_resource_small_header); 289 - } 290 - 291 - return (descriptor_length); 292 202 } 293 203 294 204 /******************************************************************************* ··· 287 243 288 244 void 289 245 acpi_rs_set_resource_header(u8 descriptor_type, 290 - acpi_size total_length, union aml_resource *aml) 246 + acpi_rsdesc_size total_length, 247 + union aml_resource *aml) 291 248 { 292 - u16 resource_length; 293 - 294 249 ACPI_FUNCTION_ENTRY(); 295 250 296 - /* Set the descriptor type */ 251 + /* Set the Descriptor Type */ 297 252 298 253 aml->small_header.descriptor_type = descriptor_type; 299 254 300 - /* Determine if this is a small or large resource */ 255 + /* Set the Resource Length */ 301 256 302 - if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { 303 - /* Large Resource type -- bytes 1-2 contain the 16-bit length */ 304 - 305 - resource_length = 306 - (u16) (total_length - 307 - sizeof(struct aml_resource_large_header)); 308 - 309 - /* Insert length into the Large descriptor length field */ 310 - 311 - ACPI_MOVE_16_TO_16(&aml->large_header.resource_length, 312 - &resource_length); 313 - } else { 314 - /* Small Resource type -- bits 2:0 of byte 0 contain the length */ 315 - 316 - resource_length = 317 - (u16) (total_length - 318 - sizeof(struct aml_resource_small_header)); 319 - 320 - /* Insert length into the descriptor type byte */ 321 - 322 - aml->small_header.descriptor_type |= (u8) resource_length; 323 - } 324 - } 325 - 326 - /******************************************************************************* 327 - * 328 - * FUNCTION: acpi_rs_get_resource_type 329 - * 330 - * PARAMETERS: resource_type - Byte 0 of a resource descriptor 331 - * 332 - * RETURN: The Resource Type with no extraneous bits (except the 333 - * Large/Small descriptor bit -- this is left alone) 334 - * 335 - * DESCRIPTION: Extract the Resource Type/Name from the first byte of 336 - * a resource descriptor. 337 - * 338 - ******************************************************************************/ 339 - 340 - u8 acpi_rs_get_resource_type(u8 resource_type) 341 - { 342 - ACPI_FUNCTION_ENTRY(); 343 - 344 - /* Determine if this is a small or large resource */ 345 - 346 - if (resource_type & ACPI_RESOURCE_NAME_LARGE) { 347 - /* Large Resource Type -- bits 6:0 contain the name */ 348 - 349 - return (resource_type); 350 - } else { 351 - /* Small Resource Type -- bits 6:3 contain the name */ 352 - 353 - return ((u8) (resource_type & ACPI_RESOURCE_NAME_SMALL_MASK)); 354 - } 257 + acpi_rs_set_resource_length(total_length, aml); 355 258 } 356 259 357 260 /******************************************************************************* ··· 351 360 * 352 361 ******************************************************************************/ 353 362 354 - u16 355 - acpi_rs_get_resource_source(u16 resource_length, 356 - acpi_size minimum_length, 363 + acpi_rs_length 364 + acpi_rs_get_resource_source(acpi_rs_length resource_length, 365 + acpi_rs_length minimum_length, 357 366 struct acpi_resource_source * resource_source, 358 367 union aml_resource * aml, char *string_ptr) 359 368 { 360 - acpi_size total_length; 369 + acpi_rsdesc_size total_length; 361 370 u8 *aml_resource_source; 362 371 363 372 ACPI_FUNCTION_ENTRY(); ··· 373 382 * Note: Some resource descriptors will have an additional null, so 374 383 * we add 1 to the minimum length. 375 384 */ 376 - if (total_length > (minimum_length + 1)) { 385 + if (total_length > (acpi_rsdesc_size) (minimum_length + 1)) { 377 386 /* Get the resource_source_index */ 378 387 379 388 resource_source->index = aml_resource_source[0]; ··· 389 398 sizeof(struct acpi_resource_source); 390 399 } 391 400 401 + /* 402 + * In order for the struct_size to fall on a 32-bit boundary, calculate 403 + * the length of the string (+1 for the NULL terminator) and expand the 404 + * struct_size to the next 32-bit boundary. 405 + * 406 + * Zero the entire area of the buffer. 407 + */ 408 + total_length = 409 + ACPI_ROUND_UP_to_32_bITS(ACPI_STRLEN 410 + ((char *)&aml_resource_source[1]) + 411 + 1); 412 + ACPI_MEMSET(resource_source->string_ptr, 0, total_length); 413 + 392 414 /* Copy the resource_source string to the destination */ 393 415 394 416 resource_source->string_length = 395 417 acpi_rs_strcpy(resource_source->string_ptr, 396 418 (char *)&aml_resource_source[1]); 397 419 398 - /* 399 - * In order for the struct_size to fall on a 32-bit boundary, 400 - * calculate the length of the string and expand the 401 - * struct_size to the next 32-bit boundary. 402 - */ 403 - return ((u16) 404 - ACPI_ROUND_UP_to_32_bITS(resource_source-> 405 - string_length)); 420 + return ((acpi_rs_length) total_length); 406 421 } else { 407 422 /* resource_source is not present */ 408 423 ··· 431 434 * 432 435 * RETURN: Total length of the AML descriptor 433 436 * 434 - * DESCRIPTION: Convert an optoinal resource_source from internal format to a 437 + * DESCRIPTION: Convert an optional resource_source from internal format to a 435 438 * raw AML resource descriptor 436 439 * 437 440 ******************************************************************************/ 438 441 439 - acpi_size 442 + acpi_rsdesc_size 440 443 acpi_rs_set_resource_source(union aml_resource * aml, 441 - acpi_size minimum_length, 444 + acpi_rs_length minimum_length, 442 445 struct acpi_resource_source * resource_source) 443 446 { 444 447 u8 *aml_resource_source; 445 - acpi_size descriptor_length; 448 + acpi_rsdesc_size descriptor_length; 446 449 447 450 ACPI_FUNCTION_ENTRY(); 448 451 ··· 469 472 * final descriptor length 470 473 */ 471 474 descriptor_length += 472 - ((acpi_size) resource_source->string_length + 1); 475 + ((acpi_rsdesc_size) resource_source->string_length + 1); 473 476 } 474 477 475 478 /* Return the new total length of the AML descriptor */
+1 -1
drivers/acpi/resources/rsxface.c
··· 57 57 ACPI_COPY_FIELD(out, in, decode); \ 58 58 ACPI_COPY_FIELD(out, in, min_address_fixed); \ 59 59 ACPI_COPY_FIELD(out, in, max_address_fixed); \ 60 - ACPI_COPY_FIELD(out, in, attribute); \ 60 + ACPI_COPY_FIELD(out, in, info); \ 61 61 ACPI_COPY_FIELD(out, in, granularity); \ 62 62 ACPI_COPY_FIELD(out, in, minimum); \ 63 63 ACPI_COPY_FIELD(out, in, maximum); \
+2 -3
drivers/acpi/tables/tbutils.c
··· 94 94 new_table_desc->pointer->length) 95 95 && 96 96 (!ACPI_MEMCMP 97 - ((const char *)table_desc->pointer, 98 - (const char *)new_table_desc->pointer, 99 - (acpi_size) new_table_desc->pointer->length))) { 97 + (table_desc->pointer, new_table_desc->pointer, 98 + new_table_desc->pointer->length))) { 100 99 /* Match: this table is already installed */ 101 100 102 101 ACPI_DEBUG_PRINT((ACPI_DB_TABLES,
+1 -1
drivers/acpi/utilities/utalloc.c
··· 866 866 867 867 if (!num_outstanding) { 868 868 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 869 - "No outstanding allocations.\n")); 869 + "No outstanding allocations\n")); 870 870 } else { 871 871 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 872 872 "%d(%X) Outstanding allocations\n",
+35 -29
drivers/acpi/utilities/utglobal.c
··· 217 217 * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to 218 218 * perform a Notify() operation on it. 219 219 */ 220 - const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = 221 - { {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL}, 222 - {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL}, 223 - {"_SB_", ACPI_TYPE_DEVICE, NULL}, 224 - {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, 225 - {"_TZ_", ACPI_TYPE_THERMAL, NULL}, 226 - {"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL}, 227 - {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, 228 - {"_GL_", ACPI_TYPE_MUTEX, (char *)1}, 220 + const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = { 221 + {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL}, 222 + {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL}, 223 + {"_SB_", ACPI_TYPE_DEVICE, NULL}, 224 + {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, 225 + {"_TZ_", ACPI_TYPE_THERMAL, NULL}, 226 + {"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL}, 227 + {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, 228 + {"_GL_", ACPI_TYPE_MUTEX, (char *)1}, 229 229 230 230 #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY) 231 - {"_OSI", ACPI_TYPE_METHOD, (char *)1}, 231 + {"_OSI", ACPI_TYPE_METHOD, (char *)1}, 232 232 #endif 233 233 234 234 /* Table terminator */ 235 235 236 - {NULL, ACPI_TYPE_ANY, NULL} 236 + {NULL, ACPI_TYPE_ANY, NULL} 237 237 }; 238 238 239 239 /* ··· 503 503 /* Event type decoding */ 504 504 505 505 static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = { 506 + /*! [Begin] no source code translation (keep these strings as-is) */ 506 507 "PM_Timer", 507 - "global_lock", 508 - "power_button", 509 - "sleep_button", 510 - "real_time_clock", 508 + "GlobalLock", 509 + "PowerButton", 510 + "SleepButton", 511 + "RealTimeClock", 512 + /*! [End] no source code translation !*/ 511 513 }; 512 514 513 515 char *acpi_ut_get_event_name(u32 event_id) ··· 547 545 /* Printable names of the ACPI object types */ 548 546 549 547 static const char *acpi_gbl_ns_type_names[] = { 548 + /*! [Begin] no source code translation (keep these strings as-is) */ 550 549 /* 00 */ "Untyped", 551 550 /* 01 */ "Integer", 552 551 /* 02 */ "String", 553 552 /* 03 */ "Buffer", 554 553 /* 04 */ "Package", 555 - /* 05 */ "field_unit", 554 + /* 05 */ "FieldUnit", 556 555 /* 06 */ "Device", 557 556 /* 07 */ "Event", 558 557 /* 08 */ "Method", ··· 562 559 /* 11 */ "Power", 563 560 /* 12 */ "Processor", 564 561 /* 13 */ "Thermal", 565 - /* 14 */ "buffer_field", 566 - /* 15 */ "ddb_handle", 567 - /* 16 */ "debug_object", 568 - /* 17 */ "region_field", 569 - /* 18 */ "bank_field", 570 - /* 19 */ "index_field", 562 + /* 14 */ "BufferField", 563 + /* 15 */ "DdbHandle", 564 + /* 16 */ "DebugObject", 565 + /* 17 */ "RegionField", 566 + /* 18 */ "BankField", 567 + /* 19 */ "IndexField", 571 568 /* 20 */ "Reference", 572 569 /* 21 */ "Alias", 573 - /* 22 */ "method_alias", 570 + /* 22 */ "MethodAlias", 574 571 /* 23 */ "Notify", 575 - /* 24 */ "addr_handler", 576 - /* 25 */ "resource_desc", 577 - /* 26 */ "resource_fld", 572 + /* 24 */ "AddrHandler", 573 + /* 25 */ "ResourceDesc", 574 + /* 26 */ "ResourceFld", 578 575 /* 27 */ "Scope", 579 576 /* 28 */ "Extra", 580 577 /* 29 */ "Data", 581 578 /* 30 */ "Invalid" 579 + /*! [End] no source code translation !*/ 582 580 }; 583 581 584 582 char *acpi_ut_get_type_name(acpi_object_type type) ··· 662 658 /* Printable names of object descriptor types */ 663 659 664 660 static const char *acpi_gbl_desc_type_names[] = { 661 + /*! [Begin] no source code translation (keep these ASL Keywords as-is) */ 665 662 /* 00 */ "Invalid", 666 663 /* 01 */ "Cached", 667 664 /* 02 */ "State-Generic", 668 665 /* 03 */ "State-Update", 669 666 /* 04 */ "State-Package", 670 667 /* 05 */ "State-Control", 671 - /* 06 */ "State-root_parse_scope", 672 - /* 07 */ "State-parse_scope", 673 - /* 08 */ "State-walk_scope", 668 + /* 06 */ "State-RootParseScope", 669 + /* 07 */ "State-ParseScope", 670 + /* 08 */ "State-WalkScope", 674 671 /* 09 */ "State-Result", 675 672 /* 10 */ "State-Notify", 676 673 /* 11 */ "State-Thread", ··· 679 674 /* 13 */ "Parser", 680 675 /* 14 */ "Operand", 681 676 /* 15 */ "Node" 677 + /*! [End] no source code translation !*/ 682 678 }; 683 679 684 680 char *acpi_ut_get_descriptor_name(void *object)
+124 -24
drivers/acpi/utilities/utmisc.c
··· 43 43 44 44 #include <acpi/acpi.h> 45 45 #include <acpi/acnamesp.h> 46 + #include <acpi/amlresrc.h> 46 47 47 48 #define _COMPONENT ACPI_UTILITIES 48 49 ACPI_MODULE_NAME("utmisc") ··· 791 790 792 791 /******************************************************************************* 793 792 * 793 + * FUNCTION: acpi_ut_get_resource_type 794 + * 795 + * PARAMETERS: Aml - Pointer to the raw AML resource descriptor 796 + * 797 + * RETURN: The Resource Type with no extraneous bits (except the 798 + * Large/Small descriptor bit -- this is left alone) 799 + * 800 + * DESCRIPTION: Extract the Resource Type/Name from the first byte of 801 + * a resource descriptor. 802 + * 803 + ******************************************************************************/ 804 + 805 + u8 acpi_ut_get_resource_type(void *aml) 806 + { 807 + ACPI_FUNCTION_ENTRY(); 808 + 809 + /* 810 + * Byte 0 contains the descriptor name (Resource Type) 811 + * Determine if this is a small or large resource 812 + */ 813 + if (*((u8 *) aml) & ACPI_RESOURCE_NAME_LARGE) { 814 + /* Large Resource Type -- bits 6:0 contain the name */ 815 + 816 + return (*((u8 *) aml)); 817 + } else { 818 + /* Small Resource Type -- bits 6:3 contain the name */ 819 + 820 + return ((u8) (*((u8 *) aml) & ACPI_RESOURCE_NAME_SMALL_MASK)); 821 + } 822 + } 823 + 824 + /******************************************************************************* 825 + * 826 + * FUNCTION: acpi_ut_get_resource_length 827 + * 828 + * PARAMETERS: Aml - Pointer to the raw AML resource descriptor 829 + * 830 + * RETURN: Byte Length 831 + * 832 + * DESCRIPTION: Get the "Resource Length" of a raw AML descriptor. By 833 + * definition, this does not include the size of the descriptor 834 + * header or the length field itself. 835 + * 836 + ******************************************************************************/ 837 + 838 + u16 acpi_ut_get_resource_length(void *aml) 839 + { 840 + u16 resource_length; 841 + 842 + ACPI_FUNCTION_ENTRY(); 843 + 844 + /* 845 + * Byte 0 contains the descriptor name (Resource Type) 846 + * Determine if this is a small or large resource 847 + */ 848 + if (*((u8 *) aml) & ACPI_RESOURCE_NAME_LARGE) { 849 + /* Large Resource type -- bytes 1-2 contain the 16-bit length */ 850 + 851 + ACPI_MOVE_16_TO_16(&resource_length, &((u8 *) aml)[1]); 852 + 853 + } else { 854 + /* Small Resource type -- bits 2:0 of byte 0 contain the length */ 855 + 856 + resource_length = (u16) (*((u8 *) aml) & 857 + ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK); 858 + } 859 + 860 + return (resource_length); 861 + } 862 + 863 + /******************************************************************************* 864 + * 865 + * FUNCTION: acpi_ut_get_descriptor_length 866 + * 867 + * PARAMETERS: Aml - Pointer to the raw AML resource descriptor 868 + * 869 + * RETURN: Byte length 870 + * 871 + * DESCRIPTION: Get the total byte length of a raw AML descriptor, including the 872 + * length of the descriptor header and the length field itself. 873 + * Used to walk descriptor lists. 874 + * 875 + ******************************************************************************/ 876 + 877 + u32 acpi_ut_get_descriptor_length(void *aml) 878 + { 879 + u32 descriptor_length; 880 + 881 + ACPI_FUNCTION_ENTRY(); 882 + 883 + /* First get the Resource Length (Does not include header length) */ 884 + 885 + descriptor_length = acpi_ut_get_resource_length(aml); 886 + 887 + /* Determine if this is a small or large resource */ 888 + 889 + if (*((u8 *) aml) & ACPI_RESOURCE_NAME_LARGE) { 890 + descriptor_length += sizeof(struct aml_resource_large_header); 891 + } else { 892 + descriptor_length += sizeof(struct aml_resource_small_header); 893 + } 894 + 895 + return (descriptor_length); 896 + } 897 + 898 + /******************************************************************************* 899 + * 794 900 * FUNCTION: acpi_ut_get_resource_end_tag 795 901 * 796 902 * PARAMETERS: obj_desc - The resource template buffer object 797 903 * 798 904 * RETURN: Pointer to the end tag 799 905 * 800 - * DESCRIPTION: Find the END_TAG resource descriptor in a resource template 906 + * DESCRIPTION: Find the END_TAG resource descriptor in an AML resource template 801 907 * 802 908 ******************************************************************************/ 803 909 804 910 u8 *acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc) 805 911 { 806 - u8 buffer_byte; 807 - u8 *buffer; 808 - u8 *end_buffer; 912 + u8 *aml; 913 + u8 *end_aml; 809 914 810 - buffer = obj_desc->buffer.pointer; 811 - end_buffer = buffer + obj_desc->buffer.length; 915 + aml = obj_desc->buffer.pointer; 916 + end_aml = aml + obj_desc->buffer.length; 812 917 813 - while (buffer < end_buffer) { 814 - buffer_byte = *buffer; 815 - if (buffer_byte & ACPI_RESOURCE_NAME_LARGE) { 816 - /* Large Descriptor - Length is next 2 bytes */ 918 + /* Walk the resource template, one descriptor per loop */ 817 919 818 - buffer += ((*(buffer + 1) | (*(buffer + 2) << 8)) + 3); 819 - } else { 820 - /* Small Descriptor. End Tag will be found here */ 920 + while (aml < end_aml) { 921 + if (acpi_ut_get_resource_type(aml) == 922 + ACPI_RESOURCE_NAME_END_TAG) { 923 + /* Found the end_tag descriptor, all done */ 821 924 822 - if ((buffer_byte & ACPI_RESOURCE_NAME_SMALL_MASK) == 823 - ACPI_RESOURCE_NAME_END_TAG) { 824 - /* Found the end tag descriptor, all done. */ 825 - 826 - return (buffer); 827 - } 828 - 829 - /* Length is in the header */ 830 - 831 - buffer += ((buffer_byte & 0x07) + 1); 925 + return (aml); 832 926 } 927 + 928 + /* Point to the next resource descriptor */ 929 + 930 + aml += acpi_ut_get_resource_length(aml); 833 931 } 834 932 835 - /* End tag not found */ 933 + /* End tag was not found */ 836 934 837 935 return (NULL); 838 936 }
+6 -6
drivers/pnp/pnpacpi/rsparser.c
··· 401 401 mem->align = p->alignment; 402 402 mem->size = p->address_length; 403 403 404 - mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ? 404 + mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? 405 405 IORESOURCE_MEM_WRITEABLE : 0; 406 406 407 407 pnp_register_mem_resource(option,mem); ··· 424 424 mem->align = p->alignment; 425 425 mem->size = p->address_length; 426 426 427 - mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ? 427 + mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? 428 428 IORESOURCE_MEM_WRITEABLE : 0; 429 429 430 430 pnp_register_mem_resource(option,mem); ··· 446 446 mem->size = p->address_length; 447 447 mem->align = 0; 448 448 449 - mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ? 449 + mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? 450 450 IORESOURCE_MEM_WRITEABLE : 0; 451 451 452 452 pnp_register_mem_resource(option,mem); ··· 734 734 resource->type = ACPI_RESOURCE_TYPE_MEMORY24; 735 735 resource->length = sizeof(struct acpi_resource); 736 736 /* Note: pnp_assign_mem will copy pnp_mem->flags into p->flags */ 737 - resource->data.memory24.read_write_attribute = 737 + resource->data.memory24.write_protect = 738 738 (p->flags & IORESOURCE_MEM_WRITEABLE) ? 739 739 ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; 740 740 resource->data.memory24.minimum = p->start; ··· 748 748 { 749 749 resource->type = ACPI_RESOURCE_TYPE_MEMORY32; 750 750 resource->length = sizeof(struct acpi_resource); 751 - resource->data.memory32.read_write_attribute = 751 + resource->data.memory32.write_protect = 752 752 (p->flags & IORESOURCE_MEM_WRITEABLE) ? 753 753 ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; 754 754 resource->data.memory32.minimum = p->start; ··· 762 762 { 763 763 resource->type = ACPI_RESOURCE_TYPE_FIXED_MEMORY32; 764 764 resource->length = sizeof(struct acpi_resource); 765 - resource->data.fixed_memory32.read_write_attribute = 765 + resource->data.fixed_memory32.write_protect = 766 766 (p->flags & IORESOURCE_MEM_WRITEABLE) ? 767 767 ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; 768 768 resource->data.fixed_memory32.address = p->start;
+1 -1
include/acpi/acconfig.h
··· 63 63 64 64 /* Current ACPICA subsystem version in YYYYMMDD format */ 65 65 66 - #define ACPI_CA_VERSION 0x20050930 66 + #define ACPI_CA_VERSION 0x20051021 67 67 68 68 /* 69 69 * OS name, used for the _OS object. The _OS object is essentially obsolete,
+15 -4
include/acpi/acdisasm.h
··· 60 60 extern const char *acpi_gbl_io_decode[2]; 61 61 extern const char *acpi_gbl_word_decode[4]; 62 62 extern const char *acpi_gbl_consume_decode[2]; 63 + extern const char *acpi_gbl_config_decode[4]; 63 64 extern const char *acpi_gbl_min_decode[2]; 64 65 extern const char *acpi_gbl_max_decode[2]; 65 66 extern const char *acpi_gbl_DECdecode[2]; ··· 172 171 /* 173 172 * dmresrc 174 173 */ 175 - void 176 - acpi_dm_resource_descriptor(struct acpi_op_walk_info *info, 177 - u8 * byte_data, u32 byte_count); 174 + void acpi_dm_dump_integer8(u8 value, char *name); 178 175 179 - u8 acpi_dm_is_resource_descriptor(union acpi_parse_object *op); 176 + void acpi_dm_dump_integer16(u16 value, char *name); 177 + 178 + void acpi_dm_dump_integer32(u32 value, char *name); 179 + 180 + void acpi_dm_dump_integer64(u64 value, char *name); 181 + 182 + void 183 + acpi_dm_resource_template(struct acpi_op_walk_info *info, 184 + u8 * byte_data, u32 byte_count); 185 + 186 + u8 acpi_dm_is_resource_template(union acpi_parse_object *op); 180 187 181 188 void acpi_dm_indent(u32 level); 182 189 ··· 231 222 void 232 223 acpi_dm_vendor_large_descriptor(union aml_resource *resource, 233 224 u32 length, u32 level); 225 + 226 + void acpi_dm_vendor_common(char *name, u8 * byte_data, u32 length, u32 level); 234 227 235 228 /* 236 229 * dmresrcs
+3 -3
include/acpi/acmacros.h
··· 202 202 203 203 #define ACPI_BUFFER_INDEX(buf_len,buf_offset,byte_gran) (buf_offset) 204 204 205 - #ifdef ACPI_MISALIGNED_TRANSFERS 205 + #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED 206 206 207 207 /* The hardware supports unaligned transfers, just do the little-endian move */ 208 208 ··· 563 563 return (_s); }) 564 564 #define return_UINT8(s) ACPI_DO_WHILE0 ({ \ 565 565 register u8 _s = (u8) (s); \ 566 - acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \ 566 + acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) _s); \ 567 567 return (_s); }) 568 568 #define return_UINT32(s) ACPI_DO_WHILE0 ({ \ 569 569 register u32 _s = (u32) (s); \ 570 - acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \ 570 + acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) _s); \ 571 571 return (_s); }) 572 572 #else /* Use original less-safe macros */ 573 573
+2 -2
include/acpi/acpiosxf.h
··· 108 108 109 109 void acpi_os_delete_lock(acpi_handle handle); 110 110 111 - unsigned long acpi_os_acquire_lock(acpi_handle handle); 111 + acpi_native_uint acpi_os_acquire_lock(acpi_handle handle); 112 112 113 - void acpi_os_release_lock(acpi_handle handle, unsigned long flags); 113 + void acpi_os_release_lock(acpi_handle handle, acpi_native_uint flags); 114 114 115 115 /* 116 116 * Memory allocation and mapping
+181 -214
include/acpi/acresrc.h
··· 49 49 #include "amlresrc.h" 50 50 51 51 /* 52 + * If possible, pack the following structures to byte alignment, since we 53 + * don't care about performance for debug output 54 + */ 55 + #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED 56 + #pragma pack(1) 57 + #endif 58 + 59 + /* 60 + * Individual entry for the resource conversion tables 61 + */ 62 + typedef const struct acpi_rsconvert_info { 63 + u8 opcode; 64 + u8 resource_offset; 65 + u8 aml_offset; 66 + u8 value; 67 + 68 + } acpi_rsconvert_info; 69 + 70 + /* Resource conversion opcodes */ 71 + 72 + #define ACPI_RSC_INITGET 0 73 + #define ACPI_RSC_INITSET 1 74 + #define ACPI_RSC_FLAGINIT 2 75 + #define ACPI_RSC_1BITFLAG 3 76 + #define ACPI_RSC_2BITFLAG 4 77 + #define ACPI_RSC_COUNT 5 78 + #define ACPI_RSC_COUNT16 6 79 + #define ACPI_RSC_LENGTH 7 80 + #define ACPI_RSC_MOVE8 8 81 + #define ACPI_RSC_MOVE16 9 82 + #define ACPI_RSC_MOVE32 10 83 + #define ACPI_RSC_MOVE64 11 84 + #define ACPI_RSC_SET8 12 85 + #define ACPI_RSC_DATA8 13 86 + #define ACPI_RSC_ADDRESS 14 87 + #define ACPI_RSC_SOURCE 15 88 + #define ACPI_RSC_SOURCEX 16 89 + #define ACPI_RSC_BITMASK 17 90 + #define ACPI_RSC_BITMASK16 18 91 + #define ACPI_RSC_EXIT_NE 19 92 + #define ACPI_RSC_EXIT_LE 20 93 + 94 + /* Resource Conversion sub-opcodes */ 95 + 96 + #define ACPI_RSC_COMPARE_AML_LENGTH 0 97 + #define ACPI_RSC_COMPARE_VALUE 1 98 + 99 + #define ACPI_RSC_TABLE_SIZE(d) (sizeof (d) / sizeof (struct acpi_rsconvert_info)) 100 + 101 + #define ACPI_RS_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_resource,f) 102 + #define AML_OFFSET(f) (u8) ACPI_OFFSET (union aml_resource,f) 103 + 104 + /* 52 105 * Resource dispatch and info tables 53 106 */ 54 - struct acpi_resource_info { 107 + typedef const struct acpi_resource_info { 55 108 u8 length_type; 56 109 u8 minimum_aml_resource_length; 57 110 u8 minimum_internal_struct_length; 58 - }; 111 + 112 + } acpi_resource_info; 59 113 60 114 /* Types for length_type above */ 61 115 62 - #define ACPI_FIXED_LENGTH 0 63 - #define ACPI_VARIABLE_LENGTH 1 64 - #define ACPI_SMALL_VARIABLE_LENGTH 2 116 + #define ACPI_FIXED_LENGTH 0 117 + #define ACPI_VARIABLE_LENGTH 1 118 + #define ACPI_SMALL_VARIABLE_LENGTH 2 65 119 66 - /* Handlers */ 120 + typedef const struct acpi_rsdump_info { 121 + u8 opcode; 122 + u8 offset; 123 + char *name; 124 + const void *pointer; 67 125 68 - typedef acpi_status(*ACPI_SET_RESOURCE_HANDLER) (struct acpi_resource * 69 - resource, 70 - union aml_resource * aml); 126 + } acpi_rsdump_info; 71 127 72 - typedef acpi_status(*ACPI_GET_RESOURCE_HANDLER) (union aml_resource * aml, 73 - u16 aml_resource_length, 74 - struct acpi_resource * 75 - resource); 128 + /* Values for the Opcode field above */ 76 129 77 - typedef void (*ACPI_DUMP_RESOURCE_HANDLER) (union acpi_resource_data * data); 130 + #define ACPI_RSD_TITLE 0 131 + #define ACPI_RSD_LITERAL 1 132 + #define ACPI_RSD_STRING 2 133 + #define ACPI_RSD_UINT8 3 134 + #define ACPI_RSD_UINT16 4 135 + #define ACPI_RSD_UINT32 5 136 + #define ACPI_RSD_UINT64 6 137 + #define ACPI_RSD_1BITFLAG 7 138 + #define ACPI_RSD_2BITFLAG 8 139 + #define ACPI_RSD_SHORTLIST 9 140 + #define ACPI_RSD_LONGLIST 10 141 + #define ACPI_RSD_DWORDLIST 11 142 + #define ACPI_RSD_ADDRESS 12 143 + #define ACPI_RSD_SOURCE 13 78 144 79 - /* Tables indexed by internal resource type */ 145 + /* restore default alignment */ 80 146 81 - extern u8 acpi_gbl_aml_resource_sizes[]; 82 - extern ACPI_SET_RESOURCE_HANDLER acpi_gbl_set_resource_dispatch[]; 83 - extern ACPI_DUMP_RESOURCE_HANDLER acpi_gbl_dump_resource_dispatch[]; 147 + #pragma pack() 84 148 85 - /* Tables indexed by raw AML resource descriptor type */ 149 + /* Resource tables indexed by internal resource type */ 150 + 151 + extern const u8 acpi_gbl_aml_resource_sizes[]; 152 + extern struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[]; 153 + 154 + /* Resource tables indexed by raw AML resource descriptor type */ 86 155 87 156 extern struct acpi_resource_info acpi_gbl_sm_resource_info[]; 88 157 extern struct acpi_resource_info acpi_gbl_lg_resource_info[]; 89 - extern ACPI_GET_RESOURCE_HANDLER acpi_gbl_sm_get_resource_dispatch[]; 90 - extern ACPI_GET_RESOURCE_HANDLER acpi_gbl_lg_get_resource_dispatch[]; 158 + extern struct acpi_rsconvert_info *acpi_gbl_sm_get_resource_dispatch[]; 159 + extern struct acpi_rsconvert_info *acpi_gbl_lg_get_resource_dispatch[]; 91 160 92 161 /* 93 - * Function prototypes called from Acpi* APIs 162 + * rscreate 163 + */ 164 + acpi_status 165 + acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, 166 + struct acpi_buffer *output_buffer); 167 + 168 + acpi_status 169 + acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer, 170 + struct acpi_buffer *output_buffer); 171 + 172 + acpi_status 173 + acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, 174 + struct acpi_buffer *output_buffer); 175 + 176 + /* 177 + * rsutils 94 178 */ 95 179 acpi_status 96 180 acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); ··· 193 109 194 110 acpi_status 195 111 acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); 196 - 197 - acpi_status 198 - acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, 199 - struct acpi_buffer *output_buffer); 200 - 201 - acpi_status 202 - acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer, 203 - struct acpi_buffer *output_buffer); 204 - 205 - acpi_status 206 - acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, 207 - struct acpi_buffer *output_buffer); 208 - 209 - /* 210 - * rsdump 211 - */ 212 - #ifdef ACPI_FUTURE_USAGE 213 - void acpi_rs_dump_resource_list(struct acpi_resource *resource); 214 - 215 - void acpi_rs_dump_irq_list(u8 * route_table); 216 - #endif /* ACPI_FUTURE_USAGE */ 217 112 218 113 /* 219 114 * rscalc ··· 218 155 acpi_size aml_size_needed, u8 * output_buffer); 219 156 220 157 /* 221 - * rsio 222 - */ 223 - acpi_status 224 - acpi_rs_get_io(union aml_resource *aml, 225 - u16 aml_resource_length, struct acpi_resource *resource); 226 - 227 - acpi_status 228 - acpi_rs_set_io(struct acpi_resource *resource, union aml_resource *aml); 229 - 230 - acpi_status 231 - acpi_rs_get_fixed_io(union aml_resource *aml, 232 - u16 aml_resource_length, struct acpi_resource *resource); 233 - 234 - acpi_status 235 - acpi_rs_set_fixed_io(struct acpi_resource *resource, union aml_resource *aml); 236 - 237 - acpi_status 238 - acpi_rs_get_dma(union aml_resource *aml, 239 - u16 aml_resource_length, struct acpi_resource *resource); 240 - 241 - acpi_status 242 - acpi_rs_set_dma(struct acpi_resource *resource, union aml_resource *aml); 243 - 244 - /* 245 - * rsirq 246 - */ 247 - acpi_status 248 - acpi_rs_get_irq(union aml_resource *aml, 249 - u16 aml_resource_length, struct acpi_resource *resource); 250 - 251 - acpi_status 252 - acpi_rs_set_irq(struct acpi_resource *resource, union aml_resource *aml); 253 - 254 - acpi_status 255 - acpi_rs_get_ext_irq(union aml_resource *aml, 256 - u16 aml_resource_length, struct acpi_resource *resource); 257 - 258 - acpi_status 259 - acpi_rs_set_ext_irq(struct acpi_resource *resource, union aml_resource *aml); 260 - 261 - /* 262 158 * rsaddr 263 159 */ 264 - acpi_status 265 - acpi_rs_get_address16(union aml_resource *aml, 266 - u16 aml_resource_length, struct acpi_resource *resource); 267 - 268 - acpi_status 269 - acpi_rs_set_address16(struct acpi_resource *resource, union aml_resource *aml); 270 - 271 - acpi_status 272 - acpi_rs_get_address32(union aml_resource *aml, 273 - u16 aml_resource_length, struct acpi_resource *resource); 274 - 275 - acpi_status 276 - acpi_rs_set_address32(struct acpi_resource *resource, union aml_resource *aml); 277 - 278 - acpi_status 279 - acpi_rs_get_address64(union aml_resource *aml, 280 - u16 aml_resource_length, struct acpi_resource *resource); 281 - 282 - acpi_status 283 - acpi_rs_set_address64(struct acpi_resource *resource, union aml_resource *aml); 284 - 285 - acpi_status 286 - acpi_rs_get_ext_address64(union aml_resource *aml, 287 - u16 aml_resource_length, 288 - struct acpi_resource *resource); 289 - 290 - acpi_status 291 - acpi_rs_set_ext_address64(struct acpi_resource *resource, 292 - union aml_resource *aml); 293 - 294 - /* 295 - * rsmemory 296 - */ 297 - acpi_status 298 - acpi_rs_get_memory24(union aml_resource *aml, 299 - u16 aml_resource_length, struct acpi_resource *resource); 300 - 301 - acpi_status 302 - acpi_rs_set_memory24(struct acpi_resource *resource, union aml_resource *aml); 303 - 304 - acpi_status 305 - acpi_rs_get_memory32(union aml_resource *aml, 306 - u16 aml_resource_length, struct acpi_resource *resource); 307 - 308 - acpi_status 309 - acpi_rs_set_memory32(struct acpi_resource *resource, union aml_resource *aml); 310 - 311 - acpi_status 312 - acpi_rs_get_fixed_memory32(union aml_resource *aml, 313 - u16 aml_resource_length, 160 + void 161 + acpi_rs_set_address_common(union aml_resource *aml, 314 162 struct acpi_resource *resource); 315 163 316 - acpi_status 317 - acpi_rs_set_fixed_memory32(struct acpi_resource *resource, 164 + u8 165 + acpi_rs_get_address_common(struct acpi_resource *resource, 318 166 union aml_resource *aml); 319 167 320 168 /* 321 169 * rsmisc 322 170 */ 323 171 acpi_status 324 - acpi_rs_get_generic_reg(union aml_resource *aml, 325 - u16 aml_resource_length, 326 - struct acpi_resource *resource); 172 + acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, 173 + union aml_resource *aml, 174 + struct acpi_rsconvert_info *info); 327 175 328 176 acpi_status 329 - acpi_rs_set_generic_reg(struct acpi_resource *resource, 330 - union aml_resource *aml); 331 - 332 - acpi_status 333 - acpi_rs_get_vendor(union aml_resource *aml, 334 - u16 aml_resource_length, struct acpi_resource *resource); 335 - 336 - acpi_status 337 - acpi_rs_set_vendor(struct acpi_resource *resource, union aml_resource *aml); 338 - 339 - acpi_status 340 - acpi_rs_get_start_dpf(union aml_resource *aml, 341 - u16 aml_resource_length, struct acpi_resource *resource); 342 - 343 - acpi_status 344 - acpi_rs_set_start_dpf(struct acpi_resource *resource, union aml_resource *aml); 345 - 346 - acpi_status 347 - acpi_rs_get_end_dpf(union aml_resource *aml, 348 - u16 aml_resource_length, struct acpi_resource *resource); 349 - 350 - acpi_status 351 - acpi_rs_set_end_dpf(struct acpi_resource *resource, union aml_resource *aml); 352 - 353 - acpi_status 354 - acpi_rs_get_end_tag(union aml_resource *aml, 355 - u16 aml_resource_length, struct acpi_resource *resource); 356 - 357 - acpi_status 358 - acpi_rs_set_end_tag(struct acpi_resource *resource, union aml_resource *aml); 177 + acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, 178 + union aml_resource *aml, 179 + struct acpi_rsconvert_info *info); 359 180 360 181 /* 361 182 * rsutils ··· 248 301 acpi_rs_move_data(void *destination, 249 302 void *source, u16 item_count, u8 move_type); 250 303 251 - /* Types used in move_type above */ 304 + u8 acpi_rs_decode_bitmask(u16 mask, u8 * list); 252 305 253 - #define ACPI_MOVE_TYPE_16_TO_32 0 254 - #define ACPI_MOVE_TYPE_32_TO_16 1 255 - #define ACPI_MOVE_TYPE_32_TO_32 2 256 - #define ACPI_MOVE_TYPE_64_TO_64 3 306 + u16 acpi_rs_encode_bitmask(u8 * list, u8 count); 257 307 258 - u16 259 - acpi_rs_get_resource_source(u16 resource_length, 260 - acpi_size minimum_length, 308 + acpi_rs_length 309 + acpi_rs_get_resource_source(acpi_rs_length resource_length, 310 + acpi_rs_length minimum_length, 261 311 struct acpi_resource_source *resource_source, 262 312 union aml_resource *aml, char *string_ptr); 263 313 264 - acpi_size 314 + acpi_rsdesc_size 265 315 acpi_rs_set_resource_source(union aml_resource *aml, 266 - acpi_size minimum_length, 316 + acpi_rs_length minimum_length, 267 317 struct acpi_resource_source *resource_source); 268 - 269 - u8 acpi_rs_get_resource_type(u8 resource_start_byte); 270 - 271 - u32 acpi_rs_get_descriptor_length(union aml_resource *aml); 272 - 273 - u16 acpi_rs_get_resource_length(union aml_resource *aml); 274 318 275 319 void 276 320 acpi_rs_set_resource_header(u8 descriptor_type, 277 - acpi_size total_length, union aml_resource *aml); 321 + acpi_rsdesc_size total_length, 322 + union aml_resource *aml); 323 + 324 + void 325 + acpi_rs_set_resource_length(acpi_rsdesc_size total_length, 326 + union aml_resource *aml); 278 327 279 328 struct acpi_resource_info *acpi_rs_get_resource_info(u8 resource_type); 280 329 281 - #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 282 330 /* 283 331 * rsdump 284 332 */ 285 - void acpi_rs_dump_irq(union acpi_resource_data *resource); 333 + void acpi_rs_dump_resource_list(struct acpi_resource *resource); 286 334 287 - void acpi_rs_dump_address16(union acpi_resource_data *resource); 335 + void acpi_rs_dump_irq_list(u8 * route_table); 288 336 289 - void acpi_rs_dump_address32(union acpi_resource_data *resource); 337 + /* 338 + * Resource conversion tables 339 + */ 340 + extern struct acpi_rsconvert_info acpi_rs_convert_dma[]; 341 + extern struct acpi_rsconvert_info acpi_rs_convert_end_dpf[]; 342 + extern struct acpi_rsconvert_info acpi_rs_convert_io[]; 343 + extern struct acpi_rsconvert_info acpi_rs_convert_fixed_io[]; 344 + extern struct acpi_rsconvert_info acpi_rs_convert_end_tag[]; 345 + extern struct acpi_rsconvert_info acpi_rs_convert_memory24[]; 346 + extern struct acpi_rsconvert_info acpi_rs_convert_generic_reg[]; 347 + extern struct acpi_rsconvert_info acpi_rs_convert_memory32[]; 348 + extern struct acpi_rsconvert_info acpi_rs_convert_fixed_memory32[]; 349 + extern struct acpi_rsconvert_info acpi_rs_convert_address32[]; 350 + extern struct acpi_rsconvert_info acpi_rs_convert_address16[]; 351 + extern struct acpi_rsconvert_info acpi_rs_convert_ext_irq[]; 352 + extern struct acpi_rsconvert_info acpi_rs_convert_address64[]; 353 + extern struct acpi_rsconvert_info acpi_rs_convert_ext_address64[]; 290 354 291 - void acpi_rs_dump_address64(union acpi_resource_data *resource); 355 + /* These resources require separate get/set tables */ 292 356 293 - void acpi_rs_dump_ext_address64(union acpi_resource_data *resource); 357 + extern struct acpi_rsconvert_info acpi_rs_get_irq[]; 358 + extern struct acpi_rsconvert_info acpi_rs_get_start_dpf[]; 359 + extern struct acpi_rsconvert_info acpi_rs_get_vendor_small[]; 360 + extern struct acpi_rsconvert_info acpi_rs_get_vendor_large[]; 294 361 295 - void acpi_rs_dump_dma(union acpi_resource_data *resource); 362 + extern struct acpi_rsconvert_info acpi_rs_set_irq[]; 363 + extern struct acpi_rsconvert_info acpi_rs_set_start_dpf[]; 364 + extern struct acpi_rsconvert_info acpi_rs_set_vendor[]; 296 365 297 - void acpi_rs_dump_io(union acpi_resource_data *resource); 366 + #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 367 + /* 368 + * rsinfo 369 + */ 370 + extern struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[]; 298 371 299 - void acpi_rs_dump_ext_irq(union acpi_resource_data *resource); 300 - 301 - void acpi_rs_dump_fixed_io(union acpi_resource_data *resource); 302 - 303 - void acpi_rs_dump_fixed_memory32(union acpi_resource_data *resource); 304 - 305 - void acpi_rs_dump_memory24(union acpi_resource_data *resource); 306 - 307 - void acpi_rs_dump_memory32(union acpi_resource_data *resource); 308 - 309 - void acpi_rs_dump_start_dpf(union acpi_resource_data *resource); 310 - 311 - void acpi_rs_dump_vendor(union acpi_resource_data *resource); 312 - 313 - void acpi_rs_dump_generic_reg(union acpi_resource_data *resource); 314 - 315 - void acpi_rs_dump_end_dpf(union acpi_resource_data *resource); 316 - 317 - void acpi_rs_dump_end_tag(union acpi_resource_data *resource); 318 - 372 + /* 373 + * rsdump 374 + */ 375 + extern struct acpi_rsdump_info acpi_rs_dump_irq[]; 376 + extern struct acpi_rsdump_info acpi_rs_dump_dma[]; 377 + extern struct acpi_rsdump_info acpi_rs_dump_start_dpf[]; 378 + extern struct acpi_rsdump_info acpi_rs_dump_end_dpf[]; 379 + extern struct acpi_rsdump_info acpi_rs_dump_io[]; 380 + extern struct acpi_rsdump_info acpi_rs_dump_fixed_io[]; 381 + extern struct acpi_rsdump_info acpi_rs_dump_vendor[]; 382 + extern struct acpi_rsdump_info acpi_rs_dump_end_tag[]; 383 + extern struct acpi_rsdump_info acpi_rs_dump_memory24[]; 384 + extern struct acpi_rsdump_info acpi_rs_dump_memory32[]; 385 + extern struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[]; 386 + extern struct acpi_rsdump_info acpi_rs_dump_address16[]; 387 + extern struct acpi_rsdump_info acpi_rs_dump_address32[]; 388 + extern struct acpi_rsdump_info acpi_rs_dump_address64[]; 389 + extern struct acpi_rsdump_info acpi_rs_dump_ext_address64[]; 390 + extern struct acpi_rsdump_info acpi_rs_dump_ext_irq[]; 391 + extern struct acpi_rsdump_info acpi_rs_dump_generic_reg[]; 319 392 #endif 320 393 321 394 #endif /* __ACRESRC_H__ */
+100 -83
include/acpi/actypes.h
··· 83 83 * UINT32 32-bit (4 byte) unsigned value 84 84 * INT64 64-bit (8 byte) signed value 85 85 * UINT64 64-bit (8 byte) unsigned value 86 - * ACPI_NATIVE_INT 32-bit on IA-32, 64-bit on IA-64 signed value 87 - * ACPI_NATIVE_UINT 32-bit on IA-32, 64-bit on IA-64 unsigned value 86 + * ACPI_NATIVE_UINT 32-bit on IA-32, 64-bit on x86_64/IA-64 unsigned value 88 87 */ 88 + 89 + typedef unsigned long acpi_native_uint; 89 90 90 91 #ifndef ACPI_MACHINE_WIDTH 91 92 #error ACPI_MACHINE_WIDTH not defined ··· 109 108 110 109 /*! [End] no source code translation !*/ 111 110 112 - typedef s64 acpi_native_int; 113 - typedef u64 acpi_native_uint; 114 - 115 111 typedef u64 acpi_table_ptr; 116 112 typedef u64 acpi_io_address; 117 113 typedef u64 acpi_physical_address; ··· 119 121 #define ACPI_MAX_PTR ACPI_UINT64_MAX 120 122 #define ACPI_SIZE_MAX ACPI_UINT64_MAX 121 123 124 + /* 125 + * In the case of the Itanium Processor Family (IPF), the hardware does not 126 + * support misaligned memory transfers. Set the MISALIGNMENT_NOT_SUPPORTED flag 127 + * to indicate that special precautions must be taken to avoid alignment faults. 128 + * (IA64 or ia64 is currently used by existing compilers to indicate IPF.) 129 + * 130 + * Note: Em64_t and other X86-64 processors do support misaligned transfers, 131 + * so there is no need to define this flag. 132 + */ 133 + #if defined (__IA64__) || defined (__ia64__) 134 + #define ACPI_MISALIGNMENT_NOT_SUPPORTED 135 + #endif 136 + 122 137 #elif ACPI_MACHINE_WIDTH == 16 123 138 124 - /*! [Begin] no source code translation (keep the typedefs) */ 139 + /*! [Begin] no source code translation (keep the typedefs as-is) */ 125 140 126 141 /* 127 142 * 16-bit type definitions ··· 153 142 154 143 /*! [End] no source code translation !*/ 155 144 156 - typedef u16 acpi_native_uint; 157 - typedef s16 acpi_native_int; 158 - 159 145 typedef u32 acpi_table_ptr; 160 146 typedef u32 acpi_io_address; 161 147 typedef char *acpi_physical_address; 162 148 typedef u16 acpi_size; 163 149 164 150 #define ALIGNED_ADDRESS_BOUNDARY 0x00000002 165 - #define ACPI_MISALIGNED_TRANSFERS 166 151 #define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */ 167 152 #define ACPI_MAX_PTR ACPI_UINT16_MAX 168 153 #define ACPI_SIZE_MAX ACPI_UINT16_MAX ··· 186 179 187 180 /*! [End] no source code translation !*/ 188 181 189 - typedef s32 acpi_native_int; 190 - typedef u32 acpi_native_uint; 191 - 192 182 typedef u64 acpi_table_ptr; 193 183 typedef u32 acpi_io_address; 194 184 typedef u64 acpi_physical_address; 195 185 typedef u32 acpi_size; 196 186 197 187 #define ALIGNED_ADDRESS_BOUNDARY 0x00000004 198 - #define ACPI_MISALIGNED_TRANSFERS 199 188 #define ACPI_MAX_PTR ACPI_UINT32_MAX 200 189 #define ACPI_SIZE_MAX ACPI_UINT32_MAX 201 190 ··· 898 895 /* 899 896 * Definitions for Resource Attributes 900 897 */ 898 + typedef u16 acpi_rs_length; /* Resource Length field is fixed at 16 bits */ 899 + typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (length+3) = (64_k-1)+3 */ 901 900 902 901 /* 903 902 * Memory Attributes ··· 932 927 /* 933 928 * IRQ Attributes 934 929 */ 935 - #define ACPI_EDGE_SENSITIVE (u8) 0x00 936 - #define ACPI_LEVEL_SENSITIVE (u8) 0x01 930 + #define ACPI_LEVEL_SENSITIVE (u8) 0x00 931 + #define ACPI_EDGE_SENSITIVE (u8) 0x01 937 932 938 933 #define ACPI_ACTIVE_HIGH (u8) 0x00 939 934 #define ACPI_ACTIVE_LOW (u8) 0x01 ··· 980 975 #define ACPI_CONSUMER (u8) 0x01 981 976 982 977 /* 978 + * If possible, pack the following structures to byte alignment 979 + */ 980 + #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED 981 + #pragma pack(1) 982 + #endif 983 + 984 + /* 983 985 * Structures used to describe device resources 984 986 */ 985 987 struct acpi_resource_irq { 986 - u32 triggering; 987 - u32 polarity; 988 - u32 sharable; 989 - u32 interrupt_count; 990 - u32 interrupts[1]; 988 + u8 triggering; 989 + u8 polarity; 990 + u8 sharable; 991 + u8 interrupt_count; 992 + u8 interrupts[1]; 991 993 }; 992 994 993 995 struct acpi_resource_dma { 994 - u32 type; 995 - u32 bus_master; 996 - u32 transfer; 997 - u32 channel_count; 998 - u32 channels[1]; 996 + u8 type; 997 + u8 bus_master; 998 + u8 transfer; 999 + u8 channel_count; 1000 + u8 channels[1]; 999 1001 }; 1000 1002 1001 1003 struct acpi_resource_start_dependent { 1002 - u32 compatibility_priority; 1003 - u32 performance_robustness; 1004 + u8 compatibility_priority; 1005 + u8 performance_robustness; 1004 1006 }; 1005 1007 1006 1008 /* ··· 1016 1004 */ 1017 1005 1018 1006 struct acpi_resource_io { 1019 - u32 io_decode; 1020 - u32 minimum; 1021 - u32 maximum; 1022 - u32 alignment; 1023 - u32 address_length; 1007 + u8 io_decode; 1008 + u8 alignment; 1009 + u8 address_length; 1010 + u16 minimum; 1011 + u16 maximum; 1024 1012 }; 1025 1013 1026 1014 struct acpi_resource_fixed_io { 1027 - u32 address; 1028 - u32 address_length; 1015 + u16 address; 1016 + u8 address_length; 1029 1017 }; 1030 1018 1031 1019 struct acpi_resource_vendor { 1032 - u32 byte_length; 1020 + u16 byte_length; 1033 1021 u8 byte_data[1]; 1034 1022 }; 1035 1023 ··· 1038 1026 }; 1039 1027 1040 1028 struct acpi_resource_memory24 { 1041 - u32 read_write_attribute; 1042 - u32 minimum; 1043 - u32 maximum; 1044 - u32 alignment; 1045 - u32 address_length; 1029 + u8 write_protect; 1030 + u16 minimum; 1031 + u16 maximum; 1032 + u16 alignment; 1033 + u16 address_length; 1046 1034 }; 1047 1035 1048 1036 struct acpi_resource_memory32 { 1049 - u32 read_write_attribute; 1037 + u8 write_protect; 1050 1038 u32 minimum; 1051 1039 u32 maximum; 1052 1040 u32 alignment; ··· 1054 1042 }; 1055 1043 1056 1044 struct acpi_resource_fixed_memory32 { 1057 - u32 read_write_attribute; 1045 + u8 write_protect; 1058 1046 u32 address; 1059 1047 u32 address_length; 1060 1048 }; 1061 1049 1062 1050 struct acpi_memory_attribute { 1063 - u16 cache_attribute; 1064 - u16 read_write_attribute; 1051 + u8 write_protect; 1052 + u8 caching; 1053 + u8 range_type; 1054 + u8 translation; 1065 1055 }; 1066 1056 1067 1057 struct acpi_io_attribute { 1068 - u16 range_attribute; 1069 - u16 translation_attribute; 1070 - }; 1071 - 1072 - struct acpi_bus_attribute { 1073 - u16 reserved1; 1074 - u16 reserved2; 1058 + u8 range_type; 1059 + u8 translation; 1060 + u8 translation_type; 1061 + u8 reserved1; 1075 1062 }; 1076 1063 1077 1064 union acpi_resource_attribute { 1078 - struct acpi_memory_attribute memory; 1065 + struct acpi_memory_attribute mem; 1079 1066 struct acpi_io_attribute io; 1080 - struct acpi_bus_attribute bus; 1067 + 1068 + /* Used for the *word_space macros */ 1069 + 1070 + u8 type_specific; 1081 1071 }; 1082 1072 1083 1073 struct acpi_resource_source { 1084 - u32 index; 1085 - u32 string_length; 1074 + u8 index; 1075 + u16 string_length; 1086 1076 char *string_ptr; 1087 1077 }; 1088 1078 1089 1079 /* Fields common to all address descriptors, 16/32/64 bit */ 1090 1080 1091 1081 #define ACPI_RESOURCE_ADDRESS_COMMON \ 1092 - u32 resource_type; \ 1093 - u32 producer_consumer; \ 1094 - u32 decode; \ 1095 - u32 min_address_fixed; \ 1096 - u32 max_address_fixed; \ 1097 - union acpi_resource_attribute attribute; 1082 + u8 resource_type; \ 1083 + u8 producer_consumer; \ 1084 + u8 decode; \ 1085 + u8 min_address_fixed; \ 1086 + u8 max_address_fixed; \ 1087 + union acpi_resource_attribute info; 1098 1088 1099 1089 struct acpi_resource_address { 1100 1090 ACPI_RESOURCE_ADDRESS_COMMON}; 1101 1091 1102 1092 struct acpi_resource_address16 { 1103 - ACPI_RESOURCE_ADDRESS_COMMON u32 granularity; 1104 - u32 minimum; 1105 - u32 maximum; 1106 - u32 translation_offset; 1107 - u32 address_length; 1093 + ACPI_RESOURCE_ADDRESS_COMMON u16 granularity; 1094 + u16 minimum; 1095 + u16 maximum; 1096 + u16 translation_offset; 1097 + u16 address_length; 1108 1098 struct acpi_resource_source resource_source; 1109 1099 }; 1110 1100 ··· 1129 1115 }; 1130 1116 1131 1117 struct acpi_resource_extended_address64 { 1132 - ACPI_RESOURCE_ADDRESS_COMMON u64 granularity; 1118 + ACPI_RESOURCE_ADDRESS_COMMON u8 revision_iD; 1119 + u64 granularity; 1133 1120 u64 minimum; 1134 1121 u64 maximum; 1135 1122 u64 translation_offset; 1136 1123 u64 address_length; 1137 - u64 type_specific_attributes; 1138 - u8 revision_iD; 1124 + u64 type_specific; 1139 1125 }; 1140 1126 1141 1127 struct acpi_resource_extended_irq { 1142 - u32 producer_consumer; 1143 - u32 triggering; 1144 - u32 polarity; 1145 - u32 sharable; 1146 - u32 interrupt_count; 1128 + u8 producer_consumer; 1129 + u8 triggering; 1130 + u8 polarity; 1131 + u8 sharable; 1132 + u8 interrupt_count; 1147 1133 struct acpi_resource_source resource_source; 1148 1134 u32 interrupts[1]; 1149 1135 }; 1150 1136 1151 1137 struct acpi_resource_generic_register { 1152 - u32 space_id; 1153 - u32 bit_width; 1154 - u32 bit_offset; 1155 - u32 access_size; 1138 + u8 space_id; 1139 + u8 bit_width; 1140 + u8 bit_offset; 1141 + u8 access_size; 1156 1142 u64 address; 1157 1143 }; 1158 1144 ··· 1206 1192 union acpi_resource_data data; 1207 1193 }; 1208 1194 1209 - #define ACPI_RESOURCE_LENGTH 12 1210 - #define ACPI_RESOURCE_LENGTH_NO_DATA 8 /* Id + Length fields */ 1195 + /* restore default alignment */ 1211 1196 1212 - #define ACPI_SIZEOF_RESOURCE(type) (u32) (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (type)) 1197 + #pragma pack() 1198 + 1199 + #define ACPI_RS_SIZE_MIN 12 1200 + #define ACPI_RS_SIZE_NO_DATA 8 /* Id + Length fields */ 1201 + #define ACPI_RS_SIZE(type) (u32) (ACPI_RS_SIZE_NO_DATA + sizeof (type)) 1213 1202 1214 1203 #define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length) 1215 1204 1216 - #ifdef ACPI_MISALIGNED_TRANSFERS 1205 + #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED 1217 1206 #define ACPI_ALIGN_RESOURCE_SIZE(length) (length) 1218 1207 #else 1219 1208 #define ACPI_ALIGN_RESOURCE_SIZE(length) ACPI_ROUND_UP_TO_NATIVE_WORD(length)
+6 -1
include/acpi/acutils.h
··· 159 159 #define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO)) 160 160 #define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU)) 161 161 #define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP)) 162 - #define ACPI_IS_ASCII(c) ((c) < 0x80) 163 162 164 163 #endif /* ACPI_USE_SYSTEM_CLIBRARY */ 165 164 ··· 417 418 /* Values for Base above (16=Hex, 10=Decimal) */ 418 419 419 420 #define ACPI_ANY_BASE 0 421 + 422 + u32 acpi_ut_get_descriptor_length(void *aml); 423 + 424 + u16 acpi_ut_get_resource_length(void *aml); 425 + 426 + u8 acpi_ut_get_resource_type(void *aml); 420 427 421 428 u8 *acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc); 422 429
+7 -7
include/acpi/amlresrc.h
··· 134 134 AML_RESOURCE_SMALL_HEADER_COMMON}; 135 135 136 136 struct aml_resource_io { 137 - AML_RESOURCE_SMALL_HEADER_COMMON u8 information; 137 + AML_RESOURCE_SMALL_HEADER_COMMON u8 flags; 138 138 u16 minimum; 139 139 u16 maximum; 140 140 u8 alignment; ··· 164 164 AML_RESOURCE_LARGE_HEADER_COMMON}; 165 165 166 166 struct aml_resource_memory24 { 167 - AML_RESOURCE_LARGE_HEADER_COMMON u8 information; 167 + AML_RESOURCE_LARGE_HEADER_COMMON u8 flags; 168 168 u16 minimum; 169 169 u16 maximum; 170 170 u16 alignment; ··· 175 175 AML_RESOURCE_LARGE_HEADER_COMMON}; 176 176 177 177 struct aml_resource_memory32 { 178 - AML_RESOURCE_LARGE_HEADER_COMMON u8 information; 178 + AML_RESOURCE_LARGE_HEADER_COMMON u8 flags; 179 179 u32 minimum; 180 180 u32 maximum; 181 181 u32 alignment; ··· 183 183 }; 184 184 185 185 struct aml_resource_fixed_memory32 { 186 - AML_RESOURCE_LARGE_HEADER_COMMON u8 information; 186 + AML_RESOURCE_LARGE_HEADER_COMMON u8 flags; 187 187 u32 address; 188 188 u32 address_length; 189 189 }; ··· 205 205 u64 maximum; 206 206 u64 translation_offset; 207 207 u64 address_length; 208 - u64 type_specific_attributes; 208 + u64 type_specific; 209 209 }; 210 210 211 211 #define AML_RESOURCE_EXTENDED_ADDRESS_REVISION 1 /* ACPI 3.0 */ ··· 239 239 240 240 struct aml_resource_extended_irq { 241 241 AML_RESOURCE_LARGE_HEADER_COMMON u8 flags; 242 - u8 table_length; 243 - u32 interrupt_number[1]; 242 + u8 interrupt_count; 243 + u32 interrupts[1]; 244 244 /* res_source_index, res_source optional fields follow */ 245 245 }; 246 246
+6 -5
include/acpi/platform/acenv.h
··· 206 206 * 207 207 *****************************************************************************/ 208 208 209 + #define ACPI_IS_ASCII(c) ((c) < 0x80) 210 + 209 211 #ifdef ACPI_USE_SYSTEM_CLIBRARY 210 212 /* 211 213 * Use the standard C library headers. ··· 237 235 #define ACPI_STRCAT(d,s) (void) strcat((d), (s)) 238 236 #define ACPI_STRNCAT(d,s,n) strncat((d), (s), (acpi_size)(n)) 239 237 #define ACPI_STRTOUL(d,s,n) strtoul((d), (s), (acpi_size)(n)) 240 - #define ACPI_MEMCMP(s1,s2,n) memcmp((s1), (s2), (acpi_size)(n)) 238 + #define ACPI_MEMCMP(s1,s2,n) memcmp((const char *)(s1), (const char *)(s2), (acpi_size)(n)) 241 239 #define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (acpi_size)(n)) 242 240 #define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (acpi_size)(n)) 243 241 ··· 249 247 #define ACPI_IS_UPPER(i) isupper((int) (i)) 250 248 #define ACPI_IS_PRINT(i) isprint((int) (i)) 251 249 #define ACPI_IS_ALPHA(i) isalpha((int) (i)) 252 - #define ACPI_IS_ASCII(i) isascii((int) (i)) 253 250 254 251 #else 255 252 ··· 275 274 /* 276 275 * Storage alignment properties 277 276 */ 278 - #define _AUPBND (sizeof (acpi_native_int) - 1) 279 - #define _ADNBND (sizeof (acpi_native_int) - 1) 277 + #define _AUPBND (sizeof (acpi_native_uint) - 1) 278 + #define _ADNBND (sizeof (acpi_native_uint) - 1) 280 279 281 280 /* 282 281 * Variable argument list macro definitions ··· 298 297 #define ACPI_STRCAT(d,s) (void) acpi_ut_strcat ((d), (s)) 299 298 #define ACPI_STRNCAT(d,s,n) acpi_ut_strncat ((d), (s), (acpi_size)(n)) 300 299 #define ACPI_STRTOUL(d,s,n) acpi_ut_strtoul ((d), (s), (acpi_size)(n)) 301 - #define ACPI_MEMCMP(s1,s2,n) acpi_ut_memcmp((s1), (s2), (acpi_size)(n)) 300 + #define ACPI_MEMCMP(s1,s2,n) acpi_ut_memcmp((const char *)(s1), (const char *)(s2), (acpi_size)(n)) 302 301 #define ACPI_MEMCPY(d,s,n) (void) acpi_ut_memcpy ((d), (s), (acpi_size)(n)) 303 302 #define ACPI_MEMSET(d,v,n) (void) acpi_ut_memset ((d), (v), (acpi_size)(n)) 304 303 #define ACPI_TOUPPER acpi_ut_to_upper