efi_loader: device path for SATA devices

Provide device path nodes for SATA devices.

This avoids creation of two handles with the same device path indicating
our root node.

This is what the device paths for a SATA drive with four partitions could
like:

/VenHw(..)/Sata(0x0,0xffff,0x0)
/VenHw(..)/Sata(0x0,0xffff,0x0)/HD(1,MBR,0x81ea591f,0x800,0x63ff830)
/VenHw(..)/Sata(0x0,0xffff,0x0)/HD(2,MBR,0x81ea591f,0x6400800,0x9ff830)
/VenHw(..)/Sata(0x0,0xffff,0x0)/HD(3,MBR,0x81ea591f,0x6e00800,0x16ef2ab0)
/VenHw(..)/Sata(0x0,0xffff,0x0)/HD(4,MBR,0x81ea591f,0x1dcf3800,0x1dcedab0)

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
This commit is contained in:
Heinrich Schuchardt 2020-05-20 23:12:02 +02:00
parent 19ecced71c
commit bf3bcef7fb
3 changed files with 39 additions and 0 deletions

View file

@ -458,6 +458,11 @@ __maybe_unused static unsigned int dp_size(struct udevice *dev)
return dp_size(dev->parent) +
sizeof(struct efi_device_path_sd_mmc_path);
#endif
#if defined(CONFIG_AHCI) || defined(CONFIG_SATA)
case UCLASS_AHCI:
return dp_size(dev->parent) +
sizeof(struct efi_device_path_sata);
#endif
#if defined(CONFIG_NVME)
case UCLASS_NVME:
return dp_size(dev->parent) +
@ -623,6 +628,22 @@ __maybe_unused static void *dp_fill(void *buf, struct udevice *dev)
return &sddp[1];
}
#endif
#if defined(CONFIG_AHCI) || defined(CONFIG_SATA)
case UCLASS_AHCI: {
struct efi_device_path_sata *dp =
dp_fill(buf, dev->parent);
struct blk_desc *desc = dev_get_uclass_platdata(dev);
dp->dp.type = DEVICE_PATH_TYPE_MESSAGING_DEVICE;
dp->dp.sub_type = DEVICE_PATH_SUB_TYPE_MSG_SATA;
dp->dp.length = sizeof(*dp);
dp->hba_port = desc->devnum;
/* default 0xffff implies no port multiplier */
dp->port_multiplier_port = 0xffff;
dp->logical_unit_number = desc->lun;
return &dp[1];
}
#endif
#if defined(CONFIG_NVME)
case UCLASS_NVME: {
struct efi_device_path_nvme *dp =