Date: Wed, 14 Feb 2018 18:05:37 +0000 (UTC) From: Emmanuel Vadot <manu@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329268 - in head/stand/efi: include libefi loader Message-ID: <201802141805.w1EI5bs2035976@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: manu Date: Wed Feb 14 18:05:37 2018 New Revision: 329268 URL: https://svnweb.freebsd.org/changeset/base/329268 Log: efi: Only scan the BLKIO MEDIA once Scan only the BLOCK IO MEDIA once instead of each time for each type of device (fd, cd and hdd). Leave the mechanism to free and reprobe all devices if one day we want to implement a "dev rescan" thing. Reviewed by: imp, tsoome MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D14334 Modified: head/stand/efi/include/efilib.h head/stand/efi/libefi/efipart.c head/stand/efi/loader/main.c Modified: head/stand/efi/include/efilib.h ============================================================================== --- head/stand/efi/include/efilib.h Wed Feb 14 17:59:04 2018 (r329267) +++ head/stand/efi/include/efilib.h Wed Feb 14 18:05:37 2018 (r329268) @@ -106,4 +106,7 @@ int wcscmp(CHAR16 *, CHAR16 *); void cpy8to16(const char *, CHAR16 *, size_t); void cpy16to8(const CHAR16 *, char *, size_t); +/* efipart.c */ +int efipart_inithandles(void); + #endif /* _LOADER_EFILIB_H */ Modified: head/stand/efi/libefi/efipart.c ============================================================================== --- head/stand/efi/libefi/efipart.c Wed Feb 14 17:59:04 2018 (r329267) +++ head/stand/efi/libefi/efipart.c Wed Feb 14 18:05:37 2018 (r329268) @@ -148,7 +148,7 @@ efiblk_pdinfo_count(pdinfo_list_t *pdi) return (i); } -static int +int efipart_inithandles(void) { UINTN sz; @@ -176,6 +176,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); } @@ -319,11 +323,7 @@ efipart_updatefd(void) static int efipart_initfd(void) { - int rv; - rv = efipart_inithandles(); - if (rv != 0) - return (rv); STAILQ_INIT(&fdinfo); efipart_updatefd(); @@ -439,11 +439,7 @@ efipart_updatecd(void) static int efipart_initcd(void) { - int rv; - rv = efipart_inithandles(); - if (rv != 0) - return (rv); STAILQ_INIT(&cdinfo); efipart_updatecd(); @@ -685,11 +681,7 @@ efipart_updatehd(void) static int efipart_inithd(void) { - int rv; - rv = efipart_inithandles(); - if (rv != 0) - return (rv); STAILQ_INIT(&hdinfo); efipart_updatehd(); Modified: head/stand/efi/loader/main.c ============================================================================== --- head/stand/efi/loader/main.c Wed Feb 14 17:59:04 2018 (r329267) +++ head/stand/efi/loader/main.c Wed Feb 14 18:05:37 2018 (r329268) @@ -456,11 +456,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++)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201802141805.w1EI5bs2035976>