Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/efidev/efirt.c
Show First 20 Lines • Show All 179 Lines • ▼ Show 20 Lines | efi_init(void) | ||||
mtx_init(&efi_lock, "efi", NULL, MTX_DEF); | mtx_init(&efi_lock, "efi", NULL, MTX_DEF); | ||||
if (efi_systbl_phys == 0) { | if (efi_systbl_phys == 0) { | ||||
if (bootverbose) | if (bootverbose) | ||||
printf("EFI systbl not available\n"); | printf("EFI systbl not available\n"); | ||||
return (0); | return (0); | ||||
} | } | ||||
efi_systbl = (struct efi_systbl *)efi_phys_to_kva(efi_systbl_phys); | efi_systbl = (struct efi_systbl *)efi_phys_to_kva(efi_systbl_phys, | ||||
sizeof(struct efi_systbl)); | |||||
if (efi_systbl == NULL || efi_systbl->st_hdr.th_sig != EFI_SYSTBL_SIG) { | if (efi_systbl == NULL || efi_systbl->st_hdr.th_sig != EFI_SYSTBL_SIG) { | ||||
efi_systbl = NULL; | efi_systbl = NULL; | ||||
if (bootverbose) | if (bootverbose) | ||||
printf("EFI systbl signature invalid\n"); | printf("EFI systbl signature invalid\n"); | ||||
return (0); | return (0); | ||||
} | } | ||||
efi_cfgtbl = (efi_systbl->st_cfgtbl == 0) ? NULL : | efi_cfgtbl = (efi_systbl->st_cfgtbl == 0) ? NULL : | ||||
(struct efi_cfgtbl *)efi_systbl->st_cfgtbl; | (struct efi_cfgtbl *)efi_systbl->st_cfgtbl; | ||||
Show All 37 Lines | #if defined(__aarch64__) || defined(__amd64__) | ||||
/* | /* | ||||
* Some UEFI implementations have multiple implementations of the | * Some UEFI implementations have multiple implementations of the | ||||
* RS->GetTime function. They switch from one we can only use early | * RS->GetTime function. They switch from one we can only use early | ||||
* in the boot process to one valid as a RunTime service only when we | * in the boot process to one valid as a RunTime service only when we | ||||
* call RS->SetVirtualAddressMap. As this is not always the case, e.g. | * call RS->SetVirtualAddressMap. As this is not always the case, e.g. | ||||
* with an old loader.efi, check if the RS->GetTime function is within | * with an old loader.efi, check if the RS->GetTime function is within | ||||
* the EFI map, and fail to attach if not. | * the EFI map, and fail to attach if not. | ||||
*/ | */ | ||||
rtdm = (struct efi_rt *)efi_phys_to_kva((uintptr_t)efi_runtime); | rtdm = (struct efi_rt *)efi_phys_to_kva((uintptr_t)efi_runtime, | ||||
sizeof(struct efi_rt)); | |||||
if (rtdm == NULL || !efi_is_in_map(map, ndesc, efihdr->descriptor_size, | if (rtdm == NULL || !efi_is_in_map(map, ndesc, efihdr->descriptor_size, | ||||
(vm_offset_t)rtdm->rt_gettime)) { | (vm_offset_t)rtdm->rt_gettime)) { | ||||
if (bootverbose) | if (bootverbose) | ||||
printf( | printf( | ||||
"EFI runtime services table has an invalid pointer\n"); | "EFI runtime services table has an invalid pointer\n"); | ||||
efi_runtime = NULL; | efi_runtime = NULL; | ||||
efi_destroy_1t1_map(); | efi_destroy_1t1_map(); | ||||
return (ENXIO); | return (ENXIO); | ||||
▲ Show 20 Lines • Show All 278 Lines • ▼ Show 20 Lines | if (error == 0) | ||||
error = efi_status_to_errno(ecp->ec_efi_status); | error = efi_status_to_errno(ecp->ec_efi_status); | ||||
else if (bootverbose) | else if (bootverbose) | ||||
printf("EFI %s call faulted, error %d\n", ecp->ec_name, error); | printf("EFI %s call faulted, error %d\n", ecp->ec_name, error); | ||||
return (error); | return (error); | ||||
} | } | ||||
#define EFI_RT_METHOD_PA(method) \ | #define EFI_RT_METHOD_PA(method) \ | ||||
((uintptr_t)((struct efi_rt *)efi_phys_to_kva((uintptr_t) \ | ((uintptr_t)((struct efi_rt *)efi_phys_to_kva((uintptr_t) \ | ||||
efi_runtime))->method) | efi_runtime, sizeof(struct efi_rt)))->method) | ||||
static int | static int | ||||
efi_get_time_locked(struct efi_tm *tm, struct efi_tmcap *tmcap) | efi_get_time_locked(struct efi_tm *tm, struct efi_tmcap *tmcap) | ||||
{ | { | ||||
struct efirt_callinfo ec; | struct efirt_callinfo ec; | ||||
int error; | int error; | ||||
EFI_TIME_OWNED(); | EFI_TIME_OWNED(); | ||||
▲ Show 20 Lines • Show All 280 Lines • Show Last 20 Lines |