Changes in kernel/genarch/src/acpi/acpi.c [1b20da0:a35b458] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/acpi/acpi.c
r1b20da0 ra35b458 69 69 uint8_t sum = 0; 70 70 uint32_t i; 71 71 72 72 for (i = 0; i < 20; i++) 73 73 sum = (uint8_t) (sum + _rsdp[i]); 74 74 75 75 if (sum) 76 76 return 0; /* bad checksum */ 77 77 78 78 if (rsdp->revision == 0) 79 79 return 1; /* ACPI 1.0 */ 80 80 81 81 for (; i < rsdp->length; i++) 82 82 sum = (uint8_t) (sum + _rsdp[i]); 83 83 84 84 return !sum; 85 85 } … … 90 90 uint8_t sum = 0; 91 91 unsigned int i; 92 92 93 93 for (i = 0; i < hdr->length; i++) 94 94 sum = (uint8_t) (sum + sdt[i]); 95 95 96 96 return !sum; 97 97 } … … 109 109 vsdt = (struct acpi_sdt_header *) km_map((uintptr_t) psdt, 110 110 vhdr->length, PAGE_WRITE | PAGE_NOT_CACHEABLE); 111 111 112 112 // TODO: do not leak vtmp 113 113 … … 121 121 size_t cnt = (acpi_rsdt->header.length - sizeof(struct acpi_sdt_header)) 122 122 / sizeof(uint32_t); 123 123 124 124 for (i = 0; i < cnt; i++) { 125 125 for (j = 0; j < sizeof(signature_map) … … 127 127 struct acpi_sdt_header *hdr = 128 128 (struct acpi_sdt_header *) (sysarg_t) acpi_rsdt->entry[i]; 129 129 130 130 struct acpi_sdt_header *vhdr = map_sdt(hdr); 131 131 if (CMP_SIGNATURE(vhdr->signature, signature_map[j].signature)) { 132 132 if (!acpi_sdt_check((uint8_t *) vhdr)) 133 133 break; 134 134 135 135 *signature_map[j].sdt_ptr = vhdr; 136 136 LOG("%p: ACPI %s", *signature_map[j].sdt_ptr, … … 147 147 size_t cnt = (acpi_xsdt->header.length - sizeof(struct acpi_sdt_header)) 148 148 / sizeof(uint64_t); 149 149 150 150 for (i = 0; i < cnt; i++) { 151 151 for (j = 0; j < sizeof(signature_map) … … 153 153 struct acpi_sdt_header *hdr = 154 154 (struct acpi_sdt_header *) ((uintptr_t) acpi_xsdt->entry[i]); 155 155 156 156 struct acpi_sdt_header *vhdr = map_sdt(hdr); 157 157 if (CMP_SIGNATURE(vhdr->signature, signature_map[j].signature)) { 158 158 if (!acpi_sdt_check((uint8_t *) vhdr)) 159 159 break; 160 160 161 161 *signature_map[j].sdt_ptr = vhdr; 162 162 LOG("%p: ACPI %s", *signature_map[j].sdt_ptr, … … 174 174 unsigned int length[2] = { 1024, 128 * 1024 }; 175 175 uint64_t *sig = (uint64_t *) RSDP_SIGNATURE; 176 176 177 177 /* 178 178 * Find Root System Description Pointer … … 180 180 * 2. search 128K starting at 0xe0000 181 181 */ 182 182 183 183 addr[0] = (uint8_t *) PA2KA(ebda); 184 184 for (i = (ebda ? 0 : 1); i < 2; i++) { … … 191 191 } 192 192 } 193 193 194 194 return; 195 195 196 196 rsdp_found: 197 197 LOG("%p: ACPI Root System Description Pointer", acpi_rsdp); 198 198 199 199 uintptr_t acpi_rsdt_p = (uintptr_t) acpi_rsdp->rsdt_address; 200 200 uintptr_t acpi_xsdt_p = 0; … … 202 202 if (acpi_rsdp->revision) 203 203 acpi_xsdt_p = (uintptr_t) acpi_rsdp->xsdt_address; 204 204 205 205 if (acpi_rsdt_p) 206 206 acpi_rsdt = (struct acpi_rsdt *) map_sdt( 207 207 (struct acpi_sdt_header *) acpi_rsdt_p); 208 208 209 209 if (acpi_xsdt_p) 210 210 acpi_xsdt = (struct acpi_xsdt *) map_sdt( 211 211 (struct acpi_sdt_header *) acpi_xsdt_p); 212 212 213 213 if ((acpi_rsdt) && (!acpi_sdt_check((uint8_t *) acpi_rsdt))) { 214 214 log(LF_ARCH, LVL_ERROR, "RSDT: bad checksum"); 215 215 return; 216 216 } 217 217 218 218 if ((acpi_xsdt) && (!acpi_sdt_check((uint8_t *) acpi_xsdt))) { 219 219 log(LF_ARCH, LVL_ERROR, "XSDT: bad checksum"); 220 220 return; 221 221 } 222 222 223 223 if (acpi_xsdt) 224 224 configure_via_xsdt();
Note:
See TracChangeset
for help on using the changeset viewer.