acpi_machdep.c (281a6ff273d191678b343d531cdb7e877d6663f9) acpi_machdep.c (7ae99f80b6661760c5de3edd330b279f04b092a2)
1/*-
2 * Copyright (c) 2001 Mitsuru IWASAKI
3 * Copyright (c) 2015 The FreeBSD Foundation
4 * All rights reserved.
5 *
6 * This software was developed by Andrew Turner under
7 * sponsorship from the FreeBSD Foundation.
8 *

--- 57 unchanged lines hidden (view full) ---

66map_table(vm_paddr_t pa, const char *sig)
67{
68 ACPI_TABLE_HEADER *header;
69 vm_size_t length;
70 void *table;
71
72 header = pmap_mapbios(pa, sizeof(ACPI_TABLE_HEADER));
73 if (strncmp(header->Signature, sig, ACPI_NAMESEG_SIZE) != 0) {
1/*-
2 * Copyright (c) 2001 Mitsuru IWASAKI
3 * Copyright (c) 2015 The FreeBSD Foundation
4 * All rights reserved.
5 *
6 * This software was developed by Andrew Turner under
7 * sponsorship from the FreeBSD Foundation.
8 *

--- 57 unchanged lines hidden (view full) ---

66map_table(vm_paddr_t pa, const char *sig)
67{
68 ACPI_TABLE_HEADER *header;
69 vm_size_t length;
70 void *table;
71
72 header = pmap_mapbios(pa, sizeof(ACPI_TABLE_HEADER));
73 if (strncmp(header->Signature, sig, ACPI_NAMESEG_SIZE) != 0) {
74 pmap_unmapbios((vm_offset_t)header, sizeof(ACPI_TABLE_HEADER));
74 pmap_unmapbios(header, sizeof(ACPI_TABLE_HEADER));
75 return (NULL);
76 }
77 length = header->Length;
75 return (NULL);
76 }
77 length = header->Length;
78 pmap_unmapbios((vm_offset_t)header, sizeof(ACPI_TABLE_HEADER));
78 pmap_unmapbios(header, sizeof(ACPI_TABLE_HEADER));
79
80 table = pmap_mapbios(pa, length);
81 if (ACPI_FAILURE(AcpiTbChecksum(table, length))) {
82 if (bootverbose)
83 printf("ACPI: Failed checksum for table %s\n", sig);
84#if (ACPI_CHECKSUM_ABORT)
85 pmap_unmapbios(table, length);
86 return (NULL);

--- 15 unchanged lines hidden (view full) ---

102 if (table == NULL) {
103 if (bootverbose)
104 printf("ACPI: Failed to map table at 0x%jx\n",
105 (uintmax_t)address);
106 return (0);
107 }
108
109 if (strncmp(table->Signature, sig, ACPI_NAMESEG_SIZE) != 0) {
79
80 table = pmap_mapbios(pa, length);
81 if (ACPI_FAILURE(AcpiTbChecksum(table, length))) {
82 if (bootverbose)
83 printf("ACPI: Failed checksum for table %s\n", sig);
84#if (ACPI_CHECKSUM_ABORT)
85 pmap_unmapbios(table, length);
86 return (NULL);

--- 15 unchanged lines hidden (view full) ---

102 if (table == NULL) {
103 if (bootverbose)
104 printf("ACPI: Failed to map table at 0x%jx\n",
105 (uintmax_t)address);
106 return (0);
107 }
108
109 if (strncmp(table->Signature, sig, ACPI_NAMESEG_SIZE) != 0) {
110 pmap_unmapbios((vm_offset_t)table, sizeof(ACPI_TABLE_HEADER));
110 pmap_unmapbios(table, sizeof(ACPI_TABLE_HEADER));
111 return (0);
112 }
111 return (0);
112 }
113 pmap_unmapbios((vm_offset_t)table, sizeof(ACPI_TABLE_HEADER));
113 pmap_unmapbios(table, sizeof(ACPI_TABLE_HEADER));
114 return (1);
115}
116
117/* Unmap a table previously mapped via acpi_map_table(). */
118void
119acpi_unmap_table(void *table)
120{
121 ACPI_TABLE_HEADER *header;
122
123 header = (ACPI_TABLE_HEADER *)table;
114 return (1);
115}
116
117/* Unmap a table previously mapped via acpi_map_table(). */
118void
119acpi_unmap_table(void *table)
120{
121 ACPI_TABLE_HEADER *header;
122
123 header = (ACPI_TABLE_HEADER *)table;
124 pmap_unmapbios((vm_offset_t)table, header->Length);
124 pmap_unmapbios(table, header->Length);
125}
126
127/*
128 * Try to map a table at a given physical address previously returned
129 * by acpi_find_table().
130 */
131void *
132acpi_map_table(vm_paddr_t pa, const char *sig)

--- 36 unchanged lines hidden (view full) ---

169 if (rsdp->Revision >= 2 && rsdp->XsdtPhysicalAddress != 0) {
170 /*
171 * AcpiOsGetRootPointer only verifies the checksum for
172 * the version 1.0 portion of the RSDP. Version 2.0 has
173 * an additional checksum that we verify first.
174 */
175 if (AcpiTbChecksum((UINT8 *)rsdp, ACPI_RSDP_XCHECKSUM_LENGTH)) {
176 printf("ACPI: RSDP failed extended checksum\n");
125}
126
127/*
128 * Try to map a table at a given physical address previously returned
129 * by acpi_find_table().
130 */
131void *
132acpi_map_table(vm_paddr_t pa, const char *sig)

--- 36 unchanged lines hidden (view full) ---

169 if (rsdp->Revision >= 2 && rsdp->XsdtPhysicalAddress != 0) {
170 /*
171 * AcpiOsGetRootPointer only verifies the checksum for
172 * the version 1.0 portion of the RSDP. Version 2.0 has
173 * an additional checksum that we verify first.
174 */
175 if (AcpiTbChecksum((UINT8 *)rsdp, ACPI_RSDP_XCHECKSUM_LENGTH)) {
176 printf("ACPI: RSDP failed extended checksum\n");
177 pmap_unmapbios((vm_offset_t)rsdp,
178 sizeof(ACPI_TABLE_RSDP));
177 pmap_unmapbios(rsdp, sizeof(ACPI_TABLE_RSDP));
179 return (0);
180 }
181 xsdt = map_table(rsdp->XsdtPhysicalAddress, ACPI_SIG_XSDT);
182 if (xsdt == NULL) {
183 printf("ACPI: Failed to map XSDT\n");
178 return (0);
179 }
180 xsdt = map_table(rsdp->XsdtPhysicalAddress, ACPI_SIG_XSDT);
181 if (xsdt == NULL) {
182 printf("ACPI: Failed to map XSDT\n");
184 pmap_unmapbios((vm_offset_t)rsdp,
185 sizeof(ACPI_TABLE_RSDP));
183 pmap_unmapbios(rsdp, sizeof(ACPI_TABLE_RSDP));
186 return (0);
187 }
188 count = (xsdt->Header.Length - sizeof(ACPI_TABLE_HEADER)) /
189 sizeof(UINT64);
190 for (i = 0; i < count; i++)
191 if (probe_table(xsdt->TableOffsetEntry[i], sig)) {
192 addr = xsdt->TableOffsetEntry[i];
193 break;
194 }
195 acpi_unmap_table(xsdt);
196 } else {
197 printf("ACPI: Unsupported RSDP version %d and XSDT %#lx\n",
198 rsdp->Revision, rsdp->XsdtPhysicalAddress);
199 }
184 return (0);
185 }
186 count = (xsdt->Header.Length - sizeof(ACPI_TABLE_HEADER)) /
187 sizeof(UINT64);
188 for (i = 0; i < count; i++)
189 if (probe_table(xsdt->TableOffsetEntry[i], sig)) {
190 addr = xsdt->TableOffsetEntry[i];
191 break;
192 }
193 acpi_unmap_table(xsdt);
194 } else {
195 printf("ACPI: Unsupported RSDP version %d and XSDT %#lx\n",
196 rsdp->Revision, rsdp->XsdtPhysicalAddress);
197 }
200 pmap_unmapbios((vm_offset_t)rsdp, sizeof(ACPI_TABLE_RSDP));
198 pmap_unmapbios(rsdp, sizeof(ACPI_TABLE_RSDP));
201
202 if (addr == 0)
203 return (0);
204
205 /*
206 * Verify that we can map the full table and that its checksum is
207 * correct, etc.
208 */

--- 75 unchanged lines hidden ---
199
200 if (addr == 0)
201 return (0);
202
203 /*
204 * Verify that we can map the full table and that its checksum is
205 * correct, etc.
206 */

--- 75 unchanged lines hidden ---