Skip to content

Commit

Permalink
9127 efi: Only scan the BLKIO MEDIA once
Browse files Browse the repository at this point in the history
Reviewed by: Andy Fiddaman <omnios@citrus-it.co.uk>
Reviewed by: Yuri Pankov <yuripv@yuripv.net>
Approved by: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
  • Loading branch information
tsoome authored and hrosenfeld committed Apr 23, 2018
1 parent 7703357 commit c00b6c9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
3 changes: 3 additions & 0 deletions usr/src/boot/sys/boot/efi/include/efilib.h
Expand Up @@ -112,4 +112,7 @@ bool efi_str_to_guid(const char *, EFI_GUID *);
bool efi_name_to_guid(const char *, EFI_GUID *);
bool efi_guid_to_name(EFI_GUID *, char **);

/* efipart.c */
int efipart_inithandles(void);

#endif /* _LOADER_EFILIB_H */
18 changes: 5 additions & 13 deletions usr/src/boot/sys/boot/efi/libefi/efipart.c
Expand Up @@ -147,7 +147,7 @@ efiblk_pdinfo_count(pdinfo_list_t *pdi)
return (i);
}

static int
int
efipart_inithandles(void)
{
UINTN sz;
Expand Down Expand Up @@ -175,6 +175,10 @@ efipart_inithandles(void)

efipart_handles = hin;
efipart_nhandles = sz;
#ifdef EFIPART_DEBUG
printf("%s: Got %d BLOCK IO MEDIA handle(s)\n", __func__,
efipart_nhandles);
#endif
return (0);
}

Expand Down Expand Up @@ -318,11 +322,7 @@ efipart_updatefd(void)
static int
efipart_initfd(void)
{
int rv;

rv = efipart_inithandles();
if (rv != 0)
return (rv);
STAILQ_INIT(&fdinfo);

efipart_updatefd();
Expand Down Expand Up @@ -438,11 +438,7 @@ efipart_updatecd(void)
static int
efipart_initcd(void)
{
int rv;

rv = efipart_inithandles();
if (rv != 0)
return (rv);
STAILQ_INIT(&cdinfo);

efipart_updatecd();
Expand Down Expand Up @@ -684,11 +680,7 @@ efipart_updatehd(void)
static int
efipart_inithd(void)
{
int rv;

rv = efipart_inithandles();
if (rv != 0)
return (rv);
STAILQ_INIT(&hdinfo);

efipart_updatehd();
Expand Down
12 changes: 8 additions & 4 deletions usr/src/boot/sys/boot/efi/loader/main.c
Expand Up @@ -435,11 +435,15 @@ main(int argc, CHAR16 *argv[])
}

/*
* March through the device switch probing for things.
* Scan the BLOCK IO MEDIA handles then
* march through the device switch probing for things.
*/
for (i = 0; devsw[i] != NULL; i++)
if (devsw[i]->dv_init != NULL)
(devsw[i]->dv_init)();
if ((i = efipart_inithandles()) == 0) {
for (i = 0; devsw[i] != NULL; i++)
if (devsw[i]->dv_init != NULL)
(devsw[i]->dv_init)();
} else
printf("efipart_inithandles failed %d, expect failures", i);

printf("Command line arguments:");
for (i = 0; i < argc; i++) {
Expand Down

0 comments on commit c00b6c9

Please sign in to comment.