printk_foo -> printk(BIOS_FOO, ...)
[coreboot.git] / src / southbridge / amd / sb600 / sb600_smbus.c
index d5a8a187425eb4bcb931a7f79820e4593a0ff5dd..9e14930b099963507948b7b6730b6403442c1882 100644 (file)
@@ -1,9 +1,22 @@
-//#include <arch/io.h>
-//#include <device/device.h>
-//#include <device/pci.h>
-//#include <device/pci_ids.h>
-//#include <device/pci_ops.h>
-//#include <device/smbus_def.h>
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2008 Advanced Micro Devices, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+ */
+
 #include "sb600_smbus.h"
 
 static inline void smbus_delay(void)
@@ -13,7 +26,7 @@ static inline void smbus_delay(void)
 
 static int smbus_wait_until_ready(u32 smbus_io_base)
 {
-       unsigned long loops;
+       u32 loops;
        loops = SMBUS_TIMEOUT;
        do {
                u8 val;
@@ -29,7 +42,7 @@ static int smbus_wait_until_ready(u32 smbus_io_base)
 
 static int smbus_wait_until_done(u32 smbus_io_base)
 {
-       unsigned long loops;
+       u32 loops;
        loops = SMBUS_TIMEOUT;
        do {
                u8 val;
@@ -102,7 +115,7 @@ static int do_smbus_send_byte(u32 smbus_io_base, u32 device,
        return 0;
 }
 
-static int do_smbus_read_byte(u32 smbus_io_base, u32 device,
+int do_smbus_read_byte(u32 smbus_io_base, u32 device,
                              u32 address)
 {
        u8 byte;
@@ -133,7 +146,7 @@ static int do_smbus_read_byte(u32 smbus_io_base, u32 device,
        return byte;
 }
 
-static int do_smbus_write_byte(u32 smbus_io_base, u32 device,
+int do_smbus_write_byte(u32 smbus_io_base, u32 device,
                               u32 address, u8 val)
 {
        u8 byte;
@@ -164,17 +177,18 @@ static int do_smbus_write_byte(u32 smbus_io_base, u32 device,
        return 0;
 }
 
-static void alink_ab_indx(unsigned int reg_space, unsigned int reg_addr,
-                         unsigned int mask, unsigned int val)
+static void alink_ab_indx(u32 reg_space, u32 reg_addr,
+                         u32 mask, u32 val)
 {
-       unsigned int tmp;
+       u32 tmp;
+
        outl((reg_space & 0x3) << 30 | reg_addr, AB_INDX);
        tmp = inl(AB_DATA);
 
        tmp &= ~mask;
        tmp |= val;
 
-       /* printk_debug("about write %x, index=%x", tmp, (reg_space&0x3)<<30 | reg_addr); */
+       /* printk(BIOS_DEBUG, "about write %x, index=%x", tmp, (reg_space&0x3)<<30 | reg_addr); */
        outl((reg_space & 0x3) << 30 | reg_addr, AB_INDX);      /* probably we dont have to do it again. */
        outl(tmp, AB_DATA);
 }
@@ -182,10 +196,10 @@ static void alink_ab_indx(unsigned int reg_space, unsigned int reg_addr,
 /* space = 0: AX_INDXC, AX_DATAC
 *   space = 1: AX_INDXP, AX_DATAP
  */
-static void alink_ax_indx(unsigned int space /*c or p? */ , unsigned int axindc,
-                         unsigned int mask, unsigned int val)
+static void alink_ax_indx(u32 space /*c or p? */ , u32 axindc,
+                         u32 mask, u32 val)
 {
-       unsigned int tmp;
+       u32 tmp;
 
        /* read axindc to tmp */
        outl(space << 30 | space << 3 | 0x30, AB_INDX);
@@ -202,6 +216,3 @@ static void alink_ax_indx(unsigned int space /*c or p? */ , unsigned int axindc,
        outl(space << 30 | space << 3 | 0x34, AB_INDX);
        outl(tmp, AB_DATA);
 }
-
-
-