From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Graf Date: Mon, 4 Dec 2017 00:16:57 +0100 Subject: [U-Boot] [PATCH 1/3] efi_loader: correctly determine if an MMC device is an SD-card In-Reply-To: <20171202124220.26949-2-xypron.glpk@gmx.de> References: <20171202124220.26949-1-xypron.glpk@gmx.de> <20171202124220.26949-2-xypron.glpk@gmx.de> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 > --- > 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