From 437dfba25bb023f1a9ae351438c14204e950c1f2 Mon Sep 17 00:00:00 2001 From: jljusten Date: Fri, 22 Apr 2011 22:21:53 +0000 Subject: [PATCH] OptionRomPkg BltLibSample: Fix build for IPF architecture Use AsmReadItc for IPF and AsmReadTsc for IA32 & X64. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11580 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Application/BltLibSample/BltLibSample.c | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/OptionRomPkg/Application/BltLibSample/BltLibSample.c b/OptionRomPkg/Application/BltLibSample/BltLibSample.c index fd2b2ce345..300b9ee117 100644 --- a/OptionRomPkg/Application/BltLibSample/BltLibSample.c +++ b/OptionRomPkg/Application/BltLibSample/BltLibSample.c @@ -20,6 +20,20 @@ #include +UINT64 +ReadTimestamp ( + VOID + ) +{ +#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64) + return AsmReadTsc (); +#elif defined (MDE_CPU_IPF) + return AsmReadItc (); +#else +#error ReadTimestamp not supported for this architecture! +#endif +} + UINT32 Rand32 ( VOID @@ -34,10 +48,10 @@ Rand32 ( R32 = 0; Found = 0; - Tsc1 = AsmReadTsc (); - Tsc2 = AsmReadTsc (); + Tsc1 = ReadTimestamp (); + Tsc2 = ReadTimestamp (); do { - Tsc2 = AsmReadTsc (); + Tsc2 = ReadTimestamp (); TscBits = Tsc2 ^ Tsc1; Bits = HighBitSet64 (TscBits); if (Bits > 0) {