Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102774909
D25201.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D25201.diff
View Options
Index: head/sys/arm64/arm64/machdep.c
===================================================================
--- head/sys/arm64/arm64/machdep.c
+++ head/sys/arm64/arm64/machdep.c
@@ -120,6 +120,7 @@
* passed into the kernel and used by the EFI code to call runtime services.
*/
vm_paddr_t efi_systbl_phys;
+static struct efi_map_header *efihdr;
/* pagezero_* implementations are provided in support.S */
void pagezero_simple(void *);
@@ -1071,11 +1072,52 @@
}
}
+int
+memory_mapping_mode(vm_paddr_t pa)
+{
+ struct efi_md *map, *p;
+ size_t efisz;
+ int ndesc, i;
+
+ if (efihdr == NULL)
+ return (VM_MEMATTR_WRITE_BACK);
+
+ /*
+ * Memory map data provided by UEFI via the GetMemoryMap
+ * Boot Services API.
+ */
+ efisz = (sizeof(struct efi_map_header) + 0xf) & ~0xf;
+ map = (struct efi_md *)((uint8_t *)efihdr + efisz);
+
+ if (efihdr->descriptor_size == 0)
+ return (VM_MEMATTR_WRITE_BACK);
+ ndesc = efihdr->memory_size / efihdr->descriptor_size;
+
+ for (i = 0, p = map; i < ndesc; i++,
+ p = efi_next_descriptor(p, efihdr->descriptor_size)) {
+ if (pa < p->md_phys ||
+ pa >= p->md_phys + p->md_pages * EFI_PAGE_SIZE)
+ continue;
+ if (p->md_type == EFI_MD_TYPE_IOMEM ||
+ p->md_type == EFI_MD_TYPE_IOPORT)
+ return (VM_MEMATTR_DEVICE);
+ else if ((p->md_attr & EFI_MD_ATTR_WB) != 0 ||
+ p->md_type == EFI_MD_TYPE_RECLAIM)
+ return (VM_MEMATTR_WRITE_BACK);
+ else if ((p->md_attr & EFI_MD_ATTR_WT) != 0)
+ return (VM_MEMATTR_WRITE_THROUGH);
+ else if ((p->md_attr & EFI_MD_ATTR_WC) != 0)
+ return (VM_MEMATTR_WRITE_COMBINING);
+ break;
+ }
+
+ return (VM_MEMATTR_DEVICE);
+}
+
void
initarm(struct arm64_bootparams *abp)
{
struct efi_fb *efifb;
- struct efi_map_header *efihdr;
struct pcpu *pcpup;
char *env;
#ifdef FDT
Index: head/sys/arm64/arm64/pmap.c
===================================================================
--- head/sys/arm64/arm64/pmap.c
+++ head/sys/arm64/arm64/pmap.c
@@ -5449,7 +5449,7 @@
/* L3 table is linked */
va = trunc_page(va);
pa = trunc_page(pa);
- pmap_kenter(va, size, pa, VM_MEMATTR_WRITE_BACK);
+ pmap_kenter(va, size, pa, memory_mapping_mode(pa));
}
return ((void *)(va + offset));
Index: head/sys/arm64/include/machdep.h
===================================================================
--- head/sys/arm64/include/machdep.h
+++ head/sys/arm64/include/machdep.h
@@ -56,6 +56,7 @@
#ifdef FDT
void parse_fdt_bootargs(void);
#endif
+int memory_mapping_mode(vm_paddr_t pa);
extern void (*pagezero)(void *);
#endif /* _KERNEL */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 18, 12:19 AM (8 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14687495
Default Alt Text
D25201.diff (2 KB)
Attached To
Mode
D25201: Use EFI memory map to determine attributes for AcpiOsMapMemory mappings on arm64
Attached
Detach File
Event Timeline
Log In to Comment