Changes in kernel/genarch/src/acpi/acpi.c [93da799:96b02eb9] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/acpi/acpi.c
r93da799 r96b02eb9 39 39 #include <genarch/acpi/madt.h> 40 40 #include <arch/bios/bios.h> 41 #include <mm/as.h> 41 42 #include <mm/page.h> 42 #include <mm/km.h>43 43 #include <print.h> 44 44 … … 96 96 } 97 97 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; 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); 114 105 } 115 106 … … 127 118 (struct acpi_sdt_header *) (sysarg_t) acpi_rsdt->entry[i]; 128 119 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))120 map_sdt(hdr); 121 if (CMP_SIGNATURE(hdr->signature, signature_map[j].signature)) { 122 if (!acpi_sdt_check((uint8_t *) hdr)) 132 123 break; 133 124 134 *signature_map[j].sdt_ptr = vhdr;125 *signature_map[j].sdt_ptr = hdr; 135 126 LOG("%p: ACPI %s", *signature_map[j].sdt_ptr, 136 127 signature_map[j].description); … … 153 144 (struct acpi_sdt_header *) ((uintptr_t) acpi_xsdt->entry[i]); 154 145 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))146 map_sdt(hdr); 147 if (CMP_SIGNATURE(hdr->signature, signature_map[j].signature)) { 148 if (!acpi_sdt_check((uint8_t *) hdr)) 158 149 break; 159 150 160 *signature_map[j].sdt_ptr = vhdr;151 *signature_map[j].sdt_ptr = hdr; 161 152 LOG("%p: ACPI %s", *signature_map[j].sdt_ptr, 162 153 signature_map[j].description); … … 196 187 LOG("%p: ACPI Root System Description Pointer", acpi_rsdp); 197 188 198 uintptr_t acpi_rsdt_p = (uintptr_t) acpi_rsdp->rsdt_address; 199 uintptr_t acpi_xsdt_p = 0; 200 189 acpi_rsdt = (struct acpi_rsdt *) ((uintptr_t) acpi_rsdp->rsdt_address); 201 190 if (acpi_rsdp->revision) 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); 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); 211 198 212 199 if ((acpi_rsdt) && (!acpi_sdt_check((uint8_t *) acpi_rsdt))) {
Note:
See TracChangeset
for help on using the changeset viewer.