diff options
Diffstat (limited to 'drivers/acpi/tables/tbrsdt.c')
-rw-r--r-- | drivers/acpi/tables/tbrsdt.c | 59 |
1 files changed, 21 insertions, 38 deletions
diff --git a/drivers/acpi/tables/tbrsdt.c b/drivers/acpi/tables/tbrsdt.c index b7ffe39c3626..069d498465d0 100644 --- a/drivers/acpi/tables/tbrsdt.c +++ b/drivers/acpi/tables/tbrsdt.c | |||
@@ -96,32 +96,13 @@ acpi_tb_verify_rsdp ( | |||
96 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 96 | return_ACPI_STATUS (AE_BAD_PARAMETER); |
97 | } | 97 | } |
98 | 98 | ||
99 | /* | 99 | /* Verify RSDP signature and checksum */ |
100 | * The signature and checksum must both be correct | ||
101 | */ | ||
102 | if (ACPI_STRNCMP ((char *) rsdp, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) { | ||
103 | /* Nope, BAD Signature */ | ||
104 | |||
105 | status = AE_BAD_SIGNATURE; | ||
106 | goto cleanup; | ||
107 | } | ||
108 | |||
109 | /* Check the standard checksum */ | ||
110 | 100 | ||
111 | if (acpi_tb_checksum (rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) { | 101 | status = acpi_tb_validate_rsdp (rsdp); |
112 | status = AE_BAD_CHECKSUM; | 102 | if (ACPI_FAILURE (status)) { |
113 | goto cleanup; | 103 | goto cleanup; |
114 | } | 104 | } |
115 | 105 | ||
116 | /* Check extended checksum if table version >= 2 */ | ||
117 | |||
118 | if (rsdp->revision >= 2) { | ||
119 | if (acpi_tb_checksum (rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0) { | ||
120 | status = AE_BAD_CHECKSUM; | ||
121 | goto cleanup; | ||
122 | } | ||
123 | } | ||
124 | |||
125 | /* The RSDP supplied is OK */ | 106 | /* The RSDP supplied is OK */ |
126 | 107 | ||
127 | table_info.pointer = ACPI_CAST_PTR (struct acpi_table_header, rsdp); | 108 | table_info.pointer = ACPI_CAST_PTR (struct acpi_table_header, rsdp); |
@@ -159,8 +140,8 @@ cleanup: | |||
159 | * | 140 | * |
160 | * RETURN: None, Address | 141 | * RETURN: None, Address |
161 | * | 142 | * |
162 | * DESCRIPTION: Extract the address of the RSDT or XSDT, depending on the | 143 | * DESCRIPTION: Extract the address of either the RSDT or XSDT, depending on the |
163 | * version of the RSDP | 144 | * version of the RSDP and whether the XSDT pointer is valid |
164 | * | 145 | * |
165 | ******************************************************************************/ | 146 | ******************************************************************************/ |
166 | 147 | ||
@@ -174,16 +155,19 @@ acpi_tb_get_rsdt_address ( | |||
174 | 155 | ||
175 | out_address->pointer_type = acpi_gbl_table_flags | ACPI_LOGICAL_ADDRESSING; | 156 | out_address->pointer_type = acpi_gbl_table_flags | ACPI_LOGICAL_ADDRESSING; |
176 | 157 | ||
177 | /* | 158 | /* Use XSDT if it is present */ |
178 | * For RSDP revision 0 or 1, we use the RSDT. | 159 | |
179 | * For RSDP revision 2 (and above), we use the XSDT | 160 | if ((acpi_gbl_RSDP->revision >= 2) && |
180 | */ | 161 | acpi_gbl_RSDP->xsdt_physical_address) { |
181 | if (acpi_gbl_RSDP->revision < 2) { | ||
182 | out_address->pointer.value = acpi_gbl_RSDP->rsdt_physical_address; | ||
183 | } | ||
184 | else { | ||
185 | out_address->pointer.value = | 162 | out_address->pointer.value = |
186 | acpi_gbl_RSDP->xsdt_physical_address; | 163 | acpi_gbl_RSDP->xsdt_physical_address; |
164 | acpi_gbl_root_table_type = ACPI_TABLE_TYPE_XSDT; | ||
165 | } | ||
166 | else { | ||
167 | /* No XSDT, use the RSDT */ | ||
168 | |||
169 | out_address->pointer.value = acpi_gbl_RSDP->rsdt_physical_address; | ||
170 | acpi_gbl_root_table_type = ACPI_TABLE_TYPE_RSDT; | ||
187 | } | 171 | } |
188 | } | 172 | } |
189 | 173 | ||
@@ -211,10 +195,9 @@ acpi_tb_validate_rsdt ( | |||
211 | 195 | ||
212 | 196 | ||
213 | /* | 197 | /* |
214 | * For RSDP revision 0 or 1, we use the RSDT. | 198 | * Search for appropriate signature, RSDT or XSDT |
215 | * For RSDP revision 2 and above, we use the XSDT | ||
216 | */ | 199 | */ |
217 | if (acpi_gbl_RSDP->revision < 2) { | 200 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { |
218 | no_match = ACPI_STRNCMP ((char *) table_ptr, RSDT_SIG, | 201 | no_match = ACPI_STRNCMP ((char *) table_ptr, RSDT_SIG, |
219 | sizeof (RSDT_SIG) -1); | 202 | sizeof (RSDT_SIG) -1); |
220 | } | 203 | } |
@@ -236,11 +219,11 @@ acpi_tb_validate_rsdt ( | |||
236 | acpi_gbl_RSDP->rsdt_physical_address, | 219 | acpi_gbl_RSDP->rsdt_physical_address, |
237 | (void *) (acpi_native_uint) acpi_gbl_RSDP->rsdt_physical_address)); | 220 | (void *) (acpi_native_uint) acpi_gbl_RSDP->rsdt_physical_address)); |
238 | 221 | ||
239 | if (acpi_gbl_RSDP->revision < 2) { | 222 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { |
240 | ACPI_REPORT_ERROR (("Looking for RSDT (RSDP->Rev < 2)\n")) | 223 | ACPI_REPORT_ERROR (("Looking for RSDT\n")) |
241 | } | 224 | } |
242 | else { | 225 | else { |
243 | ACPI_REPORT_ERROR (("Looking for XSDT (RSDP->Rev >= 2)\n")) | 226 | ACPI_REPORT_ERROR (("Looking for XSDT\n")) |
244 | } | 227 | } |
245 | 228 | ||
246 | ACPI_DUMP_BUFFER ((char *) table_ptr, 48); | 229 | ACPI_DUMP_BUFFER ((char *) table_ptr, 48); |