X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ArmPlatformPkg%2FDrivers%2FSP805WatchdogDxe%2FSP805Watchdog.c;h=f8faab735de6c2fed4feecb5edeb3ae88aebd80a;hb=3723a71a33d88307d96bca4facdce7d0120d922f;hp=0eb459303f2eb956fc8d8c000a50d5aa20387eab;hpb=33e7c2abf4852c98d13072102277170e198c5220;p=mirror_edk2.git diff --git a/ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805Watchdog.c b/ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805Watchdog.c index 0eb459303f..f8faab735d 100644 --- a/ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805Watchdog.c +++ b/ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805Watchdog.c @@ -16,15 +16,15 @@ #include #include -#include #include +#include +#include +#include #include #include #include -#include #include -#include #include /** @@ -75,18 +75,18 @@ SP805Identify ( ) { // Check if this is a PrimeCell Peripheral - if( ( MmioRead8( SP805_WDOG_PCELL_ID0 ) != 0x0D ) - || ( MmioRead8( SP805_WDOG_PCELL_ID1 ) != 0xF0 ) - || ( MmioRead8( SP805_WDOG_PCELL_ID2 ) != 0x05 ) - || ( MmioRead8( SP805_WDOG_PCELL_ID3 ) != 0xB1 ) ) { + if ( (MmioRead8 (SP805_WDOG_PCELL_ID0) != 0x0D) + || (MmioRead8 (SP805_WDOG_PCELL_ID1) != 0xF0) + || (MmioRead8 (SP805_WDOG_PCELL_ID2) != 0x05) + || (MmioRead8 (SP805_WDOG_PCELL_ID3) != 0xB1)) { return EFI_NOT_FOUND; } // Check if this PrimeCell Peripheral is the SP805 Watchdog Timer - if( ( MmioRead8( SP805_WDOG_PERIPH_ID0 ) != 0x05 ) - || ( MmioRead8( SP805_WDOG_PERIPH_ID1 ) != 0x18 ) - || (( MmioRead8( SP805_WDOG_PERIPH_ID2 ) & 0x0000000F) != 0x04 ) - || ( MmioRead8( SP805_WDOG_PERIPH_ID3 ) != 0x00 ) ) { + if ( (MmioRead8 (SP805_WDOG_PERIPH_ID0) != 0x05) + || (MmioRead8 (SP805_WDOG_PERIPH_ID1) != 0x18) + || ((MmioRead8 (SP805_WDOG_PERIPH_ID2) & 0x0000000F) != 0x04) + || (MmioRead8 (SP805_WDOG_PERIPH_ID3) != 0x00)) { return EFI_NOT_FOUND; } @@ -282,10 +282,10 @@ SP805SetTimerPeriod ( // // WatchdogTicks = (TimerPeriod * SP805_CLOCK_FREQUENCY) / 20 MHz ; - Ticks64bit = DivU64x32( MultU64x32( TimerPeriod, SP805_CLOCK_FREQUENCY ), 20000000 ); + Ticks64bit = DivU64x32(MultU64x32(TimerPeriod, (UINTN)PcdGet32(PcdSP805WatchdogClockFrequencyInHz)), 20000000); // The registers in the SP805 are only 32 bits - if( Ticks64bit > SP805_MAX_TICKS ) { + if(Ticks64bit > (UINT64)0xFFFFFFFF) { // We could load the watchdog with the maximum supported value but // if a smaller value was requested, this could have the watchdog // triggering before it was intended.