c5fd22b69488c5e53ff662eac723bb15e96ad56c
[coreboot.git] / src / southbridge / amd / cimx_wrapper / sb800 / Amdlib.h
1 /*\r
2  *****************************************************************************\r
3  *\r
4  * This file is part of the coreboot project.\r
5  *\r
6  * Copyright (C) 2010 Advanced Micro Devices, Inc.\r
7  *\r
8  * This program is free software; you can redistribute it and/or modify\r
9  * it under the terms of the GNU General Public License as published by\r
10  * the Free Software Foundation; version 2 of the License.\r
11  *\r
12  * This program is distributed in the hope that it will be useful,\r
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
15  * GNU General Public License for more details.\r
16  *\r
17  * You should have received a copy of the GNU General Public License\r
18  * along with this program; if not, write to the Free Software\r
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA\r
20  * ***************************************************************************\r
21  *\r
22  */\r
23 \r
24 #ifndef _AMD_SB_LIB_H_\r
25 #define _AMD_SB_LIB_H_\r
26 \r
27 typedef CHAR8  *va_list;\r
28 #ifndef _INTSIZEOF\r
29   #define _INTSIZEOF (n) ( (sizeof (n) + sizeof (UINTN) - 1) & ~(sizeof (UINTN) - 1) )\r
30 #endif\r
31 \r
32 // Also support coding convention rules for var arg macros\r
33 #ifndef va_start\r
34   #define va_start(ap, v)  ( ap = (va_list)&(v) + _INTSIZEOF (v) )\r
35 #endif\r
36 #define va_arg(ap, t)    ( *(t *) ((ap += _INTSIZEOF (t)) - _INTSIZEOF (t)) )\r
37 #define va_end(ap)      ( ap = (va_list)0 )\r
38 \r
39 \r
40 #pragma pack (push, 1)\r
41 \r
42 #define IMAGE_ALIGN          32*1024\r
43 #define NUM_IMAGE_LOCATION   32\r
44 \r
45 //Entry Point Call\r
46 typedef void (*CIM_IMAGE_ENTRY) (void* pConfig);\r
47 \r
48 //Hook Call\r
49 \r
50 typedef struct _CIMFILEHEADER\r
51 {\r
52   UINT32  AMDLogo;\r
53   UINT64  CreatorID;\r
54   UINT32  Version1;\r
55   UINT32  Version2;\r
56   UINT32  Version3;\r
57   UINT32  ModuleInfoOffset;\r
58   UINT32  EntryPoint;\r
59   UINT32  ImageBase;\r
60   UINT32  RelocTableOffset;\r
61   UINT32  ImageSize;\r
62   UINT16  CheckSum;\r
63   UINT8 ImageType;\r
64   UINT8 Reserved2;\r
65 } CIMFILEHEADER;\r
66 \r
67 #ifndef BIT0\r
68   #define BIT0 (1 << 0)\r
69 #endif\r
70 #ifndef BIT1\r
71   #define BIT1 (1 << 1)\r
72 #endif\r
73 #ifndef BIT2\r
74   #define BIT2 (1 << 2)\r
75 #endif\r
76 #ifndef BIT3\r
77   #define BIT3 (1 << 3)\r
78 #endif\r
79 #ifndef BIT4\r
80   #define BIT4 (1 << 4)\r
81 #endif\r
82 #ifndef BIT5\r
83   #define BIT5 (1 << 5)\r
84 #endif\r
85 #ifndef BIT6\r
86   #define BIT6 (1 << 6)\r
87 #endif\r
88 #ifndef BIT7\r
89   #define BIT7 (1 << 7)\r
90 #endif\r
91 #ifndef BIT8\r
92   #define BIT8 (1 << 8)\r
93 #endif\r
94 #ifndef BIT9\r
95   #define BIT9 (1 << 9)\r
96 #endif\r
97 #ifndef BIT10\r
98   #define BIT10 (1 << 10)\r
99 #endif\r
100 #ifndef BIT11\r
101   #define BIT11 (1 << 11)\r
102 #endif\r
103 #ifndef BIT12\r
104   #define BIT12 (1 << 12)\r
105 #endif\r
106 #ifndef BIT13\r
107   #define BIT13 (1 << 13)\r
108 #endif\r
109 #ifndef BIT14\r
110   #define BIT14 (1 << 14)\r
111 #endif\r
112 #ifndef BIT15\r
113   #define BIT15 (1 << 15)\r
114 #endif\r
115 #ifndef BIT16\r
116   #define BIT16 (1 << 16)\r
117 #endif\r
118 #ifndef BIT17\r
119   #define BIT17 (1 << 17)\r
120 #endif\r
121 #ifndef BIT18\r
122   #define BIT18 (1 << 18)\r
123 #endif\r
124 #ifndef BIT19\r
125   #define BIT19 (1 << 19)\r
126 #endif\r
127 #ifndef BIT20\r
128   #define BIT20 (1 << 20)\r
129 #endif\r
130 #ifndef BIT21\r
131   #define BIT21 (1 << 21)\r
132 #endif\r
133 #ifndef BIT22\r
134   #define BIT22 (1 << 22)\r
135 #endif\r
136 #ifndef BIT23\r
137   #define BIT23 (1 << 23)\r
138 #endif\r
139 #ifndef  BIT24\r
140   #define BIT24 (1 << 24)\r
141 #endif\r
142 #ifndef BIT25\r
143   #define BIT25 (1 << 25)\r
144 #endif\r
145 #ifndef BIT26\r
146   #define BIT26 (1 << 26)\r
147 #endif\r
148 #ifndef BIT27\r
149   #define BIT27 (1 << 27)\r
150 #endif\r
151 #ifndef BIT28\r
152   #define BIT28 (1 << 28)\r
153 #endif\r
154 #ifndef BIT29\r
155   #define BIT29 (1 << 29)\r
156 #endif\r
157 #ifndef BIT30\r
158   #define BIT30 (1 << 30)\r
159 #endif\r
160 #ifndef BIT31\r
161   #define BIT31 (1 << 31)\r
162 #endif\r
163 \r
164 #pragma pack (pop)\r
165 \r
166 typedef enum\r
167 {\r
168   AccWidthUint8 = 0,\r
169   AccWidthUint16,\r
170   AccWidthUint32,\r
171 } ACC_WIDTH;\r
172 \r
173 #define S3_SAVE  0x80\r
174 \r
175 #endif\r