All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heinrich Schuchardt <xypron.glpk@gmx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/3] efi_loader: correctly determine if an MMC device is an SD-card
Date: Mon, 4 Dec 2017 07:50:15 +0100	[thread overview]
Message-ID: <3e75a274-24fc-7377-7513-da4e792845d0@gmx.de> (raw)
In-Reply-To: <bccbcb54-5a47-6a80-8446-b6b16808d4f3@suse.de>



On 12/04/2017 12:16 AM, Alexander Graf wrote:
> 
> 
> On 02.12.17 13:42, Heinrich Schuchardt wrote:
>> The SD cards and eMMC devices have different device nodes.
>> The current coding interpretes all MMC devices as eMMC.
>>
>> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
>> ---
>>   lib/efi_loader/efi_device_path.c | 24 +++++++++++++++++++++---
>>   1 file changed, 21 insertions(+), 3 deletions(-)
>>
>> diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c
>> index b4e2f933cb..42fe6e1185 100644
>> --- a/lib/efi_loader/efi_device_path.c
>> +++ b/lib/efi_loader/efi_device_path.c
>> @@ -36,6 +36,24 @@ static const struct efi_device_path_vendor ROOT = {
>>   	.guid = U_BOOT_GUID,
>>   };
>>   
>> +#if defined(CONFIG_DM_MMC) && defined(CONFIG_MMC)
>> +/*
>> + * Determine if an MMC device is an SD card.
>> + *
>> + * @desc	block device descriptor
>> + * @return	true if the device is an SD card
>> + */
>> +static bool is_sd(struct blk_desc *desc)
>> +{
>> +	struct mmc *mmc = find_mmc_device(desc->devnum);
>> +
>> +	if (!mmc)
>> +		return false;
>> +
>> +	return IS_SD(mmc) != 0U;
>> +}
>> +#endif
>> +
>>   static void *dp_alloc(size_t sz)
>>   {
>>   	void *buf;
>> @@ -298,9 +316,9 @@ static void *dp_fill(void *buf, struct udevice *dev)
>>   		struct blk_desc *desc = mmc_get_blk_desc(mmc);
>>   
>>   		sddp->dp.type     = DEVICE_PATH_TYPE_MESSAGING_DEVICE;
>> -		sddp->dp.sub_type = (desc->if_type == IF_TYPE_MMC) ?
>> -			DEVICE_PATH_SUB_TYPE_MSG_MMC :
>> -			DEVICE_PATH_SUB_TYPE_MSG_SD;
>> +		sddp->dp.sub_type = is_sd(desc) ?
>> +			DEVICE_PATH_SUB_TYPE_MSG_SD :
>> +			DEVICE_PATH_SUB_TYPE_MSG_MMC;
> 
> So in general, MMC != SD != eMMC. Or rather eMMC "is like" SD "is like"
> MMC maybe?
> 
> I really don't know how edk2 distinguishes between them. In general,
> eMMC is an SD card on steroids. Can you double-check in the edk2 code
> and then we just do whatever they do?
> 
> 
> Alex
> 

EDK2 defines the following conversion functions:
   {L"SD",                      DevPathFromTextSd                      },
   {L"eMMC",                    DevPathFromTextEmmc                    },
in MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c:3465
and
   {MESSAGING_DEVICE_PATH, MSG_SD_DP, DevPathToTextSd             },
   {MESSAGING_DEVICE_PATH, MSG_EMMC_DP, DevPathToTextEmmc         },
in MdePkg/Library/UefiDevicePathLib/DevicePathToText.c:2256

Regards

Heinrich

  reply	other threads:[~2017-12-04  6:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-02 12:42 [U-Boot] [PATCH 0/3] efi_loader: correct media device paths Heinrich Schuchardt
2017-12-02 12:42 ` [U-Boot] [PATCH 1/3] efi_loader: correctly determine if an MMC device is an SD-card Heinrich Schuchardt
2017-12-03 23:16   ` Alexander Graf
2017-12-04  6:50     ` Heinrich Schuchardt [this message]
2017-12-02 12:42 ` [U-Boot] [PATCH 2/3] efi_loader: correctly setup device paths for block devices Heinrich Schuchardt
2017-12-03 19:24   ` Mark Kettenis
2017-12-03 21:20     ` xypron.glpk at gmx.de
2017-12-03 23:02       ` Alexander Graf
2017-12-04 13:39       ` Mark Kettenis
2017-12-02 12:42 ` [U-Boot] [PATCH 3/3] efi_loader: correct DeviceNodeToText for media types Heinrich Schuchardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3e75a274-24fc-7377-7513-da4e792845d0@gmx.de \
    --to=xypron.glpk@gmx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.