paca.h 3.9 KB

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