Get rid of some unneeded function prototypes in romstage.c files.
[coreboot.git] / src / southbridge / intel / i82801bx / i82801bx_early_smbus.c
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2005 Tyan Computer
5  * (Written by Yinghai Lu <yinghailu@gmail.com> for Tyan Computer)
6  * Copyright (C) 2007 Corey Osgood <corey.osgood@gmail.com>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
21  */
22
23 #include <arch/io.h>
24 #include <arch/romcc_io.h>
25 #include <console/console.h>
26 #include <device/pci_ids.h>
27 #include <device/pci_def.h>
28 #include "i82801bx.h"
29 #include "i82801bx_smbus.h"
30
31 void enable_smbus(void)
32 {
33         device_t dev;
34
35         /* Set the SMBus device statically (D31:F3). */
36         dev = PCI_DEV(0x0, 0x1f, 0x3);
37
38         /* Set SMBus I/O base. */
39         pci_write_config32(dev, SMB_BASE,
40                            SMBUS_IO_BASE | PCI_BASE_ADDRESS_SPACE_IO);
41
42         /* Set SMBus enable. */
43         pci_write_config8(dev, HOSTC, HST_EN);
44
45         /* Set SMBus I/O space enable. */
46         pci_write_config16(dev, PCI_COMMAND, PCI_COMMAND_IO);
47
48         /* Disable interrupt generation. */
49         outb(0, SMBUS_IO_BASE + SMBHSTCTL);
50
51         /* Clear any lingering errors, so transactions can run. */
52         outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), SMBUS_IO_BASE + SMBHSTSTAT);
53
54         print_debug("SMBus controller enabled\n");
55 }
56
57 int smbus_read_byte(u8 device, u8 address)
58 {
59         return do_smbus_read_byte(SMBUS_IO_BASE, device, address);
60 }