Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F161775707
D5408.id13931.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D5408.id13931.diff
View Options
Index: head/sys/arm64/arm64/machdep.c
===================================================================
--- head/sys/arm64/arm64/machdep.c
+++ head/sys/arm64/arm64/machdep.c
@@ -83,6 +83,7 @@
#endif
#ifdef FDT
+#include <dev/fdt/fdt_common.h>
#include <dev/ofw/openfirm.h>
#endif
@@ -668,6 +669,20 @@
return (1);
}
+#ifdef FDT
+static void
+add_fdt_mem_regions(struct mem_region *mr, int mrcnt, vm_paddr_t *physmap,
+ u_int *physmap_idxp)
+{
+
+ for (int i = 0; i < mrcnt; i++) {
+ if (!add_physmap_entry(mr[i].mr_start, mr[i].mr_size, physmap,
+ physmap_idxp))
+ break;
+ }
+}
+#endif
+
#define efi_next_descriptor(ptr, size) \
((struct efi_md *)(((uint8_t *) ptr) + size))
@@ -807,6 +822,10 @@
{
struct efi_map_header *efihdr;
struct pcpu *pcpup;
+#ifdef FDT
+ struct mem_region mem_regions[FDT_MEM_REGIONS];
+ int mem_regions_sz;
+#endif
vm_offset_t lastaddr;
caddr_t kmdp;
vm_paddr_t mem_len;
@@ -834,7 +853,18 @@
physmap_idx = 0;
efihdr = (struct efi_map_header *)preload_search_info(kmdp,
MODINFO_METADATA | MODINFOMD_EFI_MAP);
- add_efi_map_entries(efihdr, physmap, &physmap_idx);
+ if (efihdr != NULL)
+ add_efi_map_entries(efihdr, physmap, &physmap_idx);
+#ifdef FDT
+ else {
+ /* Grab physical memory regions information from device tree. */
+ if (fdt_get_mem_regions(mem_regions, &mem_regions_sz,
+ NULL) != 0)
+ panic("Cannot get physical memory regions");
+ add_fdt_mem_regions(mem_regions, mem_regions_sz, physmap,
+ &physmap_idx);
+ }
+#endif
/* Print the memory map */
mem_len = 0;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jul 7, 6:00 PM (10 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34808527
Default Alt Text
D5408.id13931.diff (1 KB)
Attached To
Mode
D5408: Get memory ranges from FDT if no EFI API is available
Attached
Detach File
Event Timeline
Log In to Comment