2 * This file is part of the coreboot project.
4 * Copyright (C) 2007 Advanced Micro Devices, Inc.
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.
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.
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
24 /* For AMD64 or 32-bit GCC */
26 typedef unsigned int uint32;
28 typedef unsigned short uint16;
30 typedef unsigned char uint8;
32 /* Create the Boolean type */
35 typedef unsigned char BOOL;
37 /* Force tight packing of structures */
43 typedef struct _uint64
51 * SBDFO - Segment Bus Device Function Offset
52 * 31:28 Segment (4-bits)
54 * 19:15 Device (5-bits)
55 * 14:12 Function(3-bits)
56 * 11:00 Offset (12-bits)
60 #define MAKE_SBDFO(seg,bus,dev,fun,off) ((((uint32)(seg))<<28) | (((uint32)(bus))<<20) | \
61 (((uint32)(dev))<<15) | (((uint32)(fun))<<12) | ((uint32)(off)))
62 #define SBDFO_SEG(x) (((uint32)(x)>>28) & 0x0F)
63 #define SBDFO_BUS(x) (((uint32)(x)>>20) & 0xFF)
64 #define SBDFO_DEV(x) (((uint32)(x)>>15) & 0x1F)
65 #define SBDFO_FUN(x) (((uint32)(x)>>12) & 0x07)
66 #define SBDFO_OFF(x) (((uint32)(x)) & 0xFFF)
67 #define ILLEGAL_SBDFO 0xFFFFFFFF
69 void CALLCONV AmdMSRRead(uint32 Address, uint64 *Value);
70 void CALLCONV AmdMSRWrite(uint32 Address, uint64 *Value);
71 void CALLCONV AmdIORead(uint8 IOSize, uint16 Address, uint32 *Value);
72 void CALLCONV AmdIOWrite(uint8 IOSize, uint16 Address, uint32 *Value);
73 void CALLCONV AmdMemRead(uint8 MemSize, uint64 *Address, uint32 *Value);
74 void CALLCONV AmdMemWrite(uint8 MemSize, uint64 *Address, uint32 *Value);
75 void CALLCONV AmdPCIRead(SBDFO loc, uint32 *Value);
76 void CALLCONV AmdPCIWrite(SBDFO loc, uint32 *Value);
77 void CALLCONV AmdCPUIDRead(uint32 Address, uint32 Regs[4]);
78 void CALLCONV ErrorStop(uint32 Value);
84 #endif /* PORTING_H */