48177ed1777ce41058506140deca802f379c0f15
[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 #pragma pack (push, 1)\r
40 \r
41 #define IMAGE_ALIGN          32*1024\r
42 #define NUM_IMAGE_LOCATION   32\r
43 \r
44 //Entry Point Call\r
45 typedef void (*CIM_IMAGE_ENTRY) (void* pConfig);\r
46 \r
47 //Hook Call\r
48 \r
49 typedef struct _CIMFILEHEADER\r
50 {\r
51   UINT32  AMDLogo;\r
52   UINT64  CreatorID;\r
53   UINT32  Version1;\r
54   UINT32  Version2;\r
55   UINT32  Version3;\r
56   UINT32  ModuleInfoOffset;\r
57   UINT32  EntryPoint;\r
58   UINT32  ImageBase;\r
59   UINT32  RelocTableOffset;\r
60   UINT32  ImageSize;\r
61   UINT16  CheckSum;\r
62   UINT8 ImageType;\r
63   UINT8 Reserved2;\r
64 } CIMFILEHEADER;\r
65 \r
66 #ifndef BIT0\r
67   #define BIT0 (1 << 0)\r
68 #endif\r
69 #ifndef BIT1\r
70   #define BIT1 (1 << 1)\r
71 #endif\r
72 #ifndef BIT2\r
73   #define BIT2 (1 << 2)\r
74 #endif\r
75 #ifndef BIT3\r
76   #define BIT3 (1 << 3)\r
77 #endif\r
78 #ifndef BIT4\r
79   #define BIT4 (1 << 4)\r
80 #endif\r
81 #ifndef BIT5\r
82   #define BIT5 (1 << 5)\r
83 #endif\r
84 #ifndef BIT6\r
85   #define BIT6 (1 << 6)\r
86 #endif\r
87 #ifndef BIT7\r
88   #define BIT7 (1 << 7)\r
89 #endif\r
90 #ifndef BIT8\r
91   #define BIT8 (1 << 8)\r
92 #endif\r
93 #ifndef BIT9\r
94   #define BIT9 (1 << 9)\r
95 #endif\r
96 #ifndef BIT10\r
97   #define BIT10 (1 << 10)\r
98 #endif\r
99 #ifndef BIT11\r
100   #define BIT11 (1 << 11)\r
101 #endif\r
102 #ifndef BIT12\r
103   #define BIT12 (1 << 12)\r
104 #endif\r
105 #ifndef BIT13\r
106   #define BIT13 (1 << 13)\r
107 #endif\r
108 #ifndef BIT14\r
109   #define BIT14 (1 << 14)\r
110 #endif\r
111 #ifndef BIT15\r
112   #define BIT15 (1 << 15)\r
113 #endif\r
114 #ifndef BIT16\r
115   #define BIT16 (1 << 16)\r
116 #endif\r
117 #ifndef BIT17\r
118   #define BIT17 (1 << 17)\r
119 #endif\r
120 #ifndef BIT18\r
121   #define BIT18 (1 << 18)\r
122 #endif\r
123 #ifndef BIT19\r
124   #define BIT19 (1 << 19)\r
125 #endif\r
126 #ifndef BIT20\r
127   #define BIT20 (1 << 20)\r
128 #endif\r
129 #ifndef BIT21\r
130   #define BIT21 (1 << 21)\r
131 #endif\r
132 #ifndef BIT22\r
133   #define BIT22 (1 << 22)\r
134 #endif\r
135 #ifndef BIT23\r
136   #define BIT23 (1 << 23)\r
137 #endif\r
138 #ifndef  BIT24\r
139   #define BIT24 (1 << 24)\r
140 #endif\r
141 #ifndef BIT25\r
142   #define BIT25 (1 << 25)\r
143 #endif\r
144 #ifndef BIT26\r
145   #define BIT26 (1 << 26)\r
146 #endif\r
147 #ifndef BIT27\r
148   #define BIT27 (1 << 27)\r
149 #endif\r
150 #ifndef BIT28\r
151   #define BIT28 (1 << 28)\r
152 #endif\r
153 #ifndef BIT29\r
154   #define BIT29 (1 << 29)\r
155 #endif\r
156 #ifndef BIT30\r
157   #define BIT30 (1 << 30)\r
158 #endif\r
159 #ifndef BIT31\r
160   #define BIT31 (1 << 31)\r
161 #endif\r
162 \r
163 #pragma pack (pop)\r
164 \r
165 typedef enum\r
166 {\r
167   AccWidthUint8 = 0,\r
168   AccWidthUint16,\r
169   AccWidthUint32,\r
170 } ACC_WIDTH;\r
171 \r
172 #define S3_SAVE  0x80\r
173 \r
174 #endif\r