Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename 'msecs' to 'usecs' to avoid potential confusion #563

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions fallback.c
Original file line number Diff line number Diff line change
Expand Up @@ -1006,14 +1006,14 @@ try_start_first_option(EFI_HANDLE parent_image_handle)
EFI_HANDLE image_handle;

if (get_fallback_verbose()) {
int fallback_verbose_wait = 500000; /* default to 0.5s */
unsigned long fallback_verbose_wait = 500000; /* default to 0.5s */
#ifdef FALLBACK_VERBOSE_WAIT
fallback_verbose_wait = FALLBACK_VERBOSE_WAIT;
#endif
console_print(L"Verbose enabled, sleeping for %d mseconds... "
L"Press the Pause key now to hold for longer.\n",
fallback_verbose_wait);
msleep(fallback_verbose_wait);
usleep(fallback_verbose_wait);
}

if (!first_new_option) {
Expand All @@ -1036,7 +1036,7 @@ try_start_first_option(EFI_HANDLE parent_image_handle)
}
console_print(L"\n");

msleep(500000000);
usleep(500000000);
return efi_status;
}

Expand All @@ -1051,7 +1051,7 @@ try_start_first_option(EFI_HANDLE parent_image_handle)
efi_status = BS->StartImage(image_handle, NULL, NULL);
if (EFI_ERROR(efi_status)) {
console_print(L"StartImage failed: %r\n", efi_status);
msleep(500000000);
usleep(500000000);
}
return efi_status;
}
Expand Down Expand Up @@ -1211,14 +1211,14 @@ efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
console_print(L"Reset System\n");

if (get_fallback_verbose()) {
int fallback_verbose_wait = 500000; /* default to 0.5s */
unsigned long fallback_verbose_wait = 500000; /* default to 0.5s */
#ifdef FALLBACK_VERBOSE_WAIT
fallback_verbose_wait = FALLBACK_VERBOSE_WAIT;
#endif
console_print(L"Verbose enabled, sleeping for %d mseconds... "
L"Press the Pause key now to hold for longer.\n",
fallback_verbose_wait);
msleep(fallback_verbose_wait);
usleep(fallback_verbose_wait);
}

RT->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL);
Expand Down
4 changes: 2 additions & 2 deletions include/asm.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ static inline void wait_for_debug(void)
{
uint64_t a, b;
int x;
extern void msleep(unsigned long msecs);
extern void usleep(unsigned long usecs);

a = read_counter();
for (x = 0; x < 1000; x++) {
msleep(1000);
usleep(1000);
b = read_counter();
if (a != b)
break;
Expand Down
4 changes: 3 additions & 1 deletion include/console.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ extern EFI_STATUS EFIAPI vdprint_(const CHAR16 *fmt, const char *file, int line,
extern EFI_STATUS print_crypto_errors(EFI_STATUS rc, char *file, const char *func, int line);
#define crypterr(rc) print_crypto_errors((rc), __FILE__, __func__, __LINE__)

extern VOID msleep(unsigned long msecs);
#ifndef SHIM_UNIT_TEST
extern VOID usleep(unsigned long usecs);
#endif

/* This is used in various things to determine if we should print to the
* console */
Expand Down
4 changes: 2 additions & 2 deletions lib/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -744,9 +744,9 @@ setup_verbosity(VOID)
}

VOID
msleep(unsigned long msecs)
usleep(unsigned long usecs)
{
BS->Stall(msecs);
BS->Stall(usecs);
}

/* This is used in various things to determine if we should print to the
Expand Down
2 changes: 1 addition & 1 deletion model.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ gcm_gmult_4bit(u64 Xi[2], u128 Htable[16])
}

void
msleep(int n)
usleep(int n)
{
__coverity_sleep__();
}
Expand Down
6 changes: 3 additions & 3 deletions replacements.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ replacement_start_image(EFI_HANDLE image_handle, UINTN *exit_data_size, CHAR16 *
console_print(L"Something has gone seriously wrong: %r\n",
efi_status2);
console_print(L"shim cannot continue, sorry.\n");
msleep(5000000);
usleep(5000000);
RT->ResetSystem(EfiResetShutdown,
EFI_SECURITY_VIOLATION,
0, NULL);
Expand Down Expand Up @@ -118,7 +118,7 @@ exit_boot_services(EFI_HANDLE image_key, UINTN map_key)

console_print(L"Bootloader has not verified loaded image.\n");
console_print(L"System is compromised. halting.\n");
msleep(5000000);
usleep(5000000);
RT->ResetSystem(EfiResetShutdown, EFI_SECURITY_VIOLATION, 0, NULL);
return EFI_SECURITY_VIOLATION;
}
Expand All @@ -143,7 +143,7 @@ do_exit(EFI_HANDLE ImageHandle, EFI_STATUS ExitStatus,
console_print(L"Something has gone seriously wrong: %r\n",
efi_status2);
console_print(L"shim cannot continue, sorry.\n");
msleep(5000000);
usleep(5000000);
RT->ResetSystem(EfiResetShutdown,
EFI_SECURITY_VIOLATION, 0, NULL);
}
Expand Down
12 changes: 6 additions & 6 deletions shim.c
Original file line number Diff line number Diff line change
Expand Up @@ -1207,7 +1207,7 @@ EFI_STATUS init_grub(EFI_HANDLE image_handle)
efi_status = start_image(image_handle, MOK_MANAGER);
if (EFI_ERROR(efi_status)) {
console_print(L"start_image() returned %r\n", efi_status);
msleep(2000000);
usleep(2000000);
return efi_status;
}

Expand All @@ -1222,15 +1222,15 @@ EFI_STATUS init_grub(EFI_HANDLE image_handle)
console_print(
L"start_image() returned %r, falling back to default loader\n",
efi_status);
msleep(2000000);
usleep(2000000);
load_options = NULL;
load_options_size = 0;
efi_status = start_image(image_handle, DEFAULT_LOADER);
}

if (EFI_ERROR(efi_status)) {
console_print(L"start_image() returned %r\n", efi_status);
msleep(2000000);
usleep(2000000);
}

return efi_status;
Expand Down Expand Up @@ -1647,7 +1647,7 @@ devel_egress(devel_egress_action action UNUSED)
console_print(L"Waiting to %a...", reasons[action]);
for (size_t sleepcount = 0; sleepcount < 10; sleepcount++) {
console_print(L"%d...", 10 - sleepcount);
msleep(1000000);
usleep(1000000);
}
console_print(L"\ndoing %a\n", action);

Expand Down Expand Up @@ -1785,7 +1785,7 @@ efi_main (EFI_HANDLE passed_image_handle, EFI_SYSTEM_TABLE *passed_systab)
#if defined(ENABLE_SHIM_DEVEL)
devel_egress(COLD_RESET);
#else
msleep(5000000);
usleep(5000000);
RT->ResetSystem(EfiResetShutdown, EFI_SECURITY_VIOLATION,
0, NULL);
#endif
Expand All @@ -1802,7 +1802,7 @@ efi_main (EFI_HANDLE passed_image_handle, EFI_SYSTEM_TABLE *passed_systab)
*/
if (user_insecure_mode) {
console_print(L"Booting in insecure mode\n");
msleep(2000000);
usleep(2000000);
}

/*
Expand Down