kernel-entry-init.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 2000 Silicon Graphics, Inc.
  7. * Copyright (C) 2005 Ralf Baechle <ralf@linux-mips.org>
  8. */
  9. #ifndef __ASM_MACH_IP27_KERNEL_ENTRY_H
  10. #define __ASM_MACH_IP27_KERNEL_ENTRY_H
  11. #include <asm/sn/addrs.h>
  12. #include <asm/sn/sn0/hubni.h>
  13. #include <asm/sn/klkernvars.h>
  14. /*
  15. * Returns the local nasid into res.
  16. */
  17. .macro GET_NASID_ASM res
  18. dli \res, LOCAL_HUB_ADDR(NI_STATUS_REV_ID)
  19. ld \res, (\res)
  20. and \res, NSRI_NODEID_MASK
  21. dsrl \res, NSRI_NODEID_SHFT
  22. .endm
  23. /*
  24. * Intentionally empty macro, used in head.S. Override in
  25. * arch/mips/mach-xxx/kernel-entry-init.h when necessary.
  26. */
  27. .macro kernel_entry_setup
  28. GET_NASID_ASM t1
  29. move t2, t1 # text and data are here
  30. MAPPED_KERNEL_SETUP_TLB
  31. .endm
  32. /*
  33. * Do SMP slave processor setup necessary before we can savely execute C code.
  34. */
  35. .macro smp_slave_setup
  36. GET_NASID_ASM t1
  37. dli t0, KLDIR_OFFSET + (KLI_KERN_VARS * KLDIR_ENT_SIZE) + \
  38. KLDIR_OFF_POINTER + CAC_BASE
  39. dsll t1, NASID_SHFT
  40. or t0, t0, t1
  41. ld t0, 0(t0) # t0 points to kern_vars struct
  42. lh t1, KV_RO_NASID_OFFSET(t0)
  43. lh t2, KV_RW_NASID_OFFSET(t0)
  44. MAPPED_KERNEL_SETUP_TLB
  45. /*
  46. * We might not get launched at the address the kernel is linked to,
  47. * so we jump there.
  48. */
  49. PTR_LA t0, 0f
  50. jr t0
  51. 0:
  52. .endm
  53. #endif /* __ASM_MACH_IP27_KERNEL_ENTRY_H */