summaryrefslogtreecommitdiffstats
path: root/src/arch/x86/interface/pcbios/rtc_entropy.c
diff options
context:
space:
mode:
authorSimon Rettberg2021-07-22 14:36:35 +0200
committerSimon Rettberg2021-07-22 14:36:35 +0200
commitfc21afb08c7b827b3cd4a77618f36a7abdc13494 (patch)
treef7909726a1d49cb834bfa9647621b29cb15caea4 /src/arch/x86/interface/pcbios/rtc_entropy.c
parentMerge branch 'master' into openslx (diff)
parent[cloud] Retry DHCP aggressively in AWS EC2 (diff)
downloadipxe-fc21afb08c7b827b3cd4a77618f36a7abdc13494.tar.gz
ipxe-fc21afb08c7b827b3cd4a77618f36a7abdc13494.tar.xz
ipxe-fc21afb08c7b827b3cd4a77618f36a7abdc13494.zip
Merge branch 'master' into openslx
Diffstat (limited to 'src/arch/x86/interface/pcbios/rtc_entropy.c')
-rw-r--r--src/arch/x86/interface/pcbios/rtc_entropy.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/arch/x86/interface/pcbios/rtc_entropy.c b/src/arch/x86/interface/pcbios/rtc_entropy.c
index e9e6baa59..e0c175685 100644
--- a/src/arch/x86/interface/pcbios/rtc_entropy.c
+++ b/src/arch/x86/interface/pcbios/rtc_entropy.c
@@ -36,6 +36,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <biosint.h>
#include <pic8259.h>
#include <rtc.h>
+#include <ipxe/cpuid.h>
#include <ipxe/entropy.h>
/** Maximum time to wait for an RTC interrupt, in milliseconds */
@@ -174,8 +175,17 @@ static int rtc_entropy_check ( void ) {
* @ret rc Return status code
*/
static int rtc_entropy_enable ( void ) {
+ struct x86_features features;
int rc;
+ /* Check that TSC is supported */
+ x86_features ( &features );
+ if ( ! ( features.intel.edx & CPUID_FEATURES_INTEL_EDX_TSC ) ) {
+ DBGC ( &rtc_flag, "RTC has no TSC\n" );
+ rc = -ENOTSUP;
+ goto err_no_tsc;
+ }
+
/* Hook ISR and enable RTC interrupts */
rtc_hook_isr();
enable_irq ( RTC_IRQ );
@@ -191,6 +201,7 @@ static int rtc_entropy_enable ( void ) {
rtc_disable_int();
disable_irq ( RTC_IRQ );
rtc_unhook_isr();
+ err_no_tsc:
return rc;
}