Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F160428298
D57806.id180506.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
D57806.id180506.diff
View Options
diff --git a/stand/efi/include/efilib.h b/stand/efi/include/efilib.h
--- a/stand/efi/include/efilib.h
+++ b/stand/efi/include/efilib.h
@@ -68,6 +68,7 @@
pdinfo_t *efiblk_get_pdinfo(struct devdesc *dev);
pdinfo_t *efiblk_get_pdinfo_by_handle(EFI_HANDLE h);
pdinfo_t *efiblk_get_pdinfo_by_device_path(EFI_DEVICE_PATH *path);
+void efiblk_memdisk_preload(void);
/* libefi.c */
void *efi_get_table(EFI_GUID *tbl);
diff --git a/stand/efi/libefi/efipart.c b/stand/efi/libefi/efipart.c
--- a/stand/efi/libefi/efipart.c
+++ b/stand/efi/libefi/efipart.c
@@ -1250,3 +1250,47 @@
free(blkbuf);
return (rc);
}
+
+/*
+ * Predicate: is this a VirtualDisk as far as UEFI is concerned?
+ */
+static bool
+testmd(pdinfo_t *hd, pdinfo_t *data __unused)
+{
+ EFI_DEVICE_PATH *node;
+
+ node = efi_devpath_last_node(hd->pd_devpath);
+ if (node == NULL)
+ return (false);
+ if (DevicePathType(node) == MEDIA_DEVICE_PATH &&
+ DevicePathSubType(node) == MEDIA_RAM_DISK_DP)
+ return (true);
+
+ return (false);
+}
+
+/*
+ * Passes all the VirtualDisk instances to FreeBSD as a preloaded memory disk.
+ */
+void
+efiblk_memdisk_preload(void)
+{
+ MEDIA_RAM_DISK_DEVICE_PATH *ram;
+ uint64_t start, end;
+ pdinfo_t *md;
+ char key[32], value[32];
+ int i;
+
+ while ((md = efipart_get_pd(&pdinfo, testmd, NULL)) != NULL) {
+ ram = (MEDIA_RAM_DISK_DEVICE_PATH *)efi_devpath_last_node(md->pd_devpath);
+ i = ram->Instance;
+ start = ((uint64_t)ram->StartingAddr[1] << 32) | ram->StartingAddr[0];
+ end = ((uint64_t)ram->EndingAddr[1] << 32) | ram->EndingAddr[0];
+ snprintf(key, sizeof(key), "hint.md.%d.physaddr", i);
+ snprintf(value, sizeof(value), "0x%016x", start);
+ setenv(key, value, 1);
+ snprintf(key, sizeof(key), "hint.md.%d.len", i);
+ snprintf(value, sizeof(value), "0x%016x", end - start);
+ setenv(key, value, 1);
+ }
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jun 25, 8:13 AM (19 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34316547
Default Alt Text
D57806.id180506.diff (1 KB)
Attached To
Mode
D57806: loader.efi: efiblk_memdisk_preload passes the VirtualDisks to FreeBSD
Attached
Detach File
Event Timeline
Log In to Comment