From mboxrd@z Thu Jan 1 00:00:00 1970 From: AKASHI Takahiro Date: Thu, 3 Oct 2019 16:21:41 +0900 Subject: [U-Boot] [PATCH v2 3/3] efi_loader: disk: install file system protocol to a whole disk In-Reply-To: <1ccff3d4-8a78-576f-870c-9c6b6295f307@gmx.de> References: <20190912045114.19108-1-takahiro.akashi@linaro.org> <20190912045114.19108-4-takahiro.akashi@linaro.org> <1ccff3d4-8a78-576f-870c-9c6b6295f307@gmx.de> Message-ID: <20191003072141.GM18778@linaro.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Heinrich, On Thu, Sep 12, 2019 at 11:21:51AM +0200, Heinrich Schuchardt wrote: > On 9/12/19 6:51 AM, AKASHI Takahiro wrote: > > Currently, a whole disk without any partitions is not associated > > with EFI_SIMPLE_FILE_SYSTEM_PROTOCOL. So even if it houses FAT > > file system, there is a chance that we may not be able to access > > it, particularly, when accesses are to be attempted after searching > > that protocol against a device handle. > > > > With this patch, EFI_SIMPLE_FILE_SYSTEM_PROTOCOL is installed > > to such a disk if part_get_info() shows there is not partition > > table installed on it. > > > > Signed-off-by: AKASHI Takahiro > > --- > > lib/efi_loader/efi_disk.c | 5 ++++- > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c > > index d72f455901f2..d36f22cedc52 100644 > > --- a/lib/efi_loader/efi_disk.c > > +++ b/lib/efi_loader/efi_disk.c > > @@ -253,6 +253,7 @@ static efi_status_t efi_disk_add_dev( > > struct efi_disk_obj **disk) > > { > > struct efi_disk_obj *diskobj; > > + disk_partition_t info; > > efi_status_t ret; > > > > /* Don't add empty devices */ > > @@ -284,7 +285,9 @@ static efi_status_t efi_disk_add_dev( > > diskobj->dp); > > if (ret != EFI_SUCCESS) > > return ret; > > - if (part >= 1 && efi_fs_exists(desc, part)) { > > + /* partitions or whole disk without partitions */ > > + if ((part >= 1 || part_get_info(desc, part, &info)) && > > part_get_info() returns -1 for part = 0 on a DOS partioned disk. So this > check does not work. Right. So this statement should be simplified like: if (efi_fs_exists(desc, part)) { diskobj->volume = efi_simple_file_system(desc, part, diskobj->dp); ret = efi_add_protocol(&diskobj->header, ... } -Takahiro Akashi > Best regards > > Heinrich > > > + efi_fs_exists(desc, part)) { > > diskobj->volume = efi_simple_file_system(desc, part, > > diskobj->dp); > > ret = efi_add_protocol(&diskobj->header, > > >