~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/powerpc/boot/util.S

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-or-later */
  2 /*
  3  * Copied from <file:arch/powerpc/kernel/misc_32.S>
  4  *
  5  * This file contains miscellaneous low-level functions.
  6  *    Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
  7  *
  8  * Largely rewritten by Cort Dougan (cort@cs.nmt.edu)
  9  * and Paul Mackerras.
 10  *
 11  * kexec bits:
 12  * Copyright (C) 2002-2003 Eric Biederman  <ebiederm@xmission.com>
 13  * GameCube/ppc32 port Copyright (C) 2004 Albert Herranz
 14  */
 15 #include "ppc_asm.h"
 16 
 17 #define SPRN_PVR        0x11F   /* Processor Version Register */
 18 
 19         .text
 20 
 21 /* udelay needs to know the period of the
 22  * timebase in nanoseconds.  This used to be hardcoded to be 60ns
 23  * (period of 66MHz/4).  Now a variable is used that is initialized to
 24  * 60 for backward compatibility, but it can be overridden as necessary
 25  * with code something like this:
 26  *    extern unsigned long timebase_period_ns;
 27  *    timebase_period_ns = 1000000000 / bd->bi_tbfreq;
 28  */
 29         .data
 30         .globl timebase_period_ns
 31 timebase_period_ns:
 32         .long   60
 33 
 34         .text
 35 /*
 36  * Delay for a number of microseconds
 37  */
 38         .globl  udelay
 39 udelay:
 40         mulli   r4,r3,1000      /* nanoseconds */
 41         /*  Change r4 to be the number of ticks using:
 42          *      (nanoseconds + (timebase_period_ns - 1 )) / timebase_period_ns
 43          *  timebase_period_ns defaults to 60 (16.6MHz) */
 44         mflr    r5
 45         bcl     20,31,0f
 46 0:      mflr    r6
 47         mtlr    r5
 48         addis   r5,r6,(timebase_period_ns-0b)@ha
 49         lwz     r5,(timebase_period_ns-0b)@l(r5)
 50         add     r4,r4,r5
 51         addi    r4,r4,-1
 52         divw    r4,r4,r5        /* BUS ticks */
 53 1:      MFTBU(r5)
 54         MFTBL(r6)
 55         MFTBU(r7)
 56         cmpw    0,r5,r7
 57         bne     1b              /* Get [synced] base time */
 58         addc    r9,r6,r4        /* Compute end time */
 59         addze   r8,r5
 60 2:      MFTBU(r5)
 61         cmpw    0,r5,r8
 62         blt     2b
 63         bgt     3f
 64         MFTBL(r6)
 65         cmpw    0,r6,r9
 66         blt     2b
 67 3:      blr

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php