[U-Boot] [PATCH 1/2] efi_loader: device_path: add Device Logical Unit sub type

Heinrich Schuchardt xypron.glpk at gmx.de
Thu Aug 22 18:44:49 UTC 2019


On 8/22/19 10:54 AM, AKASHI Takahiro wrote:
> This sub type may not be very useful for normal systems,
> but it will be used to support "host" devices on U-Boot sandbox
> build.
>
> See UEFI Specification 2.8, section 10.3.4.8.
>
> Signed-off-by: AKASHI Takahiro <takahiro.akashi at linaro.org>
> ---
>   include/efi_api.h                        | 6 ++++++
>   lib/efi_loader/efi_device_path_to_text.c | 6 ++++++
>   2 files changed, 12 insertions(+)
>
> diff --git a/include/efi_api.h b/include/efi_api.h
> index d3fff3c57936..bb028546c864 100644
> --- a/include/efi_api.h
> +++ b/include/efi_api.h
> @@ -427,6 +427,7 @@ struct efi_device_path_acpi_path {
>   #  define DEVICE_PATH_SUB_TYPE_MSG_USB		0x05
>   #  define DEVICE_PATH_SUB_TYPE_MSG_MAC_ADDR	0x0b
>   #  define DEVICE_PATH_SUB_TYPE_MSG_USB_CLASS	0x0f
> +#  define DEVICE_PATH_SUB_TYPE_MSG_LUN		0x11
>   #  define DEVICE_PATH_SUB_TYPE_MSG_SD		0x1a
>   #  define DEVICE_PATH_SUB_TYPE_MSG_MMC		0x1d
>
> @@ -443,6 +444,11 @@ struct efi_device_path_scsi {
>   	u16 logical_unit_number;
>   } __packed;
>
> +struct efi_device_path_lun {
> +	struct efi_device_path dp;
> +	u8 logical_unit_number;
> +} __packed;
> +
>   struct efi_device_path_usb {
>   	struct efi_device_path dp;
>   	u8 parent_port_number;
> diff --git a/lib/efi_loader/efi_device_path_to_text.c b/lib/efi_loader/efi_device_path_to_text.c
> index 96fd08971b73..8aae8215e1af 100644
> --- a/lib/efi_loader/efi_device_path_to_text.c
> +++ b/lib/efi_loader/efi_device_path_to_text.c
> @@ -107,6 +107,12 @@ static char *dp_msging(char *s, struct efi_device_path *dp)
>   			     ide->logical_unit_number);
>   		break;
>   	}
> +	case DEVICE_PATH_SUB_TYPE_MSG_LUN: {
> +		struct efi_device_path_lun *lun =
> +			(struct efi_device_path_lun *)dp;
> +		s += sprintf(s, "LUN(%u)", lun->logical_unit_number);

The UEFI spec 2 has this output example:
Unit(LUN)

In EDK2:
MdePkg/Library/UefiDevicePathLib/DevicePathToText.c:1019:
UefiDevicePathLibCatPrint (Str, L"Unit(0x%x)", LogicalUnit->Lun);

Please, correct the output format to match EDK2 (and the spec).

Best regards

Heinrich

> +		break;
> +	}
>   	case DEVICE_PATH_SUB_TYPE_MSG_USB: {
>   		struct efi_device_path_usb *udp =
>   			(struct efi_device_path_usb *)dp;
>



More information about the U-Boot mailing list