Browse Source

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

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 8 years ago
parent
commit
57d0ea7c46

+ 0
- 1
src/arch/x86/include/bits/errfile.h View File

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

+ 1
- 0
src/include/ipxe/errfile.h View File

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

src/arch/x86/interface/efi/efi_entropy.c → src/interface/efi/efi_entropy.c View File

@@ -26,6 +26,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
26 26
 #include <errno.h>
27 27
 #include <ipxe/entropy.h>
28 28
 #include <ipxe/crc32.h>
29
+#include <ipxe/profile.h>
29 30
 #include <ipxe/efi/efi.h>
30 31
 #include <ipxe/efi/Protocol/Rng.h>
31 32
 
@@ -104,13 +105,12 @@ static void efi_entropy_disable ( void ) {
104 105
 /**
105 106
  * Wait for a timer tick
106 107
  *
107
- * @ret low		TSC low-order bits, or negative error
108
+ * @ret low		CPU profiling low-order bits, or negative error
108 109
  */
109 110
 static int efi_entropy_tick ( void ) {
110 111
 	EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
111 112
 	UINTN index;
112 113
 	uint16_t low;
113
-	uint32_t discard_d;
114 114
 	EFI_STATUS efirc;
115 115
 	int rc;
116 116
 
@@ -129,8 +129,8 @@ static int efi_entropy_tick ( void ) {
129 129
 		return rc;
130 130
 	}
131 131
 
132
-	/* Get current TSC low-order bits */
133
-	__asm__ __volatile__ ( "rdtsc" : "=a" ( low ), "=d" ( discard_d ) );
132
+	/* Get current CPU profiling timestamp low-order bits */
133
+	low = profile_timestamp();
134 134
 
135 135
 	return low;
136 136
 }

Loading…
Cancel
Save