paca.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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. u32 default_decr; /* Default decrementer value */
  57. u64 kernel_toc; /* Kernel TOC address */
  58. u64 stab_real; /* Absolute address of segment table */
  59. u64 stab_addr; /* Virtual address of segment table */
  60. void *emergency_sp; /* pointer to emergency stack */
  61. s16 hw_cpu_id; /* Physical processor number */
  62. u8 cpu_start; /* At startup, processor spins until */
  63. /* this becomes non-zero. */
  64. /*
  65. * Now, starting in cacheline 2, the exception save areas
  66. */
  67. /* used for most interrupts/exceptions */
  68. u64 exgen[10] __attribute__((aligned(0x80)));
  69. u64 exmc[10]; /* used for machine checks */
  70. u64 exslb[10]; /* used for SLB/segment table misses
  71. * on the linear mapping */
  72. #ifdef CONFIG_PPC_64K_PAGES
  73. pgd_t *pgdir;
  74. #endif /* CONFIG_PPC_64K_PAGES */
  75. mm_context_t context;
  76. u16 slb_cache[SLB_CACHE_ENTRIES];
  77. u16 slb_cache_ptr;
  78. /*
  79. * then miscellaneous read-write fields
  80. */
  81. struct task_struct *__current; /* Pointer to current */
  82. u64 kstack; /* Saved Kernel stack addr */
  83. u64 stab_rr; /* stab/slb round-robin counter */
  84. u64 next_jiffy_update_tb; /* TB value for next jiffy update */
  85. u64 saved_r1; /* r1 save for RTAS calls */
  86. u64 saved_msr; /* MSR saved here by enter_rtas */
  87. u8 proc_enabled; /* irq soft-enable flag */
  88. /* not yet used */
  89. u64 exdsi[8]; /* used for linear mapping hash table misses */
  90. /*
  91. * iSeries structure which the hypervisor knows about -
  92. * this structure should not cross a page boundary.
  93. * The vpa_init/register_vpa call is now known to fail if the
  94. * lppaca structure crosses a page boundary.
  95. * The lppaca is also used on POWER5 pSeries boxes.
  96. * The lppaca is 640 bytes long, and cannot readily change
  97. * since the hypervisor knows its layout, so a 1kB
  98. * alignment will suffice to ensure that it doesn't
  99. * cross a page boundary.
  100. */
  101. struct lppaca lppaca __attribute__((__aligned__(0x400)));
  102. };
  103. extern struct paca_struct paca[];
  104. #endif /* _ASM_POWERPC_PACA_H */