| .. | .. |
|---|
| 3 | 3 | * |
|---|
| 4 | 4 | * Module Name: evgpeinit - System GPE initialization and update |
|---|
| 5 | 5 | * |
|---|
| 6 | | - * Copyright (C) 2000 - 2018, Intel Corp. |
|---|
| 6 | + * Copyright (C) 2000 - 2020, Intel Corp. |
|---|
| 7 | 7 | * |
|---|
| 8 | 8 | *****************************************************************************/ |
|---|
| 9 | 9 | |
|---|
| .. | .. |
|---|
| 32 | 32 | * kernel boot time as well. |
|---|
| 33 | 33 | */ |
|---|
| 34 | 34 | |
|---|
| 35 | +#ifdef ACPI_GPE_USE_LOGICAL_ADDRESSES |
|---|
| 36 | +#define ACPI_FADT_GPE_BLOCK_ADDRESS(N) \ |
|---|
| 37 | + acpi_gbl_FADT.xgpe##N##_block.space_id == \ |
|---|
| 38 | + ACPI_ADR_SPACE_SYSTEM_MEMORY ? \ |
|---|
| 39 | + (u64)acpi_gbl_xgpe##N##_block_logical_address : \ |
|---|
| 40 | + acpi_gbl_FADT.xgpe##N##_block.address |
|---|
| 41 | +#else |
|---|
| 42 | +#define ACPI_FADT_GPE_BLOCK_ADDRESS(N) acpi_gbl_FADT.xgpe##N##_block.address |
|---|
| 43 | +#endif /* ACPI_GPE_USE_LOGICAL_ADDRESSES */ |
|---|
| 44 | + |
|---|
| 35 | 45 | /******************************************************************************* |
|---|
| 36 | 46 | * |
|---|
| 37 | 47 | * FUNCTION: acpi_ev_gpe_initialize |
|---|
| .. | .. |
|---|
| 49 | 59 | u32 register_count1 = 0; |
|---|
| 50 | 60 | u32 gpe_number_max = 0; |
|---|
| 51 | 61 | acpi_status status; |
|---|
| 62 | + u64 address; |
|---|
| 52 | 63 | |
|---|
| 53 | 64 | ACPI_FUNCTION_TRACE(ev_gpe_initialize); |
|---|
| 54 | 65 | |
|---|
| .. | .. |
|---|
| 85 | 96 | * If EITHER the register length OR the block address are zero, then that |
|---|
| 86 | 97 | * particular block is not supported. |
|---|
| 87 | 98 | */ |
|---|
| 88 | | - if (acpi_gbl_FADT.gpe0_block_length && |
|---|
| 89 | | - acpi_gbl_FADT.xgpe0_block.address) { |
|---|
| 99 | + address = ACPI_FADT_GPE_BLOCK_ADDRESS(0); |
|---|
| 100 | + |
|---|
| 101 | + if (acpi_gbl_FADT.gpe0_block_length && address) { |
|---|
| 90 | 102 | |
|---|
| 91 | 103 | /* GPE block 0 exists (has both length and address > 0) */ |
|---|
| 92 | 104 | |
|---|
| .. | .. |
|---|
| 97 | 109 | /* Install GPE Block 0 */ |
|---|
| 98 | 110 | |
|---|
| 99 | 111 | status = acpi_ev_create_gpe_block(acpi_gbl_fadt_gpe_device, |
|---|
| 100 | | - acpi_gbl_FADT.xgpe0_block. |
|---|
| 101 | 112 | address, |
|---|
| 102 | 113 | acpi_gbl_FADT.xgpe0_block. |
|---|
| 103 | 114 | space_id, register_count0, 0, |
|---|
| .. | .. |
|---|
| 110 | 121 | } |
|---|
| 111 | 122 | } |
|---|
| 112 | 123 | |
|---|
| 113 | | - if (acpi_gbl_FADT.gpe1_block_length && |
|---|
| 114 | | - acpi_gbl_FADT.xgpe1_block.address) { |
|---|
| 124 | + address = ACPI_FADT_GPE_BLOCK_ADDRESS(1); |
|---|
| 125 | + |
|---|
| 126 | + if (acpi_gbl_FADT.gpe1_block_length && address) { |
|---|
| 115 | 127 | |
|---|
| 116 | 128 | /* GPE block 1 exists (has both length and address > 0) */ |
|---|
| 117 | 129 | |
|---|
| .. | .. |
|---|
| 137 | 149 | |
|---|
| 138 | 150 | status = |
|---|
| 139 | 151 | acpi_ev_create_gpe_block(acpi_gbl_fadt_gpe_device, |
|---|
| 140 | | - acpi_gbl_FADT.xgpe1_block. |
|---|
| 141 | 152 | address, |
|---|
| 142 | 153 | acpi_gbl_FADT.xgpe1_block. |
|---|
| 143 | 154 | space_id, register_count1, |
|---|
| .. | .. |
|---|
| 156 | 167 | * GPE0 and GPE1 do not have to be contiguous in the GPE number |
|---|
| 157 | 168 | * space. However, GPE0 always starts at GPE number zero. |
|---|
| 158 | 169 | */ |
|---|
| 159 | | - gpe_number_max = acpi_gbl_FADT.gpe1_base + |
|---|
| 160 | | - ((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1); |
|---|
| 161 | 170 | } |
|---|
| 162 | 171 | } |
|---|
| 163 | 172 | |
|---|
| .. | .. |
|---|
| 169 | 178 | |
|---|
| 170 | 179 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, |
|---|
| 171 | 180 | "There are no GPE blocks defined in the FADT\n")); |
|---|
| 172 | | - status = AE_OK; |
|---|
| 173 | 181 | goto cleanup; |
|---|
| 174 | 182 | } |
|---|
| 175 | 183 | |
|---|
| .. | .. |
|---|
| 292 | 300 | acpi_status status; |
|---|
| 293 | 301 | u32 gpe_number; |
|---|
| 294 | 302 | u8 temp_gpe_number; |
|---|
| 295 | | - char name[ACPI_NAME_SIZE + 1]; |
|---|
| 303 | + char name[ACPI_NAMESEG_SIZE + 1]; |
|---|
| 296 | 304 | u8 type; |
|---|
| 297 | 305 | |
|---|
| 298 | 306 | ACPI_FUNCTION_TRACE(ev_match_gpe_method); |
|---|
| .. | .. |
|---|
| 310 | 318 | * 1) Extract the method name and null terminate it |
|---|
| 311 | 319 | */ |
|---|
| 312 | 320 | ACPI_MOVE_32_TO_32(name, &method_node->name.integer); |
|---|
| 313 | | - name[ACPI_NAME_SIZE] = 0; |
|---|
| 321 | + name[ACPI_NAMESEG_SIZE] = 0; |
|---|
| 314 | 322 | |
|---|
| 315 | 323 | /* 2) Name must begin with an underscore */ |
|---|
| 316 | 324 | |
|---|