[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 06/15] ieee1275: add nvme support within ofpath
From: |
Eric Snowberg |
Subject: |
[PATCH 06/15] ieee1275: add nvme support within ofpath |
Date: |
Wed, 29 Jun 2016 14:43:19 -0700 |
Add nvme support within ofpath
Signed-off-by: Eric Snowberg <address@hidden>
---
grub-core/osdep/linux/ofpath.c | 46 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/grub-core/osdep/linux/ofpath.c b/grub-core/osdep/linux/ofpath.c
index 0994e08..4c1c95b 100644
--- a/grub-core/osdep/linux/ofpath.c
+++ b/grub-core/osdep/linux/ofpath.c
@@ -343,6 +343,49 @@ of_path_of_ide(const char *sys_devname
__attribute__((unused)), const char *devi
return ret;
}
+static char *
+of_path_of_nvme(const char *sys_devname __attribute__((unused)),
+ const char *device,
+ const char *devnode __attribute__((unused)),
+ const char *devicenode)
+{
+ char *sysfs_path, *of_path, disk[MAX_DISK_CAT];
+ const char *digit_string, *part_end;
+
+ digit_string = trailing_digits (device);
+ part_end = devicenode + strlen (devicenode) - 1;
+
+ if ((digit_string != '\0') && (*part_end == 'p'))
+ {
+ /* We have a partition number, strip it off */
+ int part;
+ char *nvmedev, *end;
+
+ nvmedev = strdup (devicenode);
+
+ if (nvmedev == NULL)
+ return NULL;
+
+ end = nvmedev + strlen (nvmedev) - 1;
+ *end = '\0'; /* remove the p */
+ sscanf (digit_string, "%d", &part);
+ snprintf (disk, sizeof (disk), "/address@hidden:%c", 'a' + (part - 1));
+ sysfs_path = block_device_get_sysfs_path_and_link (nvmedev);
+ free (nvmedev);
+ }
+ else
+ {
+ /* We do not have the parition */
+ snprintf (disk, sizeof (disk), "/address@hidden");
+ sysfs_path = block_device_get_sysfs_path_and_link (device);
+ }
+
+ of_path = find_obppath (sysfs_path);
+ free (sysfs_path);
+ strcat (of_path, disk);
+ return of_path;
+}
+
static int
vendor_is_ATA(const char *path)
{
@@ -695,6 +738,9 @@ grub_util_devname_to_ofpath (const char *sys_devname)
/* All the models I've seen have a devalias "floppy".
New models have no floppy at all. */
ofpath = xstrdup ("floppy");
+ else if (device[0] == 'n' && device[1] == 'v' && device[2] == 'm'
+ && device[3] == 'e')
+ ofpath = of_path_of_nvme (name_buf, device, devnode, devicenode);
else
{
grub_util_warn (_("unknown device type %s"), device);
--
1.7.1
- [PATCH 00/15] Add missing SPARC support, Eric Snowberg, 2016/06/29
- [PATCH 01/15] sparc64: fix OF path names for sun4v systems, Eric Snowberg, 2016/06/29
- [PATCH 02/15] sparc64: Add blocklist GPT support for SPARC, Eric Snowberg, 2016/06/29
- [PATCH 03/15] grub-install: fix memory leak, Eric Snowberg, 2016/06/29
- [PATCH 04/15] sparc64: Use the correct disk name in core.img, Eric Snowberg, 2016/06/29
- [PATCH 05/15] ieee1275: fix segfault in grub-ofpathname, Eric Snowberg, 2016/06/29
- [PATCH 06/15] ieee1275: add nvme support within ofpath,
Eric Snowberg <=
- [PATCH 07/15] ofdisk: memory corruption fix, Eric Snowberg, 2016/06/29
- [PATCH 09/15] ieee1275: ofdisk - don't continue to query block-size after we have it, Eric Snowberg, 2016/06/29
- [PATCH 08/15] ofdisk: move open logic, Eric Snowberg, 2016/06/29
- [PATCH 11/15] sparc64: boot performance improvements, Eric Snowberg, 2016/06/29
- [PATCH 10/15] ofdisk: refactor open logic, Eric Snowberg, 2016/06/29
- [PATCH 12/15] ofdisk: only add aliases that exist, Eric Snowberg, 2016/06/29
- [PATCH 14/15] parser: Remove escape from the state transitions, Eric Snowberg, 2016/06/29
- [PATCH 13/15] sparc64: add disks that don't have a devalias to the device list, Eric Snowberg, 2016/06/29
- [PATCH 15/15] sparc64: ignore hypervisor reboot memory block device, Eric Snowberg, 2016/06/29