david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[efi] Generalise EFI entropy generation to non-x86 CPUs

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown 2016-05-04 14:13:44 +01:00
parent 757ab98381
commit 57d0ea7c46
3 changed files with 5 additions and 5 deletions

View File

@ -53,7 +53,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define ERRFILE_cpuid_cmd ( ERRFILE_ARCH | ERRFILE_OTHER | 0x00000000 )
#define ERRFILE_cpuid_settings ( ERRFILE_ARCH | ERRFILE_OTHER | 0x00010000 )
#define ERRFILE_efi_entropy ( ERRFILE_ARCH | ERRFILE_OTHER | 0x00020000 )
/** @} */

View File

@ -351,6 +351,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define ERRFILE_efi_usb ( ERRFILE_OTHER | 0x004b0000 )
#define ERRFILE_efi_fbcon ( ERRFILE_OTHER | 0x004c0000 )
#define ERRFILE_efi_local ( ERRFILE_OTHER | 0x004d0000 )
#define ERRFILE_efi_entropy ( ERRFILE_OTHER | 0x004e0000 )
/** @} */

View File

@ -26,6 +26,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <errno.h>
#include <ipxe/entropy.h>
#include <ipxe/crc32.h>
#include <ipxe/profile.h>
#include <ipxe/efi/efi.h>
#include <ipxe/efi/Protocol/Rng.h>
@ -104,13 +105,12 @@ static void efi_entropy_disable ( void ) {
/**
* Wait for a timer tick
*
* @ret low TSC low-order bits, or negative error
* @ret low CPU profiling low-order bits, or negative error
*/
static int efi_entropy_tick ( void ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
UINTN index;
uint16_t low;
uint32_t discard_d;
EFI_STATUS efirc;
int rc;
@ -129,8 +129,8 @@ static int efi_entropy_tick ( void ) {
return rc;
}
/* Get current TSC low-order bits */
__asm__ __volatile__ ( "rdtsc" : "=a" ( low ), "=d" ( discard_d ) );
/* Get current CPU profiling timestamp low-order bits */
low = profile_timestamp();
return low;
}