Please bear with me - another rename checkin. This qualifies as trivial, no
[coreboot.git] / src / northbridge / amd / amdht / comlib.h
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2007 Advanced Micro Devices, Inc.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
18  */
19
20 #ifndef COMLIB_H
21 #define COMLIB_H
22
23 #ifndef FILECODE
24 #error "FILECODE was not defined, should be #define'd to 0xFxxx"
25 #endif
26
27 #include "porting.h"
28
29 /* include LinuxBIOS pci functions */
30 #include <device/pci_def.h>
31 #include <device/pci_ids.h>
32
33 #ifdef AMD_DEBUG
34     #define ASSERT(x) ((x) ? 0 : ErrorStop(((uint32)FILECODE)*0x10000 + ((__LINE__)%10) + (((__LINE__/10)%10)*0x10) + (((__LINE__/100)%10)*0x100) +(((__LINE__/1000)%10)*0x1000)))
35 #else
36     #define ASSERT(x)
37 #endif
38
39 #ifdef AMD_DEBUG_ERROR_STOP
40     /* Macro to aid debugging, causes program to halt and display the line number of the halt in decimal */
41     #define STOP_HERE ErrorStop(((uint32)FILECODE)*0x10000 + ((__LINE__)%10) + (((__LINE__/10)%10)*0x10) + (((__LINE__/100)%10)*0x100) +(((__LINE__/1000)%10)*0x1000))
42 #else
43     /* Macro to aid debugging, causes program to halt and display the line number of the halt in decimal */
44     /* #define STOP_HERE STOP_HERE_OnlyForDebugUse */
45     #define STOP_HERE
46 #endif
47
48 void CALLCONV AmdPCIReadBits(SBDFO loc, uint8 highbit, uint8 lowbit, uint32 *value);
49 void CALLCONV AmdPCIWriteBits(SBDFO loc, uint8 highbit, uint8 lowbit, uint32 *value);
50 void CALLCONV AmdPCIFindNextCap(SBDFO *current);
51
52 void CALLCONV Amdmemcpy(void *dst, const void *src, uint32 length);
53 void CALLCONV Amdmemset(void *buf, uint8 val, uint32 length);
54
55 uint8 CALLCONV AmdBitScanReverse(uint32 value);
56 uint32 CALLCONV AmdRotateRight(uint32 value, uint8 size, uint32 count);
57 uint32 CALLCONV AmdRotateLeft(uint32 value, uint8 size, uint32 count);
58
59 #endif