Changes in kernel/genarch/src/acpi/acpi.c [96b02eb9:93da799] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/acpi/acpi.c
r96b02eb9 r93da799 39 39 #include <genarch/acpi/madt.h> 40 40 #include <arch/bios/bios.h> 41 #include <mm/as.h>42 41 #include <mm/page.h> 42 #include <mm/km.h> 43 43 #include <print.h> 44 44 … … 96 96 } 97 97 98 static void map_sdt(struct acpi_sdt_header *sdt) 99 { 100 page_table_lock(AS_KERNEL, true); 101 page_mapping_insert(AS_KERNEL, (uintptr_t) sdt, (uintptr_t) sdt, 102 PAGE_NOT_CACHEABLE | PAGE_WRITE); 103 map_structure((uintptr_t) sdt, sdt->length); 104 page_table_unlock(AS_KERNEL, true); 98 static struct acpi_sdt_header *map_sdt(struct acpi_sdt_header *psdt) 99 { 100 struct acpi_sdt_header *vhdr; 101 struct acpi_sdt_header *vsdt; 102 103 /* Start with mapping the header only. */ 104 vhdr = (struct acpi_sdt_header *) km_map_structure((uintptr_t) psdt, 105 sizeof(struct acpi_sdt_header), PAGE_READ | PAGE_NOT_CACHEABLE); 106 107 /* Now we can map the entire structure. */ 108 vsdt = (struct acpi_sdt_header *) km_map_structure((uintptr_t) psdt, 109 vhdr->length, PAGE_WRITE | PAGE_NOT_CACHEABLE); 110 111 // TODO: do not leak vtmp 112 113 return vsdt; 105 114 } 106 115 … … 118 127 (struct acpi_sdt_header *) (sysarg_t) acpi_rsdt->entry[i]; 119 128 120 map_sdt(hdr);121 if (CMP_SIGNATURE( hdr->signature, signature_map[j].signature)) {122 if (!acpi_sdt_check((uint8_t *) hdr))129 struct acpi_sdt_header *vhdr = map_sdt(hdr); 130 if (CMP_SIGNATURE(vhdr->signature, signature_map[j].signature)) { 131 if (!acpi_sdt_check((uint8_t *) vhdr)) 123 132 break; 124 133 125 *signature_map[j].sdt_ptr = hdr;134 *signature_map[j].sdt_ptr = vhdr; 126 135 LOG("%p: ACPI %s", *signature_map[j].sdt_ptr, 127 136 signature_map[j].description); … … 144 153 (struct acpi_sdt_header *) ((uintptr_t) acpi_xsdt->entry[i]); 145 154 146 map_sdt(hdr);147 if (CMP_SIGNATURE( hdr->signature, signature_map[j].signature)) {148 if (!acpi_sdt_check((uint8_t *) hdr))155 struct acpi_sdt_header *vhdr = map_sdt(hdr); 156 if (CMP_SIGNATURE(vhdr->signature, signature_map[j].signature)) { 157 if (!acpi_sdt_check((uint8_t *) vhdr)) 149 158 break; 150 159 151 *signature_map[j].sdt_ptr = hdr;160 *signature_map[j].sdt_ptr = vhdr; 152 161 LOG("%p: ACPI %s", *signature_map[j].sdt_ptr, 153 162 signature_map[j].description); … … 187 196 LOG("%p: ACPI Root System Description Pointer", acpi_rsdp); 188 197 189 acpi_rsdt = (struct acpi_rsdt *) ((uintptr_t) acpi_rsdp->rsdt_address); 198 uintptr_t acpi_rsdt_p = (uintptr_t) acpi_rsdp->rsdt_address; 199 uintptr_t acpi_xsdt_p = 0; 200 190 201 if (acpi_rsdp->revision) 191 acpi_xsdt = (struct acpi_xsdt *) ((uintptr_t) acpi_rsdp->xsdt_address); 192 193 if (acpi_rsdt) 194 map_sdt((struct acpi_sdt_header *) acpi_rsdt); 195 196 if (acpi_xsdt) 197 map_sdt((struct acpi_sdt_header *) acpi_xsdt); 202 acpi_xsdt_p = (uintptr_t) acpi_rsdp->xsdt_address; 203 204 if (acpi_rsdt_p) 205 acpi_rsdt = (struct acpi_rsdt *) map_sdt( 206 (struct acpi_sdt_header *) acpi_rsdt_p); 207 208 if (acpi_xsdt_p) 209 acpi_xsdt = (struct acpi_xsdt *) map_sdt( 210 (struct acpi_sdt_header *) acpi_xsdt_p); 198 211 199 212 if ((acpi_rsdt) && (!acpi_sdt_check((uint8_t *) acpi_rsdt))) {
Note:
See TracChangeset
for help on using the changeset viewer.