We define IO_APIC_ADDR in <arch/ioapic.h>, let's use it.
[coreboot.git] / src / southbridge / via / vt8237r / vt8237r.h
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2007 Rudolf Marek <r.marek@assembler.cz>
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 SOUTHBRIDGE_VIA_VT8237R_VT8237R_H
21 #define SOUTHBRIDGE_VIA_VT8237R_VT8237R_H
22
23 #include <stdint.h>
24
25 /* Static resources for the VT8237R southbridge */
26
27 #define VT8237R_APIC_ID                 0x2
28 #define VT8237R_ACPI_IO_BASE            0x500
29 #define VT8237R_SMBUS_IO_BASE           0x400
30 /* 0x0 disabled, 0x2 reserved, 0xf = IRQ15 */
31 #define VT8237R_ACPI_IRQ                0x9
32 #if defined(__GNUC__)
33 #define VT8237S_SPI_MEM_BASE            0xfed02000ULL
34 #else
35 #define VT8237S_SPI_MEM_BASE            0xfed02000UL
36 #endif
37 #define VT8237R_HPET_ADDR               0xfed00000ULL
38
39 /* IDE */
40 #define IDE_CS                          0x40
41 #define IDE_CONF_I                      0x41
42 #define IDE_CONF_II                     0x42
43 #define IDE_CONF_FIFO                   0x43
44 #define IDE_MISC_I                      0x44
45 #define IDE_MISC_II                     0x45
46 #define IDE_UDMA                        0x50
47
48 /* SMBus */
49 #define VT8237R_PSON                    0x82
50 #define VT8237R_POWER_WELL              0x94
51 #define VT8237R_SMBUS_IO_BASE_REG       0xd0
52 #define VT8237R_SMBUS_HOST_CONF         0xd2
53
54 #define SMBHSTSTAT                      (VT8237R_SMBUS_IO_BASE + 0x0)
55 #define SMBSLVSTAT                      (VT8237R_SMBUS_IO_BASE + 0x1)
56 #define SMBHSTCTL                       (VT8237R_SMBUS_IO_BASE + 0x2)
57 #define SMBHSTCMD                       (VT8237R_SMBUS_IO_BASE + 0x3)
58 #define SMBXMITADD                      (VT8237R_SMBUS_IO_BASE + 0x4)
59 #define SMBHSTDAT0                      (VT8237R_SMBUS_IO_BASE + 0x5)
60
61 #define HOST_RESET                      0xff
62 /* 1 in the 0 bit of SMBHSTADD states to READ. */
63 #define READ_CMD                        0x01
64 #define SMBUS_TIMEOUT                   (100 * 1000 * 10)
65 #define I2C_TRANS_CMD                   0x40
66 #define CLOCK_SLAVE_ADDRESS             0x69
67
68 #if CONFIG_DEBUG_SMBUS
69 #define PRINT_DEBUG(x)          print_debug(x)
70 #define PRINT_DEBUG_HEX16(x)    print_debug_hex16(x)
71 #else
72 #define PRINT_DEBUG(x)
73 #define PRINT_DEBUG_HEX16(x)
74 #endif
75
76 #define SMBUS_DELAY() inb(0x80)
77
78 struct vt8237_network_rom {
79         u8 mac_address[6];
80         u8 phy_addr;
81         u8 res1;
82         u16 sub_sid;
83         u16 sub_vid;
84         u16 pid;
85         u16 vid;
86         u8 pmcc;
87         u8 data_sel;
88         u8 pmu_data_reg;
89         u8 aux_curr;
90         u16 reserved;
91         u8 min_gnt;
92         u8 max_lat;
93         u8 bcr0;
94         u8 bcr1;
95         u8 cfg_a;
96         u8 cfg_b;
97         u8 cfg_c;
98         u8 cfg_d;
99         u8 checksum;
100 }
101 #if defined(__GNUC__)
102 __attribute__ ((packed))
103 #endif
104 ;
105
106 #ifdef __PRE_RAM__
107 #ifndef __ROMCC__
108 u8 smbus_read_byte(u8 dimm, u8 offset);
109 void enable_smbus(void);
110 void smbus_fixup(const struct mem_controller *ctrl);
111 // these are in vt8237_early_smbus.c - do they really belong there?
112 void vt8237_sb_enable_fid_vid(void);
113 void enable_rom_decode(void);
114 void vt8237_early_spi_init(void);
115 int vt8237_early_network_init(struct vt8237_network_rom *rom);
116 #endif
117 #else
118 #include <device/device.h>
119 void writeback(struct device *dev, u16 where, u8 what);
120 void dump_south(device_t dev);
121 #endif
122
123 #endif