paca.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*
  2. * include/asm-powerpc/paca.h
  3. *
  4. * This control block defines the PACA which defines the processor
  5. * specific data for each logical processor on the system.
  6. * There are some pointers defined that are utilized by PLIC.
  7. *
  8. * C 2001 PPC 64 Team, IBM Corp
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License
  12. * as published by the Free Software Foundation; either version
  13. * 2 of the License, or (at your option) any later version.
  14. */
  15. #ifndef _ASM_POWERPC_PACA_H
  16. #define _ASM_POWERPC_PACA_H
  17. #include <linux/config.h>
  18. #include <asm/types.h>
  19. #include <asm/lppaca.h>
  20. #include <asm/mmu.h>
  21. register struct paca_struct *local_paca asm("r13");
  22. #define get_paca() local_paca
  23. struct task_struct;
  24. /*
  25. * Defines the layout of the paca.
  26. *
  27. * This structure is not directly accessed by firmware or the service
  28. * processor except for the first two pointers that point to the
  29. * lppaca area and the ItLpRegSave area for this CPU. The lppaca
  30. * object is currently contained within the PACA but it doesn't need
  31. * to be.
  32. */
  33. struct paca_struct {
  34. /*
  35. * Because hw_cpu_id, unlike other paca fields, is accessed
  36. * routinely from other CPUs (from the IRQ code), we stick to
  37. * read-only (after boot) fields in the first cacheline to
  38. * avoid cacheline bouncing.
  39. */
  40. /*
  41. * MAGIC: These first two pointers can't be moved - they're
  42. * accessed by the firmware
  43. */
  44. struct lppaca *lppaca_ptr; /* Pointer to LpPaca for PLIC */
  45. #ifdef CONFIG_PPC_ISERIES
  46. void *reg_save_ptr; /* Pointer to LpRegSave for PLIC */
  47. #endif /* CONFIG_PPC_ISERIES */
  48. /*
  49. * MAGIC: the spinlock functions in arch/ppc64/lib/locks.c
  50. * load lock_token and paca_index with a single lwz
  51. * instruction. They must travel together and be properly
  52. * aligned.
  53. */
  54. u16 lock_token; /* Constant 0x8000, used in locks */
  55. u16 paca_index; /* Logical processor number */
  56. u64 kernel_toc; /* Kernel TOC address */
  57. u64 stab_real; /* Absolute address of segment table */
  58. u64 stab_addr; /* Virtual address of segment table */
  59. void *emergency_sp; /* pointer to emergency stack */
  60. s16 hw_cpu_id; /* Physical processor number */
  61. u8 cpu_start; /* At startup, processor spins until */
  62. /* this becomes non-zero. */
  63. /*
  64. * Now, starting in cacheline 2, the exception save areas
  65. */
  66. /* used for most interrupts/exceptions */
  67. u64 exgen[10] __attribute__((aligned(0x80)));
  68. u64 exmc[10]; /* used for machine checks */
  69. u64 exslb[10]; /* used for SLB/segment table misses
  70. * on the linear mapping */
  71. #ifdef CONFIG_PPC_64K_PAGES
  72. pgd_t *pgdir;
  73. #endif /* CONFIG_PPC_64K_PAGES */
  74. mm_context_t context;
  75. u16 slb_cache[SLB_CACHE_ENTRIES];
  76. u16 slb_cache_ptr;
  77. /*
  78. * then miscellaneous read-write fields
  79. */
  80. struct task_struct *__current; /* Pointer to current */
  81. u64 kstack; /* Saved Kernel stack addr */
  82. u64 stab_rr; /* stab/slb round-robin counter */
  83. u64 saved_r1; /* r1 save for RTAS calls */
  84. u64 saved_msr; /* MSR saved here by enter_rtas */
  85. u8 proc_enabled; /* irq soft-enable flag */
  86. /*
  87. * iSeries structure which the hypervisor knows about -
  88. * this structure should not cross a page boundary.
  89. * The vpa_init/register_vpa call is now known to fail if the
  90. * lppaca structure crosses a page boundary.
  91. * The lppaca is also used on POWER5 pSeries boxes.
  92. * The lppaca is 640 bytes long, and cannot readily change
  93. * since the hypervisor knows its layout, so a 1kB
  94. * alignment will suffice to ensure that it doesn't
  95. * cross a page boundary.
  96. */
  97. struct lppaca lppaca __attribute__((__aligned__(0x400)));
  98. };
  99. extern struct paca_struct paca[];
  100. #endif /* _ASM_POWERPC_PACA_H */