grub/grub-core/disk
Eric Snowberg 3434ddec0e ieee1275: obdisk driver
Add a new disk driver called obdisk for IEEE1275 platforms.  Currently
the only platform using this disk driver is SPARC, however other IEEE1275
platforms could start using it if they so choose.  While the functionality
within the current IEEE1275 ofdisk driver may be suitable for PPC and x86, it
presented too many problems on SPARC hardware.

Within the old ofdisk, there is not a way to determine the true canonical
name for the disk.  Within Open Boot, the same disk can have multiple names
but all reference the same disk.  For example the same disk can be referenced
by its SAS WWN, using this form:

/pci@302/pci@2/pci@0/pci@17/LSI,sas@0/disk@w5000cca02f037d6d,0

It can also be referenced by its PHY identifier using this form:

/pci@302/pci@2/pci@0/pci@17/LSI,sas@0/disk@p0

It can also be referenced by its Target identifier using this form:

/pci@302/pci@2/pci@0/pci@17/LSI,sas@0/disk@0

Also, when the LUN=0, it is legal to omit the ,0 from the device name.  So with
the disk above, before taking into account the device aliases, there are 6 ways
to reference the same disk.

Then it is possible to have 0 .. n device aliases all representing the same disk.
Within this new driver the true canonical name is determined using the the
IEEE1275 encode-unit and decode-unit commands when address_cells == 4.  This
will determine the true single canonical name for the device so multiple ihandles
are not opened for the same device.  This is what frequently happens with the old
ofdisk driver.  With some devices when they are opened multiple times it causes
the entire system to hang.

Another problem solved with this driver is devices that do not have a device
alias can be booted and used within GRUB. Within the old ofdisk, this was not
possible, unless it was the original boot device.  All devices behind a SAS
or SCSI parent can be found.   Within the old ofdisk, finding these disks
relied on there being an alias defined.  The alias requirement is not
necessary with this new driver.  It can also find devices behind a parent
after they have been hot-plugged.  This is something that is not possible
with the old ofdisk driver.

The old ofdisk driver also incorrectly assumes that the device pointing to by a
device alias is in its true canonical form. This assumption is never made with
this new driver.

Another issue solved with this driver is that it properly caches the ihandle
for all open devices.  The old ofdisk tries to do this by caching the last
opened ihandle.  However this does not work properly because the layer above
does not use a consistent device name for the same disk when calling into the
driver.  This is because the upper layer uses the bootpath value returned within
/chosen, other times it uses the device alias, and other times it uses the
value within grub.cfg.  It does not have a way to figure out that these devices
are the same disk.  This is not a problem with this new driver.

Due to the way GRUB repeatedly opens and closes the same disk. Caching the
ihandle is important on SPARC.  Without caching, some SAS devices can take
15 - 20 minutes to get to the GRUB menu. This ihandle caching is not possible
without correctly having the canonical disk name.

When available, this driver also tries to use the deblocker #blocks and
a way of determining the disk size.

Finally and probably most importantly, this new driver is also capable of
seeing all partitions on a GPT disk.  With the old driver, the GPT
partition table can not be read and only the first partition on the disk
can be seen.

Signed-off-by: Eric Snowberg <eric.snowberg@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2019-03-12 20:04:07 +01:00
..
arc Enable mipsel-arc. 2013-04-25 22:42:35 +02:00
efi i386, x86_64, ppc: fix switch fallthrough cases with GCC7 2017-04-04 19:23:55 +03:00
i386/pc biosdisk: Add missing cast. 2015-01-24 21:50:30 +01:00
ieee1275 ieee1275: obdisk driver 2019-03-12 20:04:07 +01:00
uboot uboot: Add the missing disk write operation support 2019-01-22 15:23:51 +01:00
xen accept also hdX as alias to native Xen disk name 2015-01-23 19:52:45 +03:00
AFSplitter.c disk/AFsplitter: check argument validity before doing any allocs. 2015-01-24 21:33:30 +01:00
ahci.c ahci: Increase time-out from 10 s to 32 s 2018-09-13 10:54:54 +02:00
ata.c grub_ata_setaddress: Check that geometry is sane when using CHS addressing. 2015-01-21 17:42:10 +01:00
cryptodisk.c i386, x86_64, ppc: fix switch fallthrough cases with GCC7 2017-04-04 19:23:55 +03:00
diskfilter.c diskfilter: Make name a const char to fix compilation error. 2015-07-22 20:39:14 +02:00
dmraid_nvidia.c dmraid_nvidia: Set a name to usable value to avoid null dereference. 2015-07-22 01:57:40 +02:00
geli.c disk/geli: Add missing free. 2015-01-24 21:47:51 +01:00
host.c Remove practice of assigning random const pointers to device id. 2013-12-16 14:49:11 +01:00
ldm.c disk: Update grub_gpt_partentry 2018-04-23 13:21:45 +02:00
loopback.c verifiers: File type for fine-grained signature-verification controlling 2018-11-09 13:25:31 +01:00
luks.c grub-core/disk/luks.c: fix use after free and memory leaks 2014-11-28 21:12:00 +03:00
lvm.c remove extra newlines in grub_util_* strings 2015-05-13 09:47:17 +03:00
mdraid1x_linux.c Add gcc_struct to all packed structures when compiling with mingw. 2013-12-15 14:14:30 +01:00
mdraid_linux.c cleanup: grub_cpu_to_XXX_compile_time for constants 2014-09-22 20:47:10 +04:00
mdraid_linux_be.c Handle big-endian mdraid. 2012-03-26 16:10:40 +02:00
memdisk.c Remove practice of assigning random const pointers to device id. 2013-12-16 14:49:11 +01:00
pata.c Add PCI command activation to all PCI drivers as required for coreboot 2013-11-26 14:21:11 +01:00
raid5_recover.c * include/grub/diskfilter.h (grub_raid5_recover_func_t): Use proper 2012-06-25 17:36:50 +02:00
raid6_recover.c btrfs: Make more generic the code for RAID 6 rebuilding 2018-10-31 12:07:29 +01:00
scsi.c disk/scsi: fix use after free 2015-06-20 23:38:18 +03:00
usbms.c cleanup: grub_cpu_to_XXX_compile_time for constants 2014-09-22 20:47:10 +04:00