Skip to contentSkip to conversation

Implement NVMe native disk support

PATCH New Vladimir Serbinenko 1 participant 1 message May 16, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Implement NVMe native disk support

This is useful 2-fold:
1) On coreboot port it allows to boot from NVMe devices
2) On older systems you can install NVMe via PCIe adapter and boot from it

---
 grub-core/Makefile.core.def     |   6 +
 grub-core/commands/nativedisk.c |   3 +-
 grub-core/disk/nvme.c           | 642 ++++++++++++++++++++++++++++++++
 include/grub/disk.h             |   1 +
 4 files changed, 651 insertions(+), 1 deletion(-)
 create mode 100644 grub-core/disk/nvme.c
grub-core/Makefile.core.def +6 -0
index 8e1b1d9f3..47ac8bf3f 100644
@@ -1305,6 +1305,12 @@ module = {
   enable = pci;
 };
 
+module = {
+  name = nvme;
+  common = disk/nvme.c;
+  enable = pci;
+};
+
 module = {
   name = pata;
   common = disk/pata.c;
grub-core/commands/nativedisk.c +2 -1
index 580c8d3b0..a431a066a 100644
@@ -34,7 +34,7 @@ GRUB_MOD_LICENSE ("GPLv3+");
 static const char *modnames_def[] = {
   /* FIXME: autogenerate this.  */
 #if defined (__i386__) || defined (__x86_64__) || defined (GRUB_MACHINE_MIPS_LOONGSON)
-  "pata", "ahci", "usbms", "ohci", "uhci", "ehci"
+  "pata", "ahci", "usbms", "ohci", "uhci", "ehci", "nvme"
 #elif defined (GRUB_MACHINE_MIPS_QEMU_MIPS)
   "pata"
 #else
@@ -77,6 +77,7 @@ get_uuid (const char *name, char **uuid, int getnative)
       /* Native disks.  */
     case GRUB_DISK_DEVICE_ATA_ID:
     case GRUB_DISK_DEVICE_SCSI_ID:
+    case GRUB_DISK_DEVICE_NVME_ID:
     case GRUB_DISK_DEVICE_XEN:
       if (getnative)
 	break;
grub-core/disk/nvme.c new file +642 -0

642 lines not on this page · raw message

include/grub/disk.h +1 -0
index fbf23df7f..fce52c207 100644
@@ -52,6 +52,7 @@ enum grub_disk_dev_id
     GRUB_DISK_DEVICE_UBOOTDISK_ID,
     GRUB_DISK_DEVICE_XEN,
     GRUB_DISK_DEVICE_OBDISK_ID,
+    GRUB_DISK_DEVICE_NVME_ID,
   };
 
 struct grub_disk;
Signature · 7 lines
2.39.2


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel