Skip to content

Commit

Permalink
[efi] Generalise EFI entropy generation to non-x86 CPUs
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed May 4, 2016
1 parent 757ab98 commit 57d0ea7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/arch/x86/include/bits/errfile.h
Expand Up @@ -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 )

/** @} */

Expand Down
1 change: 1 addition & 0 deletions src/include/ipxe/errfile.h
Expand Up @@ -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 )

/** @} */

Expand Down
Expand Up @@ -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>

Expand Down Expand Up @@ -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;

Expand All @@ -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;
}
Expand Down

0 comments on commit 57d0ea7

Please sign in to comment.