summaryrefslogtreecommitdiffstats
path: root/master/debian/kfreebsd-9_ada_devices.patch
diff options
context:
space:
mode:
Diffstat (limited to 'master/debian/kfreebsd-9_ada_devices.patch')
-rw-r--r--master/debian/kfreebsd-9_ada_devices.patch71
1 files changed, 71 insertions, 0 deletions
diff --git a/master/debian/kfreebsd-9_ada_devices.patch b/master/debian/kfreebsd-9_ada_devices.patch
new file mode 100644
index 0000000..e1c22e4
--- /dev/null
+++ b/master/debian/kfreebsd-9_ada_devices.patch
@@ -0,0 +1,71 @@
+2011-06-16 Robert Millan <rmh@gnu.org>
+
+ Detect `ataraid' devices on GNU/kFreeBSD. Fix for ATA devices using
+ `ata' driver on kernel of FreeBSD 9.
+
+ * util/deviceiter.c [__FreeBSD_kernel__] (get_ada_disk_name)
+ (get_ataraid_disk_name): New functions.
+ [__FreeBSD_kernel__] (grub_util_iterate_devices): Scan for ataraid
+ (/dev/ar[0-9]+) and ada (/dev/ada[0-9]+) devices using
+ get_ataraid_disk_name() and get_ada_disk_name().
+
+=== modified file 'util/deviceiter.c'
+--- a/util/deviceiter.c
++++ b/util/deviceiter.c
+@@ -286,6 +286,20 @@
+ #endif
+ }
+
++#ifdef __FreeBSD_kernel__
++static void
++get_ada_disk_name (char *name, int unit)
++{
++ sprintf (name, "/dev/ada%d", unit);
++}
++
++static void
++get_ataraid_disk_name (char *name, int unit)
++{
++ sprintf (name, "/dev/ar%d", unit);
++}
++#endif
++
+ #ifdef __linux__
+ static void
+ get_virtio_disk_name (char *name, int unit)
+@@ -620,6 +634,35 @@
+ }
+ }
+
++#ifdef __FreeBSD_kernel__
++ /* IDE disks using ATA Direct Access driver. */
++ if (get_kfreebsd_version () >= 800000)
++ for (i = 0; i < 96; i++)
++ {
++ char name[16];
++
++ get_ada_disk_name (name, i);
++ if (check_device_readable_unique (name))
++ {
++ if (hook (name, 0))
++ goto out;
++ }
++ }
++
++ /* ATARAID disks. */
++ for (i = 0; i < 8; i++)
++ {
++ char name[20];
++
++ get_ataraid_disk_name (name, i);
++ if (check_device_readable_unique (name))
++ {
++ if (hook (name, 0))
++ goto out;
++ }
++ }
++#endif
++
+ #ifdef __linux__
+ /* Virtio disks. */
+ for (i = 0; i < 26; i++)