patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / include / asm-ppc64 / paca.h
1 #ifndef _PPC64_PACA_H
2 #define _PPC64_PACA_H
3
4 /*============================================================================
5  *                                                         Header File Id
6  * Name______________:  paca.h
7  *
8  * Description_______:
9  *
10  * This control block defines the PACA which defines the processor 
11  * specific data for each logical processor on the system.  
12  * There are some pointers defined that are utilized by PLIC.
13  *
14  * C 2001 PPC 64 Team, IBM Corp
15  *
16  * This program is free software; you can redistribute it and/or
17  * modify it under the terms of the GNU General Public License
18  * as published by the Free Software Foundation; either version
19  * 2 of the License, or (at your option) any later version.
20  */    
21 #include        <asm/types.h>
22
23 #define N_EXC_STACK    2
24
25 /*-----------------------------------------------------------------------------
26  * Other Includes
27  *-----------------------------------------------------------------------------
28  */
29 #include        <asm/iSeries/ItLpPaca.h>
30 #include        <asm/iSeries/ItLpRegSave.h>
31 #include        <asm/iSeries/ItLpQueue.h>
32 #include        <asm/rtas.h>
33 #include        <asm/mmu.h>
34 #include        <asm/processor.h>
35
36 extern struct paca_struct paca[];
37 register struct paca_struct *local_paca asm("r13");
38 #define get_paca()      local_paca
39
40 struct task_struct;
41
42 /*============================================================================
43  * Name_______: paca
44  *
45  * Description:
46  *
47  *      Defines the layout of the paca.  
48  *
49  *      This structure is not directly accessed by PLIC or the SP except
50  *      for the first two pointers that point to the ItLpPaca area and the
51  *      ItLpRegSave area for this processor.  Both the ItLpPaca and
52  *      ItLpRegSave objects are currently contained within the
53  *      PACA but they do not need to be.
54  *
55  *============================================================================
56  */
57 struct paca_struct {
58 /*=====================================================================================
59  * CACHE_LINE_1 0x0000 - 0x007F
60  *=====================================================================================
61  */
62         struct ItLpPaca *xLpPacaPtr;    /* Pointer to LpPaca for PLIC           0x00 */
63         struct ItLpRegSave *xLpRegSavePtr; /* Pointer to LpRegSave for PLIC     0x08 */
64         struct task_struct *xCurrent;   /* Pointer to current                   0x10 */
65         /* Note: the spinlock functions in arch/ppc64/lib/locks.c load lock_token and
66            xPacaIndex with a single lwz instruction, using the constant offset 24.
67            If you move either field, fix the spinlocks and rwlocks. */
68         u16 lock_token;                 /* Constant 0x8000, used in spinlocks   0x18 */
69         u16 xPacaIndex;                 /* Logical processor number             0x1A */
70         u32 default_decr;               /* Default decrementer value            0x1c */ 
71         u64 xKsave;                     /* Saved Kernel stack addr or zero      0x20 */
72         struct ItLpQueue *lpQueuePtr;   /* LpQueue handled by this processor    0x28 */
73         u64  xTOC;                      /* Kernel TOC address                   0x30 */
74         STAB xStab_data;                /* Segment table information            0x38,0x40,0x48 */
75         u8 *exception_sp;               /*                                      0x50 */
76         u8 xProcEnabled;                /*                                      0x58 */
77         u8 prof_enabled;                /* 1=iSeries profiling enabled          0x59 */
78         u16 xHwProcNum;                 /* Physical processor number            0x5a */
79         u8 resv1[36];                   /*                                      0x5c */
80
81 /*=====================================================================================
82  * CACHE_LINE_2 0x0080 - 0x00FF
83  *=====================================================================================
84  */
85         u64 spare1;                     /*                                      0x00 */
86         u64 spare2;                     /*                                      0x08 */
87         u64 spare3;                     /*                                      0x10 */
88         u64 spare4;             /*                                      0x18 */
89         u64 next_jiffy_update_tb;       /* TB value for next jiffy update       0x20 */
90         u32 lpEvent_count;              /* lpEvents processed                   0x28 */
91         u32 prof_multiplier;            /*                                      0x2C */
92         u32 prof_counter;               /*                                      0x30 */
93         u32 prof_shift;                 /* iSeries shift for profile bucket size0x34 */
94         u32 *prof_buffer;               /* iSeries profiling buffer             0x38 */
95         u32 *prof_stext;                /* iSeries start of kernel text         0x40 */
96         u32 prof_len;                   /* iSeries length of profile buffer -1  0x48 */
97         u8  yielded;                    /* 0 = this processor is running        0x4c */
98                                         /* 1 = this processor is yielded             */
99         u8  rsvd2[128-77];              /*                                      0x49 */
100
101 /*=====================================================================================
102  * CACHE_LINE_3 0x0100 - 0x017F
103  *=====================================================================================
104  */
105         u8              xProcStart;     /* At startup, processor spins until    0x100 */
106                                         /* xProcStart becomes non-zero. */
107         u8              rsvd3[127];
108
109 /*=====================================================================================
110  * CACHE_LINE_4-8  0x0180 - 0x03FF Contains ItLpPaca
111  *=====================================================================================
112  */
113         struct ItLpPaca xLpPaca;        /* Space for ItLpPaca */
114
115 /*=====================================================================================
116  * CACHE_LINE_9-16 0x0400 - 0x07FF Contains ItLpRegSave
117  *=====================================================================================
118  */
119         struct ItLpRegSave xRegSav;     /* Register save for proc */
120
121 /*=====================================================================================
122  * CACHE_LINE_17-18 0x0800 - 0x08FF Reserved
123  *=====================================================================================
124  */
125         struct rtas_args xRtas;         /* Per processor RTAS struct */
126         u64 xR1;                        /* r1 save for RTAS calls */
127         u64 xSavedMsr;                  /* Old msr saved here by HvCall */
128         u8 rsvd5[256-16-sizeof(struct rtas_args)];
129
130 /*=====================================================================================
131  * CACHE_LINE_19-30 0x0900 - 0x0EFF Reserved
132  *=====================================================================================
133  */
134         u64 slb_shadow[0x20];
135         u64 dispatch_log;
136         u8  rsvd6[0x500 - 0x8];
137
138 /*=====================================================================================
139  * CACHE_LINE_31 0x0F00 - 0x0F7F Exception stack
140  *=====================================================================================
141  */
142         u8 exception_stack[N_EXC_STACK*EXC_FRAME_SIZE];
143
144 /*=====================================================================================
145  * CACHE_LINE_32 0x0F80 - 0x0FFF Reserved
146  *=====================================================================================
147  */
148         u8 rsvd7[0x80];                  /* Give the stack some rope ... */
149
150 /*=====================================================================================
151  * Page 2 Reserved for guard page.  Also used as a stack early in SMP boots before
152  *        relocation is enabled.
153  *=====================================================================================
154  */
155         u8 guard[0x1000];               /* ... and then hang 'em         */ 
156 };
157
158 #endif /* _PPC64_PACA_H */