x86: Change MMIO addr in readN(addr)/writeN(addr, val) to pointer

On x86, change the type of the address parameter in
read8()/read16/read32()/write8()/write16()/write32() to be a
pointer, instead of unsigned long.

Change-Id: Ic26dd8a72d82828b69be3c04944710681b7bd330
Signed-off-by: Kevin Paul Herbert <kph@meraki.net>
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-on: http://review.coreboot.org/7784
Tested-by: build bot (Jenkins)
diff --git a/src/device/azalia_device.c b/src/device/azalia_device.c
index b250f3d..d93fb3a 100644
--- a/src/device/azalia_device.c
+++ b/src/device/azalia_device.c
@@ -30,7 +30,7 @@
 #define HDA_ICII_BUSY (1 << 0)
 #define HDA_ICII_VALID (1 << 1)
 
-static int set_bits(u32 port, u32 mask, u32 val)
+static int set_bits(void *port, u32 mask, u32 val)
 {
 	u32 reg32;
 	int count;
@@ -59,7 +59,7 @@
 	return 0;
 }
 
-static int codec_detect(u32 base)
+static int codec_detect(u8 *base)
 {
 	u32 reg32;
 	int count;
@@ -136,7 +136,7 @@
  *  no response would imply that the codec is non-operative
  */
 
-static int wait_for_ready(u32 base)
+static int wait_for_ready(u8 *base)
 {
 	/* Use a 50 usec timeout - the Linux kernel uses the
 	 * same duration */
@@ -159,14 +159,15 @@
  *  is non-operative
  */
 
-static int wait_for_valid(u32 base)
+static int wait_for_valid(u8 *base)
 {
 	/* Use a 50 usec timeout - the Linux kernel uses the
 	 * same duration */
 
 	int timeout = 25;
 
-	write32(base + HDA_ICII_REG, HDA_ICII_VALID | HDA_ICII_BUSY);
+	write32(base + HDA_ICII_REG,
+		HDA_ICII_VALID | HDA_ICII_BUSY);
 	while (timeout--) {
 		udelay(1);
 	}
@@ -182,7 +183,7 @@
 	return -1;
 }
 
-static void codec_init(struct device *dev, u32 base, int addr)
+static void codec_init(struct device *dev, u8 *base, int addr)
 {
 	u32 reg32;
 	const u32 *verb;
@@ -226,7 +227,7 @@
 	printk(BIOS_DEBUG, "azalia_audio: verb loaded.\n");
 }
 
-static void codecs_init(struct device *dev, u32 base, u32 codec_mask)
+static void codecs_init(struct device *dev, u8 *base, u32 codec_mask)
 {
 	int i;
 
@@ -238,7 +239,7 @@
 
 void azalia_audio_init(struct device *dev)
 {
-	u32 base;
+	u8 *base;
 	struct resource *res;
 	u32 codec_mask;
 
@@ -248,8 +249,8 @@
 
 	// NOTE this will break as soon as the azalia_audio get's a bar above
 	// 4G. Is there anything we can do about it?
-	base = (u32) res->base;
-	printk(BIOS_DEBUG, "azalia_audio: base = %08x\n", (u32) base);
+	base = res2mmio(res, 0, 0);
+	printk(BIOS_DEBUG, "azalia_audio: base = %p\n", base);
 	codec_mask = codec_detect(base);
 
 	if (codec_mask) {
diff --git a/src/device/oprom/realmode/x86.c b/src/device/oprom/realmode/x86.c
index 461cb06..919fd6d 100644
--- a/src/device/oprom/realmode/x86.c
+++ b/src/device/oprom/realmode/x86.c
@@ -80,7 +80,7 @@
 	memcpy((void *)0xfffd9, &ident, 7);
 
 	/* system model: IBM-AT */
-	write8(0xffffe, 0xfc);
+	write8((void *)0xffffe, 0xfc);
 }
 
 static int (*intXX_handler[256])(void) = { NULL };