ps3-head.S 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * PS3 bootwrapper entry.
  4. *
  5. * Copyright (C) 2007 Sony Computer Entertainment Inc.
  6. * Copyright 2007 Sony Corp.
  7. */
  8. #include "ppc_asm.h"
  9. .machine "ppc64"
  10. .text
  11. /*
  12. * __system_reset_overlay - The PS3 first stage entry.
  13. *
  14. * The bootwraper build script copies the 512 bytes at symbol
  15. * __system_reset_overlay to offset 0x100 of the rom image. This symbol
  16. * must occupy 512 or less bytes.
  17. *
  18. * The PS3 has a single processor with two threads.
  19. */
  20. .globl __system_reset_overlay
  21. __system_reset_overlay:
  22. /* Switch to 32-bit mode. */
  23. mfmsr r9
  24. clrldi r9,r9,1
  25. mtmsrd r9
  26. nop
  27. /* Get thread number in r3 and branch. */
  28. mfspr r3, 0x88
  29. cntlzw. r3, r3
  30. beq 1f
  31. /* Secondary goes to __secondary_hold in kernel. */
  32. li r4, 0x60
  33. mtctr r4
  34. bctr
  35. 1:
  36. /* Primary delays then goes to _zimage_start in wrapper. */
  37. or 31, 31, 31 /* db16cyc */
  38. or 31, 31, 31 /* db16cyc */
  39. lis r4, _zimage_start@ha
  40. addi r4, r4, _zimage_start@l
  41. mtctr r4
  42. bctr
  43. . = __system_reset_overlay + 512
  44. /*
  45. * __system_reset_kernel - Place holder for the kernel reset vector.
  46. *
  47. * The bootwrapper build script copies 512 bytes from offset 0x100
  48. * of the rom image to the symbol __system_reset_kernel. At runtime
  49. * the bootwrapper program copies the 512 bytes at __system_reset_kernel
  50. * to ram address 0x100. This symbol must occupy 512 bytes.
  51. */
  52. .globl __system_reset_kernel
  53. __system_reset_kernel:
  54. . = __system_reset_kernel + 512